summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMersad Jelacic <mersad@axis.com>2015-06-15 13:43:53 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-06-22 13:49:34 +0200
commita573cc4004b2d96eeaa6f95e035ac6ced6cb134b (patch)
treeee3338d8c0c0ef6df2208b2780a39f44c067ce58
parent8336d7a60bc8340e3bc012fec8fbbbd739ef5674 (diff)
opusenc: Add bitrate to the tags
https://bugzilla.gnome.org/show_bug.cgi?id=750992
-rw-r--r--ext/opus/gstopusenc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/opus/gstopusenc.c b/ext/opus/gstopusenc.c
index 4bac854d2..70c771806 100644
--- a/ext/opus/gstopusenc.c
+++ b/ext/opus/gstopusenc.c
@@ -221,6 +221,7 @@ static void gst_opus_enc_get_property (GObject * object, guint prop_id,
static void gst_opus_enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
+static void gst_opus_enc_set_tags (GstOpusEnc * enc);
static gboolean gst_opus_enc_start (GstAudioEncoder * benc);
static gboolean gst_opus_enc_stop (GstAudioEncoder * benc);
static gboolean gst_opus_enc_set_format (GstAudioEncoder * benc,
@@ -237,6 +238,22 @@ G_DEFINE_TYPE_WITH_CODE (GstOpusEnc, gst_opus_enc, GST_TYPE_AUDIO_ENCODER,
G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
static void
+gst_opus_enc_set_tags (GstOpusEnc * enc)
+{
+ GstTagList *taglist;
+
+ /* create a taglist and add a bitrate tag to it */
+ taglist = gst_tag_list_new_empty ();
+ gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
+ GST_TAG_BITRATE, enc->bitrate, NULL);
+
+ gst_audio_encoder_merge_tags (GST_AUDIO_ENCODER (enc), taglist,
+ GST_TAG_MERGE_REPLACE);
+
+ gst_tag_list_unref (taglist);
+}
+
+static void
gst_opus_enc_class_init (GstOpusEncClass * klass)
{
GObjectClass *gobject_class;
@@ -679,6 +696,9 @@ gst_opus_enc_set_format (GstAudioEncoder * benc, GstAudioInfo * info)
return FALSE;
}
+ /* update the tags */
+ gst_opus_enc_set_tags (enc);
+
enc->frame_samples = gst_opus_enc_get_frame_samples (enc);
/* feedback to base class */