summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorPhilippe Normand <philn@igalia.com>2015-05-19 18:58:11 +0200
committerTim-Philipp Müller <tim@centricular.com>2015-07-11 00:19:20 +0100
commitee407305588e4a18cffbd8fd60bffc9b3f03fab4 (patch)
tree23555d3a76ecf7ace67b2d513a6c2da9720c32ec /gst
parent6d78d32d51970003d7bc54fd16cb37922501df91 (diff)
protection: implement meta transform function
Copy the GstMeta contents over to the new buffer. https://bugzilla.gnome.org/show_bug.cgi?id=749590
Diffstat (limited to 'gst')
-rw-r--r--gst/gstprotection.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gst/gstprotection.c b/gst/gstprotection.c
index c5223eeaa..87122c935 100644
--- a/gst/gstprotection.c
+++ b/gst/gstprotection.c
@@ -84,6 +84,28 @@ gst_protection_meta_free (GstMeta * meta, GstBuffer * buffer)
gst_structure_free (protection_meta->info);
}
+static gboolean
+gst_protection_meta_transform (GstBuffer * transbuf, GstMeta * meta,
+ GstBuffer * buffer, GQuark type, gpointer data)
+{
+ GstProtectionMeta *protection_meta = (GstProtectionMeta *) meta;
+
+ if (GST_META_TRANSFORM_IS_COPY (type)) {
+ GstMetaTransformCopy *copy = data;
+ if (!copy->region) {
+ /* only copy if the complete data is copied as well */
+ gst_buffer_add_protection_meta (transbuf,
+ gst_structure_copy (protection_meta->info));
+ } else {
+ return FALSE;
+ }
+ } else {
+ /* transform type not supported */
+ return FALSE;
+ }
+ return TRUE;
+}
+
const GstMetaInfo *
gst_protection_meta_get_info (void)
{
@@ -93,8 +115,7 @@ gst_protection_meta_get_info (void)
const GstMetaInfo *meta =
gst_meta_register (GST_PROTECTION_META_API_TYPE, "GstProtectionMeta",
sizeof (GstProtectionMeta), gst_protection_meta_init,
- gst_protection_meta_free,
- (GstMetaTransformFunction) NULL);
+ gst_protection_meta_free, gst_protection_meta_transform);
g_once_init_leave (&protection_meta_info, meta);
}