[gst-devel] sending extra data along with buffers

Albert Costa costa_albert at yahoo.fr
Tue Jan 15 17:24:58 CET 2008

I'm quite interested in the topic about adding extra data to buffers. I'm currently working on a project where I have to analyse video frames, extract some piece of info out of it (like detection of features), and perform some overlaying of these data over the video frame.
That is, I absolutely needed to pass some information along with each buffer... And these information are not size-invariant : for example, the data are 'number of detected features + ROI for each feature' (and other stuff...), so it changes from frame to frame. 
So I could not put it into caps or tags, I had to find a way to solve the issue.

What I did (the easiest but not prettiest.... but I lacked time) is develop an input plugin that takes a common x-raw-rgb type flow as input. It analyses the frame, and then creates an output buffer that contains the frame data and my own specific data. It is sent to src pad as 'ANY' type (because the size of my buffer is no longer coherent with raw-rgb caps).
Then my next plugin will take that as input. Knowing the length of each field, I extract the original frame, my data, and perform some overlaying on my frame. Finally, I send again a 'raw-rgb' on the src pad, to be linked to a directdrawsink:

gst-inspect filesrc location=myfile.avi ! decodebin ! ffmpegcolorspace ! myvideo_analyser ! myvideo_overlay ! ffmpegcolorspace ! directdrawsink

That's the 'easy' way, but it is not very nice-looking, nor 'generic' (e.g. I cannot use my specific data with other base gstreamer plugins).
I was thinking once of splitting my original buffer frame and my data over 2 distincts output pads. But then again for my data I cannot do much (it has to by 'ANY' type, unless I create a new specific mime which I don't know how to do)... Sending events with my data for each buffer doesn't look safe. I've done some other work where events where not received synchronously (ie sent event1, buffer1, event2, buffer2 but received event1, buffer1, buffer2, event2...).
The idea of adding a GstStructure (or something similar) inside a GstBuffer seems to be the most interesting thing, at least with regard to my own experience. Would be null for general case, and user-filled for... user purpose.


Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20080115/f44a832a/attachment.htm>

More information about the gstreamer-devel mailing list