]> git.sesse.net Git - vlc/blobdiff - modules/demux/mkv.cpp
* include/configuration.h: some small re-work of the config declaration macros.
[vlc] / modules / demux / mkv.cpp
index f9afb2a2e23969a44255ec256de48790656bce5d..72ea0cc7634f6a3f68467ad0e8868a3e84672bf0 100644 (file)
@@ -2,7 +2,7 @@
  * mkv.cpp : matroska demuxer
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: mkv.cpp,v 1.27 2003/09/12 16:26:40 fenrir Exp $
+ * $Id: mkv.cpp,v 1.37 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -497,7 +497,7 @@ static int Open( vlc_object_t * p_this )
                     tk.p_extra_data = NULL;
                     tk.i_codec = 0;
                     tk.psz_codec = NULL;
-                    tk.psz_language = NULL;
+                    tk.psz_language = strdup("English");
                     tk.i_default_duration = 0;
                     tk.f_timecodescale = 1.0;
 
@@ -1045,8 +1045,8 @@ static int Open( vlc_object_t * p_this )
             val.psz_string = "UTF-8";
 #if defined(HAVE_ICONV)
             var_Create( p_input, "subsdec-encoding", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
-#endif
             var_Set( p_input, "subsdec-encoding", val );
+#endif
         }
         if( !strcmp( tk.psz_codec, "V_MS/VFW/FOURCC" ) )
         {
@@ -1244,9 +1244,17 @@ static int Open( vlc_object_t * p_this )
         {
             tk.i_codec = VLC_FOURCC( 's', 'u', 'b', 't' );
         }
-        else if( !strcmp( tk.psz_codec, "S_TEXT/SSA" ) )
+        else if( !strcmp( tk.psz_codec, "S_TEXT/SSA" ) ||
+                 !strcmp( tk.psz_codec, "S_SSA" ) ||
+                 !strcmp( tk.psz_codec, "S_ASS" ))
         {
-            tk.i_codec = VLC_FOURCC( 's', 'u', 'b', 't' );
+            tk.i_codec = VLC_FOURCC( 's', 's', 'a', ' ' );
+            tk.p_es->p_demux_data = (es_sys_t *)malloc( sizeof( subtitle_data_t ) );
+            tk.p_es->p_demux_data->psz_header = strdup( (char *)tk.p_extra_data );
+        }
+        else if( !strcmp( tk.psz_codec, "S_VOBSUB" ) )
+        {
+            tk.i_codec = VLC_FOURCC( 's','p','u',' ' );
         }
         else
         {
@@ -1502,7 +1510,8 @@ static pes_packet_t *MemToPES( input_thread_t *p_input, uint8_t *p_mem, int i_me
     p_pes->p_first = p_pes->p_last = p_data;
     p_pes->i_nb_data = 1;
     p_pes->i_pes_size = i_mem;
-
+    p_pes->i_rate = p_input->stream.control.i_rate;
+    
     return p_pes;
 }
 
@@ -1616,12 +1625,11 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts
         p_pes->i_pts = i_pts;
         p_pes->i_dts = i_pts;
 
-        if( tk.i_cat == SPU_ES )
+        if( tk.i_cat == SPU_ES && strcmp( tk.psz_codec, "S_VOBSUB" ) )
         {
             if( i_duration > 0 )
             {
-                /* FIXME not sure about that */
-                p_pes->i_dts += i_duration * 1000;// * (mtime_t) 1000 / p_sys->i_timescale;
+                p_pes->i_dts += i_duration * 1000;
             }
             else
             {
@@ -1630,23 +1638,7 @@ static void BlockDecode( input_thread_t *p_input, KaxBlock *block, mtime_t i_pts
 
             if( p_pes->p_first && p_pes->i_pes_size > 0 )
             {
-                p_pes->p_first->p_payload_end[-1] = '\0';
-            }
-            if( !strcmp( tk.psz_codec, "S_TEXT/SSA" ) )
-            {
-                /* remove all fields before text for now */
-                char *start = (char*)p_pes->p_first->p_payload_start;
-                int  i_comma = 0;
-
-                while( *start && i_comma < 8 )
-                {
-                    if( *start++ == ',' )
-                    {
-                        i_comma++;
-                    }
-                }
-                memmove( p_pes->p_first->p_payload_start, start,
-                         strlen( start) + 1 );
+                p_pes->p_first->p_payload_end[0] = '\0';
             }
         }