[gst-devel] How to send data to next elemnet before calling _chain()

sudarshan bisht bisht.sudarshan at gmail.com
Thu Aug 20 06:31:45 CEST 2009


      Hi  ,
             I think you can send such extradata using caps .

So on demuxer side do :---

           GstBuffer *=buf;

            buf = gst_buffer_new_and_alloc (size);

            memcpy (GST_BUFFER_DATA (buf), the data u want to pass as an
extradata (should be guint8*) , size);

           gst_caps_set_simple (stream->caps,"codec_data", GST_TYPE_BUFFER,
buf, NULL);

           gst_buffer_unref (buf);
 On Decoder side in _setcaps function u can do :----


        GstBuffer    *codec_data = NULL;

         guint8* extradata =NULL;

        capStruct = gst_caps_get_structure(caps,0);

       /* Read extra data passed via demuxer. */
        value = gst_structure_get_value(capStruct, "codec_data");

        codec_data = gst_value_get_buffer(value);
**
        extradata =GST_BUFFER_DATA(codec_data);

        // now u can parse extradata to get your fields .


2009/8/20 Chen, Weian <weian.chen at intel.com>

>
> The data I want to send is couple of bytes (some information of current
> element)  which will be used in next element's _setcap() funct. So we could
> not wait the gst_pad_push() function to send.
>
> thanks,
> Weian
>  -----Original Message-----
> From: Michael Smith [mailto:msmith at xiph.org]
> Sent: 2009年8月20日 1:35
> To: Discussion of the development of GStreamer
> Subject: Re: [gst-devel] How to send data to next elemnet before calling
> _chain()
>
> On Wed, Aug 19, 2009 at 4:41 AM, Chen, Weian<weian.chen at intel.com> wrote:
> > Hi All,
> >
> > I need to send some data to the next element before calling the _chain
> > function (such as send the data from src element to encoder element),
> does
> > it possible?
>
> Can you explain in a bit more detail what you want to do?
>
> You normally should call gst_pad_push() to send data to the next
> element in your pipeline - but that calls the chain function in that
> next element, so it sounds like you're asking for something different?
>
> What data do you want to send? Why do you want to avoid calling the
> chain function when sending this data?
>
> Mike
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



-- 
Regards,

Sudarshan Bisht
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090820/3785130e/attachment.htm>


More information about the gstreamer-devel mailing list