The integration of gst.h now works like a charm.
Thank you so much!
This brought me a looooog way!
I am now able to compile and run this code.
However I am experiencing performance issues which indicates that playbin is not using hardware acceleration althought gst-omx is installed on the RPi.
According to this guide all I need to do is change the rank of the plugin which is doing the hw acceleration.
However if I try to combine this ( http://docs.gstreamer.com/pages/viewpage.action?pageId=327735"] ) and this code I receive the following output:
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
xcb_connection_has_error() returned true
xcb_connection_has_error() returned true
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
** (GTK_Test_RPI:6770): WARNING **: Too old frames, bug in decoder -- please file a bug
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (GTK_Test_RPI:6770): WARNING **: Command line `dbus-launch --autolaunch=34069147acf8a24283639d4a51f267a2 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
xcb_connection_has_error() returned true
xcb_connection_has_error() returned true
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
** (GTK_Test_RPI:6770): WARNING **: Too old frames, bug in decoder -- please file a bug
To copy to clipboard, switch view to plain text mode
This is the code I run:
#include <gst/gst.h>
static void enable_factory (const gchar *name, gboolean enable) {
g_type_init ();
GstRegistry *registry = NULL;
GstElementFactory *factory = NULL;
registry = gst_registry_get ();
if (!registry) return;
factory = gst_element_factory_find (name);
if (!factory) return;
if (enable) {
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_PRIMARY + 1);
}
else {
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_NONE);
}
gst_registry_add_feature (registry, GST_PLUGIN_FEATURE (factory));
return;
}
int main(int argc, char *argv[]) {
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
enable_factory("omxmpeg2videodec", true);
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
pipeline = gst_parse_launch ("playbin uri=http://192.168.178.51:8001", NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
/* Free resources */
if (msg != NULL)
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
#include <gst/gst.h>
static void enable_factory (const gchar *name, gboolean enable) {
g_type_init ();
GstRegistry *registry = NULL;
GstElementFactory *factory = NULL;
registry = gst_registry_get ();
if (!registry) return;
factory = gst_element_factory_find (name);
if (!factory) return;
if (enable) {
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_PRIMARY + 1);
}
else {
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), GST_RANK_NONE);
}
gst_registry_add_feature (registry, GST_PLUGIN_FEATURE (factory));
return;
}
int main(int argc, char *argv[]) {
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
enable_factory("omxmpeg2videodec", true);
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
pipeline = gst_parse_launch ("playbin uri=http://192.168.178.51:8001", NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
/* Free resources */
if (msg != NULL)
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
To copy to clipboard, switch view to plain text mode
Edit:
And this is the interesting part of the .pro file:
INCLUDEPATH += /opt/rpi/sysroot/usr/include/gstreamer-1.0
LIBS += -lglib-2.0 -lpthread -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt
LIBS += -L/opt/rpi/sysroot/lib/arm-linux-gnueabihf/ -L/opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/
INCLUDEPATH += /opt/rpi/sysroot/usr/include/gstreamer-1.0
LIBS += -lglib-2.0 -lpthread -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt
LIBS += -L/opt/rpi/sysroot/lib/arm-linux-gnueabihf/ -L/opt/rpi/sysroot/usr/lib/arm-linux-gnueabihf/
To copy to clipboard, switch view to plain text mode
The error output is exactly the same as if I would run the main function without trying to increase the decoders rank.
Edited because of a moronic mistake.
Bookmarks