changeset 959:b2fbf53360cf trunk

[svn] bug fix for #897 - make mp3 header parsing continue even if xing header is located first. - if xing header does not provide enough information to calculate average bitrate, scan_file() now calculate it from frames.
author yaz
date Sat, 14 Apr 2007 22:08:50 -0700
parents 30e515b6e651
children 34325e9fcc60
files ChangeLog src/madplug/decoder.c
diffstat 2 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Apr 14 18:09:55 2007 -0700
+++ b/ChangeLog	Sat Apr 14 22:08:50 2007 -0700
@@ -1,3 +1,11 @@
+2007-04-15 01:09:55 +0000  Tony Vroon <chainsaw@gentoo.org>
+  revision [2056]
+  A cast a day keeps the compiler warning at bay.
+  trunk/src/rootvis/config_frontend.c         |    8 ++++----
+  trunk/src/rootvis/config_frontend_widgets.c |    8 ++++----
+  2 files changed, 8 insertions(+), 8 deletions(-)
+
+
 2007-04-15 00:38:32 +0000  Tony Vroon <chainsaw@gentoo.org>
   revision [2054]
   Hammer the WMA plugin into shape enough to bolt the following upstream commit on: "WMA decoder improvement, output closer to the dmo binary.
--- a/src/madplug/decoder.c	Sat Apr 14 18:09:55 2007 -0700
+++ b/src/madplug/decoder.c	Sat Apr 14 22:08:50 2007 -0700
@@ -178,6 +178,7 @@
     struct mad_frame frame;     /* to read xing data */
     gboolean has_xing = FALSE;
     int bitrate_frames = 0;
+    guint xing_bitrate = 0;
 
     mad_stream_init(&stream);
     mad_header_init(&header);
@@ -299,11 +300,14 @@
                             info->duration.seconds = info->tuple->length / 1000;
                             info->duration.fraction = info->tuple->length % 1000;
                         }
-                        info->bitrate =
+                        xing_bitrate = 
                             8.0 * info->xing.bytes /
                             mad_timer_count(info->duration,
                                             MAD_UNITS_SECONDS);
-                        break;
+#ifdef DEBUG
+                        g_message("xing: bitrate = %d", xing_bitrate);
+#endif
+                        continue;
                     }
                 }
 
@@ -363,8 +367,12 @@
             break;
     }
 
-    if (info->vbr && !has_xing)
+    if (info->vbr && xing_bitrate == 0) {
         info->bitrate = info->bitrate / bitrate_frames;
+#ifdef DEBUG
+        g_message("info->bitrate = %d", info->bitrate);
+#endif
+    }
 
     mad_frame_finish(&frame);
     mad_header_finish(&header);
@@ -372,6 +380,7 @@
     xing_finish(&info->xing);
 
 #ifdef DEBUG
+    g_message("scan_file: info->frames = %d", info->frames);
     g_message("e: scan_file");
 #endif                          /* DEBUG */
     return (info->frames != 0 || info->remote == TRUE);