Reputation: 165
I'm writing a program to mimic a gsteramer pipeline I have working from the command line.
I have been able to successfully trap some signals like:
g_signal_connect (data2.source, "pad-added", G_CALLBACK (pad_added_handler), &data2);
g_signal_connect (data2.source, "drained", G_CALLBACK (eos_cb), &data);
to add pads and tell when the url reader has reached end of stream — EOS.
I'm trying create a trap to find when the bus has reached EOS but am having issues. I've seen examples of trapping errors from the bus like this:
g_signal_connect (G_OBJECT (bus), "message::error", (GCallback)error_cb, &data);
I'm thinking something like this should work:
g_signal_connect (G_OBJECT (bus), "message::eos", (GCallback)eos_cb_bus, &data);
But I do not know exactly what to look for (the 'message::eos' part).
Can someone help me? Thanks much!
Upvotes: 2
Views: 2469
Reputation: 1285
Compare your code with How to use a bus. Copying the example code from there:
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline);
gst_bus_add_signal_watch (bus);
g_signal_connect (bus, "message::error", G_CALLBACK (cb_message_error), NULL);
g_signal_connect (bus, "message::eos", G_CALLBACK (cb_message_eos), NULL);
So "message::eos" is the correct signal name. Possibly you forgot gst_bus_add_signal_watch() in your code?
Compare also Difference between gst_bus_add_watch() and g_signal_connect().
Upvotes: 0
Reputation: 7373
The GStreamer hello world example is a good start to see how this should be handled:
https://gstreamer.freedesktop.org/documentation/application-development/basics/helloworld.html
Basically you set up a GstBus callback and pick the messages from there which you are interested in. In your case it will be EOS.
Upvotes: 1