| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
#ifdef HAVE_CONFIG_H |
|---|
| 25 |
# include "config.h" |
|---|
| 26 |
#endif |
|---|
| 27 |
|
|---|
| 28 |
#include <vlc_common.h> |
|---|
| 29 |
|
|---|
| 30 |
#include "input_internal.h" |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 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_source ) |
|---|
| 38 |
{ |
|---|
| 39 |
static const char typename[] = "access"; |
|---|
| 40 |
access_t *p_access = vlc_custom_create( p_obj, sizeof (*p_access), |
|---|
| 41 |
VLC_OBJECT_GENERIC, typename ); |
|---|
| 42 |
|
|---|
| 43 |
if( p_access == NULL ) |
|---|
| 44 |
return NULL; |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
p_access->p_source = p_source; |
|---|
| 48 |
if( p_source ) |
|---|
| 49 |
{ |
|---|
| 50 |
msg_Dbg( p_obj, "creating access filter '%s'", psz_access ); |
|---|
| 51 |
} |
|---|
| 52 |
else |
|---|
| 53 |
{ |
|---|
| 54 |
msg_Dbg( p_obj, "creating access '%s' path='%s'", |
|---|
| 55 |
psz_access, psz_path ); |
|---|
| 56 |
p_access->psz_path = strdup( psz_path ); |
|---|
| 57 |
} |
|---|
| 58 |
p_access->psz_access = strdup( psz_access ); |
|---|
| 59 |
p_access->psz_demux = strdup( psz_demux ); |
|---|
| 60 |
|
|---|
| 61 |
p_access->pf_read = NULL; |
|---|
| 62 |
p_access->pf_block = NULL; |
|---|
| 63 |
p_access->pf_seek = NULL; |
|---|
| 64 |
p_access->pf_control = NULL; |
|---|
| 65 |
p_access->p_sys = NULL; |
|---|
| 66 |
p_access->info.i_update = 0; |
|---|
| 67 |
p_access->info.i_size = 0; |
|---|
| 68 |
p_access->info.i_pos = 0; |
|---|
| 69 |
p_access->info.b_eof = false; |
|---|
| 70 |
p_access->info.b_prebuffered = false; |
|---|
| 71 |
p_access->info.i_title = 0; |
|---|
| 72 |
p_access->info.i_seekpoint = 0; |
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
vlc_object_attach( p_access, p_obj ); |
|---|
| 77 |
|
|---|
| 78 |
p_access->p_module = |
|---|
| 79 |
module_Need( p_access, p_source ? "access_filter" : "access", |
|---|
| 80 |
psz_access, true ); |
|---|
| 81 |
|
|---|
| 82 |
if( p_access->p_module == NULL ) |
|---|
| 83 |
{ |
|---|
| 84 |
msg_StackAdd( "could not create access" ); |
|---|
| 85 |
vlc_object_detach( p_access ); |
|---|
| 86 |
free( p_access->psz_access ); |
|---|
| 87 |
free( p_access->psz_path ); |
|---|
| 88 |
free( p_access->psz_demux ); |
|---|
| 89 |
vlc_object_release( p_access ); |
|---|
| 90 |
return NULL; |
|---|
| 91 |
} |
|---|
| 92 |
|
|---|
| 93 |
return p_access; |
|---|
| 94 |
} |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
access_t *__access_New( vlc_object_t *p_obj, const char *psz_access, |
|---|
| 100 |
const char *psz_demux, const char *psz_path ) |
|---|
| 101 |
{ |
|---|
| 102 |
return access_InternalNew( p_obj, psz_access, psz_demux, |
|---|
| 103 |
psz_path, NULL ); |
|---|
| 104 |
} |
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
access_t *access_FilterNew( access_t *p_source, const char *psz_access_filter ) |
|---|
| 110 |
{ |
|---|
| 111 |
return access_InternalNew( VLC_OBJECT(p_source), psz_access_filter, |
|---|
| 112 |
p_source->psz_demux, p_source->psz_path, |
|---|
| 113 |
p_source ); |
|---|
| 114 |
} |
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
void access_Delete( access_t *p_access ) |
|---|
| 120 |
{ |
|---|
| 121 |
module_Unneed( p_access, p_access->p_module ); |
|---|
| 122 |
vlc_object_detach( p_access ); |
|---|
| 123 |
|
|---|
| 124 |
free( p_access->psz_access ); |
|---|
| 125 |
free( p_access->psz_path ); |
|---|
| 126 |
free( p_access->psz_demux ); |
|---|
| 127 |
|
|---|
| 128 |
if( p_access->p_source ) |
|---|
| 129 |
{ |
|---|
| 130 |
access_Delete( p_access->p_source ); |
|---|
| 131 |
} |
|---|
| 132 |
|
|---|
| 133 |
vlc_object_release( p_access ); |
|---|
| 134 |
} |
|---|
| 135 |
|
|---|