I have a issue about this example<br>When I set the state as PLAYING, in which moment the element 's state will be changed?<br>Because the video sink just the first frame and stop it.<br>How can I make it run continuility?<br>
I have already set the state of the pipeline , but it still doesn't work<br>can some one give me some hints?<br><br><div class="gmail_quote">On Wed, May 4, 2011 at 12:23 AM, sudarshan bisht <span dir="ltr"><<a href="mailto:bisht.sudarshan@gmail.com">bisht.sudarshan@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">You forgot to add <span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px">vcolorspace to the bin that why you are getting those warnings. </span><div>
<div></div><div class="h5"><br><br><div class="gmail_quote">
On Mon, May 2, 2011 at 7:56 PM, "Andreas Büttner" <span dir="ltr"><<a href="mailto:Andreas.Buettner87@web.de" target="_blank">Andreas.Buettner87@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi,<br>
<br>
I know the topic was already discussed, but I always receive a mistake by<br>
using the following code(its nearly the code from a member here in the<br>
forum):<br>
<br>
------------------code------------------<br>
#include <gst/gst.h><br>
#include <glib.h><br>
#include <string.h><br>
<br>
static GstElement *source, *demuxer, *vdqueue, *vdsink, *decvd,<br>
*vcolorspace;<br>
<br>
void on_pad_added (GstElement *element, GstPad *pad)<br>
{<br>
<br>
gchar *name;<br>
name = gst_pad_get_name (pad);<br>
g_debug ("A new pad %s was created\n", name);<br>
<br>
GstCaps *caps;<br>
GstStructure *str;<br>
<br>
caps = gst_pad_get_caps (pad);<br>
g_assert (caps != NULL);<br>
str = gst_caps_get_structure (caps, 0);<br>
g_assert (str != NULL);<br>
<br>
<br>
if (g_strrstr (gst_structure_get_name (str), "video")) {<br>
g_debug ("Linking video pad to dec_vd");<br>
// Link it actually<br>
GstPad *targetsink = gst_element_get_pad (decvd, "sink");<br>
g_assert (targetsink != NULL);<br>
gst_pad_link (pad, targetsink);<br>
gst_object_unref (targetsink);<br>
}<br>
<br>
gst_caps_unref (caps);<br>
<br>
}<br>
<br>
static gboolean<br>
bus_call (GstBus *bus,<br>
GstMessage *msg,<br>
gpointer data)<br>
{<br>
GMainLoop *loop = (GMainLoop *) data;<br>
<br>
switch (GST_MESSAGE_TYPE (msg)) {<br>
<br>
case GST_MESSAGE_EOS:<br>
g_print ("End of stream\n");<br>
g_main_loop_quit (loop);<br>
break;<br>
<br>
case GST_MESSAGE_ERROR: {<br>
gchar *debug;<br>
GError *error;<br>
<br>
gst_message_parse_error (msg, &error, &debug);<br>
<br>
g_printerr ("Error: %s (%s) \n", error->message, debug);<br>
g_free (debug);<br>
g_error_free (error);<br>
<br>
g_main_loop_quit (loop);<br>
break;<br>
}<br>
default:<br>
break;<br>
}<br>
<br>
return TRUE;<br>
}<br>
<br>
int<br>
main (int argc,<br>
char *argv[])<br>
{<br>
GMainLoop *loop;<br>
<br>
GstElement *pipeline;<br>
GstBus *bus;<br>
<br>
/* Initialisation */<br>
gst_init (&argc, &argv);<br>
<br>
loop = g_main_loop_new (NULL, FALSE);<br>
<br>
<br>
/* Check input arguments */<br>
if (argc != 2) {<br>
g_printerr ("Usage: %s <AVI filename>\n", argv[0]);<br>
return -1;<br>
}<br>
<br>
<br>
/* Create gstreamer elements */<br>
pipeline = gst_pipeline_new ("media-player");<br>
source = gst_element_factory_make ("filesrc", "file-source");<br>
demuxer = gst_element_factory_make ("avidemux", "avi-demuxer");<br>
decvd = gst_element_factory_make ("decodebin", "video-decoder");<br>
vcolorspace = gst_element_factory_make ("ffmpegcolorspace",<br>
"color-space");<br>
<br>
vdsink = gst_element_factory_make ("autovideosink", "video-sink");<br>
vdqueue = gst_element_factory_make ("queue", "video-queue");<br>
<br>
<br>
if (!pipeline || !source || !demuxer || !decvd || !vdsink<br>
|| !vdqueue) {<br>
g_printerr ("One element could not be created. Exiting.\n");<br>
return -1;<br>
}<br>
<br>
/* Set up the pipeline */<br>
<br>
/* we set the input filename to the source element */<br>
g_object_set (G_OBJECT (source), "location", argv[1], NULL);<br>
<br>
/* we add a message handler */<br>
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>
gst_bus_add_watch (bus, bus_call, loop);<br>
gst_object_unref (bus);<br>
<br>
gst_bin_add_many (GST_BIN (pipeline), source, demuxer, decvd, vdqueue,<br>
vdsink, NULL);<br>
<br>
gst_element_link (source, demuxer);<br>
gst_element_link (demuxer,vdqueue);<br>
gst_element_link (vdqueue, decvd);<br>
gst_element_link (decvd, vcolorspace);<br>
gst_element_link (vcolorspace, vdsink);<br>
<br>
g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added),<br>
decvd);<br>
//g_signal_connect (decvd, "pad-added", G_CALLBACK (on_pad_added),<br>
NULL);<br>
<br>
/* Set the pipeline to "playing" state*/<br>
g_print ("Now playing: %s\n", argv[1]);<br>
gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>
<br>
/* Iterate */<br>
g_print ("Running...\n");<br>
g_main_loop_run (loop);<br>
<br>
/* Out of the main loop, clean up nicely */<br>
g_print ("Returned, stopping playback\n");<br>
gst_element_set_state (pipeline, GST_STATE_NULL);<br>
<br>
g_print ("Deleting pipeline\n");<br>
gst_object_unref (GST_OBJECT (pipeline));<br>
<br>
return 0;<br>
}<br>
<br>
------------------code-end--------------<br>
<br>
I get the following mistake:<br>
<br>
(play-avi2:4453): GStreamer-WARNING **: Trying to connect elements that<br>
don't share a common ancestor: color-space and video-sink<br>
<br>
(play-avi2:4453): GStreamer-WARNING **: Trying to connect elements that<br>
don't share a common ancestor: color-space and video-sink<br>
Now playing: avi-test2.avi<br>
** (play-avi2:4453): DEBUG: A new pad video_00 was created<br>
<br>
** (play-avi2:4453): DEBUG: Linking video pad to dec_vd<br>
Running...<br>
Error: Interner Datenstromfehler. (gstavidemux.c(5134): gst_avi_demux_loop<br>
(): /GstPipeline:media-player/GstAviDemux:avi-demuxer:<br>
streaming stopped, reason not-linked)<br>
Returned, stopping playback<br>
Deleting pipeline<br>
<br>
<br>
I also tried the command-line tool: gst-launch filesrc<br>
location=avi-test2.avi ! avidemux name=demux demux.video_00 ! queue !<br>
decodebin ! ffmpegcolorspace ! videoscale ! autovideosink<br>
<br>
On this way it is working, but with the code it is not possible to play the<br>
avi-file. I think the mistake is at the dynamic src-pad from the avidemuxer,<br>
but I have no idea how to fix it.<br>
<br>
<br>
Best regards, Andreas<br>
<br>
<br>
___________________________________________________________<br>
Schon gehört? <a href="http://WEB.DE" target="_blank">WEB.DE</a> hat einen genialen Phishing-Filter in die<br>
Toolbar eingebaut! <a href="http://produkte.web.de/go/toolbar" target="_blank">http://produkte.web.de/go/toolbar</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">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>
</blockquote></div><br><br clear="all"><br></div></div>-- <br>Regards,<br><font color="#888888"><br>Sudarshan Bisht<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>