How to add GstMeta to buffers in a pool?

Mohammed Sameer msameer at foolab.org
Wed Jun 10 16:10:24 PDT 2015


On Wed, Jun 10, 2015 at 05:37:09PM +0000, Spruyt, Randy wrote:
>  When using a buffer pool, adding MetaData to an acquired buffer seems
>  work fine, but the next time I acquire the same buffer, the data is
>  gone. I suspect I may be using this incorrectly somehow?

[...]

>  void test()
>  {
>  GstBuffer* buf = NULL;
>  mfxFrameSurface1 someSurface;
>  IntelQuickSyncMeta* metaData = NULL;
>  GstBufferPool* pool = NULL;
>  GstStructure* config = NULL;
>  GstCaps* caps = NULL;
>  pool = gst_buffer_pool_new();
>  config = gst_buffer_pool_get_config( pool );
>  caps = gst_caps_from_string("video/x-raw");
>  gst_buffer_pool_config_set_params( config, caps, 100, 1, 1 );
>  if( gst_buffer_pool_set_config( pool, config ) )
>  {
>  if( gst_buffer_pool_set_active( pool, TRUE ) )
>  {
>  while( gst_buffer_pool_acquire_buffer( pool, &buf,
>  NULL ) != GST_FLOW_EOS )
>  {
>  // first loop this is NULL which is fine,
>  2nd loop this should not be null, but it is
> 
>  metaData =
>  gst_buffer_get_intel_quicksync_meta( buf );
> 
>  if( !metaData )
> 
>  {
> 
>  // add some meta data,

Here you can set the GST_META_FLAG_POOLED flag:
GST_META_FLAG_SET (metaData, GST_META_FLAG_POOLED);

https://developer.gnome.org/gstreamer/stable/gstreamer-GstMeta.html
and check the note in alloc_buffer() https://developer.gnome.org/gstreamer/stable/gstreamer-GstBufferPool.html

Cheers,

-- 
GPG-Key: 0xA3FD0DF7 - 9F73 032E EAC9 F7AD 951F  280E CB66 8E29 A3FD 0DF7
Debian User and Developer.
Homepage: www.foolab.org


More information about the gstreamer-devel mailing list