1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 1999-2004 VideoLAN
5 * $Id: demux.c 7546 2004-04-29 13:53:29Z gbazin $
7 * Author: Laurent Aimar <fenrir@via.ecp.fr>
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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
26 #include <vlc/input.h>
30 int access_vaControl( input_thread_t *p_input, int i_query, va_list args )
32 if( p_input->pf_access_control )
34 return p_input->pf_access_control( p_input, i_query, args );
39 int access_Control( input_thread_t *p_input, int i_query, ... )
44 va_start( args, i_query );
45 i_result = access_vaControl( p_input, i_query, args );
51 int access_vaControlDefault( input_thread_t *p_input, int i_query, va_list args )
56 /*****************************************************************************
58 *****************************************************************************/
59 access_t *__access2_New( vlc_object_t *p_obj, char *psz_mrl )
61 access_t *p_access = vlc_object_create( p_obj, VLC_OBJECT_ACCESS );
63 char *psz_dup = strdup( psz_mrl ? psz_mrl : "" );
64 char *psz = strchr( psz_dup, ':' );
66 if( p_access == NULL )
73 p_access->psz_access = NULL;
74 p_access->psz_path = NULL;
80 if( psz[0] == '/' && psz[1] == '/' )
84 p_access->psz_path = strdup( psz );
86 psz = strchr( psz_dup, '/' );
90 p_access->psz_access = strdup( psz_dup );
95 p_access->psz_path = strdup( psz_mrl );
100 p_access->psz_demux = strdup( "" );
101 if( p_access->psz_access == NULL )
103 p_access->psz_access = strdup( "" );
105 if( p_access->psz_path == NULL )
107 p_access->psz_path = strdup( "" );
109 msg_Dbg( p_obj, "access2_New: '%s' -> access='%s' path='%s'",
111 p_access->psz_access, p_access->psz_path );
113 p_access->pf_read = NULL;
114 p_access->pf_block = NULL;
115 p_access->pf_seek = NULL;
116 p_access->pf_control = NULL;
117 p_access->p_sys = NULL;
119 /* Before module_Need (for var_Create...) */
120 vlc_object_attach( p_access, p_obj );
123 module_Need( p_access, "access2", p_access->psz_access, VLC_FALSE );
125 if( p_access->p_module == NULL )
127 vlc_object_detach( p_access );
128 free( p_access->psz_access );
129 free( p_access->psz_path );
130 free( p_access->psz_demux );
131 vlc_object_destroy( p_access );
138 /*****************************************************************************
140 *****************************************************************************/
141 void access2_Delete( access_t *p_access )
143 module_Unneed( p_access, p_access->p_module );
144 vlc_object_detach( p_access );
146 free( p_access->psz_access );
147 free( p_access->psz_path );
148 free( p_access->psz_demux );
150 vlc_object_destroy( p_access );