Changes between Version 12 and Version 13 of Docs/825gen2/Dev/Devices/USB/Webcams


Ignore:
Timestamp:
08/21/24 10:46:11 (3 months ago)
Author:
Don Wilson
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Docs/825gen2/Dev/Devices/USB/Webcams

    v12 v13  
    9191}}}
    9292
     93Following is an example function to display live video for the specified number of seconds:
    9394
     95{{{
     96void WebCamDisplayVideo(int seconds)
     97{
     98        GstElement* pipeline;
     99        GstBus* bus;
     100        GstMessage* msg;
     101
     102        const char* cmd = "v4l2src device=/dev/video2 ! autovideosink";
     103        pipeline = gst_parse_launch(cmd, NULL);
     104         gst_element_set_state (pipeline, GST_STATE_PLAYING);
     105
     106         /* Wait until error or EOS */
     107         bus = gst_element_get_bus(pipeline);
     108         msg = gst_bus_timed_pop_filtered(bus, seconds * 1000 * GST_MSECOND, (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
     109         if(msg != NULL) {
     110                 gst_message_unref(msg);
     111         }
     112         gst_object_unref(bus);
     113         gst_element_set_state(pipeline, GST_STATE_NULL);
     114         gst_object_unref(pipeline);
     115}
     116
     117}}}
     118
     119