[xiph-commits] r16393 - in trunk/xiph-qt: . OggImport/src

arek at svn.xiph.org arek at svn.xiph.org
Sat Aug 1 16:40:59 PDT 2009


Author: arek
Date: 2009-08-01 16:40:59 -0700 (Sat, 01 Aug 2009)
New Revision: 16393

Modified:
   trunk/xiph-qt/ChangeLog
   trunk/xiph-qt/OggImport/src/stream_theora.c
   trunk/xiph-qt/OggImport/src/stream_types_theora.h
Log:
	* OggImport/src/stream_theora.c:
	* OggImport/src/stream_types_theora.h:
	Handle base grpos of pre-3.2.1 Theora bitstreams correctly.



Modified: trunk/xiph-qt/ChangeLog
===================================================================
--- trunk/xiph-qt/ChangeLog	2009-08-01 23:37:40 UTC (rev 16392)
+++ trunk/xiph-qt/ChangeLog	2009-08-01 23:40:59 UTC (rev 16393)
@@ -1,5 +1,11 @@
 2009-08-02  Arek Korbik  <arkadini at gmail.com>
 
+	* OggImport/src/stream_theora.c:
+	* OggImport/src/stream_types_theora.h:
+	Handle base grpos of pre-3.2.1 Theora bitstreams correctly.
+
+2009-08-02  Arek Korbik  <arkadini at gmail.com>
+
 	* OggImport/src/stream_flac.c:
 	* OggImport/src/stream_speex.c:
 	Add minimal stub code for Speex and FLAC to not block group base

Modified: trunk/xiph-qt/OggImport/src/stream_theora.c
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_theora.c	2009-08-01 23:37:40 UTC (rev 16392)
+++ trunk/xiph-qt/OggImport/src/stream_theora.c	2009-08-01 23:40:59 UTC (rev 16393)
@@ -123,6 +123,10 @@
                                                                  // we've been consistently packeting-out so far...
         dbg_printf("---/t / page duration: %lld, %lld (%lld); pkts: %d\n", duration, ogg_page_granulepos(opg), si->lastGranulePos, packets);
         if (duration >= 0) {
+            if (si->si_theora.bitstream_version <= 0x00030200) {
+                // compensate for 0-based grpos in pre-3.2.1 bitstreams (as opposed to 1-based)
+                duration += 1;
+            }
             si->baseGranulePos = grpos - (duration << si->si_theora.granulepos_shift); // subtracting from the "frames at last keyframe" part directly
             if (si->baseGranulePos < 0)
                 si->baseGranulePos = 0;
@@ -281,6 +285,8 @@
 
     th_decode_headerin(&si->si_theora.ti, &si->si_theora.tc, &si->si_theora.ts, opckt); //check errors?
 
+    si->si_theora.bitstream_version = (si->si_theora.ti.version_major << 16) + (si->si_theora.ti.version_minor << 8) + (si->si_theora.ti.version_subminor);
+
     si->numChannels = 0;
     //si->lastMediaInserted = 0;
     si->mediaLength = 0;

Modified: trunk/xiph-qt/OggImport/src/stream_types_theora.h
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_types_theora.h	2009-08-01 23:37:40 UTC (rev 16392)
+++ trunk/xiph-qt/OggImport/src/stream_types_theora.h	2009-08-01 23:40:59 UTC (rev 16393)
@@ -60,6 +60,8 @@
     th_comment tc;
     th_setup_info *ts;
 
+    UInt32 bitstream_version;
+
     UInt32 granulepos_shift;
     UInt32 fps_framelen;
 



More information about the commits mailing list