A gstreamermm dynamic Gst::Pad example.
#include <gstreamermm.h>
#include <glibmm/main.h>
int main(int argc, char *argv[])
{
Glib::RefPtr<Glib::MainLoop> main_loop = Glib::MainLoop::create();
try
{
pipeline->add(source)->add(decodebin)->add(sink);
}
{
return 1;
}
try
{
source->link(decodebin);
}
{
}
pipeline->get_bus()->add_watch([main_loop] (const Glib::RefPtr<Gst::Bus>&,
const Glib::RefPtr<Gst::Message>& message) {
switch (message->get_message_type())
{
case Gst::MESSAGE_EOS:
case Gst::MESSAGE_ERROR:
main_loop->quit();
break;
default:
break;
}
return true;
});
decodebin->signal_pad_added().connect([decodebin, sink] (const Glib::RefPtr<Gst::Pad>& pad) {
{
}
else
{
}
});
main_loop->run();
return 0;
}