diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2013-03-29 16:37:01 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2013-03-29 16:37:01 +0100 |
commit | 3d1322f08ec21300978c10b67e5ebe08b3f0c46b (patch) | |
tree | 686d635975ac7515bca5292ad0a50c2f292c04df | |
parent | 5f79a8cb933e1b2a1fad54d854ff89495e621333 (diff) |
videometa: Implement copying of GstVideoGLTextureUploadMeta
-rw-r--r-- | gst-libs/gst/video/gstvideometa.c | 39 | ||||
-rw-r--r-- | gst-libs/gst/video/gstvideometa.h | 5 |
2 files changed, 37 insertions, 7 deletions
diff --git a/gst-libs/gst/video/gstvideometa.c b/gst-libs/gst/video/gstvideometa.c index b36b67a08..a330245ca 100644 --- a/gst-libs/gst/video/gstvideometa.c +++ b/gst-libs/gst/video/gstvideometa.c @@ -399,8 +399,36 @@ gst_video_gl_texture_upload_meta_free (GstMeta * meta, GstBuffer * buffer) { GstVideoGLTextureUploadMeta *vmeta = (GstVideoGLTextureUploadMeta *) meta; - if (vmeta->destroy_notify) - vmeta->destroy_notify (vmeta->user_data); + if (vmeta->user_data_free) + vmeta->user_data_free (vmeta->user_data); +} + +static gboolean +gst_video_gl_texture_upload_meta_transform (GstBuffer * dest, GstMeta * meta, + GstBuffer * buffer, GQuark type, gpointer data) +{ + GstVideoGLTextureUploadMeta *dmeta, *smeta; + + smeta = (GstVideoGLTextureUploadMeta *) meta; + + if (GST_META_TRANSFORM_IS_COPY (type)) { + GstMetaTransformCopy *copy = data; + + if (!copy->region) { + /* only copy if the complete data is copied as well */ + dmeta = + (GstVideoGLTextureUploadMeta *) gst_buffer_add_meta (dest, + GST_VIDEO_GL_TEXTURE_UPLOAD_META_INFO, NULL); + dmeta->buffer = dest; + dmeta->upload = smeta->upload; + dmeta->user_data = smeta->user_data; + dmeta->user_data_copy = smeta->user_data_copy; + dmeta->user_data_free = smeta->user_data_free; + if (dmeta->user_data_copy) + dmeta->user_data = dmeta->user_data_copy (dmeta->user_data); + } + } + return TRUE; } const GstMetaInfo * @@ -415,7 +443,7 @@ gst_video_gl_texture_upload_meta_get_info (void) sizeof (GstVideoGLTextureUploadMeta), NULL, gst_video_gl_texture_upload_meta_free, - NULL); + gst_video_gl_texture_upload_meta_transform); g_once_init_leave (&info, meta); } return info; @@ -440,7 +468,7 @@ gst_video_gl_texture_upload_meta_get_info (void) GstVideoGLTextureUploadMeta * gst_buffer_add_video_gl_texture_upload_meta (GstBuffer * buffer, GstVideoGLTextureUpload upload, gpointer user_data, - GDestroyNotify destroy_notify) + GBoxedCopyFunc user_data_copy, GBoxedFreeFunc user_data_free) { GstVideoGLTextureUploadMeta *meta; @@ -454,7 +482,8 @@ gst_buffer_add_video_gl_texture_upload_meta (GstBuffer * buffer, meta->buffer = buffer; meta->upload = upload; meta->user_data = user_data; - meta->destroy_notify = destroy_notify; + meta->user_data_copy = user_data_copy; + meta->user_data_free = user_data_free; return meta; } diff --git a/gst-libs/gst/video/gstvideometa.h b/gst-libs/gst/video/gstvideometa.h index 5485c48cf..21b4a72d6 100644 --- a/gst-libs/gst/video/gstvideometa.h +++ b/gst-libs/gst/video/gstvideometa.h @@ -165,11 +165,12 @@ struct _GstVideoGLTextureUploadMeta { GstVideoGLTextureUpload upload; gpointer user_data; - GDestroyNotify destroy_notify; + GBoxedCopyFunc user_data_copy; + GBoxedFreeFunc user_data_free; }; #define gst_buffer_get_video_gl_texture_upload_meta(b) ((GstVideoGLTextureUploadMeta*)gst_buffer_get_meta((b),GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE)) -GstVideoGLTextureUploadMeta * gst_buffer_add_video_gl_texture_upload_meta (GstBuffer *buffer, GstVideoGLTextureUpload upload, gpointer user_data, GDestroyNotify destroy_notify); +GstVideoGLTextureUploadMeta * gst_buffer_add_video_gl_texture_upload_meta (GstBuffer *buffer, GstVideoGLTextureUpload upload, gpointer user_data, GBoxedCopyFunc copy_user_data, GBoxedFreeFunc free_user_data); gboolean gst_video_gl_texture_upload_meta_upload (GstVideoGLTextureUploadMeta *meta, guint format, guint texture_id); GType gst_video_gl_texture_upload_meta_api_get_type (void); |