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

Favor Tang tangher at gmail.com
Mon Jun 1 05:06:16 CEST 2009


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.

please check my code in attachment.

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
~~~~~~~~~~~~~~~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: videotest.c
Type: application/octet-stream
Size: 5787 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090601/88838f7b/attachment.obj>


More information about the gstreamer-devel mailing list