changeset 1041:7d7f77129c75 trunk

[svn] - Do not complain about errors in the stream while testing a file
author ertzing
date Wed, 16 May 2007 13:00:14 -0700
parents 1b0890d5c00b
children 77dbd83ea6e4
files ChangeLog src/flacng/flacng.h src/flacng/seekable_stream_callbacks.c src/flacng/tools.c
diffstat 4 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed May 16 04:10:36 2007 -0700
+++ b/ChangeLog	Wed May 16 13:00:14 2007 -0700
@@ -1,3 +1,12 @@
+2007-05-16 11:10:36 +0000  Ralf Ertzinger <ralf@skytale.net>
+  revision [2246]
+  
+  - Add filename to error message for unreadable metadata
+  
+  trunk/src/flacng/tools.c |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2007-05-15 20:45:38 +0000  Ralf Ertzinger <ralf@skytale.net>
   revision [2242]
   
--- a/src/flacng/flacng.h	Wed May 16 04:10:36 2007 -0700
+++ b/src/flacng/flacng.h	Wed May 16 13:00:14 2007 -0700
@@ -88,6 +88,7 @@
     gboolean metadata_changed;
     struct frame_info frame;
     glong read_max;
+    gboolean testing;
     gchar* name;
 } callback_info;
 
--- a/src/flacng/seekable_stream_callbacks.c	Wed May 16 04:10:36 2007 -0700
+++ b/src/flacng/seekable_stream_callbacks.c	Wed May 16 13:00:14 2007 -0700
@@ -231,9 +231,17 @@
 
 void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) {
 
+    callback_info* info = (callback_info*) client_data;
+
     _ENTER;
 
-    _ERROR("FLAC decoder error callback was called: %d", status);
+    _DEBUG("Using callback_info %s", info->name);
+
+    if (!info->testing) {
+        _ERROR("FLAC decoder error callback was called: %d", status);
+    } else {
+        _DEBUG("FLAC decoder error callback was called: %d", status);
+    }
 
     _LEAVE;
 
--- a/src/flacng/tools.c	Wed May 16 04:10:36 2007 -0700
+++ b/src/flacng/tools.c	Wed May 16 13:00:14 2007 -0700
@@ -94,6 +94,7 @@
     info->buffer_used = 0;
     info->write_pointer = info->output_buffer;
     info->read_max = -1;
+    info->testing = FALSE;
 
     /*
      * Clear the stream and frame information
@@ -278,6 +279,12 @@
     info->read_max = 8192;
 
     /*
+     * We are not sure if this is an actual flac file, so do not
+     * complain too much about errors in the stream
+     */
+    info->testing = TRUE;
+
+    /*
      * Open the file
      */
     if (NULL == (info->input_stream = vfs_fopen(filename, "rb"))) {
@@ -300,6 +307,7 @@
      */
 
     info->read_max = -1;
+    info->testing = FALSE;
 
     _LEAVE TRUE;
 }