changeset 997:e46b98155d5d trunk

[svn] - fix a bug which counts number of frames twice in handling xing header. - now fileinfo dialog calculates play length even though TLEN tag exists so that it can overwrite wrong TLEN tag.
author yaz
date Tue, 01 May 2007 12:49:27 -0700
parents 34da98fd7d26
children 799b321bd9bd
files ChangeLog src/madplug/decoder.c src/madplug/fileinfo.c src/madplug/input.c src/madplug/plugin.h src/madplug/xing.c
diffstat 6 files changed, 31 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue May 01 10:38:27 2007 -0700
+++ b/ChangeLog	Tue May 01 12:49:27 2007 -0700
@@ -1,3 +1,12 @@
+2007-05-01 17:38:27 +0000  Ralf Ertzinger <ralf@skytale.net>
+  revision [2132]
+  
+  - Fix alternative code path in flac_write
+  
+  trunk/src/filewriter/flac.c |    4 ++--
+  1 file changed, 2 insertions(+), 2 deletions(-)
+
+
 2007-05-01 15:54:31 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [2130]
   - add tuple handling, but i don't think i'm doing it right...
--- a/src/madplug/decoder.c	Tue May 01 10:38:27 2007 -0700
+++ b/src/madplug/decoder.c	Tue May 01 12:49:27 2007 -0700
@@ -191,6 +191,11 @@
     info->pos = mad_timer_zero;
     info->duration = mad_timer_zero; // should be cleared before loop, if we use it as break condition.
 
+    if(info->fileinfo_request == TRUE) {
+        info->tuple->length = -1;
+        info->fileinfo_request = FALSE;
+    }
+
 #ifdef DEBUG
     g_message("f: scan_file");
     g_message("scan_file frames = %d", info->frames);
@@ -294,9 +299,10 @@
 #endif                          /* DEBUG */
                         has_xing = TRUE;
                         info->vbr = TRUE;   /* otherwise xing header would have been 'Info' */
-                        info->frames = info->xing.frames;
-                        if(info->tuple->length == -1)
-                            mad_timer_multiply(&info->duration, info->frames);
+                        if(info->tuple->length == -1) {
+                            info->duration = mad_timer_zero;
+                            mad_timer_multiply(&info->duration, info->xing.frames);
+                        }
                         else {
                             info->duration.seconds = info->tuple->length / 1000;
                             info->duration.fraction = info->tuple->length % 1000;
@@ -378,6 +384,9 @@
             break;
     }
 
+    if (info->xing.frames)
+        info->frames = info->xing.frames;
+
     if (info->vbr && xing_bitrate != 0) {
         info->bitrate = xing_bitrate;
     }
--- a/src/madplug/fileinfo.c	Tue May 01 10:38:27 2007 -0700
+++ b/src/madplug/fileinfo.c	Tue May 01 12:49:27 2007 -0700
@@ -586,6 +586,7 @@
     utf_filename = str_to_utf8(filename);
     create_window();
 
+    info.fileinfo_request = TRUE;
     input_get_info(&info, info.remote ? TRUE : FALSE);
 
     title = g_strdup_printf("File Info - %s", g_basename(utf_filename));
--- a/src/madplug/input.c	Tue May 01 10:38:27 2007 -0700
+++ b/src/madplug/input.c	Tue May 01 12:49:27 2007 -0700
@@ -122,6 +122,8 @@
     if(audmad_is_remote((gchar *)url))
         info->remote = TRUE;
 
+    info->fileinfo_request = FALSE;
+
 #ifdef DEBUG
     g_message("i: info->size = %lu", (long unsigned int)info->size);
     g_message("e: input_init");
--- a/src/madplug/plugin.h	Tue May 01 10:38:27 2007 -0700
+++ b/src/madplug/plugin.h	Tue May 01 12:49:27 2007 -0700
@@ -52,7 +52,7 @@
     /* InputPlayback */
     InputPlayback *playback;
 
-    /* flags */
+    /* seek time */
     gulong seek;      /**< seek time in milliseconds */
 
     /* state */
@@ -98,7 +98,9 @@
     VFSFile *infile;
     gint offset;
 
+    /* flags */
     gboolean remote;
+    gboolean fileinfo_request;
 
 };
 
--- a/src/madplug/xing.c	Tue May 01 10:38:27 2007 -0700
+++ b/src/madplug/xing.c	Tue May 01 12:49:27 2007 -0700
@@ -32,6 +32,10 @@
 void xing_init(struct xing *xing)
 {
     xing->flags = 0;
+    xing->frames = 0;
+    xing->bytes = 0;
+    xing->toc[0] = '\0';
+    xing->scale = 0;
 }
 
 /*