Usage of queue2
pchaurasia
pchaurasia at gameloreinc.com
Thu Sep 14 21:53:43 UTC 2017
Hi Folks
I am not able fathom exact usage of queue2 from documentation or examples.
Could you someone please educate about exact usage of queue2, or spot a
problem with my code below ?
Thanks
1. This is how my pipeline looks -
/* Create the elements */
data.source = gst_element_factory_make ("filesrc", "my_filesource");
data.decode = gst_element_factory_make ("decodebin", "my_decoder");
data.sink = gst_element_factory_make ("nveglglessink" , "vsink");
data.filter = gst_element_factory_make ("plugin", "my_filter");
data.queue2 = gst_element_factory_make ("queue2", "queue");
/* Create the empty pipeline */
data.pipeline = gst_pipeline_new ("test-pipeline");
if (!data.pipeline || !data.source || !data.decode || !data.sink ||
!data.filter || !data.queue2) {
g_printerr ("Not all elements could be created.\n");
return -1;
}
/* Build the pipeline. Note that we are NOT linking the source at this
* point. We will do it later. */
gst_bin_add_many (GST_BIN (data.pipeline), data.source, data.queue2,
data.decode , data.sink, NULL);
if (!gst_element_link_many (data.source, data.queue2, data.decode, NULL))
{
g_printerr ("Elements could not be linked.\n");
gst_object_unref (data.pipeline);
return -1;
}
2. Then I set the pipeline to PAUSED state in order to let queue2 fill up.
ret = gst_element_set_state (data.pipeline, GST_STATE_PAUSED);
if (ret == GST_STATE_CHANGE_FAILURE) {
g_printerr ("Unable to set the pipeline to the playing state.\n");
gst_object_unref (data.pipeline);
return -1;
}
3. I switch to PLAYING STATE when there is enough data in queue2 (100%)
case GST_MESSAGE_BUFFERING: {
gint percent = 0;
/* If the stream is live, we do not care about buffering. */
//if (data.is_live) break;
gst_message_parse_buffering (msg, &percent);
g_print ("Buffering (%3d%%)\r", percent);
/* Wait until buffering is complete before start/resume playing */
if (percent < 100)
gst_element_set_state (data.pipeline, GST_STATE_PAUSED);
else
gst_element_set_state (data.pipeline, GST_STATE_PLAYING);
break;
}
4. Upon run I see -
ubuntu at tegra-ubuntu:~/work/Internet/gstTemplate/gst-template/gst-app/src$
./gst-app
/home/ubuntu/opencv-3.3.0/opencv_extra/testdata/highgui/video/big_buck_bunny.mp4
Pipeline state changed from NULL to READY:
(gst-app:13612): GStreamer-CRITICAL **: pushing on pad typefind:src but it
was not activated in push mode
(gst-app:13612): GStreamer-WARNING **:
Trying to join task 0x621170 from its thread would deadlock.
You cannot change the state of an element from its streaming
thread. Use g_idle_add() or post a GstMessage on the bus to
schedule the state change from the main thread.
Error received from element my_decoder: Your GStreamer installation is
missing a plug-in.
Debugging information: gstdecodebin2.c(4565): gst_decode_bin_expose ():
/GstPipeline:test-pipeline/GstDecodeBin:my_decoder:
no suitable plugins found:
Couldn't set qtdemux0 to PAUSED
Segmentation fault (core dumped)
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list