* mpeg_ps.c : Program Stream input module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: mpeg_ps.c,v 1.9 2002/04/04 22:51:01 massiot Exp $
+ * $Id: mpeg_ps.c,v 1.15 2002/06/01 12:32:00 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
#include <string.h> /* strdup() */
#include <errno.h>
-#include <videolan/vlc.h>
+#include <vlc/vlc.h>
+#include <vlc/input.h>
#include <sys/types.h>
-#include "stream_control.h"
-#include "input_ext-intf.h"
-#include "input_ext-dec.h"
-#include "input_ext-plugins.h"
-
/*****************************************************************************
* Constants
*****************************************************************************/
* Local prototypes
*****************************************************************************/
static void input_getfunctions( function_list_t * p_function_list );
-static int PSDemux ( struct input_thread_s * );
-static int PSInit ( struct input_thread_s * );
-static void PSEnd ( struct input_thread_s * );
+static int PSDemux ( input_thread_t * );
+static int PSInit ( input_thread_t * );
+static void PSEnd ( input_thread_t * );
/*****************************************************************************
* Build configuration tree.
MODULE_CONFIG_STOP
MODULE_INIT_START
- SET_DESCRIPTION( "ISO 13818-1 MPEG Program Stream input" )
+ SET_DESCRIPTION( _("ISO 13818-1 MPEG Program Stream input") )
ADD_CAPABILITY( DEMUX, 100 )
ADD_SHORTCUT( "ps" )
MODULE_INIT_STOP
if( input_Peek( p_input, &p_peek, 4 ) < 4 )
{
/* Stream shorter than 4 bytes... */
- intf_ErrMsg( "input error: cannot peek() (mpeg_ps)" );
+ msg_Err( p_input, "cannot peek()" );
return( -1 );
}
if( *p_input->psz_demux && !strncmp( p_input->psz_demux, "ps", 3 ) )
{
/* User forced */
- intf_ErrMsg( "input error: this doesn't look like an MPEG PS stream, continuing" );
+ msg_Err( p_input, "this does not look like an MPEG PS stream, continuing" );
}
else
{
- intf_WarnMsg( 2, "input: PS plug-in discarded (no startcode)" );
- return( -1 );
+ msg_Warn( p_input, "this does not look like an MPEG PS stream, "
+ "but continuing anyway" );
}
}
else if( *(p_peek + 3) <= 0xb9 )
if( *p_input->psz_demux && !strncmp( p_input->psz_demux, "ps", 3 ) )
{
/* User forced */
- intf_ErrMsg( "input error: this seems to be an elementary stream (ES plug-in ?),");
- intf_ErrMsg( "but continuing" );
+ msg_Err( p_input, "this seems to be an elementary stream (ES module?), but continuing" );
}
else
{
- intf_WarnMsg( 2, "input: PS plug-in discarded (ES startcode)" );
- return( -1 );
+ msg_Warn( p_input, "this seems to be an elementary stream (ES module?), but continuing" );
}
}
p_input->stream.p_selected_program =
p_input->stream.pp_programs[0] ;
- p_input->stream.p_new_program =
- p_input->stream.pp_programs[0] ;
if( p_input->stream.b_seekable )
{
case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES:
- if( config_GetIntVariable( "input_channel" )
+ if( config_GetInt( p_input, "audio-channel" )
== (p_es->i_id & 0x1F) ||
- ( config_GetIntVariable( "input_channel" ) < 0
- && !(p_es->i_id & 0x1F) ) )
- switch( config_GetIntVariable( "input_audio" ) )
+ ( config_GetInt( p_input, "audio-channel" ) < 0
+ && !(p_es->i_id & 0x1F) ) )
+ switch( config_GetInt( p_input, "audio-type" ) )
{
case -1:
case REQUESTED_MPEG:
break;
case AC3_AUDIO_ES:
- if( config_GetIntVariable( "input_channel" )
+ if( config_GetInt( p_input, "audio-channel" )
== ((p_es->i_id & 0xF00) >> 8) ||
- ( config_GetIntVariable( "input_channel" ) < 0
- && !((p_es->i_id & 0xF00) >> 8) ) )
- switch( config_GetIntVariable( "input_audio" ) )
+ ( config_GetInt( p_input, "audio-channel" ) < 0
+ && !((p_es->i_id & 0xF00) >> 8) ) )
+ switch( config_GetInt( p_input, "audio-type" ) )
{
case -1:
case REQUESTED_AC3:
break;
case DVD_SPU_ES:
- if( config_GetIntVariable( "input_subtitle" )
+ if( config_GetInt( p_input, "spu-channel" )
== ((p_es->i_id & 0x1F00) >> 8) )
{
input_SelectES( p_input, p_es );
break;
case LPCM_AUDIO_ES:
- if( config_GetIntVariable( "input_channel" )
+ if( config_GetInt( p_input, "audio-channel" )
== ((p_es->i_id & 0x1F00) >> 8) ||
- ( config_GetIntVariable( "input_channel" ) < 0
- && !((p_es->i_id & 0x1F00) >> 8) ) )
- switch( config_GetIntVariable( "input_audio" ) )
+ ( config_GetInt( p_input, "audio-channel" ) < 0
+ && !((p_es->i_id & 0x1F00) >> 8) ) )
+ switch( config_GetInt( p_input, "audio-type" ) )
{
case -1:
case REQUESTED_LPCM:
}
break;
}
+#undef p_es
}
-
}
#endif
- if( p_main->b_stats )
- {
- input_DumpStream( p_input );
- }
+ input_DumpStream( p_input );
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
else
{
/* The programs will be added when we read them. */
vlc_mutex_lock( &p_input->stream.stream_lock );
- p_input->stream.i_method = INPUT_METHOD_FILE;
p_input->stream.pp_programs[0]->b_is_ok = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
{
data_packet_t * p_data;
ssize_t i_result;
-
i_result = input_ReadPS( p_input, &p_data );
if( i_result <= 0 )