mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
mad: Post bitrate tag whenever the bitrate changes
Also send the layer/mode/emphasis/bitrate tags as an event too.
This commit is contained in:
parent
f389c77c73
commit
1e0d2d67b4
1 changed files with 21 additions and 8 deletions
|
@ -889,6 +889,7 @@ gst_mad_update_info (GstMad * mad)
|
|||
{
|
||||
struct mad_header *header = &mad->frame.header;
|
||||
gboolean changed = FALSE;
|
||||
GstTagList *list = NULL;
|
||||
|
||||
#define CHECK_HEADER(h1,str) \
|
||||
G_STMT_START{ \
|
||||
|
@ -911,11 +912,9 @@ G_STMT_START{ \
|
|||
CHECK_HEADER (layer, "layer");
|
||||
CHECK_HEADER (mode, "mode");
|
||||
CHECK_HEADER (emphasis, "emphasis");
|
||||
mad->header.bitrate = header->bitrate;
|
||||
mad->new_header = FALSE;
|
||||
|
||||
if (changed) {
|
||||
GstTagList *list;
|
||||
GEnumValue *mode;
|
||||
GEnumValue *emphasis;
|
||||
|
||||
|
@ -938,15 +937,29 @@ G_STMT_START{ \
|
|||
GST_TAG_AUDIO_CODEC, str, NULL);
|
||||
g_free (str);
|
||||
}
|
||||
if (!mad->xing_found) {
|
||||
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
||||
GST_TAG_BITRATE, mad->header.bitrate, NULL);
|
||||
}
|
||||
gst_element_post_message (GST_ELEMENT (mad),
|
||||
gst_message_new_tag (GST_OBJECT (mad), list));
|
||||
}
|
||||
|
||||
changed = FALSE;
|
||||
CHECK_HEADER (bitrate, "bitrate");
|
||||
if (!mad->xing_found && changed) {
|
||||
if (!list)
|
||||
list = gst_tag_list_new ();
|
||||
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
||||
GST_TAG_BITRATE, mad->header.bitrate, NULL);
|
||||
}
|
||||
mad->header.bitrate = header->bitrate;
|
||||
#undef CHECK_HEADER
|
||||
|
||||
if (list) {
|
||||
gst_element_post_message (GST_ELEMENT (mad),
|
||||
gst_message_new_tag (GST_OBJECT (mad), gst_tag_list_copy (list)));
|
||||
|
||||
if (mad->need_newsegment)
|
||||
mad->pending_events =
|
||||
g_list_append (mad->pending_events, gst_event_new_tag (list));
|
||||
else
|
||||
gst_pad_push_event (mad->srcpad, gst_event_new_tag (list));
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue