[Vorbis] Patch: ogg123 playing >2GB sized files

Barry Bouwsma bugs
Mon Jul 19 04:57:52 PDT 2004


[Apologies -- I've been offline for over a month, and so haven't
sent this patch in a timely manner.  Also, I'm still not up-to-
speed and do not yet have the latest source downloaded, so this
patch might be unnecessary anyway.  And the list archives appear
to not be updated since I started sending patches, so I haven't
seen any feedback yet, if any.  As usual, don't reply to me since
I have no idea when I'll be online again.]


Ah!  Finally, it took long enough, but I've located the problem that
had prevented me from seeking beyond the 2GB point within a >4GB Ogg
Vorbis file.  Now, I can seek to anywhere within this ~100 hour file.

Of course, the real proof will be whether I can continuously play for
the full length of the >4GB file -- a test which I haven't tried yet.

The problem was in using an int for the return value of a 64-bit
function.  All other references to this function in this source file
use a proper 64-bit value.  This function returns the offset within
the file, and this int wraps to <0 at 2GB, causing an EOS to be
returned for any offset at any further point in a larger file.


Sorry for the extra printf() debuggery left over in this patch...


--- lib/vorbisfile.c-DIST	Wed Sep 17 04:17:35 2003
+++ lib/vorbisfile.c	Thu Jun 17 12:17:23 2004
@@ -541,10 +548,14 @@
}
}

+/* XXX printf("Get next page...\n"); */
+
if(vf->ready_state>=OPENED){
-      int ret;
+  ogg_int64_t ret;
+/* XXX HACK       int ret; */
if(!readp)return(0);
if((ret=_get_next_page(vf,&og,-1))<0){
+/* XXX printf("Get next page failed, ret is %d.\n", ret); */
return(OV_EOF); /* eof.
leave unitialized */
}



This is the last of the known issues with large files on my FreeBSD
system -- though, as noted, I need to play through an entire >4GB
file to make sure there aren't any undiscovered problems.  (Some
other utilities like `ogginfo' may need attention, or it could be
that I simply haven't rebuilt them.)

As always, other OSen may have problems with other patches I've
already sent, so those need to be massaged into portability.

And as noted, playing such a file tends to overflow the allotted
space on the status line, but a fix for that isn't quite as easy
as I had hoped, now having dug around in the source.  Oh well.


thanks
barry bouwsma



More information about the Vorbis mailing list