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.
This commit is contained in:
Jan Schmidt 2015-09-05 23:38:44 +10:00
parent cf786a9399
commit 779ad060a4

View file

@ -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);