1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2008 Laurent Aimar
7 * Author: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
28 #include <vlc_common.h>
29 #include <vlc_stream.h>
34 static void StreamDelete( stream_t * );
36 stream_t *stream_FilterNew( stream_t *p_source,
37 const char *psz_stream_filter )
41 s = stream_CommonNew( VLC_OBJECT( p_source ) );
46 s->p_source = p_source;
49 vlc_object_attach( s, p_source );
51 s->p_module = module_need( s, "stream_filter", psz_stream_filter, true );
55 stream_CommonDelete( s );
59 s->pf_destroy = StreamDelete;
64 stream_t *stream_FilterChainNew( stream_t *p_source,
65 const char *psz_chain,
68 /* Add auto stream filter */
71 stream_t *p_filter = stream_FilterNew( p_source, NULL );
75 msg_Dbg( p_filter, "Inserted a stream filter" );
79 /* Add user stream filter */
80 char *psz_tmp = psz_chain ? strdup( psz_chain ) : NULL;
85 char *psz_end = strchr( psz, ':' );
90 p_filter = stream_FilterNew( p_source, psz );
94 msg_Warn( p_source, "failed to insert stream filter %s", psz );
100 /* Add record filter if usefull */
103 stream_t *p_filter = stream_FilterNew( p_source,
104 "stream_filter_record" );
111 static void StreamDelete( stream_t *s )
113 module_unneed( s, s->p_module );
116 stream_Delete( s->p_source );
118 stream_CommonDelete( s );