mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
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
This commit is contained in:
parent
dc6e4ccbf9
commit
9c596d20fe
2 changed files with 28 additions and 1 deletions
|
@ -9,7 +9,7 @@ libgstaiff_la_CFLAGS = \
|
||||||
$(GST_BASE_CFLAGS) \
|
$(GST_BASE_CFLAGS) \
|
||||||
$(GST_CFLAGS)
|
$(GST_CFLAGS)
|
||||||
libgstaiff_la_LIBADD = \
|
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) \
|
$(GST_BASE_LIBS) \
|
||||||
$(LIBM)
|
$(LIBM)
|
||||||
libgstaiff_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstaiff_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
#include "aiffparse.h"
|
#include "aiffparse.h"
|
||||||
#include <gst/audio/audio.h>
|
#include <gst/audio/audio.h>
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
|
#include <gst/pbutils/descriptions.h>
|
||||||
#include <gst/gst-i18n-plugin.h>
|
#include <gst/gst-i18n-plugin.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (aiffparse_debug);
|
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->bytes_per_sample = aiff->channels * aiff->width / 8;
|
||||||
aiff->bps = aiff->bytes_per_sample * aiff->rate;
|
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)
|
if (aiff->bytes_per_sample <= 0)
|
||||||
goto no_bytes_per_sample;
|
goto no_bytes_per_sample;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue