From d8f417fbb79ec5870fc18a2bbbc12cfb76843417 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 25 Jul 2005 15:31:51 +0000 Subject: [PATCH] ext/vorbis/vorbisdec.c: Report bitrate. Original commit message from CVS: * ext/vorbis/vorbisdec.c: (vorbis_handle_comment_packet): Report bitrate. --- ChangeLog | 5 +++++ ext/vorbis/vorbisdec.c | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 287f81b80a..a3c8f1b797 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-25 Ronald S. Bultje + + * ext/vorbis/vorbisdec.c: (vorbis_handle_comment_packet): + Report bitrate. + 2005-07-25 Ronald S. Bultje * gst/playback/gstplaybin.c: (gen_video_element), diff --git a/ext/vorbis/vorbisdec.c b/ext/vorbis/vorbisdec.c index 0ef244233a..66eb4f87b7 100644 --- a/ext/vorbis/vorbisdec.c +++ b/ext/vorbis/vorbisdec.c @@ -401,6 +401,7 @@ vorbis_dec_sink_event (GstPad * pad, GstEvent * event) static GstFlowReturn vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet) { + guint bitrate = 0; gchar *encoder = NULL; GstMessage *message; GstTagList *list; @@ -429,15 +430,27 @@ vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet) gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_ENCODER_VERSION, vd->vi.version, GST_TAG_AUDIO_CODEC, "Vorbis", NULL); - if (vd->vi.bitrate_upper > 0) - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL); - if (vd->vi.bitrate_nominal > 0) + if (vd->vi.bitrate_nominal > 0) { gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL); - if (vd->vi.bitrate_lower > 0) + bitrate = vd->vi.bitrate_nominal; + } + if (vd->vi.bitrate_upper > 0) { + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL); + if (!bitrate) + bitrate = vd->vi.bitrate_upper; + } + if (vd->vi.bitrate_lower > 0) { gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL); + if (!bitrate) + bitrate = vd->vi.bitrate_lower; + } + if (bitrate) { + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_BITRATE, (guint) bitrate, NULL); + } message = gst_message_new_tag ((GstObject *) vd, list); gst_element_post_message (GST_ELEMENT (vd), message);