00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef VLC_STREAM_H
00025 #define VLC_STREAM_H 1
00026
00027 #include <vlc_block.h>
00028
00029
00030
00031
00032
00033
00034 # ifdef __cplusplus
00035 extern "C" {
00036 # endif
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 typedef struct stream_text_t stream_text_t;
00047
00048
00049
00050
00051
00052 struct stream_t
00053 {
00054 VLC_COMMON_MEMBERS
00055 bool b_error;
00056
00057
00058 module_t *p_module;
00059
00060 char *psz_access;
00061
00062 char *psz_path;
00063
00064
00065 stream_t *p_source;
00066
00067
00068 int (*pf_read) ( stream_t *, void *p_read, unsigned int i_read );
00069 int (*pf_peek) ( stream_t *, const uint8_t **pp_peek, unsigned int i_peek );
00070 int (*pf_control)( stream_t *, int i_query, va_list );
00071
00072
00073 void (*pf_destroy)( stream_t *);
00074
00075
00076 stream_sys_t *p_sys;
00077
00078
00079 stream_text_t *p_text;
00080
00081
00082 input_thread_t *p_input;
00083 };
00084
00085
00086
00087
00088 enum stream_query_e
00089 {
00090
00091 STREAM_CAN_SEEK,
00092 STREAM_CAN_FASTSEEK,
00093
00094
00095 STREAM_SET_POSITION,
00096 STREAM_GET_POSITION,
00097
00098 STREAM_GET_SIZE,
00099
00100
00101
00102 STREAM_CONTROL_ACCESS,
00103
00104
00105
00106
00107 STREAM_UPDATE_SIZE,
00108
00109
00110 STREAM_GET_CONTENT_TYPE,
00111
00112
00113 STREAM_SET_RECORD_STATE,
00114 };
00115
00116 VLC_API int stream_Read( stream_t *s, void *p_read, int i_read );
00117 VLC_API int stream_Peek( stream_t *s, const uint8_t **pp_peek, int i_peek );
00118 VLC_API int stream_vaControl( stream_t *s, int i_query, va_list args );
00119 VLC_API void stream_Delete( stream_t *s );
00120 VLC_API int stream_Control( stream_t *s, int i_query, ... );
00121 VLC_API block_t * stream_Block( stream_t *s, int i_size );
00122 VLC_API block_t * stream_BlockRemaining( stream_t *s, int i_max_size );
00123 VLC_API char * stream_ReadLine( stream_t * );
00124
00125
00126
00127
00128 static inline int64_t stream_Tell( stream_t *s )
00129 {
00130 uint64_t i_pos;
00131 stream_Control( s, STREAM_GET_POSITION, &i_pos );
00132 if( i_pos >> 62 )
00133 return (int64_t)1 << 62;
00134 return i_pos;
00135 }
00136
00137
00138
00139
00140 static inline int64_t stream_Size( stream_t *s )
00141 {
00142 uint64_t i_pos;
00143 stream_Control( s, STREAM_GET_SIZE, &i_pos );
00144 if( i_pos >> 62 )
00145 return (int64_t)1 << 62;
00146 return i_pos;
00147 }
00148
00149 static inline int stream_Seek( stream_t *s, uint64_t i_pos )
00150 {
00151 return stream_Control( s, STREAM_SET_POSITION, i_pos );
00152 }
00153
00154
00155
00156
00157
00158 static inline char *stream_ContentType( stream_t *s )
00159 {
00160 char *res;
00161 if( stream_Control( s, STREAM_GET_CONTENT_TYPE, &res ) )
00162 return NULL;
00163 return res;
00164 }
00165
00166
00167
00168
00169
00170 VLC_API stream_t * stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *out );
00171
00172
00173
00174
00175 VLC_API void stream_DemuxSend( stream_t *s, block_t *p_block );
00176
00177
00178
00179
00180
00181 VLC_API stream_t * stream_MemoryNew(vlc_object_t *p_obj, uint8_t *p_buffer, uint64_t i_size, bool b_preserve_memory );
00182 #define stream_MemoryNew( a, b, c, d ) stream_MemoryNew( VLC_OBJECT(a), b, c, d )
00183
00184
00185
00186
00187
00188 VLC_API stream_t * stream_UrlNew(vlc_object_t *p_this, const char *psz_url );
00189 #define stream_UrlNew( a, b ) stream_UrlNew( VLC_OBJECT(a), b )
00190
00191
00192
00193
00194
00195
00196 VLC_API stream_t* stream_FilterNew( stream_t *p_source, const char *psz_stream_filter );
00197
00198
00199
00200
00201 # ifdef __cplusplus
00202 }
00203 # endif
00204
00205 #endif