[vlc-devel] commit: Cosmetics. (Laurent Aimar )
git version control
git at videolan.org
Thu Dec 11 21:30:10 CET 2008
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Dec 9 22:45:26 2008 +0100| [033efbad8cbb5216f1031fe4038c6014a0a3cb00] | committer: Laurent Aimar
Cosmetics.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=033efbad8cbb5216f1031fe4038c6014a0a3cb00
---
src/input/input.c | 51 ++++++--------------------------------------
src/input/stream.h | 4 +++
src/input/stream_filter.c | 47 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 58 insertions(+), 44 deletions(-)
diff --git a/src/input/input.c b/src/input/input.c
index 151d456..912590d 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -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 )
diff --git a/src/input/stream.h b/src/input/stream.h
index 1a2d50a..74e29c1 100644
--- a/src/input/stream.h
+++ b/src/input/stream.h
@@ -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
diff --git a/src/input/stream_filter.c b/src/input/stream_filter.c
index 7ad7d6a..be1ba02 100644
--- a/src/input/stream_filter.c
+++ b/src/input/stream_filter.c
@@ -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 );
More information about the vlc-devel
mailing list