opusenc: Add bitrate to the tags

https://bugzilla.gnome.org/show_bug.cgi?id=750992
This commit is contained in:
Mersad Jelacic 2015-06-15 13:43:53 +02:00 committed by Sebastian Dröge
parent 8336d7a60b
commit a573cc4004

View file

@ -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,
@ -236,6 +237,22 @@ G_DEFINE_TYPE_WITH_CODE (GstOpusEnc, gst_opus_enc, GST_TYPE_AUDIO_ENCODER,
G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL);
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)
{
@ -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 */