mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
wavparse: Add tags for container format and bitrate for uncompressed PCM
The PCM bitrate is added to help downstream elements (like uridecodebin) figure out a proper network buffer size https://bugzilla.gnome.org/show_bug.cgi?id=769390
This commit is contained in:
parent
c703ab69f5
commit
91e302e00d
2 changed files with 19 additions and 1 deletions
|
@ -10,6 +10,7 @@ libgstwavparse_la_LIBADD = \
|
||||||
-lgstriff-@GST_API_VERSION@ \
|
-lgstriff-@GST_API_VERSION@ \
|
||||||
-lgstaudio-@GST_API_VERSION@ \
|
-lgstaudio-@GST_API_VERSION@ \
|
||||||
-lgsttag-@GST_API_VERSION@ \
|
-lgsttag-@GST_API_VERSION@ \
|
||||||
|
-lgstpbutils-@GST_API_VERSION@ \
|
||||||
$(GST_BASE_LIBS) \
|
$(GST_BASE_LIBS) \
|
||||||
$(GST_LIBS) \
|
$(GST_LIBS) \
|
||||||
$(LIBM)
|
$(LIBM)
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include "gstwavparse.h"
|
#include "gstwavparse.h"
|
||||||
#include "gst/riff/riff-media.h"
|
#include "gst/riff/riff-media.h"
|
||||||
#include <gst/base/gsttypefindhelper.h>
|
#include <gst/base/gsttypefindhelper.h>
|
||||||
|
#include <gst/pbutils/descriptions.h>
|
||||||
#include <gst/gst-i18n-plugin.h>
|
#include <gst/gst-i18n-plugin.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (wavparse_debug);
|
GST_DEBUG_CATEGORY_STATIC (wavparse_debug);
|
||||||
|
@ -1223,9 +1224,25 @@ gst_wavparse_stream_headers (GstWavParse * wav)
|
||||||
|
|
||||||
wav->got_fmt = TRUE;
|
wav->got_fmt = TRUE;
|
||||||
|
|
||||||
if (codec_name) {
|
if (wav->tags == NULL)
|
||||||
wav->tags = gst_tag_list_new_empty ();
|
wav->tags = gst_tag_list_new_empty ();
|
||||||
|
|
||||||
|
{
|
||||||
|
GstCaps *templ_caps = gst_pad_get_pad_template_caps (wav->sinkpad);
|
||||||
|
gst_pb_utils_add_codec_description_to_tag_list (wav->tags,
|
||||||
|
GST_TAG_CONTAINER_FORMAT, templ_caps);
|
||||||
|
gst_caps_unref (templ_caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If bps is nonzero, then we do have a valid bitrate that can be
|
||||||
|
* announced in a tag list. */
|
||||||
|
if (wav->bps) {
|
||||||
|
guint bitrate = wav->bps * 8;
|
||||||
|
gst_tag_list_add (wav->tags, GST_TAG_MERGE_REPLACE,
|
||||||
|
GST_TAG_BITRATE, bitrate, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (codec_name) {
|
||||||
gst_tag_list_add (wav->tags, GST_TAG_MERGE_REPLACE,
|
gst_tag_list_add (wav->tags, GST_TAG_MERGE_REPLACE,
|
||||||
GST_TAG_AUDIO_CODEC, codec_name, NULL);
|
GST_TAG_AUDIO_CODEC, codec_name, NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue