<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">It works!<div>Thanks a lot.</div><div><br></div><div>jaeyong</div><div><br><div><div><div>2011. 12. 14., ¿ÀÈÄ 5:46, ½Å½Â¹è ÀÛ¼º:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<br>It seems that you are trying to link decodebin with queue element directly.<br>Try to link them by handling "new-decoded-pad" signal from decodebin.<br>Please refer below link which is official gstreamer document.<br>
<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-components-decodebin.html">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-components-decodebin.html</a><br>
Thank you.<br><br><br><br><div class="gmail_quote">On Tue, Dec 13, 2011 at 10:40 PM, jaeyong yoo <span dir="ltr"><<a href="mailto:y.jaeyong@gmail.com">y.jaeyong@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br><br>I just read gstreamer application development manual (0.10.35.1) and want to write a very simple video player.<br><br>I can play a video (mpeg2-encoded) using playbin in test/examples/manual folder thus I tried to strip out the parts that handle the required elements to play the particular video and wrote the code as follows.<br>
<br><br>#include <gst/gst.h><br><br><br>static void handoff (GstElement * identity, GstBuffer * frame, gpointer data)<br>{<br> printf("handoff called\n");<br>}<br><br>static gboolean my_bus_callback (GstBus * bus, GstMessage * msg, gpointer data)<br>
{<br> GMainLoop *loop = (GMainLoop *) data;<br><br> switch (GST_MESSAGE_TYPE (msg)) {<br> case GST_MESSAGE_EOS:<br> {<br> g_print ("End-of-stream\n");<br> g_main_loop_quit (loop);<br>
printf("JYD: bus_call: GST_MESSAGE_EOS\n");<br> break;<br> }<br> case GST_MESSAGE_ERROR:<br> {<br> gchar *debug;<br> GError *err;<br> printf("JYD: bus_call: GST_MESSAGE_ERROR\n");<br>
gst_message_parse_error (msg, &err, &debug);<br> g_free (debug);<br> g_print ("Error:: %s\n", err->message);<br> g_error_free (err);<br> g_main_loop_quit (loop);<br>
break;<br> }<br> case GST_MESSAGE_WARNING:<br> {<br> char buf[1024];<br> sprintf( buf, "%s", GST_MESSAGE_SRC_NAME(msg) );<br> printf("JYD: bus_call: %s %s\n", GST_MESSAGE_TYPE_NAME(msg), buf);<br>
<br> break;<br> }<br><br> case GST_MESSAGE_STATE_CHANGED: <br> {<br> printf("JYD: bus_call: (%s: %d)\n", GST_MESSAGE_TYPE_NAME(msg), GST_MESSAGE_TYPE(msg));<br> /* TODO: how to see the changed element state? */<br>
break;<br> }<br> default:<br> printf("JYD: bus_call: default (%s: %d)\n", GST_MESSAGE_TYPE_NAME(msg), GST_MESSAGE_TYPE(msg));<br> break;<br> }<br> return TRUE;<br>
}<br><br>gint main (gint argc, gchar * argv[])<br>{<br> GstElement *scale;<br> GstElement *identity;<br> GstElement *pipeline, *queue;<br> GstElement *src, *dec, *conv, *sink;<br> GMainLoop *loop;<br> GstBus *bus;<br>
<br> gst_init (&argc, &argv);<br><br> if (argc < 2) {<br> g_print ("usage: %s <media file or uri>\n", argv[0]);<br> return 1;<br> }<br><br> /* create and event loop and feed gstreamer bus mesages to it */<br>
loop = g_main_loop_new (NULL, FALSE);<br><br> /* create pipeline */<br> pipeline = gst_pipeline_new ("pipeline");<br> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br> gst_bus_add_watch(bus, my_bus_callback, loop);<br>
gst_object_unref (bus);<br><br> /* create an element for file-reading */<br> src = gst_element_factory_make ("filesrc", "source");<br> g_object_set (G_OBJECT (src), "location", argv[1], NULL);<br>
dec = gst_element_factory_make ("decodebin", "decode");<br> queue = gst_element_factory_make ("queue", "preroll_video_src0" );<br> sink = gst_element_factory_make ("autovideosink", "videosink");<br>
conv = gst_element_factory_make ("ffmpegcolorspace", "vconv");<br> scale = gst_element_factory_make ("videoscale", "vscale");<br> identity = gst_element_factory_make ("identity", "identity-for-what");<br>
g_object_set (identity, "silent", TRUE, NULL);<br> g_signal_connect (identity, "handoff", G_CALLBACK (handoff), NULL);<br><br> /* add elements to a bin */<br> gst_bin_add_many( GST_BIN (pipeline), src, dec, queue, conv, scale, identity, sink, NULL );<br>
<br> /* link the elements in the bin */<br> gst_element_link( src, dec );<br> gst_element_link( dec, queue );<br> gst_element_link( queue, identity );<br> gst_element_link( identity, conv );<br> gst_element_link( conv, scale );<br>
gst_element_link( scale, sink );<br><br><br> /* start the bin */<br> gst_element_set_state (pipeline, GST_STATE_PLAYING);<br><br> /* start play back and listed to events */<br> printf("go to main loop\n"); /* XXX you may start debugging here */<br>
g_main_loop_run (loop);<br> printf("return from main loop\n");<br><br> /* cleanup */<br> g_object_unref (pipeline);<br> g_object_unref (loop);<br><br> return 0;<br>}<br><br><br>and the results give me the following<br>
<br>Error:: Internal data flow error.<br>return from main loop<br><br>(lt-myvideoplayer:26621): GStreamer-CRITICAL **: <br>Trying to dispose element videosink, but it is in PAUSED instead of the NULL state.<br>You need to explicitly set elements to the NULL state before<br>
dropping the final reference, to allow them to clean up.<br>This problem may also be caused by a refcounting bug in the<br>application or some element.<br><br><br>(lt-myvideoplayer:26621): GStreamer-CRITICAL **: <br>Trying to dispose element identity-for-what, but it is in PAUSED instead of the NULL state.<br>
You need to explicitly set elements to the NULL state before<br>dropping the final reference, to allow them to clean up.<br>This problem may also be caused by a refcounting bug in the<br>application or some element.<br><br>
<br>(lt-myvideoplayer:26621): GStreamer-CRITICAL **: <br>Trying to dispose element vscale, but it is in PAUSED instead of the NULL state.<br>You need to explicitly set elements to the NULL state before<br>dropping the final reference, to allow them to clean up.<br>
This problem may also be caused by a refcounting bug in the<br>application or some element.<br><br><br>(lt-myvideoplayer:26621): GStreamer-CRITICAL **: <br>Trying to dispose element vconv, but it is in PAUSED instead of the NULL state.<br>
You need to explicitly set elements to the NULL state before<br>dropping the final reference, to allow them to clean up.<br>This problem may also be caused by a refcounting bug in the<br>application or some element.<br><br>
<br>(lt-myvideoplayer:26621): GStreamer-CRITICAL **: <br>Trying to dispose element preroll_video_src0, but it is in PAUSED instead of the NULL state.<br>You need to explicitly set elements to the NULL state before<br>dropping the final reference, to allow them to clean up.<br>
This problem may also be caused by a refcounting bug in the<br>application or some element.<br><br><br>GThread-ERROR **: file /build/buildd/glib2.0-2.30.0/./gthread/gthread-posix.c: line 171 (g_mutex_free_posix_impl): error 'Device or resource busy' during 'pthread_mutex_destroy ((pthread_mutex_t *) mutex)'<br>
Trace/breakpoint trap<br><br><br>I'm stcuked in this phase. <br>Please help me.<br>Any comments, reading recommendations, would be very appreciated.<br><font color="#888888"><br>jaeyong<br><br>
</font><br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br>
_______________________________________________<br>gstreamer-devel mailing list<br><a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel<br></blockquote></div><br></div></div></body></html>