Cosmetics.

This commit is contained in:
Laurent Aimar 2008-12-09 22:45:26 +01:00
parent 2c7d795fd2
commit 033efbad8c
3 changed files with 58 additions and 44 deletions

View File

@ -2325,8 +2325,6 @@ static int InputSourceInit( input_thread_t *p_input,
const char *psz_access;
const char *psz_demux;
char *psz_path;
char *psz_tmp;
char *psz;
vlc_value_t val;
double f_fps;
@ -2520,48 +2518,13 @@ static int InputSourceInit( input_thread_t *p_input,
goto error;
}
/* Add auto stream filter */
for( ;; )
{
stream_t *p_filter = stream_FilterNew( in->p_stream, NULL );
if( !p_filter )
break;
msg_Dbg( p_input, "Inserted a stream filter" );
in->p_stream = p_filter;
}
/* Add user stream filter */
psz_tmp = psz = var_GetNonEmptyString( p_input, "stream-filter" );
while( psz && *psz )
{
stream_t *p_filter;
char *psz_end = strchr( psz, ':' );
if( psz_end )
*psz_end++ = '\0';
p_filter = stream_FilterNew( in->p_stream, psz );
if( p_filter )
in->p_stream = p_filter;
else
msg_Warn( p_input, "failed to insert stream filter %s", psz );
psz = psz_end;
}
free( psz_tmp );
/* Add record filter if usefull */
if( var_GetBool( p_input, "input-record-native" ) )
{
stream_t *p_filter;
p_filter = stream_FilterNew( in->p_stream, "stream_filter_record" );
if( p_filter )
in->p_stream = p_filter;
else
var_SetBool( p_input, "input-record-native", false );
}
/* Add stream filters */
char *psz_stream_filter = var_GetNonEmptyString( p_input,
"stream-filter" );
in->p_stream = stream_FilterChainNew( in->p_stream,
psz_stream_filter,
var_GetBool( p_input, "input-record-native" ) );
free( psz_stream_filter );
/* Open a demuxer */
if( *psz_demux == '\0' && *in->p_access->psz_demux )

View File

@ -51,5 +51,9 @@ stream_t *stream_AccessNew( access_t *p_access, bool );
stream_t *stream_FilterNew( stream_t *p_source,
const char *psz_stream_filter );
/* */
stream_t *stream_FilterChainNew( stream_t *p_source,
const char *psz_chain,
bool b_record );
#endif

View File

@ -61,6 +61,53 @@ stream_t *stream_FilterNew( stream_t *p_source,
return s;
}
stream_t *stream_FilterChainNew( stream_t *p_source,
const char *psz_chain,
bool b_record )
{
/* Add auto stream filter */
for( ;; )
{
stream_t *p_filter = stream_FilterNew( p_source, NULL );
if( !p_filter )
break;
msg_Dbg( p_filter, "Inserted a stream filter" );
p_source = p_filter;
}
/* Add user stream filter */
char *psz_tmp = psz_chain ? strdup( psz_chain ) : NULL;
char *psz = psz_tmp;
while( psz && *psz )
{
stream_t *p_filter;
char *psz_end = strchr( psz, ':' );
if( psz_end )
*psz_end++ = '\0';
p_filter = stream_FilterNew( p_source, psz );
if( p_filter )
p_source = p_filter;
else
msg_Warn( p_source, "failed to insert stream filter %s", psz );
psz = psz_end;
}
free( psz_tmp );
/* Add record filter if usefull */
if( b_record )
{
stream_t *p_filter = stream_FilterNew( p_source,
"stream_filter_record" );
if( p_filter )
p_source = p_filter;
}
return p_source;
}
static void StreamDelete( stream_t *s )
{
module_unneed( s, s->p_module );