summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2015-09-05 23:38:44 +1000
committerJan Schmidt <jan@centricular.com>2015-09-05 23:42:50 +1000
commit779ad060a4e7cd33782571485e4990a1efc3524b (patch)
tree5dd71c9a83ef5af99cf744093e55d049c7241d19
parentcf786a9399d6f9d723000d35d3e1ad2a52a09295 (diff)
downloadgstreamer-plugins-bad-779ad060a4e7cd33782571485e4990a1efc3524b.tar.gz
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.
-rw-r--r--ext/faac/gstfaac.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c
index 9adc11fb8..a4a7c36ae 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);