]> git.sesse.net Git - vlc/blobdiff - modules/demux/mkv/chapter_command.cpp
Regression fix for non-SPU tracks in MKV containers.
[vlc] / modules / demux / mkv / chapter_command.cpp
index d74f4eeb4b15bdb175e928dc88e529178f5a2493..ec7e7acbbb5894eb067c48cee64c5dbc8feeefaa 100644 (file)
@@ -1,25 +1,25 @@
 /*****************************************************************************
- * mkv.cpp : matroska demuxer
+ * chapter_command.cpp : matroska demuxer
  *****************************************************************************
- * Copyright (C) 2003-2004 the VideoLAN team
+ * Copyright (C) 2003-2004 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Steve Lhomme <steve.lhomme@free.fr>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include "chapter_command.hpp"
@@ -172,7 +172,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
         return false;
 
     virtual_segment_c *p_segment = NULL;
-    chapter_item_c *p_chapter = NULL;
+    virtual_chapter_c *p_chapter = NULL;
     bool f_result = false;
     uint16 i_command = ( p_command[0] << 8 ) + p_command[1];
 
@@ -481,7 +481,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
             p_chapter = sys.p_current_segment->BrowseCodecPrivate( 1, MatchIsDomain, NULL, 0 );
             if ( p_chapter != NULL )
             {
-                int16 i_curr_title = p_chapter->GetTitleNumber( );
+                int16 i_curr_title = ( p_chapter->p_chapter )? p_chapter->p_chapter->GetTitleNumber() : 0;
                 if ( i_curr_title > 0 )
                 {
                     p_chapter = sys.BrowseCodecPrivate( 1, MatchVTSNumber, &i_curr_title, sizeof(i_curr_title), p_segment );
@@ -531,7 +531,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
             {
                 if ( !p_chapter->Enter( true ) )
                     // jump to the location in the found segment
-                    sys.p_current_segment->Seek( sys.demuxer, p_chapter->i_user_start_time, -1, p_chapter, -1 );
+                    sys.p_current_segment->Seek( sys.demuxer, p_chapter->i_virtual_start_time, -1, p_chapter, -1 );
 
                 f_result = true;
             }
@@ -549,7 +549,7 @@ bool dvd_command_interpretor_c::Interpret( const binary * p_command, size_t i_si
             {
                 if ( !p_chapter->Enter( true ) )
                     // jump to the location in the found segment
-                    sys.p_current_segment->Seek( sys.demuxer, p_chapter->i_user_start_time, -1, p_chapter, -1 );
+                    sys.p_current_segment->Seek( sys.demuxer, p_chapter->i_virtual_start_time, -1, p_chapter, -1 );
 
                 f_result = true;
             }
@@ -715,11 +715,7 @@ bool matroska_script_interpretor_c::Interpret( const binary * p_command, size_t
 
     msg_Dbg( &sys.demuxer, "command : %s", sz_command.c_str() );
 
-#if defined(__GNUC__) && (__GNUC__ < 3)
-    if ( sz_command.compare( CMD_MS_GOTO_AND_PLAY, 0, CMD_MS_GOTO_AND_PLAY.size() ) == 0 )
-#else
     if ( sz_command.compare( 0, CMD_MS_GOTO_AND_PLAY.size(), CMD_MS_GOTO_AND_PLAY ) == 0 )
-#endif
     {
         size_t i,j;
 
@@ -746,14 +742,14 @@ bool matroska_script_interpretor_c::Interpret( const binary * p_command, size_t
         int64_t i_chapter_uid = atoi( st.c_str() );
 
         virtual_segment_c *p_segment;
-        chapter_item_c *p_chapter = sys.FindChapter( i_chapter_uid, p_segment );
+        virtual_chapter_c *p_chapter = sys.FindChapter( i_chapter_uid, p_segment );
 
         if ( p_chapter == NULL )
             msg_Dbg( &sys.demuxer, "Chapter %"PRId64" not found", i_chapter_uid);
         else
         {
             if ( !p_chapter->EnterAndLeave( sys.p_current_segment->CurrentChapter() ) )
-                p_segment->Seek( sys.demuxer, p_chapter->i_user_start_time, -1, p_chapter, -1 );
+                p_segment->Seek( sys.demuxer, p_chapter->i_virtual_start_time, -1, p_chapter, -1 );
             b_result = true;
         }
     }