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

arek at svn.xiph.org arek at svn.xiph.org
Sun Sep 2 08:34:00 PDT 2007


Author: arek
Date: 2007-09-02 08:34:00 -0700 (Sun, 02 Sep 2007)
New Revision: 13696

Modified:
   trunk/xiph-qt/ChangeLog
   trunk/xiph-qt/OggImport/src/OggImport.c
   trunk/xiph-qt/OggImport/src/importer_types.h
Log:
	* OggImport/src/OggImport.c:
	* OggImport/src/importer_types.h:
	Completely avoid idling for small files; keep track of the actual
	duration of sample references inserted into the movie, for stats.



Modified: trunk/xiph-qt/ChangeLog
===================================================================
--- trunk/xiph-qt/ChangeLog	2007-09-02 15:23:28 UTC (rev 13695)
+++ trunk/xiph-qt/ChangeLog	2007-09-02 15:34:00 UTC (rev 13696)
@@ -1,3 +1,10 @@
+2007-09-02  Arek Korbik  <arkadini at gmail.com>
+
+	* OggImport/src/OggImport.c:
+	* OggImport/src/importer_types.h:
+	Completely avoid idling for small files; keep track of the actual
+	duration of sample references inserted into the movie, for stats.
+
 2007-09-01  Arek Korbik  <arkadini at gmail.com>
 
 	* OggImport/src/OggImport.r:

Modified: trunk/xiph-qt/OggImport/src/OggImport.c
===================================================================
--- trunk/xiph-qt/OggImport/src/OggImport.c	2007-09-02 15:23:28 UTC (rev 13695)
+++ trunk/xiph-qt/OggImport/src/OggImport.c	2007-09-02 15:34:00 UTC (rev 13696)
@@ -1049,6 +1049,7 @@
     }
 
     if (!err) {
+        globals->timeFlushed = globals->timeLoaded;
         globals->tickFlushed = TickCount();
         NotifyMovieChanged(globals, notify);
     }
@@ -1174,6 +1175,7 @@
             globals->hasVideoTrack = false;
             globals->timeLoaded = 0;
             globals->timeLoadedSubSecond = 0.0;
+            globals->timeFlushed = 0;
             globals->tickFlushed = 0;
             globals->tickNotified = 0;
             globals->dataRequested = false;
@@ -1297,6 +1299,7 @@
                 break;
             }
 
+            FlushAllStreams(globals, true);
             RemovePlaceholderTrack(globals);
             NotifyMovieChanged(globals, true);
             globals->state = kStateImportComplete;
@@ -1433,13 +1436,13 @@
     if (ret == eofErr)
         ret = noErr;
 
-    globals->usingIdle = using_idles_p;
-
     if (ret == noErr) {
         FlushAllStreams(globals, true);
     }
 
-    dbg_printf("-<<- JustStartImport(): %ld\n", (long) ret);
+    globals->usingIdle = using_idles_p;
+
+    dbg_printf("-<<- JustStartImport(): %ld [mt: %8ld]\n", (long) ret, (long) GetMovieTime(globals->theMovie, NULL));
     return ret;
 }
 
@@ -1901,8 +1904,16 @@
 #else
         err = StartImport(globals, dataRef, dataRefType);
 #endif /* 1 */
-        *outFlags |= movieImportResultNeedIdles;
-        *durationAdded = 0;
+        if (err == noErr && globals->state == kStateImportComplete) {
+            *outFlags &= !movieImportResultNeedIdles;
+            *outFlags |= movieImportResultComplete;
+            *durationAdded = globals->timeLoaded;
+            if (globals->numTracksSeen == 1)
+                *usedTrack = globals->firstTrack;
+        } else {
+            *outFlags |= movieImportResultNeedIdles;
+            *durationAdded = 0;
+        }
     } else {
         err = JustImport(globals, dataRef, dataRefType);
         *outFlags &= !movieImportResultNeedIdles;
@@ -1934,7 +1945,8 @@
         break;
 
     case kStateReadingPages:
-        if (globals->timeLoaded > globals->flushMinTimeLeft) {
+    case kStateReadingLastPages:
+        if (globals->timeFlushed > globals->flushMinTimeLeft) {
             if (globals->sizeInitialised && S64Compare(globals->dataEndOffset, S64Set(-1)) == 0) {
                 *loadState = kMovieLoadStatePlaythroughOK;
             } else if (globals->sizeInitialised && globals->totalTime > 0) {
@@ -1964,7 +1976,7 @@
             } else {
                 *loadState = kMovieLoadStatePlayable;
             }
-        } else if (globals->timeLoaded > 0) {
+        } else if (globals->timeFlushed > 0) {
             *loadState = kMovieLoadStatePlayable;
         } else {
             *loadState = kMovieLoadStateLoading;
@@ -1972,10 +1984,6 @@
 
         break;
 
-    case kStateReadingLastPages:
-        *loadState = kMovieLoadStatePlaythroughOK;
-        break;
-
     case kStateImportComplete:
         *loadState = kMovieLoadStateComplete;
         break;
@@ -1989,9 +1997,9 @@
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 COMPONENTFUNC OggImportGetMaxLoadedTime(OggImportGlobalsPtr globals, TimeValue *time)
 {
-    dbg_printf("-- GetMaxLoadedTime() called: %8ld (at: %ld)\n", globals->timeLoaded, TickCount());
+    dbg_printf("-- GetMaxLoadedTime() called: %8ld [%8ld] (at: %ld)\n", globals->timeFlushed, globals->timeLoaded, TickCount());
 
-    *time = globals->timeLoaded;
+    *time = globals->timeFlushed;
 
     return noErr;
 }

Modified: trunk/xiph-qt/OggImport/src/importer_types.h
===================================================================
--- trunk/xiph-qt/OggImport/src/importer_types.h	2007-09-02 15:23:28 UTC (rev 13695)
+++ trunk/xiph-qt/OggImport/src/importer_types.h	2007-09-02 15:34:00 UTC (rev 13696)
@@ -204,6 +204,7 @@
 
     TimeValue               timeLoaded;
     Float64                 timeLoadedSubSecond;        // last second fraction remainder
+    TimeValue               timeFlushed;                // movie timescale precision only
 
     UInt32                  tickFlushed;
     UInt32                  flushStepCheck;



More information about the commits mailing list