A gstreamermm Gst::Bus example.
#include <gstreamermm.h>
#include <glibmm/main.h>
Glib::RefPtr<Glib::MainLoop> main_loop;
bool bus_message_watch(const Glib::RefPtr<Gst::Bus>& , const Glib::RefPtr<Gst::Message>& message)
{
if (message->get_source())
{
}
switch (message->get_message_type())
{
{
auto error_msg = Glib::RefPtr<Gst::MessageError>::cast_static(message);
break;
}
main_loop->quit();
break;
{
auto state_changed_msg = Glib::RefPtr<Gst::MessageStateChanged>::cast_static(message);
break;
}
default:
break;
}
return true;
}
int main(int argc, char *argv[])
{
try
{
pipeline->add(source)->add(sink);
}
{
return 1;
}
try
{
source->link(sink);
}
{
}
Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
main_loop = Glib::MainLoop::create();
main_loop->run();
return 0;
}