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

Andoni Morales ylatuya at gmail.com
Mon Jun 1 12:40:12 CEST 2009


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
>
>




More information about the gstreamer-devel mailing list