Beispiel #1
0
 def _setup(self):
     self._clearOutputDir()
     mkdir(self._outputDirname)
     try:
         self._fp = open(self._args.output_file, 'w')
     except IOError as e:
         e.strerror = "Failed to write to output-file '%s': %s"%(os.path.realpath(self._args.output_file), e.strerror)
         raise
     open(os.path.join(self._outputDirname, "__init__.py"), "w").write("'''\nAuto-generated test.\n'''")
Beispiel #2
0
 def _setup(self):
     self._clearOutputDir()
     mkdir(self._outputDirname)
     try:
         self._fp = open(self._args.output_file, 'w')
     except IOError as e:
         e.strerror = "Failed to write to output-file '%s': %s" % (
             os.path.realpath(self._args.output_file), e.strerror)
         raise
     open(os.path.join(self._outputDirname, "__init__.py"),
          "w").write("'''\nAuto-generated test.\n'''")
Beispiel #3
0
 def __init__(self,
              sourcePipelineDescription,
              sinkPipelineDescription,
              debugger,
              mainLoop,
              getWindowId=None):
     super(PlaybackDisplay, self).__init__(debugger, getWindowId)
     self._mainloop = mainLoop
     #        glib.MainLoop()
     #        gobject.threads_init()
     imageprocessing = " ! ".join([
         # Buffer the video stream, dropping frames if downstream
         # processors aren't fast enough:
         "queue name=q leaky=2",
         # Convert to a colorspace that templatematch can handle:
         "ffmpegcolorspace",
         # Detect motion when requested:
         "stbt-motiondetect name=motiondetect enabled=false",
         # OpenCV image-processing library:
         "stbt-templatematch name=template_match method=1",  # TODO: Why is this enabled by default? Can it be disabled?
     ])
     xvideo = " ! ".join([
         # Convert to a colorspace that xvimagesink can handle:
         "ffmpegcolorspace",
         sinkPipelineDescription,
     ])
     screenshot = (
         "appsink name=screenshot max-buffers=1 drop=true sync=false")
     pipe = " ".join([
         imageprocessing, "! tee name=t", "t. ! queue leaky=2 !",
         screenshot, "t. ! queue leaky=2 !", xvideo
     ])
     self._sourcePipelineDescription = sourcePipelineDescription
     self._sourceBin = self._createSourceBin()
     self._sinkBin = gst.parse_bin_from_description(pipe, True)
     self._setPipeline(gst.Pipeline("stb-tester"))
     self._pipeline.add(self._sourceBin, self._sinkBin)
     gst.element_link_many(self._sourceBin, self._sinkBin)
     self._templateMatch = self._pipeline.get_by_name("template_match")
     self._motionDetect = self._pipeline.get_by_name("motiondetect")
     self._setScreenshot(self._pipeline.get_by_name("screenshot"))
     self._bus = self._pipeline.get_bus()
     self._bus.enable_sync_message_emission()
     self._bus.connect("message::error", self._onError)
     self._bus.connect("message::warning", self._onWarning)
     self._bus.connect("sync-message::element", self._onSyncMessage)
     self._bus.add_signal_watch()
     if self._debugger.level() > 1:
         if mkdir("stbt-debug/motiondetect") and mkdir(
                 "stbt-debug/templatematch"):
             # Note that this will dump a *lot* of files -- several images
             # per frame processed.
             self._motionDetect.props.debugDirectory = (
                 "stbt-debug/motiondetect")
             self._templateMatch.props.debugDirectory = (
                 "stbt-debug/templatematch")
         else:
             self._debugger.warn(
                 "Failed to create directory 'stbt-debug'. "
                 "Will not enable motiondetect/templatematch debug dump.")
     self._pipeline.set_state(gst.STATE_PLAYING)
     # Handle loss of video (but without end-of-stream event) from the
     # Hauppauge HDPVR capture device.
     self._queue = self._pipeline.get_by_name("q")
     self._testTimeout = None
     self._successiveUnderruns = 0
     self._underrunTimeout = None
     self._queue.connect("underrun", self._onUnderrun)
     self._queue.connect("running", self._onRunning)
Beispiel #4
0
    def __init__(self, sourcePipelineDescription, sinkPipelineDescription, debugger, mainLoop, getWindowId=None):
        super(PlaybackDisplay, self).__init__(debugger, getWindowId)
        self._mainloop = mainLoop
#        glib.MainLoop()
#        gobject.threads_init()
        imageprocessing = " ! ".join([
                # Buffer the video stream, dropping frames if downstream
                # processors aren't fast enough:
                "queue name=q leaky=2",
                # Convert to a colorspace that templatematch can handle:
                "ffmpegcolorspace",
                # Detect motion when requested:
                "stbt-motiondetect name=motiondetect enabled=false",
                # OpenCV image-processing library:
                "stbt-templatematch name=template_match method=1", # TODO: Why is this enabled by default? Can it be disabled?
                ])
        xvideo = " ! ".join([
                            # Convert to a colorspace that xvimagesink can handle:
                            "ffmpegcolorspace",
                            sinkPipelineDescription,
                            ])
        screenshot = ("appsink name=screenshot max-buffers=1 drop=true sync=false")
        pipe = " ".join([
                        imageprocessing,
                        "! tee name=t",
                        "t. ! queue leaky=2 !", screenshot,
                        "t. ! queue leaky=2 !", xvideo
                        ])
        self._sourcePipelineDescription = sourcePipelineDescription
        self._sourceBin = self._createSourceBin()
        self._sinkBin = gst.parse_bin_from_description(pipe, True)
        self._setPipeline(gst.Pipeline("stb-tester"))
        self._pipeline.add(self._sourceBin, self._sinkBin)
        gst.element_link_many(self._sourceBin, self._sinkBin)
        self._templateMatch = self._pipeline.get_by_name("template_match")
        self._motionDetect = self._pipeline.get_by_name("motiondetect")
        self._setScreenshot(self._pipeline.get_by_name("screenshot"))
        self._bus = self._pipeline.get_bus()
        self._bus.enable_sync_message_emission()
        self._bus.connect("message::error", self._onError)
        self._bus.connect("message::warning", self._onWarning)
        self._bus.connect("sync-message::element", self._onSyncMessage)
        self._bus.add_signal_watch()
        if self._debugger.level()>1:
            if mkdir("stbt-debug/motiondetect") and mkdir(
                      "stbt-debug/templatematch"):
                # Note that this will dump a *lot* of files -- several images
                # per frame processed.
                self._motionDetect.props.debugDirectory = ("stbt-debug/motiondetect")
                self._templateMatch.props.debugDirectory = ("stbt-debug/templatematch")
            else:
                self._debugger.warn("Failed to create directory 'stbt-debug'. "
                     "Will not enable motiondetect/templatematch debug dump.")
        self._pipeline.set_state(gst.STATE_PLAYING)
        # Handle loss of video (but without end-of-stream event) from the
        # Hauppauge HDPVR capture device.
        self._queue = self._pipeline.get_by_name("q")
        self._testTimeout = None
        self._successiveUnderruns = 0
        self._underrunTimeout = None
        self._queue.connect("underrun", self._onUnderrun)
        self._queue.connect("running", self._onRunning)