#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();
bus->add_watch(sigc::ptr_fun(bus_message_watch));
main_loop = Glib::MainLoop::create();
main_loop->run();
return 0;
}
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
virtual const char * what() const noexcept
static Glib::RefPtr< Gst::Element > create_element(const Glib::ustring &factory_name, const Glib::ustring &name)
Create a new element of the type defined by the given element factory.
static Glib::RefPtr< Pipeline > create()
Create a new pipeline with a unique generic name.
Glib::ustring get_name(State state)
Gets a string representing the given state.
@ MESSAGE_STATE_CHANGED
A state change happened.
Definition message.h:229
@ MESSAGE_ERROR
An error occurred.
Definition message.h:224
@ MESSAGE_EOS
End-of-stream reached in a pipeline.
Definition message.h:223
void init()
Initializes gstreamermm without parsing command line options.
@ STATE_NULL
The nullptr state or initial state of an element.
Definition enums.h:96
@ STATE_PLAYING
The element is PLAYING, the Gst::Clock is running and the data is flowing.
Definition enums.h:99