v4l2codec: Add getter for buffer index in allocator and pool

This commit is contained in:
Nicolas Dufresne 2020-02-14 21:57:34 -05:00
parent 527f040bfc
commit db787adfa1
4 changed files with 23 additions and 0 deletions

View file

@ -323,3 +323,15 @@ gst_v4l2_codec_allocator_detach (GstV4l2CodecAllocator * self)
}
GST_OBJECT_UNLOCK (self);
}
guint32
gst_v4l2_codec_memory_get_index (GstMemory * mem)
{
GstV4l2CodecBuffer *buf;
buf = gst_mini_object_get_qdata (GST_MINI_OBJECT (mem),
gst_v4l2_codec_buffer_quark ());
g_return_val_if_fail (buf, G_MAXUINT32);
return buf->index;
}

View file

@ -45,4 +45,6 @@ guint gst_v4l2_codec_allocator_get_pool_size (GstV4l2CodecAllo
void gst_v4l2_codec_allocator_detach (GstV4l2CodecAllocator * self);
guint32 gst_v4l2_codec_memory_get_index (GstMemory * mem);
#endif /* _GST_V4L2_CODECS_ALLOCATOR_H_ */

View file

@ -114,3 +114,10 @@ gst_v4l2_codec_pool_new (GstV4l2CodecAllocator * allocator)
return pool;
}
guint32
gst_v4l2_codec_buffer_get_index (GstBuffer * buffer)
{
GstMemory *mem = gst_buffer_peek_memory (buffer, 0);
return gst_v4l2_codec_memory_get_index (mem);
}

View file

@ -31,4 +31,6 @@ G_DECLARE_FINAL_TYPE(GstV4l2CodecPool, gst_v4l2_codec_pool, GST,
GstV4l2CodecPool *gst_v4l2_codec_pool_new (GstV4l2CodecAllocator *allocator);
guint32 gst_v4l2_codec_buffer_get_index (GstBuffer * buffer);
#endif /* __GST_V4L2_CODEC_POOL_H__ */