discoverer: Use nominal bitrate if bitrate tag is unavailable
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Tue, 8 Feb 2011 18:28:56 +0000 (23:58 +0530)
committerStefan Kost <ensonic@users.sf.net>
Thu, 10 Feb 2011 07:58:34 +0000 (09:58 +0200)
If the bitrate tag is unavailable, this falls back to the nominal
bitrate tag instead, if that is present.

https://bugzilla.gnome.org/show_bug.cgi?id=641860

gst-libs/gst/pbutils/gstdiscoverer.c

index 8422d8f..854fd46 100644 (file)
@@ -598,7 +598,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
     if (gst_structure_id_has_field (st, _TAGS_QUARK)) {
       gst_structure_id_get (st, _TAGS_QUARK,
           GST_TYPE_STRUCTURE, &tags_st, NULL);
-      if (gst_structure_get_uint (tags_st, GST_TAG_BITRATE, &utmp))
+      if (gst_structure_get_uint (tags_st, GST_TAG_BITRATE, &utmp) ||
+          gst_structure_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp))
         info->bitrate = utmp;
 
       if (gst_structure_get_uint (tags_st, GST_TAG_MAXIMUM_BITRATE, &utmp))
@@ -650,7 +651,8 @@ collect_information (GstDiscoverer * dc, const GstStructure * st,
     if (gst_structure_id_has_field (st, _TAGS_QUARK)) {
       gst_structure_id_get (st, _TAGS_QUARK,
           GST_TYPE_STRUCTURE, &tags_st, NULL);
-      if (gst_structure_get_uint (tags_st, GST_TAG_BITRATE, &utmp))
+      if (gst_structure_get_uint (tags_st, GST_TAG_BITRATE, &utmp) ||
+          gst_structure_get_uint (tags_st, GST_TAG_NOMINAL_BITRATE, &utmp))
         info->bitrate = utmp;
 
       if (gst_structure_get_uint (tags_st, GST_TAG_MAXIMUM_BITRATE, &utmp))