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
00061 char *psz_path;
00062
00063
00064 stream_t *p_source;
00065
00066
00067 int (*pf_read) ( stream_t *, void *p_read, unsigned int i_read );
00068 int (*pf_peek) ( stream_t *, const uint8_t **pp_peek, unsigned int i_peek );
00069 int (*pf_control)( stream_t *, int i_query, va_list );
00070
00071
00072 void (*pf_destroy)( stream_t *);
00073
00074
00075 stream_sys_t *p_sys;
00076
00077
00078 stream_text_t *p_text;
00079
00080
00081 input_thread_t *p_input;
00082 };
00083
00084
00085
00086
00087 enum stream_query_e
00088 {
00089
00090 STREAM_CAN_SEEK,
00091 STREAM_CAN_FASTSEEK,
00092
00093
00094 STREAM_SET_POSITION,
00095 STREAM_GET_POSITION,
00096
00097 STREAM_GET_SIZE,
00098
00099
00100
00101 STREAM_CONTROL_ACCESS,
00102
00103
00104
00105
00106 STREAM_UPDATE_SIZE,
00107
00108
00109 STREAM_GET_CONTENT_TYPE,
00110
00111
00112 STREAM_SET_RECORD_STATE,
00113 };
00114
00115 VLC_EXPORT( int, stream_Read, ( stream_t *s, void *p_read, int i_read ) );
00116 VLC_EXPORT( int, stream_Peek, ( stream_t *s, const uint8_t **pp_peek, int i_peek ) );
00117 VLC_EXPORT( int, stream_vaControl, ( stream_t *s, int i_query, va_list args ) );
00118 VLC_EXPORT( void, stream_Delete, ( stream_t *s ) );
00119 VLC_EXPORT( int, stream_Control, ( stream_t *s, int i_query, ... ) );
00120 VLC_EXPORT( block_t *, stream_Block, ( stream_t *s, int i_size ) );
00121 VLC_EXPORT( char *, stream_ReadLine, ( stream_t * ) );
00122
00123
00124
00125
00126 static inline int64_t stream_Tell( stream_t *s )
00127 {
00128 uint64_t i_pos;
00129 stream_Control( s, STREAM_GET_POSITION, &i_pos );
00130 if( i_pos >> 62 )
00131 return (int64_t)1 << 62;
00132 return i_pos;
00133 }
00134
00135
00136
00137
00138 static inline int64_t stream_Size( stream_t *s )
00139 {
00140 uint64_t i_pos;
00141 stream_Control( s, STREAM_GET_SIZE, &i_pos );
00142 if( i_pos >> 62 )
00143 return (int64_t)1 << 62;
00144 return i_pos;
00145 }
00146
00147 static inline int stream_Seek( stream_t *s, uint64_t i_pos )
00148 {
00149 return stream_Control( s, STREAM_SET_POSITION, i_pos );
00150 }
00151
00152
00153
00154
00155
00156 static inline char *stream_ContentType( stream_t *s )
00157 {
00158 char *res;
00159 if( stream_Control( s, STREAM_GET_CONTENT_TYPE, &res ) )
00160 return NULL;
00161 return res;
00162 }
00163
00164
00165
00166
00167
00168 VLC_EXPORT( stream_t *, stream_DemuxNew, ( demux_t *p_demux, const char *psz_demux, es_out_t *out ) );
00169
00170
00171
00172
00173 VLC_EXPORT( void, stream_DemuxSend, ( stream_t *s, block_t *p_block ) );
00174
00175
00176
00177
00178
00179 VLC_EXPORT( stream_t *, stream_MemoryNew, (vlc_object_t *p_obj, uint8_t *p_buffer, uint64_t i_size, bool b_preserve_memory ) );
00180 #define stream_MemoryNew( a, b, c, d ) stream_MemoryNew( VLC_OBJECT(a), b, c, d )
00181
00182
00183
00184
00185
00186 VLC_EXPORT( stream_t *, stream_UrlNew, (vlc_object_t *p_this, const char *psz_url ) );
00187 #define stream_UrlNew( a, b ) stream_UrlNew( VLC_OBJECT(a), b )
00188
00189
00190
00191
00192
00193
00194 VLC_EXPORT( stream_t*, stream_FilterNew, ( stream_t *p_source, const char *psz_stream_filter ) );
00195
00196
00197
00198
00199 # ifdef __cplusplus
00200 }
00201 # endif
00202
00203 #endif