[gst-devel] Is there any way to set FLAG in GstBuffer?

Thijs Vermeir thijsvermeir at gmail.com
Thu Nov 6 10:01:41 CET 2008


Hi,

On Thu, Nov 6, 2008 at 9:47 AM, Irfan Shaikh
<irfanshaikh at tataelxsi.co.in> wrote:
>
>
> Hi All,
>
>       I have completed the asfparser plug-in code now itz working fine as
> per requirrement :-)
>
> I am only facing a small problem. I want to convey to next Plug-in element.
> Whether ASF data packet i m sending to next element consists of Key frame or
> no ?
>
>
> For conveying this information i have thought of using following field of
> GstBuffer.
>    guint64 offset;
> I would either SET it or RESET it while pushing the data
> gst_pad_push(asfparse->srcpad, outputbuf)
>
>
> Is there any other convinent{feasible} way of conveying the above
> information to next plug-in element {Is there some macro or Some flag that i
> can use using GstBuffer before pushing outputbuf}
> So as to convey to next element whether the outputbuf {consisting ASF data
> packet} has a KEY frame or no ??

There is a GST_BUFFER_FLAG_DELTA_UNIT flag you should set when there
is no keyframe in the buffer.

Gr,
Thijs

> Regards,
> Irfan
>
>
> -----Original Message-----
> From: sudarshan bisht [mailto:bisht.sudarshan at gmail.com]
> Sent: Thu 11/6/2008 10:55 AM
> To: Discussion of the development of GStreamer
> Subject: Re: [gst-devel] Size of output buffer
>
> Hi Irfan ,
>          U r right data is pushed on src pad .
>
> On Tue, Oct 21, 2008 at 6:58 PM, Irfan Shaikh
> <irfanshaikh at tataelxsi.co.in>wrote:
>
>>
>> Thanks a lot Sudarshan....
>>
>> The sample code which you have send is really helping me a lot.
>>
>> If i am not wrong, I think-------- gst_pad_push(sinkpad, my_buffer) should
>> be like------ gst_pad_push(asfparse->srcpad, my_buffer).
>>
>> Am i corrrect ?
>>
>> Thanks a lot for your help and support,
>> Regards,
>> Irfan
>>
>>
>>
>> -----Original Message-----
>> From: sudarshan bisht
>> [mailto:bisht.sudarshan at gmail.com<bisht.sudarshan at gmail.com>
>> ]
>> Sent: Tue 10/21/2008 6:44 PM
>> To: Discussion of the development of GStreamer
>> Subject: Re: [gst-devel] Size of output buffer
>>
>>  Hi Irfan ,
>>
>>           I think here no need to use circular buffer , because the buffer
>> which u receive in ur plugin , u have to unref that after properly copying
>> required buffer from that . And the buffer which ul allocate in your
>> plugin
>> will be sent u next element thus will be unref by the next element .
>>
>>   I am writing a piece of code , may give u some hint  :-
>>
>>  asf_parser_plugin_chain(GstPad pad, GstBuffer *buffer)
>>  {
>>
>>       gint packet_size=0;
>>       GstBuffer *my_buffer=NULL;
>>
>>       packet_size = parse_buffer(GST_BUFFER_DATA(buffer) ); // get
>> the packet size
>>
>>       my_buffer=gst_buffer_new_and_alloc ( packet_size );
>>
>>
>> memcpy(GST_BUFFER_DATA( my_buffer),  GST_BUFFER_DATA(buffer),
>> packet_size
>> ); // can use other APIs also provided by GstBuffer (
>>
>>
>> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstBuffer.html
>> )
>>
>>         gst_pad_push(sinkpad, my_buffer);
>>
>>         gst_buffer_unref(buffer) ; // check if u have copied all the data
>>
>>         return GST_FLOW_OK ;
>>       }
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Oct 21, 2008 at 5:13 PM, Irfan Shaikh
>> <irfanshaikh at tataelxsi.co.in>wrote:
>>
>> >  Hi sudarshan,
>> >
>> >           Thanks a lot for your reply. I am pretty clear now.
>> >
>> > Earlier i had decided some other appoach as follows:
>> >           SO now i think i should not use A circular buffer, directly i
>> can
>> > use the existing Gstreamer buffer ritee ??
>> >
>> > Thanks for your reply.
>> >
>> >       Regarding my query :
>> >       1)I have written an ASF parser code which reads an ASF file from a
>> > file location path.
>> >       2)It uses fseek and fread to read the data from file in a
>> > temperory
>> > buffer
>> >       3)It uses the temporary buffer to parse the ASf headers
>> >       4)Lastly collect the ASF data packets after parsing the headers
>> into
>> > another temperory bufffer (tempbuf).
>> >       5) When i make ASF parser as gstreamer plugin, i will use
>> > gst_pad_push (asfparse->srcpad, tempbuf);
>> >
>> > I am clear about the output interface when i make the ASF parser as
>> > gstreamer plug-in.
>> >
>> >       Actual scenario:
>> >
>> >       1) Input module to ASF parser plug-in is output from "ffmux_asf"
>> > which will be in form of data buffers.
>> >       2) I will need some buffer to collect these data buffers
>> >       3) I thought of having a "Circular buffer" to take input from
>> > ffmux_asf.{Is it feasible to use a normal buffer like uint8_t *Newbuf to
>> > collect
>> >          data buffers from ffmux_asf ?? {If YES. How much memory should
>> > i
>> > allocate for NewBuf}}
>> >       4) Since my application is related to Live Streaming the buffer
>> > NewBuf size can be huge.
>> >       5) Circular buffer would have been useful.Since i will free the
>> > memory as soon as i read the Circular buffer.
>> >       6) I can use pointer operations similar to file operations
>> >
>> > In gstreamer i have GstBuffer *buf, If i use circular buffer how can i
>> use
>> > the existing "buf".
>> >
>> > Regards,
>> > Irfan.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > -----Original Message-----
>>  > From: sudarshan bisht
>> [mailto:bisht.sudarshan at gmail.com<bisht.sudarshan at gmail.com>
>> <bisht.sudarshan at gmail.com>
>> > ]
>> > Sent: Tue 10/21/2008 4:53 PM
>> > To: Discussion of the development of GStreamer
>> > Subject: Re: [gst-devel] Size of output buffer
>> >
>> > HI Irfan ,
>> >               You are trying to write a ASF Parser plugin which will be
>> > used
>> > after ffmux_asf in pipeline .
>> >  Now you want to parse data packets and send them to next element .
>> >
>> >    The buffer you get from ffmux_asf is already allocated so you dont
>> need
>> > to allocated a separate buffer for that .
>> >    To know the size of input buffer in your ASF Parser plugin you can
>> > use
>> > GST_BUFFER_SIZE(buffer) .
>> >      So now you have to parse data part of this buffer , because data
>> part
>> > of the buffer have the actual data .
>> >      For your outgoing packets allocate one more GstBuffer and copy the
>> > required number of bytes of data from received buffer to this buffer and
>> > push this buffer to next element.
>> >
>> >  You can use adapter APIs also to make it simpler . Read GstBuffer APIs
>> > thoroughly for good practice.
>> >
>> >
>> >
>> > On Tue, Oct 21, 2008 at 3:59 PM, Irfan Shaikh
>> > <irfanshaikh at tataelxsi.co.in>wrote:
>> >
>> > >
>> > >
>> > >
>> > >  -----Original Message-----
>> >  > From: sudarshan bisht
>> > [mailto:bisht.sudarshan at gmail.com<bisht.sudarshan at gmail.com>
>> <bisht.sudarshan at gmail.com>
>> > <bisht.sudarshan at gmail.com>
>> > > ]
>> > > Sent: Tue 10/21/2008 2:25 PM
>> > > To: Discussion of the development of GStreamer
>> > > Subject: Re: [gst-devel] Size of output buffer
>> > >
>> > >  Hi
>> > >
>> > >  "gst_pad_push_event" function pushes only events ( EOS , new segment
>> etc
>> > )
>> > > not buffer , in order to push buffer use "gst_pad_push"  api .
>> > >
>> > > On Tue, Oct 21, 2008 at 1:58 PM, Irfan Shaikh
>> > > <irfanshaikh at tataelxsi.co.in>wrote:
>> > >
>> > > >
>> > > > Hi Julien,
>> > > >
>> > > >      Thanks for your reply..
>> > > >
>> > > >      For ffmux_asf plug-in in gstffmpegmux.c.
>> > > >
>> > > >      Is "gst_pad_push_event" is the fuction which pushes the buffer
>> > which
>> > > > has ASF data into sink pad of next elemnt ?
>> > > >      i.e. gst_pad_push_event (ffmpegmux->srcpad, gst_event_new_eos
>> ());
>> > > > When i checked the sise of buffer its variable in size.
>> > > >
>> > > >
>> > > >       I need to allocate buffer for the next module to "ffmux_asf".
>> > Which
>> > > > is an asf parse. i need to allocate buffer in asf parser plugin. I
>> > wanted
>> > > to
>> > > > know what size of buffer should i allocate for ASF parser plug-in to
>> > take
>> > > > i/p from ffmux_asf
>> > > >
>> > > > I checked the buffer size in ffmux_asf in gst_ffmpegmux_collected
>> > > > (GstCollectPads * pads, gpointer user_data)
>> > > >
>> > > > But it shows variable part. Tell me whether i am right ??
>> > > >
>> > > > Size of buf:5757
>> > > > Size of buf:7134
>> > > > Size of buf:6927
>> > > > Size of buf:5670
>> > > > Size of buf:4989
>> > > > Size of buf:4004
>> > > > Size of buf:3615
>> > > > Size of buf:3188
>> > > > Size of buf:3022
>> > > > Size of buf:2703
>> > > >
>> > > > Thanks and regards,
>> > > > Irfan
>> > > >
>> > > >
>> > > >
>> > > > -----Original Message-----
>> > >  > From: Julien Puydt [mailto:jpuydt at free.fr <jpuydt at free.fr> <
>> jpuydt at free.fr> <
>> > jpuydt at free.fr> <
>> > > jpuydt at free.fr>]
>> > > > Sent: Mon 10/20/2008 3:29 PM
>> > > > To: Discussion of the development of GStreamer
>> > > > Subject: Re: [gst-devel] Size of output buffer
>> > > >
>> > > > irfanshaikh a écrit :
>> > > > >         How can i find size of output buffer in "ffmux_asf" which
>> is
>> > > > pushed
>> > > > > to the sink pad of next element ?
>> > > >
>> > > > GST_BUFFER_SIZE (buffer) ?
>> > > >
>> > > > Snark on #gstreamer
>> > > >
>> > > >
>> >
>> > -------------------------------------------------------------------------
>> > > > This SF.Net email is sponsored by the Moblin Your Move Developer's
>> > > > challenge
>> > > > Build the coolest Linux based applications with Moblin SDK & win
>> great
>> > > > prizes
>> > > > Grand prize is a trip for two to an Open Source event anywhere in
>> > > > the
>> > > world
>> > > > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> > > > _______________________________________________
>> > > > gstreamer-devel mailing list
>> > > > gstreamer-devel at lists.sourceforge.net
>> > > > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>> > > >
>> > > >  This message (including any attachment) is confidential and may be
>> > > > legally privileged. Access to this message by anyone other than the
>> > > intended
>> > > > recipient(s) listed above is unauthorized. If you are not the
>> intended
>> > > > recipient you are hereby notified that any disclosure, copying, or
>> > > > distribution of the message, or any action taken or omission of
>> action
>> > by
>> > > > you in reliance upon it, is prohibited and may be unlawful. Please
>> > > > immediately notify the sender by reply e-mail and permanently delete
>> > all
>> > > > copies of the message if you have received this message in error.
>> > > >
>> > > >
>> >
>> > -------------------------------------------------------------------------
>> > > > This SF.Net email is sponsored by the Moblin Your Move Developer's
>> > > > challenge
>> > > > Build the coolest Linux based applications with Moblin SDK & win
>> great
>> > > > prizes
>> > > > Grand prize is a trip for two to an Open Source event anywhere in
>> > > > the
>> > > world
>> > > > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> > > > _______________________________________________
>> > > > gstreamer-devel mailing list
>> > > > gstreamer-devel at lists.sourceforge.net
>> > > > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>> > > >
>> > > >
>> > >
>> > >
>> > > --
>> > > Regards,
>> > >
>> > > Sudarshan Bisht
>> > >
>> > >
>> > > Hi sudarshan/Ved,
>> > >
>> > >       In gstffmpegmux.c {gst-ffmpeg-0.10.5/ext/ffmpeg} i do not see
>> > > any
>> > > "gst_pad_push" function.
>> > >
>> > > I understand we need a function something like "gst_pad_push
>> > > (asfmux->srcpad, buf)", so as to push the buffer to the sink pad of
>> next
>> > > module.
>> > >
>> > > But i do not find any such api in gstffmpegmux.c.
>> > >
>> > > So i am unable to find the size of output buffer which is send to the
>> > next
>> > > module.So i got confused with "gst_pad_push_event"
>> > >
>> > > Please can you help me regarding this issue.
>> > >
>> > > I need all this information to allocate buffer size for my module "ASF
>> > > parser" which is built from scratch in C. rite know i am reading from
>> > file.
>> > >
>> > > I need to do same processing in ASF parser when i use ffmux_asf as
>> input
>> > > module for ASF parser.
>> > >
>> > > Please help me regarding this.
>> > >
>> > >
>> > > Regards,
>> > > Irfan
>> > >
>> > >  This message (including any attachment) is confidential and may be
>> > > legally privileged. Access to this message by anyone other than the
>> > intended
>> > > recipient(s) listed above is unauthorized. If you are not the intended
>> > > recipient you are hereby notified that any disclosure, copying, or
>> > > distribution of the message, or any action taken or omission of action
>> by
>> > > you in reliance upon it, is prohibited and may be unlawful. Please
>> > > immediately notify the sender by reply e-mail and permanently delete
>> all
>> > > copies of the message if you have received this message in error.
>> > >
>> > >
>> -------------------------------------------------------------------------
>> > > This SF.Net email is sponsored by the Moblin Your Move Developer's
>> > > challenge
>> > > Build the coolest Linux based applications with Moblin SDK & win great
>> > > prizes
>> > > Grand prize is a trip for two to an Open Source event anywhere in the
>> > world
>> > > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> > > _______________________________________________
>> > > gstreamer-devel mailing list
>> > > gstreamer-devel at lists.sourceforge.net
>> > > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>> > >
>> > >
>> >
>> >
>> > --
>> > Regards,
>> >
>> > Sudarshan Bisht
>> >
>> >   This message (including any attachment) is confidential and may be
>> > legally privileged. Access to this message by anyone other than the
>> intended
>> > recipient(s) listed above is unauthorized. If you are not the intended
>> > recipient you are hereby notified that any disclosure, copying, or
>> > distribution of the message, or any action taken or omission of action
>> > by
>> > you in reliance upon it, is prohibited and may be unlawful. Please
>> > immediately notify the sender by reply e-mail and permanently delete all
>> > copies of the message if you have received this message in error.
>> >
>> >
>> > -------------------------------------------------------------------------
>> > This SF.Net email is sponsored by the Moblin Your Move Developer's
>> > challenge
>> > Build the coolest Linux based applications with Moblin SDK & win great
>> > prizes
>> > Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> > _______________________________________________
>> > gstreamer-devel mailing list
>> > gstreamer-devel at lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>> >
>> >
>>
>>
>> --
>> Regards,
>>
>> Sudarshan Bisht
>>
>>   This message (including any attachment) is confidential and may be
>> legally privileged. Access to this message by anyone other than the
>> intended
>> recipient(s) listed above is unauthorized. If you are not the intended
>> recipient you are hereby notified that any disclosure, copying, or
>> distribution of the message, or any action taken or omission of action by
>> you in reliance upon it, is prohibited and may be unlawful. Please
>> immediately notify the sender by reply e-mail and permanently delete all
>> copies of the message if you have received this message in error.
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>>
>>
>
>
> --
> Regards,
>
> Sudarshan Bisht
>
>
>
>
>
> This message (including any attachment) is confidential and may be legally
> privileged. Access to this message by anyone other than the intended
> recipient(s) listed above is unauthorized. If you are not the intended
> recipient you are hereby notified that any disclosure, copying, or
> distribution of the message, or any action taken or omission of action by
> you in reliance upon it, is prohibited and may be unlawful. Please
> immediately notify the sender by reply e-mail and permanently delete all
> copies of the message if you have received this message in error.
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> 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