From 779ad060a4e7cd33782571485e4990a1efc3524b Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sat, 5 Sep 2015 23:38:44 +1000 Subject: [PATCH] faac: Add bitrate info to the tags output. Makes it possible for muxers to know the target bitrate as soon as encoding starts, which flvmux now uses. --- ext/faac/gstfaac.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c index 9adc11fb83..a4a7c36ae9 100644 --- a/ext/faac/gstfaac.c +++ b/ext/faac/gstfaac.c @@ -341,6 +341,22 @@ gst_faac_enc_generate_sink_caps (void) return caps; } +static void +gst_faac_set_tags (GstFaac * faac) +{ + 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, faac->bitrate, NULL); + + gst_audio_encoder_merge_tags (GST_AUDIO_ENCODER (faac), taglist, + GST_TAG_MERGE_REPLACE); + + gst_tag_list_unref (taglist); +} + static gboolean gst_faac_set_format (GstAudioEncoder * enc, GstAudioInfo * info) { @@ -375,6 +391,8 @@ gst_faac_set_format (GstAudioEncoder * enc, GstAudioInfo * info) if (!result) goto done; + gst_faac_set_tags (faac); + /* report needs to base class */ gst_audio_encoder_set_frame_samples_min (enc, faac->samples); gst_audio_encoder_set_frame_samples_max (enc, faac->samples);