21
21
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
22
*****************************************************************************/
26
#include <vlc/input.h>
28
#include <vlc_common.h>
28
30
#include "input_internal.h"
30
32
/*****************************************************************************
31
* access2_InternalNew:
32
34
*****************************************************************************/
33
static access_t *access2_InternalNew( vlc_object_t *p_obj, char *psz_access,
34
char *psz_demux, char *psz_path,
35
access_t *p_source, vlc_bool_t b_quick )
35
static access_t *access_InternalNew( vlc_object_t *p_obj, const char *psz_access,
36
const char *psz_demux, const char *psz_path,
37
access_t *p_access = vlc_object_create( p_obj, VLC_OBJECT_ACCESS );
39
static const char typename[] = "access";
40
access_t *p_access = vlc_custom_create( p_obj, sizeof (*p_access),
41
VLC_OBJECT_GENERIC, typename );
39
43
if( p_access == NULL )
41
msg_Err( p_obj, "vlc_object_create() failed" );
46
47
p_access->p_source = p_source;
49
50
msg_Dbg( p_obj, "creating access filter '%s'", psz_access );
50
p_access->psz_access = strdup( p_source->psz_access );
51
p_access->psz_path = strdup( p_source->psz_path );
52
p_access->psz_demux = strdup( p_source->psz_demux );
54
msg_Dbg( p_obj, "creating access '%s' path='%s'",
55
psz_access, psz_path );
56
56
p_access->psz_path = strdup( psz_path );
57
p_access->psz_access =
58
b_quick ? strdup( "file" ) : strdup( psz_access );
59
p_access->psz_demux = strdup( psz_demux );
62
msg_Dbg( p_obj, "creating access '%s' path='%s'",
63
psz_access, psz_path );
58
p_access->psz_access = strdup( psz_access );
59
p_access->psz_demux = strdup( psz_demux );
66
61
p_access->pf_read = NULL;
67
62
p_access->pf_block = NULL;
71
66
p_access->info.i_update = 0;
72
67
p_access->info.i_size = 0;
73
68
p_access->info.i_pos = 0;
74
p_access->info.b_eof = VLC_FALSE;
75
p_access->info.b_prebuffered = VLC_FALSE;
69
p_access->info.b_eof = false;
70
p_access->info.b_prebuffered = false;
76
71
p_access->info.i_title = 0;
77
72
p_access->info.i_seekpoint = 0;
80
75
/* Before module_Need (for var_Create...) */
81
76
vlc_object_attach( p_access, p_obj );
86
module_Need( p_access, "access_filter", psz_access, VLC_FALSE );
91
module_Need( p_access, "access2", p_access->psz_access,
92
b_quick ? VLC_TRUE : VLC_FALSE );
79
module_Need( p_access, p_source ? "access_filter" : "access",
95
82
if( p_access->p_module == NULL )
84
msg_StackAdd( "could not create access" );
97
85
vlc_object_detach( p_access );
98
86
free( p_access->psz_access );
99
87
free( p_access->psz_path );
100
88
free( p_access->psz_demux );
101
vlc_object_destroy( p_access );
89
vlc_object_release( p_access );
108
96
/*****************************************************************************
110
*****************************************************************************/
111
access_t *__access2_New( vlc_object_t *p_obj, char *psz_access,
112
char *psz_demux, char *psz_path, vlc_bool_t b_quick )
114
return access2_InternalNew( p_obj, psz_access, psz_demux,
115
psz_path, NULL, b_quick );
118
/*****************************************************************************
120
*****************************************************************************/
121
access_t *access2_FilterNew( access_t *p_source, char *psz_access_filter )
123
return access2_InternalNew( VLC_OBJECT(p_source), psz_access_filter,
124
NULL, NULL, p_source, VLC_FALSE );
127
/*****************************************************************************
129
*****************************************************************************/
130
void access2_Delete( access_t *p_access )
98
*****************************************************************************/
99
access_t *__access_New( vlc_object_t *p_obj, const char *psz_access,
100
const char *psz_demux, const char *psz_path )
102
return access_InternalNew( p_obj, psz_access, psz_demux,
106
/*****************************************************************************
108
*****************************************************************************/
109
access_t *access_FilterNew( access_t *p_source, const char *psz_access_filter )
111
return access_InternalNew( VLC_OBJECT(p_source), psz_access_filter,
112
p_source->psz_demux, p_source->psz_path,
116
/*****************************************************************************
118
*****************************************************************************/
119
void access_Delete( access_t *p_access )
132
121
module_Unneed( p_access, p_access->p_module );
133
122
vlc_object_detach( p_access );