125
120
/* unbuffered I/O */
130
* New fields can be added to the end with minor version bumps.
131
* Removal, reordering and changes to existing fields require a major
133
* sizeof(URLContext) must not be used outside libav*.
134
* @deprecated This struct will be made private
136
typedef struct URLContext {
137
const AVClass *av_class; ///< information for av_log(). Set by url_open().
138
struct URLProtocol *prot;
140
int is_streamed; /**< true if streamed (no seek possible), default = false */
141
int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */
143
char *filename; /**< specified URL */
145
AVIOInterruptCB interrupt_callback;
148
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
149
#define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */
152
* @deprecated This struct is to be made private. Use the higher-level
153
* AVIOContext-based API instead.
155
typedef struct URLProtocol {
157
int (*url_open)(URLContext *h, const char *url, int flags);
158
int (*url_read)(URLContext *h, unsigned char *buf, int size);
159
int (*url_write)(URLContext *h, const unsigned char *buf, int size);
160
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
161
int (*url_close)(URLContext *h);
162
struct URLProtocol *next;
163
int (*url_read_pause)(URLContext *h, int pause);
164
int64_t (*url_read_seek)(URLContext *h, int stream_index,
165
int64_t timestamp, int flags);
166
int (*url_get_file_handle)(URLContext *h);
168
const AVClass *priv_data_class;
170
int (*url_check)(URLContext *h, int mask);
173
typedef struct URLPollEntry {
179
/* not implemented */
180
attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
183
* @name URL open modes
184
* The flags argument to url_open and cosins must be one of the following
185
* constants, optionally ORed with other flags.
188
#define URL_RDONLY 1 /**< read-only */
189
#define URL_WRONLY 2 /**< write-only */
190
#define URL_RDWR (URL_RDONLY|URL_WRONLY) /**< read-write */
196
* Use non-blocking mode.
197
* If this flag is set, operations on the context will return
198
* AVERROR(EAGAIN) if they can not be performed immediately.
199
* If this flag is not set, operations on the context will never return
201
* Note that this flag does not affect the opening/connecting of the
202
* context. Connecting a protocol will always block if necessary (e.g. on
203
* network protocols) but never hang (e.g. on busy devices).
204
* Warning: non-blocking protocols is work-in-progress; this flag may be
207
#define URL_FLAG_NONBLOCK 8
209
typedef int URLInterruptCB(void);
210
extern URLInterruptCB *url_interrupt_cb;
213
* @defgroup old_url_funcs Old url_* functions
214
* The following functions are deprecated. Use the buffered API based on #AVIOContext instead.
218
attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
219
const char *url, int flags);
220
attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags);
221
attribute_deprecated int url_connect(URLContext *h);
222
attribute_deprecated int url_open(URLContext **h, const char *url, int flags);
223
attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size);
224
attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size);
225
attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size);
226
attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence);
227
attribute_deprecated int url_close(URLContext *h);
228
attribute_deprecated int64_t url_filesize(URLContext *h);
229
attribute_deprecated int url_get_file_handle(URLContext *h);
230
attribute_deprecated int url_get_max_packet_size(URLContext *h);
231
attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
232
attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
233
attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
234
int64_t timestamp, int flags);
235
attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
237
* If protocol is NULL, returns the first registered protocol,
238
* if protocol is non-NULL, returns the next registered protocol after protocol,
239
* or NULL if protocol is the last one.
241
attribute_deprecated URLProtocol *av_protocol_next(URLProtocol *p);
243
* Register the URLProtocol protocol.
245
* @param size the size of the URLProtocol struct referenced
247
attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
253
typedef attribute_deprecated AVIOContext ByteIOContext;
255
attribute_deprecated int init_put_byte(AVIOContext *s,
256
unsigned char *buffer,
260
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
261
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
262
int64_t (*seek)(void *opaque, int64_t offset, int whence));
263
attribute_deprecated AVIOContext *av_alloc_put_byte(
264
unsigned char *buffer,
268
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
269
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
270
int64_t (*seek)(void *opaque, int64_t offset, int whence));
273
* @defgroup old_avio_funcs Old put_/get_*() functions
274
* The following functions are deprecated. Use the "avio_"-prefixed functions instead.
278
attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size);
279
attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
280
attribute_deprecated int get_byte(AVIOContext *s);
281
attribute_deprecated unsigned int get_le16(AVIOContext *s);
282
attribute_deprecated unsigned int get_le24(AVIOContext *s);
283
attribute_deprecated unsigned int get_le32(AVIOContext *s);
284
attribute_deprecated uint64_t get_le64(AVIOContext *s);
285
attribute_deprecated unsigned int get_be16(AVIOContext *s);
286
attribute_deprecated unsigned int get_be24(AVIOContext *s);
287
attribute_deprecated unsigned int get_be32(AVIOContext *s);
288
attribute_deprecated uint64_t get_be64(AVIOContext *s);
290
attribute_deprecated void put_byte(AVIOContext *s, int b);
291
attribute_deprecated void put_nbyte(AVIOContext *s, int b, int count);
292
attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size);
293
attribute_deprecated void put_le64(AVIOContext *s, uint64_t val);
294
attribute_deprecated void put_be64(AVIOContext *s, uint64_t val);
295
attribute_deprecated void put_le32(AVIOContext *s, unsigned int val);
296
attribute_deprecated void put_be32(AVIOContext *s, unsigned int val);
297
attribute_deprecated void put_le24(AVIOContext *s, unsigned int val);
298
attribute_deprecated void put_be24(AVIOContext *s, unsigned int val);
299
attribute_deprecated void put_le16(AVIOContext *s, unsigned int val);
300
attribute_deprecated void put_be16(AVIOContext *s, unsigned int val);
301
attribute_deprecated void put_tag(AVIOContext *s, const char *tag);
306
attribute_deprecated int av_url_read_fpause(AVIOContext *h, int pause);
307
attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_index,
308
int64_t timestamp, int flags);
311
* @defgroup old_url_f_funcs Old url_f* functions
312
* The following functions are deprecated, use the "avio_"-prefixed functions instead.
316
attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
317
attribute_deprecated int url_fclose(AVIOContext *s);
318
attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
319
attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
320
attribute_deprecated int64_t url_ftell(AVIOContext *s);
321
attribute_deprecated int64_t url_fsize(AVIOContext *s);
323
attribute_deprecated int url_fgetc(AVIOContext *s);
324
attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size);
325
attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
326
attribute_deprecated void put_flush_packet(AVIOContext *s);
327
attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
328
attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
329
attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
330
attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h);
336
* @deprecated use AVIOContext.eof_reached
338
attribute_deprecated int url_feof(AVIOContext *s);
339
attribute_deprecated int url_ferror(AVIOContext *s);
341
attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
342
attribute_deprecated int udp_get_local_port(URLContext *h);
344
attribute_deprecated void init_checksum(AVIOContext *s,
345
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
346
unsigned long checksum);
347
attribute_deprecated unsigned long get_checksum(AVIOContext *s);
348
attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
349
/** @note unlike fgets, the EOL character is not returned and a whole
350
line is parsed. return NULL if first char read was EOF */
351
attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size);
353
* @deprecated use avio_get_str instead
355
attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen);
357
* @deprecated Use AVIOContext.seekable field directly.
359
attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
363
attribute_deprecated URLContext *url_fileno(AVIOContext *s);
366
* @deprecated use AVIOContext.max_packet_size directly.
368
attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
370
attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
372
/** return the written or read size */
373
attribute_deprecated int url_close_buf(AVIOContext *s);
376
* Return a non-zero value if the resource indicated by url
377
* exists, 0 otherwise.
378
* @deprecated Use avio_check instead.
380
attribute_deprecated int url_exist(const char *url);
381
#endif // FF_API_OLD_AVIO
384
123
* Return AVIO_FLAG_* access flags corresponding to the access permissions
385
124
* of the resource in url, or a negative value corresponding to an