]> git.sesse.net Git - vlc/blobdiff - modules/demux/mpeg/ps.c
* Stringreview !!!
[vlc] / modules / demux / mpeg / ps.c
index 7510f8106569e2d6c4434f4b9a9486077203b61c..8522fbee2da71a051a8acdfc5a983fa2ddfa5e90 100644 (file)
@@ -1,16 +1,16 @@
 /*****************************************************************************
  * ps.c : Program Stream input module for vlc
  *****************************************************************************
- * Copyright (C) 2000-2001 VideoLAN
- * $Id: ps.c,v 1.10 2003/09/07 22:48:29 fenrir Exp $
+ * Copyright (C) 2000-2004, 2004 VideoLAN
+ * $Id: ps.c,v 1.17 2004/01/25 20:05:28 hartman Exp $
  *
- * Authors: Christophe Massiot <massiot@via.ecp.fr>
+ * Author: Christophe Massiot <massiot@via.ecp.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
  * (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
@@ -25,7 +25,6 @@
  * Preamble
  *****************************************************************************/
 #include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>                                              /* strdup() */
 
 #include <vlc/vlc.h>
 #include <vlc/input.h>
@@ -138,16 +137,19 @@ static int Activate( vlc_object_t * p_this )
         return -1;
     }
     input_AddProgram( p_input, 0, sizeof( stream_ps_data_t ) );
-    
-    p_input->stream.p_selected_program = 
+
+    p_input->stream.p_selected_program =
             p_input->stream.pp_programs[0] ;
-    
+
     if( p_input->stream.b_seekable )
     {
         stream_ps_data_t * p_demux_data =
              (stream_ps_data_t *)p_input->stream.pp_programs[0]->p_demux_data;
 
+        off_t i_tell = p_input->stream.p_selected_area->i_tell;
+
         /* Pre-parse the stream to gather stream_descriptor_t. */
+        p_input->pf_seek( p_input, (off_t) 0 );
         p_input->stream.pp_programs[0]->b_is_ok = 0;
         p_demux_data->i_PSM_version = EMPTY_PSM_VERSION;
 
@@ -184,7 +186,7 @@ static int Activate( vlc_object_t * p_this )
             }
         }
         input_AccessReinit( p_input );
-        p_input->pf_seek( p_input, (off_t)0 );
+        p_input->pf_seek( p_input, i_tell );
         vlc_mutex_lock( &p_input->stream.stream_lock );
 
         if( p_demux_data->b_has_PSM )
@@ -261,6 +263,14 @@ static int Activate( vlc_object_t * p_this )
                         }
                         break;
 
+                    case VLC_FOURCC('o','g','t',' '):
+                        if( config_GetInt( p_input, "spu-channel" )
+                           == (p_es->i_id & 0x0003) )
+                        {
+                            input_SelectES( p_input, p_es );
+                        }
+                        break;
+
                     case VLC_FOURCC('l','p','c','m'):
                     case VLC_FOURCC('l','p','c','b'):
                         if( config_GetInt( p_input, "audio-channel" )