[Mplayer-cvslog] CVS: main/libmpdemux demux_mkv.cpp,1.14,1.15

Moritz Bunkus CVS mosu at mplayerhq.hu
Thu May 22 09:50:19 CEST 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv1515

Modified Files:
	demux_mkv.cpp 
Log Message:
Delayed the parsing of the cues for the case that the KaxInfos (and therefore the timecode scale) is located after the meta seek stuff.

Index: demux_mkv.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- demux_mkv.cpp	19 May 2003 20:55:52 -0000	1.14
+++ demux_mkv.cpp	22 May 2003 07:49:48 -0000	1.15
@@ -896,7 +896,7 @@
   mkv_track_t *track;
   sh_audio_t *sh_a;
   sh_video_t *sh_v;
-  uint64_t seek_pos, current_pos;
+  uint64_t seek_pos, current_pos, cues_pos;
   int seek_element_is_cue;
 
 #ifdef USE_ICONV
@@ -962,6 +962,8 @@
     mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] + a segment...\n");
     
     mkv_d->segment = (KaxSegment *)l0;
+    mkv_d->tc_scale = MKVD_TIMECODESCALE;
+    cues_pos = 0;
 
     upper_lvl_el = 0;
     exit_loop = 0;
@@ -976,8 +978,6 @@
         // General info about this Matroska file
         mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] |+ segment information...\n");
         
-        mkv_d->tc_scale = MKVD_TIMECODESCALE;
-
         l2 = es->FindNextElement(l1->Generic().Context, upper_lvl_el,
                                  0xFFFFFFFFL, true, 1);
         while (l2 != NULL) {
@@ -1340,14 +1340,8 @@
             } // while (l3 != NULL)
 
             if (!mkv_d->cues_found && (seek_pos > 0) &&
-                seek_element_is_cue && (s->end_pos != 0)) {
-              current_pos = io.getFilePointer();
-              io.setFilePointer(mkv_d->segment->GetGlobalPosition(seek_pos));
-              mkv_d->cues_found = parse_cues(mkv_d);
-              if (s->eof)
-                stream_reset(s);
-              io.setFilePointer(current_pos);
-            }
+                seek_element_is_cue && (s->end_pos != 0))
+              cues_pos = mkv_d->segment->GetGlobalPosition(seek_pos);
 
           } else
             mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] |  + unknown element, level 2: "
@@ -1410,6 +1404,19 @@
       free_mkv_demuxer(mkv_d);
       return 0;
     }
+
+    // If we have found an entry for the cues in the meta seek data but no
+    // cues at the front of the file then read them now. This way the
+    // timecode scale will have been initialized correctly.
+    if (cues_pos && !mkv_d->cues_found) {
+      current_pos = io.getFilePointer();
+      io.setFilePointer(cues_pos);
+      mkv_d->cues_found = parse_cues(mkv_d);
+      if (s->eof)
+        stream_reset(s);
+      io.setFilePointer(current_pos);
+    }
+
 
   } catch (exception &ex) {
     mp_msg(MSGT_DEMUX, MSGL_ERR, "[mkv] caught exception\n");



More information about the MPlayer-cvslog mailing list