From 2ad27e4c138949ae0cff8584723706b929bd6e56 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Thu, 4 Jun 2015 19:03:51 +0200 Subject: [PATCH] audioresample: copy metadata that only has the "audio" tag. https://bugzilla.gnome.org/show_bug.cgi?id=750406 --- gst/audioresample/gstaudioresample.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c index a268ebc912..8e1f197fb7 100644 --- a/gst/audioresample/gstaudioresample.c +++ b/gst/audioresample/gstaudioresample.c @@ -133,6 +133,8 @@ static gboolean gst_audio_resample_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps); static GstFlowReturn gst_audio_resample_transform (GstBaseTransform * base, GstBuffer * inbuf, GstBuffer * outbuf); +static gboolean gst_audio_resample_transform_meta (GstBaseTransform * trans, + GstBuffer * outbuf, GstMeta * meta, GstBuffer * inbuf); static gboolean gst_audio_resample_sink_event (GstBaseTransform * base, GstEvent * event); static gboolean gst_audio_resample_start (GstBaseTransform * base); @@ -201,6 +203,8 @@ gst_audio_resample_class_init (GstAudioResampleClass * klass) GST_DEBUG_FUNCPTR (gst_audio_resample_transform); GST_BASE_TRANSFORM_CLASS (klass)->sink_event = GST_DEBUG_FUNCPTR (gst_audio_resample_sink_event); + GST_BASE_TRANSFORM_CLASS (klass)->transform_meta = + GST_DEBUG_FUNCPTR (gst_audio_resample_transform_meta); GST_BASE_TRANSFORM_CLASS (klass)->passthrough_on_same_caps = TRUE; } @@ -1246,6 +1250,23 @@ gst_audio_resample_transform (GstBaseTransform * base, GstBuffer * inbuf, return GST_FLOW_OK; } +static gboolean +gst_audio_resample_transform_meta (GstBaseTransform * trans, GstBuffer * outbuf, + GstMeta * meta, GstBuffer * inbuf) +{ + const GstMetaInfo *info = meta->info; + const gchar *const *tags; + + tags = gst_meta_api_type_get_tags (info->api); + + if (tags && g_strv_length ((gchar **) tags) == 1 + && gst_meta_api_type_has_tag (info->api, + g_quark_from_string (GST_META_TAG_AUDIO_STR))) + return TRUE; + + return FALSE; +} + static gboolean gst_audio_resample_query (GstPad * pad, GstObject * parent, GstQuery * query) {