[gst-devel] need help about my first video test application

Andoni Morales ylatuya at gmail.com
Tue Jun 2 12:08:46 CEST 2009


2009/6/2 Favor Tang <tangher at gmail.com>:
> hi.
>
> does it work for you?
>
> In my pc running ubuntu linux on vmware, I tested a ogg video file, I
> don't get the video or the sound, even I don't get any error output.
> I can't give you any help output infomation except the example code,
> because I don't get any error.

If you need to debug a GStreamer app you can enable the debug output by setting:
# export GST_DEBUG=3.

I attach the fix to your example.

>
> code snippet:
>           /* link 'n play*/
>                   GST_INFO ("Found video stream.\n");
>                   g_print ("Found video stream.\n");
>                   gst_pad_link (pad,newpad);
>                   gst_element_link_many (videodec, colorspace, videosink, NULL);
>                   gst_element_set_state (pipeline, GST_STATE_PLAYING);
>
>                   /* link 'n play*/
>                   GST_INFO ("Found audio stream.\n");
>                   g_print ("Found audio stream.\n");
>                   gst_pad_link (pad,newpad);
>                   gst_element_link_many (decoder, conv, sink, NULL);
>                   gst_element_set_state (pipeline, GST_STATE_PLAYING);
>
> Except for in main function, I added gst_element_set_state to set
> pipeline to PLAYING in the 'on_pad_added" callback after it found
> audio or video respectively, so that it can be aware of the new pad
> had been added. or, should I add this "gst_element_set_state
> (pipeline, GST_STATE_PLAYING);" to the end of the callback function?
>
> Could you test it again, and see if you can  watch the video output or
> hear the sound. or should you give me the example code which works on
> your pc.
>
> if it were you, how would you implement this example application? I
> doubt it is an good example, though.
>
>
> thanks.
>
> On Mon, Jun 1, 2009 at 6:40 PM, Andoni Morales <ylatuya at gmail.com> wrote:
>> 2009/6/1 Favor Tang <tangher at gmail.com>:
>>> Hi, Andoni
>>>    It's taken me some time to understand you code, meanwhile,
>>> according to your advice I changed my code to link to correct element
>>> respectively In the 'on_pad_added' callback. In the callback function,
>>> I add new elements to pipeline and link them according to if it's
>>> audio or video. I think I still not get the right clue of this
>>> example. I know some applications use playbin or decodebin, I'd prefer
>>> to use it later on.
>>>
>>  This is not the way a I would implement this, but as it's just an
>> example... After linking all the element in the 'on_pad_added'
>> callback, set the pipeline to PLAYING, because the new added elements
>> are not aware of the previous change. I have tested it and it works
>> for me.
>>
>> /* link 'n play*/
>>
>> GST_INFO ("Found video stream.\n");
>>
>> gst_pad_link (pad,newpad);
>>
>> gst_element_link_many (videodec, colorspace, videosink, NULL);
>> gst_element_set_state (pipeline, GST_STATE_PLAYING);
>>
>> g_object_unref (newpad);
>>
>>
>>
>>
>>>
>>> I would highly appreciate your help.
>>>
>>> thanks
>>>
>>> On Mon, Jun 1, 2009 at 8:02 AM, Andoni Morales <ylatuya at gmail.com> wrote:
>>>> 2009/5/31 Favor Tang <tangher at gmail.com>:
>>>>> hi.
>>>>>
>>>>>    sorry for this question of a newbie. I am a beginner into
>>>>> gstreamer, and wanna write a application for video playing. I didn't
>>>>> found a simple example about video.
>>>>> I modified the audio play example. I can't get the video on screen,
>>>>> what's the problem? I doubt if I create the pipeline correctly.
>>>>
>>>> You are linking both the audio stream and the video stream to the
>>>> 'decoder' element wich is an audio decoder.
>>>> In the 'on_pad_added' callback you need to read the caps of the new
>>>> pad and link it to the correct element. If it's a video stream you
>>>> will link it to the video decoder and if it's an audio stream you need
>>>> to link it to the audio decoder. This example shows you how to check
>>>> from the caps the media type and link the demuxer new pad to the
>>>> appropiate element:
>>>>
>>>> GstCaps *caps=NULL;
>>>> GstStructure *str =NULL;
>>>> GstPad *newpad=NULL;
>>>>
>>>>
>>>>  /* check media type */
>>>> caps = gst_pad_get_caps (pad);
>>>> str = gst_caps_get_structure (caps, 0);
>>>>
>>>> if (g_strrstr (gst_structure_get_name (str), "video")){
>>>>
>>>>        newpad = gst_element_get_compatible_pad (videodec, pad, NULL);
>>>>        /* only link once */
>>>>        if (GST_PAD_IS_LINKED (newpad)) {
>>>>                g_object_unref (newpad);
>>>>                gst_caps_unref (caps);
>>>>                return;
>>>>        }
>>>>
>>>>        /* link 'n play*/
>>>>        GST_INFO ("Found video stream.");
>>>>        gst_pad_link (pad,newpad);
>>>>        g_object_unref (newpad);
>>>> }
>>>> if (g_strrstr (gst_structure_get_name (str), "audio")){
>>>>
>>>>        newpad = gst_element_get_compatible_pad (decoder, pad, NULL);
>>>>        /* only link once */
>>>>        if (GST_PAD_IS_LINKED (newpad)) {
>>>>                g_object_unref (newpad);
>>>>                gst_caps_unref (caps);
>>>>                return;
>>>>        }
>>>>
>>>>        /* link 'n play*/
>>>>        GST_INFO ("Found audio stream.");
>>>>        gst_pad_link (pad,newpad);
>>>>        g_object_unref (newpad);
>>>> }
>>>>
>>>>
>>>> BTW, you can also use the playbin element.
>>>>
>>>>
>>>>>
>>>>> I got error like below:
>>>>>
>>>>> Running....
>>>>> Dynamic pad created, linking demuxer/decoder
>>>>> Dynamic pad created, linking demuxer/decoder
>>>>> Error: Internal data streame error.
>>>>> Retured, stopping playback
>>>>> deleting pipeline
>>>>>
>>>>> and I attached my source file, hope this can help you to figure out
>>>>> what I am doing wrong.
>>>>> besides, can you give me an example about how to write program for
>>>>> video playing?
>>>>>
>>>>> any help is highly appreciated!
>>>>>
>>>>> thanks
>>>>>
>>>>> --
>>>>> ~~~~~~~~~~~~~~~~~
>>>>>  /favor
>>>>> ~~~~~~~~~~~~~~~~~
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
>>>>> is a gathering of tech-side developers & brand creativity professionals. Meet
>>>>> the minds behind Google Creative Lab, Visual Complexity, Processing, &
>>>>> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
>>>>> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
>>>>> _______________________________________________
>>>>> gstreamer-devel mailing list
>>>>> gstreamer-devel at lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>>>
>>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
>>>> is a gathering of tech-side developers & brand creativity professionals. Meet
>>>> the minds behind Google Creative Lab, Visual Complexity, Processing, &
>>>> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
>>>> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
>>>> _______________________________________________
>>>> gstreamer-devel mailing list
>>>> gstreamer-devel at lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>>
>>>
>>>
>>>
>>> --
>>> ~~~~~~~~~~~~~~~~~
>>>  /favor
>>> ~~~~~~~~~~~~~~~~~
>>>
>>> ------------------------------------------------------------------------------
>>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
>>> is a gathering of tech-side developers & brand creativity professionals. Meet
>>> the minds behind Google Creative Lab, Visual Complexity, Processing, &
>>> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
>>> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>>
>>>
>>
>> ------------------------------------------------------------------------------
>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
>> is a gathering of tech-side developers & brand creativity professionals. Meet
>> the minds behind Google Creative Lab, Visual Complexity, Processing, &
>> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
>> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>
>
>
> --
> ~~~~~~~~~~~~~~~~~
>  /favor
> ~~~~~~~~~~~~~~~~~
>
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: videotest.c
Type: text/x-csrc
Size: 6275 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090602/fa5aca0d/attachment.c>


More information about the gstreamer-devel mailing list