[xiph-commits] r9696 - trunk/vorbis-tools/ogg123

jack at svn.xiph.org jack at svn.xiph.org
Wed Aug 3 13:24:59 PDT 2005


Author: jack
Date: 2005-08-03 13:24:57 -0700 (Wed, 03 Aug 2005)
New Revision: 9696

Modified:
   trunk/vorbis-tools/ogg123/file_transport.c
Log:
Fix an old bug that prevented playback from pipes.  This fixes
Debian Bug#237187.


Modified: trunk/vorbis-tools/ogg123/file_transport.c
===================================================================
--- trunk/vorbis-tools/ogg123/file_transport.c	2005-08-03 19:13:35 UTC (rev 9695)
+++ trunk/vorbis-tools/ogg123/file_transport.c	2005-08-03 20:24:57 UTC (rev 9696)
@@ -26,6 +26,7 @@
 typedef struct file_private_t {
   FILE *fp;
   data_source_stats_t stats;
+  int seekable;
 } file_private_t;
 
 
@@ -51,6 +52,7 @@
     source->transport = &file_transport;
     source->private = private;
     
+    private->seekable = 1;
     private->stats.transfer_rate = 0;
     private->stats.bytes_read = 0;
     private->stats.input_buffer_used = 0;
@@ -60,9 +62,10 @@
   }
 
   /* Open file */
-  if (strcmp(source_string, "-") == 0)
+  if (strcmp(source_string, "-") == 0) {
     private->fp = stdin;
-  else
+    private->seekable = 0;
+  } else
     private->fp = fopen(source_string, "r");
 
   if (private->fp == NULL) {
@@ -84,6 +87,8 @@
   int items;
   long start;
 
+  if (!private->seekable) return 0;
+
   /* Record where we are */
   start = ftell(fp);
 
@@ -118,6 +123,8 @@
   file_private_t *private = source->private;
   FILE *fp = private->fp;
 
+  if (!private->seekable) return -1;
+
   return fseek(fp, offset, whence);  
 }
 
@@ -135,6 +142,8 @@
   file_private_t *private = source->private;
   FILE *fp = private->fp;
 
+  if (!private->seekable) return -1;
+
   return ftell(fp);
 }
 



More information about the commits mailing list