Esempio n. 1
0
    def test_parsable(self):
        """Test that the parsed caps match the given ones."""

        caps = ('video/x-raw, format=I420, width=320, height=240, '
                'framerate=30/1, pixel-aspect-ratio=1/1, '
                'interlace-mode=progressive')
        p = gs.pipeline('videotestsrc ! {} ! fakesink name=sink'.format(caps))
        p.set_state(gs.Gst.State.PLAYING)

        real_caps_obj = gs.get_sink_caps(p.get_by_name('sink'))
        real_caps = gs.make_command_line_parsable(real_caps_obj)

        p.set_state(gs.Gst.State.NULL)

        self.assertEqual(caps, real_caps)
Esempio n. 2
0
        gs.RaspiCam(**conf.params) +
        gs.Tee('t',
               gs.Valve('valve') + gs.H264Video() +
               gs.H264Stream(), gs.SHMSink()))

    pipeline.set_state(Gst.State.PLAYING)

    # Start debugging the gstreamer pipeline
    debuggingThread = gs.MessagePrinter(pipeline)
    debuggingThread.start()

    # TODO: Find a better method to wait for playback to start
    logger.debug(pipeline.get_state(
        Gst.CLOCK_TIME_NONE))  # Wait for pipeline to play

    caps = gs.get_sink_caps(pipeline.get_by_name(gs.SINK_NAME))
    cap_string = gs.make_command_line_parsable(caps)

    cap = cv2.VideoCapture(gs.SHMSrc(cap_string))

    # Now that the capture filters have been (hopefully) successfully
    # captured, GStreamer doesn't need to be debugged anymore and the thread
    # can be stopped.
    debuggingThread.stop()

    # Set up server
    sock, clis = networking.server.create_socket_and_client_list(
        port=conf.controlport)
    handler = networking.create_gst_handler(pipeline, gs.SRC_NAME, 'valve',
                                            gs.UDP_NAME)
Esempio n. 3
0
        gs.Webcam(device='/dev/video1') +
        gs.Tee('t', gs.SHMSink(socket_path='/tmp/foo1'),
               gs.H264Video() + gs.TSFile(gs.ts_filename(), False)))
    leftpipeline.set_state(Gst.State.PLAYING)
    rightpipeline.set_state(Gst.State.PLAYING)

    leftdebuggingThread = gs.MessagePrinter(leftpipeline)
    rightdebuggingThread = gs.MessagePrinter(rightpipeline)
    leftdebuggingThread.start()
    rightdebuggingThread.start()

    # TODO: Find a better method to wait for playback to start
    logger.debug(leftpipeline.get_state(Gst.CLOCK_TIME_NONE))
    logger.debug(rightpipeline.get_state(Gst.CLOCK_TIME_NONE))

    leftcaps = gs.get_sink_caps(leftpipeline.get_by_name(gs.SINK_NAME))
    rightcaps = gs.get_sink_caps(rightpipeline.get_by_name(gs.SINK_NAME))

    cleft = cv2.VideoCapture(gs.SHMSrc(
        gs.make_command_line_parsable(leftcaps)))
    cright = cv2.VideoCapture(
        gs.SHMSrc(gs.make_command_line_parsable(rightcaps)))

    leftdebuggingThread.stop()
    rightdebuggingThread.stop()

    # Set up server
    sock, clis = networking.server.create_socket_and_client_list(
        port=conf.controlport)
    handler = networking.create_gst_handler(None, None, None, None)