[Vorbis] ogg123 and Vorbis piped to stdin

Barry Bouwsma bugs at remove-NOSPAM-to-reply.NOSPAM.dyndns.dk
Mon Dec 20 18:15:14 PST 2004


Moin,

Two questions I have.

Actually, the first isn't so much a question.  It seems that `ogg123'
is not able to play streams from stdin, at least not for me on FreeBSD.

It also seems that with the patches way down below, it can play from
stdin for me -- I handle stdin like http-transport and return the
same values for seeking and the like, to avoid calls that fail, and
so it works, though I'm probably not doing it right.  Review is urged.


Second, I've noticed that `ogg123' isn't able to play streams that
do not start with an Ogg header or such -- for example, long ago,
when I tried to stream an Ogg Vorbis file by the same means I was
streaming mp3, it didn't work -- unless I used the software which
inserted the header before streaming the data on the proper
bondaries.

Now, I see the same thing using stdin, if I'm trying to seek within
an Ogg Vorbis file with `dd' piped to my hacked `ogg123'.  Should it
in theory be possible for `ogg123' to do the same thing on an Ogg
stream that, say, `mpg123' does, which is to seek until a passable
frame header is found, and then try to play that, sometimes even
getting the frame header right?

The purpose being to coarsely chop up some ogg files, as well as to
play files which unpatched-ogg123 isn't able to handle well (large
files, f'rinstance)


Thanks.  And below, my hacks to be able to play from stdin:

--- file_transport.c-DIST	Sun Aug 22 20:33:26 2004
+++ file_transport.c	Mon Dec 20 12:38:51 2004
@@ -84,6 +84,11 @@
   int items;
   long start;
 
+/* XXX HACK special-case stdin */
+  if (private->fp == stdin)
+    return 0;
+/* XXX */
+
   /* Record where we are */
   start = ftell(fp);
 
@@ -118,6 +123,11 @@
   file_private_t *private = source->private;
   FILE *fp = private->fp;
 
+/* XXX HACK special-case stdin */
+  if (private->fp == stdin)
+    return -1;
+/* XXX */
+
   return fseek(fp, offset, whence);  
 }
 
@@ -134,6 +144,11 @@
 {
   file_private_t *private = source->private;
   FILE *fp = private->fp;
+
+/* XXX HACK special-case stdin */
+  if (private->fp == stdin)
+    return 0;
+/* XXX */
 
   return ftell(fp);
 }


barry bouwsma



More information about the Vorbis mailing list