]> git.sesse.net Git - vlc/commitdiff
Reversed my previous patch (too buggy).
authorChristophe Massiot <massiot@videolan.org>
Mon, 3 Dec 2001 17:55:45 +0000 (17:55 +0000)
committerChristophe Massiot <massiot@videolan.org>
Mon, 3 Dec 2001 17:55:45 +0000 (17:55 +0000)
plugins/mpeg/input_ps.c
src/input/mpeg_system.c

index 6fccdf71171ceea87ddce8047817e4aca30f7ca2..88c64311d36b07c57e283c515d9bf85d95e30991 100644 (file)
@@ -2,7 +2,7 @@
  * input_ps.c: PS demux and packet management
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ps.c,v 1.40 2001/12/03 11:49:04 massiot Exp $
+ * $Id: input_ps.c,v 1.41 2001/12/03 17:55:45 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Cyril Deguet <asmax@via.ecp.fr>
@@ -291,7 +291,78 @@ static void PSInit( input_thread_t * p_input )
             /* (The PSM decoder will care about spawning the decoders) */
             p_input->stream.pp_programs[0]->b_is_ok = 1;
         }
-
+#ifdef AUTO_SPAWN
+        else
+        {
+            /* (We have to do it ourselves) */
+            int                 i_es;
+
+            /* FIXME: we should do multiple passes in case an audio type
+             * is not present */
+            for( i_es = 0;
+                 i_es < p_input->stream.pp_programs[0]->i_es_number;
+                 i_es++ )
+            {
+#define p_es p_input->stream.pp_programs[0]->pp_es[i_es]
+                switch( p_es->i_type )
+                {
+                    case MPEG1_VIDEO_ES:
+                    case MPEG2_VIDEO_ES:
+                        input_SelectES( p_input, p_es );
+                        break;
+
+                    case MPEG1_AUDIO_ES:
+                    case MPEG2_AUDIO_ES:
+                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
+                                == (p_es->i_id & 0x1F) )
+                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+                        {
+                        case 0:
+                            main_PutIntVariable( INPUT_AUDIO_VAR,
+                                                 REQUESTED_MPEG );
+                        case REQUESTED_MPEG:
+                            input_SelectES( p_input, p_es );
+                        }
+                        break;
+
+                    case AC3_AUDIO_ES:
+                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
+                                == ((p_es->i_id & 0xF00) >> 8) )
+                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+                        {
+                        case 0:
+                            main_PutIntVariable( INPUT_AUDIO_VAR,
+                                                 REQUESTED_AC3 );
+                        case REQUESTED_AC3:
+                            input_SelectES( p_input, p_es );
+                        }
+                        break;
+
+                    case DVD_SPU_ES:
+                        if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
+                                == ((p_es->i_id & 0x1F00) >> 8) )
+                        {
+                            input_SelectES( p_input, p_es );
+                        }
+                        break;
+
+                    case LPCM_AUDIO_ES:
+                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
+                                == ((p_es->i_id & 0x1F00) >> 8) )
+                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+                        {
+                        case 0:
+                            main_PutIntVariable( INPUT_AUDIO_VAR,
+                                                 REQUESTED_LPCM );
+                        case REQUESTED_LPCM:
+                            input_SelectES( p_input, p_es );
+                        }
+                        break;
+                }
+            }
+                    
+        }
+#endif
         if( p_main->b_stats )
         {
             input_DumpStream( p_input );
index 5f2aca768b03db5d70913e466f665a4cae99037d..223529ffacf52543f9666feb93a2fc9a97ab3416 100644 (file)
@@ -2,7 +2,7 @@
  * mpeg_system.c: TS, PS and PES management
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: mpeg_system.c,v 1.66 2001/12/03 11:49:04 massiot Exp $
+ * $Id: mpeg_system.c,v 1.67 2001/12/03 17:55:45 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -708,10 +708,8 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                         p_es->i_type = MPEG2_VIDEO_ES;
                         p_es->i_cat = VIDEO_ES;
 #ifdef AUTO_SPAWN
-                        if( p_main->b_video )
-                        {
+                        if( !p_input->stream.b_seekable )
                             input_SelectES( p_input, p_es );
-                        }
 #endif
                     }
                     else if( (i_id & 0xE0) == 0xC0 )
@@ -721,18 +719,16 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                         p_es->b_audio = 1;
                         p_es->i_cat = AUDIO_ES;
 #ifdef AUTO_SPAWN
-                        if( p_main->b_audio )
+                        if( !p_input->stream.b_seekable )
+                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
+                                == (p_es->i_id & 0x1F) )
+                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
                         {
-                            if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
-                                    == (p_es->i_id & 0x1F) )
-                            switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
-                            {
-                            case 0:
-                                main_PutIntVariable( INPUT_CHANNEL_VAR,
-                                                     REQUESTED_MPEG );
-                            case REQUESTED_MPEG:
-                                input_SelectES( p_input, p_es );
-                            }
+                        case 0:
+                            main_PutIntVariable( INPUT_CHANNEL_VAR,
+                                                 REQUESTED_MPEG );
+                        case REQUESTED_MPEG:
+                            input_SelectES( p_input, p_es );
                         }
 #endif
                     }
@@ -743,18 +739,16 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                         p_es->b_audio = 1;
                         p_es->i_cat = AUDIO_ES;
 #ifdef AUTO_SPAWN
-                        if( p_main->b_audio )
+                        if( !p_input->stream.b_seekable )
+                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
+                                == ((p_es->i_id & 0xF00) >> 8) )
+                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
                         {
-                            if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
-                                    == ((p_es->i_id & 0xF00) >> 8) )
-                            switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
-                            {
-                            case 0:
-                                main_PutIntVariable( INPUT_CHANNEL_VAR,
-                                                     REQUESTED_AC3 );
-                            case REQUESTED_AC3:
-                                input_SelectES( p_input, p_es );
-                            }
+                        case 0:
+                            main_PutIntVariable( INPUT_CHANNEL_VAR,
+                                                 REQUESTED_AC3 );
+                        case REQUESTED_AC3:
+                            input_SelectES( p_input, p_es );
                         }
 #endif
                     }
@@ -764,13 +758,11 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                         p_es->i_type = DVD_SPU_ES;
                         p_es->i_cat = SPU_ES;
 #ifdef AUTO_SPAWN
-                        if( p_main->b_video )
+                        if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
+                                == ((p_es->i_id & 0x1F00) >> 8) )
                         {
-                            if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
-                                    == ((p_es->i_id & 0x1F00) >> 8) )
-                            {
+                            if( !p_input->stream.b_seekable )
                                 input_SelectES( p_input, p_es );
-                            }
                         }
 #endif
                     }
@@ -781,21 +773,6 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                         p_es->b_audio = 1;
                         p_es->i_cat = AUDIO_ES;
                         /* FIXME : write the decoder */
-#ifdef AUTO_SPAWN
-                        if( p_main->b_audio )
-                        {
-                            if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
-                                    == ((p_es->i_id & 0x1F00) >> 8) )
-                            switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
-                            {
-                            case 0:
-                                main_PutIntVariable( INPUT_CHANNEL_VAR,
-                                                     REQUESTED_LPCM );
-                            case REQUESTED_LPCM:
-                                input_SelectES( p_input, p_es );
-                            }
-                        }
-#endif
                     }
                     else
                     {
@@ -803,7 +780,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                     }
                 }
 
-                /* Inform the interface that the stream has changed */
+                /* Tell the interface the stream has changed */
                 p_input->stream.b_changed = 1;
             }
         } /* stream.b_is_ok */