summaryrefslogtreecommitdiff
path: root/gst/aiff
diff options
context:
space:
mode:
authorCarlos Rafael Giani <dv@pseudoterminal.org>2016-08-02 13:48:43 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-08-02 15:21:38 +0300
commit9c596d20fe03896eb4817d11c35cfb45c83eaa94 (patch)
tree41c8cecc3b34115679ac521928eeac9508e1e1e1 /gst/aiff
parentdc6e4ccbf9d23962cf39ce7bd9f9152e9d41a6e3 (diff)
downloadgstreamer-plugins-bad-9c596d20fe03896eb4817d11c35cfb45c83eaa94.tar.gz
aiffparse: Add tags for container format and bitrate
The bitrate is added to help downstream elements (like uridecodebin) figure out a proper network buffer size https://bugzilla.gnome.org/show_bug.cgi?id=769389
Diffstat (limited to 'gst/aiff')
-rw-r--r--gst/aiff/Makefile.am2
-rw-r--r--gst/aiff/aiffparse.c27
2 files changed, 28 insertions, 1 deletions
diff --git a/gst/aiff/Makefile.am b/gst/aiff/Makefile.am
index ebe42305c..ee13fcf72 100644
--- a/gst/aiff/Makefile.am
+++ b/gst/aiff/Makefile.am
@@ -9,7 +9,7 @@ libgstaiff_la_CFLAGS = \
$(GST_BASE_CFLAGS) \
$(GST_CFLAGS)
libgstaiff_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_API_VERSION) -lgstaudio-$(GST_API_VERSION)\
+ $(GST_PLUGINS_BASE_LIBS) -lgsttag-$(GST_API_VERSION) -lgstaudio-$(GST_API_VERSION) -lgstpbutils-$(GST_API_VERSION) \
$(GST_BASE_LIBS) \
$(LIBM)
libgstaiff_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
diff --git a/gst/aiff/aiffparse.c b/gst/aiff/aiffparse.c
index 27c8313d3..bde90fcd5 100644
--- a/gst/aiff/aiffparse.c
+++ b/gst/aiff/aiffparse.c
@@ -59,6 +59,7 @@
#include "aiffparse.h"
#include <gst/audio/audio.h>
#include <gst/tag/tag.h>
+#include <gst/pbutils/descriptions.h>
#include <gst/gst-i18n-plugin.h>
GST_DEBUG_CATEGORY (aiffparse_debug);
@@ -995,6 +996,32 @@ gst_aiff_parse_stream_headers (GstAiffParse * aiff)
aiff->bytes_per_sample = aiff->channels * aiff->width / 8;
aiff->bps = aiff->bytes_per_sample * aiff->rate;
+ if (!aiff->tags)
+ aiff->tags = gst_tag_list_new_empty ();
+
+ {
+ GstCaps *templ_caps = gst_pad_get_pad_template_caps (aiff->sinkpad);
+ gst_pb_utils_add_codec_description_to_tag_list (aiff->tags,
+ GST_TAG_CONTAINER_FORMAT, templ_caps);
+ gst_caps_unref (templ_caps);
+ }
+
+ if (aiff->bps) {
+ guint bitrate = aiff->bps * 8;
+
+ GST_DEBUG_OBJECT (aiff, "adding bitrate of %u bps to tag list",
+ bitrate);
+
+ /* At the moment, aiffparse only supports uncompressed PCM data.
+ * Therefore, nominal, actual, minimum, maximum bitrate are the same.
+ * XXX: If AIFF-C support is extended to include compression,
+ * make sure that aiff->bps is set properly. */
+ gst_tag_list_add (aiff->tags, GST_TAG_MERGE_REPLACE,
+ GST_TAG_BITRATE, bitrate, GST_TAG_NOMINAL_BITRATE, bitrate,
+ GST_TAG_MINIMUM_BITRATE, bitrate, GST_TAG_MAXIMUM_BITRATE,
+ bitrate, NULL);
+ }
+
if (aiff->bytes_per_sample <= 0)
goto no_bytes_per_sample;