[xiph-cvs] cvs commit: vorbis-tools/ogginfo ogginfo2.c

Michael Smith msmith at xiph.org
Fri Aug 9 21:31:11 PDT 2002



msmith      02/08/10 00:31:11

  Modified:    ogginfo  ogginfo2.c
  Log:
  Detect another condition that things won't cope with very well, which occurs
  with some files created by very buggy encoders (granulepos is not set on
  ANY page except the header pages, and the final page in the stream)

Revision  Changes    Path
1.17      +7 -0      vorbis-tools/ogginfo/ogginfo2.c

Index: ogginfo2.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogginfo/ogginfo2.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ogginfo2.c	19 Jul 2002 06:26:54 -0000	1.16
+++ ogginfo2.c	10 Aug 2002 04:31:11 -0000	1.17
@@ -90,6 +90,7 @@
 
     long bytes;
     ogg_int64_t lastgranulepos;
+    ogg_int64_t firstgranulepos;
 
     int doneheaders;
 } misc_vorbis_info;
@@ -366,6 +367,11 @@
                         inf->lastgranulepos, gp);
             inf->lastgranulepos = gp;
         }
+        else {
+            warn(_("Negative granulepos on vorbis stream outside of headers. This file was created by a buggy encoder\n"));
+        }
+        if(inf->firstgranulepos < 0) { /* Not set yet */
+        }
         inf->bytes += page->header_len + page->body_len;
     }
 }
@@ -376,6 +382,7 @@
     long minutes, seconds;
     double bitrate, time;
 
+    /* This should be lastgranulepos - startgranulepos, or something like that*/
     time = (double)inf->lastgranulepos / inf->vi.rate;
     minutes = (long)time / 60;
     seconds = (long)time - minutes*60;

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list