[vlc-commits] stream_filter: split out code for automatic filter probing
Rémi Denis-Courmont
git at videolan.org
Tue Aug 25 20:33:15 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 25 20:24:51 2015 +0300| [15a2182a628f3f31002d55d625c587c821359ce1] | committer: Rémi Denis-Courmont
stream_filter: split out code for automatic filter probing
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=15a2182a628f3f31002d55d625c587c821359ce1
---
src/input/input.c | 2 ++
src/input/stream.h | 13 ++++++++++---
src/input/stream_filter.c | 16 ++++++++++------
3 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/src/input/input.c b/src/input/input.c
index a84be6e..535f06e 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2309,6 +2309,8 @@ static int InputSourceInit( input_thread_t *p_input,
}
/* Add stream filters */
+ p_stream = stream_FilterAutoNew( p_stream );
+
char *psz_stream_filter = var_GetNonEmptyString( p_input,
"stream-filter" );
p_stream = stream_FilterChainNew( p_stream, psz_stream_filter,
diff --git a/src/input/stream.h b/src/input/stream.h
index 5340078..6973cfe 100644
--- a/src/input/stream.h
+++ b/src/input/stream.h
@@ -47,10 +47,17 @@ stream_t *stream_FilterNew( stream_t *p_source,
const char *psz_stream_filter );
/**
+ * Automatically wraps a stream with any applicable stream filter.
+ * @return the (outermost/downstream) stream filter; if no filters were added,
+ * then the function return the source parameter.
+ * @note The function never returns NULL.
+ */
+stream_t *stream_FilterAutoNew( stream_t *source ) VLC_USED;
+
+/**
* This function creates a chain of filters:
- * - first, automatic probed stream filters are inserted.
- * - then, optional user filters (configured by psz_chain) are inserted.
- * - finaly, an optional record filter is inserted if b_record is true.
+ * - optional user filters (configured by psz_chain) are inserted.
+ * - an optional record filter is inserted if b_record is true.
*
* You must release the returned value using stream_Delete unless it is used as a
* source to another filter.
diff --git a/src/input/stream_filter.c b/src/input/stream_filter.c
index 353cf18..ef5b3d4 100644
--- a/src/input/stream_filter.c
+++ b/src/input/stream_filter.c
@@ -73,21 +73,25 @@ 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 automatic stream filter */
+stream_t *stream_FilterAutoNew( stream_t *p_source )
{
- /* Add auto stream filter */
for( ;; )
{
stream_t *p_filter = stream_FilterNew( p_source, NULL );
- if( !p_filter )
+ if( p_filter == NULL )
break;
- msg_Dbg( p_filter, "Inserted a stream filter" );
+ msg_Dbg( p_filter, "stream filter added to %p", p_source );
p_source = p_filter;
}
+ return p_source;
+}
+stream_t *stream_FilterChainNew( stream_t *p_source,
+ const char *psz_chain,
+ bool b_record )
+{
/* Add user stream filter */
char *psz_tmp = psz_chain ? strdup( psz_chain ) : NULL;
char *psz = psz_tmp;
More information about the vlc-commits
mailing list