1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 1999-2008 the VideoLAN team
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 *****************************************************************************/
31 /*****************************************************************************
33 *****************************************************************************/
34 access_t *__access_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
35 const char *psz_access, const char *psz_demux,
36 const char *psz_path )
38 access_t *p_access = vlc_custom_create( p_obj, sizeof (*p_access),
39 VLC_OBJECT_GENERIC, "access" );
41 if( p_access == NULL )
45 msg_Dbg( p_obj, "creating access '%s' path='%s'",
46 psz_access, psz_path );
48 p_access->p_input = p_parent_input;
50 p_access->psz_path = strdup( psz_path );
51 p_access->psz_access = strdup( psz_access );
52 p_access->psz_demux = strdup( psz_demux );
54 p_access->pf_read = NULL;
55 p_access->pf_block = NULL;
56 p_access->pf_seek = NULL;
57 p_access->pf_control = NULL;
58 p_access->p_sys = NULL;
60 access_InitFields( p_access );
62 /* Before module_need (for var_Create...) */
63 vlc_object_attach( p_access, p_obj );
65 p_access->p_module = module_need( p_access, "access", psz_access, true );
67 if( p_access->p_module == NULL )
69 free( p_access->psz_access );
70 free( p_access->psz_path );
71 free( p_access->psz_demux );
72 vlc_object_release( p_access );
79 /*****************************************************************************
81 *****************************************************************************/
82 void access_Delete( access_t *p_access )
84 module_unneed( p_access, p_access->p_module );
86 free( p_access->psz_access );
87 free( p_access->psz_path );
88 free( p_access->psz_demux );
90 vlc_object_release( p_access );
94 /*****************************************************************************
95 * access_GetParentInput:
96 *****************************************************************************/
97 input_thread_t * access_GetParentInput( access_t *p_access )
99 return p_access->p_input ? vlc_object_hold((vlc_object_t *)p_access->p_input) : NULL;