pad problem
Gofrane
gofrane at gmail.com
Wed May 13 03:49:35 PDT 2015
Hello,
When I ran this c code I got this problem
ghofrane at ghofrane:~/gstreamer$ gcc va.c -o va `pkg-config --cflags --libs
gstreamer-1.0`
ghofrane at ghofrane:~/gstreamer$ ./va
(va:4325): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion
'GST_IS_ELEMENT (dest)' failed
Elements 1 could not be linked.
libva info: VA-API version 0.37.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/local/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_37
libva info: va_openDriver() returns 0
(va:4325): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(va:4325): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion
'G_TYPE_CHECK_INSTANCE (instance)' failed
Unable to set the pipeline to the playing state.
**********************************************************
#include <gst/gst.h>
/* Handler for the pad-added signal */
static void on_pad_added(GstElement* element,GstPad* pad,gpointer* data)
{
GstPad* sinkpad;
GstElement * decoder = (GstElement*)data;
GstCaps* caps;
sinkpad = gst_element_get_static_pad(decoder,"sink");
gst_pad_link(pad,sinkpad);
gst_object_unref(sinkpad);
}
int main(int argc, char *argv[]) {
GstElement *pipeline, *source, *vaapisink,*vaapidecode,*demux;
GstBus *bus;
GstMessage *msg;
GstStateChangeReturn ret;
gboolean terminate = FALSE;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Create the elements */
source =gst_element_factory_make ("filesrc", "source");
if ( !source) {
g_printerr (" source could not be created.\n");
return -1;
}
demux= gst_element_factory_make("qtdemux ", "demux");
if ( !vaapisink) {
g_printerr (" demux could not be created.\n");
return -1;
}
vaapidecode= gst_element_factory_make("vaapidecode","decoder");
if ( !vaapidecode) {
g_printerr (" vaapidecode could not be created.\n");
return -1;
}
vaapisink= gst_element_factory_make ("vaapisink", "sink");
if ( !vaapisink) {
g_printerr (" vaapisink could not be created.\n");
return -1;
}
/* Create the empty pipeline */
pipeline = gst_pipeline_new ("test-pipeline");
/* pads
gst_element_link_pads (source, "source", demux, "demux"); */
/* Build the pipeline. Note that we are NOT linking the source at this
* point. We will do it later. */
gst_bin_add_many (GST_BIN (pipeline), source,demux,vaapidecode ,vaapisink,
NULL);
if (gst_element_link(source,demux )!= TRUE)g_printerr ("Elements 1 could not
be linked.\n");
if (gst_element_link (vaapidecode, vaapisink) != TRUE) g_printerr ("Elements
2 could not be linked.\n");
/* Modify the source's properties */
g_object_set (G_OBJECT (source), "location",
"big_buck_bunny_1080p_h264.mov ", NULL);
/* Connect to the pad-added signal */
g_signal_connect(demux,"pad-added",G_CALLBACK(on_pad_added),vaapidecode);
/* Start playing */
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) {
g_printerr ("Unable to set the pipeline to the playing state.\n");
gst_object_unref (pipeline);
return -1;
}
/* Listen to the bus */
bus = gst_element_get_bus (pipeline);
do {
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Parse message */
if (msg != NULL) {
GError *err;
gchar *debug_info;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_ERROR:
gst_message_parse_error (msg, &err, &debug_info);
g_printerr ("Error received from element %s: %s\n",
GST_OBJECT_NAME (msg->src), err->message);
g_printerr ("Debugging information: %s\n", debug_info ? debug_info
: "none");
g_clear_error (&err);
g_free (debug_info);
terminate = TRUE;
break;
case GST_MESSAGE_EOS:
g_print ("End-Of-Stream reached.\n");
terminate = TRUE;
break;
case GST_MESSAGE_STATE_CHANGED:
/* We are only interested in state-changed messages from the
pipeline */
if (GST_MESSAGE_SRC (msg) == GST_OBJECT (pipeline)) {
GstState old_state, new_state, pending_state;
gst_message_parse_state_changed (msg, &old_state, &new_state,
&pending_state);
g_print ("Pipeline state changed from %s to %s:\n",
gst_element_state_get_name (old_state),
gst_element_state_get_name (new_state));
}
break;
default:
/* We should not reach here */
g_printerr ("Unexpected message received.\n");
break;
}
gst_message_unref (msg);
}
} while (!terminate);
/* Free resources */
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/pad-problem-tp4671864.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list