changeset 966:1f78881a5f3c trunk

[svn] - Make flacng use vfs_fsize()
author ertzing
date Fri, 20 Apr 2007 06:51:44 -0700
parents f1642ee1115c
children 1aabbe15006f
files ChangeLog src/flacng/seekable_stream_callbacks.c
diffstat 2 files changed, 25 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 20 06:50:15 2007 -0700
+++ b/ChangeLog	Fri Apr 20 06:51:44 2007 -0700
@@ -1,3 +1,16 @@
+2007-04-20 13:50:15 +0000  Ralf Ertzinger <ralf@skytale.net>
+  revision [2070]
+  
+  - Implement vfs_fsize() for stdio
+  - Implement dummys for curl/mms/smb
+  
+  trunk/src/curl/curl.c   |    8 ++++++++
+  trunk/src/mms/mms.c     |    9 ++++++++-
+  trunk/src/smb/smb.c     |    9 ++++++++-
+  trunk/src/stdio/stdio.c |   23 +++++++++++++++++++++--
+  4 files changed, 45 insertions(+), 4 deletions(-)
+
+
 2007-04-18 14:38:58 +0000  Tony Vroon <chainsaw@gentoo.org>
   revision [2068]
   Sync with upstream. Subsong improvements for ADL, new JBM player.
--- a/src/flacng/seekable_stream_callbacks.c	Fri Apr 20 06:50:15 2007 -0700
+++ b/src/flacng/seekable_stream_callbacks.c	Fri Apr 20 06:51:44 2007 -0700
@@ -148,35 +148,26 @@
 FLAC__StreamDecoderLengthStatus length_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) {
 
     callback_info* info;
-    size_t size;
-    glong position;
+    off_t size;
 
     _ENTER;
 
     info = (callback_info*) client_data;
     _DEBUG("Using callback_info %s", info->name);
 
-    if (-1 == (position = vfs_ftell(info->input_stream))) {
-        _ERROR("Could not tell current position!");
-        _LEAVE FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
-    }
-
-    if (-1 == vfs_fseek(info->input_stream, 0, SEEK_END)) {
-        _ERROR("Could not seek to end of stream.");
-        _LEAVE FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
+    if (-1 == (size = vfs_fsize(info->input_stream))) {
+        /*
+         * Could not get the stream size. This is not necessarily an
+         * error, maybe the stream has no fixed size (think streaming
+         * audio)
+         */
+        _DEBUG("Stream length unknown");
+        *stream_length = 0;
+        _LEAVE FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
     }
 
-    if (-1 == (*stream_length = vfs_ftell(info->input_stream))) {
-        _ERROR("Could not tell position at end of stream!");
-        _LEAVE FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
-    }
-
-    if (-1 == vfs_fseek(info->input_stream, position, SEEK_SET)) {
-        _ERROR("Could not reset stream position. We're probably in trouble now.");
-        _LEAVE FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
-    }
-
-    _DEBUG("Stream length is %d bytes", *stream_length);
+    _DEBUG("Stream length is %d bytes", size);
+    *stream_length = size;
 
     _LEAVE FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
 }
@@ -187,7 +178,6 @@
 
     glong i;
     gshort j;
-    gint32 sample;
     callback_info* info;
 
     _ENTER;