Statistics
| Branch: | Revision:

ffmpeg / libavformat / avio.h @ cdc6a87f

History | View | Annotate | Download (21.8 KB)

1
/*
2
 * copyright (c) 2001 Fabrice Bellard
3
 *
4
 * This file is part of Libav.
5
 *
6
 * Libav is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * Libav is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with Libav; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
 */
20
#ifndef AVFORMAT_AVIO_H
21
#define AVFORMAT_AVIO_H
22

    
23
/**
24
 * @file
25
 * unbuffered I/O operations
26
 *
27
 * @warning This file has to be considered an internal but installed
28
 * header, so it should not be directly included in your projects.
29
 */
30

    
31
#include <stdint.h>
32

    
33
#include "libavutil/common.h"
34
#include "libavutil/log.h"
35

    
36
#include "libavformat/version.h"
37

    
38
/* unbuffered I/O */
39

    
40
#if FF_API_OLD_AVIO
41
/**
42
 * URL Context.
43
 * New fields can be added to the end with minor version bumps.
44
 * Removal, reordering and changes to existing fields require a major
45
 * version bump.
46
 * sizeof(URLContext) must not be used outside libav*.
47
 * @deprecated This struct will be made private
48
 */
49
typedef struct URLContext {
50
#if FF_API_URL_CLASS
51
    const AVClass *av_class; ///< information for av_log(). Set by url_open().
52
#endif
53
    struct URLProtocol *prot;
54
    int flags;
55
    int is_streamed;  /**< true if streamed (no seek possible), default = false */
56
    int max_packet_size;  /**< if non zero, the stream is packetized with this max packet size */
57
    void *priv_data;
58
    char *filename; /**< specified URL */
59
    int is_connected;
60
} URLContext;
61

    
62
typedef struct URLPollEntry {
63
    URLContext *handle;
64
    int events;
65
    int revents;
66
} URLPollEntry;
67

    
68
/**
69
 * @defgroup open_modes URL open modes
70
 * The flags argument to url_open and cosins must be one of the following
71
 * constants, optionally ORed with other flags.
72
 * @{
73
 */
74
#define URL_RDONLY 0  /**< read-only */
75
#define URL_WRONLY 1  /**< write-only */
76
#define URL_RDWR   2  /**< read-write */
77
/**
78
 * @}
79
 */
80

    
81
/**
82
 * Use non-blocking mode.
83
 * If this flag is set, operations on the context will return
84
 * AVERROR(EAGAIN) if they can not be performed immediately.
85
 * If this flag is not set, operations on the context will never return
86
 * AVERROR(EAGAIN).
87
 * Note that this flag does not affect the opening/connecting of the
88
 * context. Connecting a protocol will always block if necessary (e.g. on
89
 * network protocols) but never hang (e.g. on busy devices).
90
 * Warning: non-blocking protocols is work-in-progress; this flag may be
91
 * silently ignored.
92
 */
93
#define URL_FLAG_NONBLOCK 4
94

    
95
typedef int URLInterruptCB(void);
96

    
97
/**
98
 * @defgroup old_url_funcs Old url_* functions
99
 * @deprecated use the buffered API based on AVIOContext instead
100
 * @{
101
 */
102
attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
103
                                            const char *url, int flags);
104
attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags);
105
attribute_deprecated int url_connect(URLContext *h);
106
attribute_deprecated int url_open(URLContext **h, const char *url, int flags);
107
attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size);
108
attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size);
109
attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size);
110
attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence);
111
attribute_deprecated int url_close(URLContext *h);
112
attribute_deprecated int64_t url_filesize(URLContext *h);
113
attribute_deprecated int url_get_file_handle(URLContext *h);
114
attribute_deprecated int url_get_max_packet_size(URLContext *h);
115
attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
116
attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
117
attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
118
                                              int64_t timestamp, int flags);
119
attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
120
#endif
121

    
122
/**
123
 * Return a non-zero value if the resource indicated by url
124
 * exists, 0 otherwise.
125
 */
126
int url_exist(const char *url);
127

    
128
/**
129
 * The callback is called in blocking functions to test regulary if
130
 * asynchronous interruption is needed. AVERROR_EXIT is returned
131
 * in this case by the interrupted function. 'NULL' means no interrupt
132
 * callback is given.
133
 */
134
void avio_set_interrupt_cb(int (*interrupt_cb)(void));
135

    
136
#if FF_API_OLD_AVIO
137
/* not implemented */
138
attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
139

    
140

    
141
#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */
142

    
143
/**
144
 * @deprecated This struct is to be made private. Use the higher-level
145
 *             AVIOContext-based API instead.
146
 */
147
typedef struct URLProtocol {
148
    const char *name;
149
    int (*url_open)(URLContext *h, const char *url, int flags);
150
    int (*url_read)(URLContext *h, unsigned char *buf, int size);
151
    int (*url_write)(URLContext *h, const unsigned char *buf, int size);
152
    int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
153
    int (*url_close)(URLContext *h);
154
    struct URLProtocol *next;
155
    int (*url_read_pause)(URLContext *h, int pause);
156
    int64_t (*url_read_seek)(URLContext *h, int stream_index,
157
                             int64_t timestamp, int flags);
158
    int (*url_get_file_handle)(URLContext *h);
159
    int priv_data_size;
160
    const AVClass *priv_data_class;
161
    int flags;
162
} URLProtocol;
163
#endif
164

    
165
#if FF_API_REGISTER_PROTOCOL
166
extern URLProtocol *first_protocol;
167
#endif
168

    
169
#if FF_API_OLD_AVIO
170
extern URLInterruptCB *url_interrupt_cb;
171
#endif
172

    
173
#if FF_API_OLD_AVIO
174
/**
175
 * If protocol is NULL, returns the first registered protocol,
176
 * if protocol is non-NULL, returns the next registered protocol after protocol,
177
 * or NULL if protocol is the last one.
178
 */
179
attribute_deprecated URLProtocol *av_protocol_next(URLProtocol *p);
180
#endif
181

    
182
#if FF_API_REGISTER_PROTOCOL
183
/**
184
 * @deprecated Use av_register_protocol() instead.
185
 */
186
attribute_deprecated int register_protocol(URLProtocol *protocol);
187

    
188
/**
189
 * @deprecated Use av_register_protocol2() instead.
190
 */
191
attribute_deprecated int av_register_protocol(URLProtocol *protocol);
192
#endif
193

    
194
#if FF_API_OLD_AVIO
195
/**
196
 * Register the URLProtocol protocol.
197
 *
198
 * @param size the size of the URLProtocol struct referenced
199
 */
200
attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
201
#endif
202

    
203
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
204

    
205
/**
206
 * @}
207
 */
208

    
209
/**
210
 * Bytestream IO Context.
211
 * New fields can be added to the end with minor version bumps.
212
 * Removal, reordering and changes to existing fields require a major
213
 * version bump.
214
 * sizeof(AVIOContext) must not be used outside libav*.
215
 */
216
typedef struct {
217
    unsigned char *buffer;
218
    int buffer_size;
219
    unsigned char *buf_ptr, *buf_end;
220
    void *opaque;
221
    int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
222
    int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
223
    int64_t (*seek)(void *opaque, int64_t offset, int whence);
224
    int64_t pos; /**< position in the file of the current buffer */
225
    int must_flush; /**< true if the next seek should flush */
226
    int eof_reached; /**< true if eof reached */
227
    int write_flag;  /**< true if open for writing */
228
#if FF_API_OLD_AVIO
229
    attribute_deprecated int is_streamed;
230
#endif
231
    int max_packet_size;
232
    unsigned long checksum;
233
    unsigned char *checksum_ptr;
234
    unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
235
    int error;         ///< contains the error code or 0 if no error happened
236
    int (*read_pause)(void *opaque, int pause);
237
    int64_t (*read_seek)(void *opaque, int stream_index,
238
                         int64_t timestamp, int flags);
239
    /**
240
     * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
241
     */
242
    int seekable;
243
} AVIOContext;
244

    
245
#if FF_API_OLD_AVIO
246
typedef attribute_deprecated AVIOContext ByteIOContext;
247

    
248
attribute_deprecated int init_put_byte(AVIOContext *s,
249
                  unsigned char *buffer,
250
                  int buffer_size,
251
                  int write_flag,
252
                  void *opaque,
253
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
254
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
255
                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
256
attribute_deprecated AVIOContext *av_alloc_put_byte(
257
                  unsigned char *buffer,
258
                  int buffer_size,
259
                  int write_flag,
260
                  void *opaque,
261
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
262
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
263
                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
264

    
265
/**
266
 * @defgroup old_avio_funcs Old put_/get_*() functions
267
 * @deprecated use the avio_ -prefixed functions instead.
268
 * @{
269
 */
270
attribute_deprecated int          get_buffer(AVIOContext *s, unsigned char *buf, int size);
271
attribute_deprecated int          get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
272
attribute_deprecated int          get_byte(AVIOContext *s);
273
attribute_deprecated unsigned int get_le16(AVIOContext *s);
274
attribute_deprecated unsigned int get_le24(AVIOContext *s);
275
attribute_deprecated unsigned int get_le32(AVIOContext *s);
276
attribute_deprecated uint64_t     get_le64(AVIOContext *s);
277
attribute_deprecated unsigned int get_be16(AVIOContext *s);
278
attribute_deprecated unsigned int get_be24(AVIOContext *s);
279
attribute_deprecated unsigned int get_be32(AVIOContext *s);
280
attribute_deprecated uint64_t     get_be64(AVIOContext *s);
281

    
282
attribute_deprecated void         put_byte(AVIOContext *s, int b);
283
attribute_deprecated void         put_nbyte(AVIOContext *s, int b, int count);
284
attribute_deprecated void         put_buffer(AVIOContext *s, const unsigned char *buf, int size);
285
attribute_deprecated void         put_le64(AVIOContext *s, uint64_t val);
286
attribute_deprecated void         put_be64(AVIOContext *s, uint64_t val);
287
attribute_deprecated void         put_le32(AVIOContext *s, unsigned int val);
288
attribute_deprecated void         put_be32(AVIOContext *s, unsigned int val);
289
attribute_deprecated void         put_le24(AVIOContext *s, unsigned int val);
290
attribute_deprecated void         put_be24(AVIOContext *s, unsigned int val);
291
attribute_deprecated void         put_le16(AVIOContext *s, unsigned int val);
292
attribute_deprecated void         put_be16(AVIOContext *s, unsigned int val);
293
attribute_deprecated void         put_tag(AVIOContext *s, const char *tag);
294
/**
295
 * @}
296
 */
297

    
298
attribute_deprecated int     av_url_read_fpause(AVIOContext *h,    int pause);
299
attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h,    int stream_index,
300
                                                int64_t timestamp, int flags);
301

    
302
/**
303
 * @defgroup old_url_f_funcs Old url_f* functions
304
 * @deprecated use the avio_ -prefixed functions instead.
305
 * @{
306
 */
307
attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
308
attribute_deprecated int url_fclose(AVIOContext *s);
309
attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
310
attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
311
attribute_deprecated int64_t url_ftell(AVIOContext *s);
312
attribute_deprecated int64_t url_fsize(AVIOContext *s);
313
#define URL_EOF (-1)
314
attribute_deprecated int url_fgetc(AVIOContext *s);
315
attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size);
316
#ifdef __GNUC__
317
attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
318
#else
319
attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...);
320
#endif
321
attribute_deprecated void put_flush_packet(AVIOContext *s);
322
attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
323
attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
324
attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
325
attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h);
326
/**
327
 * @}
328
 */
329

    
330
/**
331
 * @deprecated use AVIOContext.eof_reached
332
 */
333
attribute_deprecated int url_feof(AVIOContext *s);
334
attribute_deprecated int url_ferror(AVIOContext *s);
335

    
336
attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
337
attribute_deprecated int udp_get_local_port(URLContext *h);
338

    
339
attribute_deprecated void init_checksum(AVIOContext *s,
340
                   unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
341
                   unsigned long checksum);
342
attribute_deprecated unsigned long get_checksum(AVIOContext *s);
343
#endif
344

    
345
/**
346
 * Allocate and initialize an AVIOContext for buffered I/O. It must be later
347
 * freed with av_free().
348
 *
349
 * @param buffer Memory block for input/output operations via AVIOContext.
350
 * @param buffer_size The buffer size is very important for performance.
351
 *        For protocols with fixed blocksize it should be set to this blocksize.
352
 *        For others a typical size is a cache page, e.g. 4kb.
353
 * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
354
 * @param opaque An opaque pointer to user-specific data.
355
 * @param read_packet  A function for refilling the buffer, may be NULL.
356
 * @param write_packet A function for writing the buffer contents, may be NULL.
357
 * @param seek A function for seeking to specified byte position, may be NULL.
358
 *
359
 * @return Allocated AVIOContext or NULL on failure.
360
 */
361
AVIOContext *avio_alloc_context(
362
                  unsigned char *buffer,
363
                  int buffer_size,
364
                  int write_flag,
365
                  void *opaque,
366
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
367
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
368
                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
369

    
370
void avio_w8(AVIOContext *s, int b);
371
void avio_write(AVIOContext *s, const unsigned char *buf, int size);
372
void avio_wl64(AVIOContext *s, uint64_t val);
373
void avio_wb64(AVIOContext *s, uint64_t val);
374
void avio_wl32(AVIOContext *s, unsigned int val);
375
void avio_wb32(AVIOContext *s, unsigned int val);
376
void avio_wl24(AVIOContext *s, unsigned int val);
377
void avio_wb24(AVIOContext *s, unsigned int val);
378
void avio_wl16(AVIOContext *s, unsigned int val);
379
void avio_wb16(AVIOContext *s, unsigned int val);
380

    
381
#if FF_API_OLD_AVIO
382
attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
383
#endif
384

    
385
/**
386
 * Write a NULL-terminated string.
387
 * @return number of bytes written.
388
 */
389
int avio_put_str(AVIOContext *s, const char *str);
390

    
391
/**
392
 * Convert an UTF-8 string to UTF-16LE and write it.
393
 * @return number of bytes written.
394
 */
395
int avio_put_str16le(AVIOContext *s, const char *str);
396

    
397
/**
398
 * Passing this as the "whence" parameter to a seek function causes it to
399
 * return the filesize without seeking anywhere. Supporting this is optional.
400
 * If it is not supported then the seek function will return <0.
401
 */
402
#define AVSEEK_SIZE 0x10000
403

    
404
/**
405
 * Oring this flag as into the "whence" parameter to a seek function causes it to
406
 * seek by any means (like reopening and linear reading) or other normally unreasonble
407
 * means that can be extreemly slow.
408
 * This may be ignored by the seek code.
409
 */
410
#define AVSEEK_FORCE 0x20000
411

    
412
/**
413
 * fseek() equivalent for AVIOContext.
414
 * @return new position or AVERROR.
415
 */
416
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
417

    
418
/**
419
 * Skip given number of bytes forward
420
 * @return new position or AVERROR.
421
 */
422
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
423
{
424
    return avio_seek(s, offset, SEEK_CUR);
425
}
426

    
427
/**
428
 * ftell() equivalent for AVIOContext.
429
 * @return position or AVERROR.
430
 */
431
static av_always_inline int64_t avio_tell(AVIOContext *s)
432
{
433
    return avio_seek(s, 0, SEEK_CUR);
434
}
435

    
436
/**
437
 * Get the filesize.
438
 * @return filesize or AVERROR
439
 */
440
int64_t avio_size(AVIOContext *s);
441

    
442
/** @warning currently size is limited */
443
#ifdef __GNUC__
444
int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
445
#else
446
int avio_printf(AVIOContext *s, const char *fmt, ...);
447
#endif
448

    
449
#if FF_API_OLD_AVIO
450
/** @note unlike fgets, the EOL character is not returned and a whole
451
    line is parsed. return NULL if first char read was EOF */
452
attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size);
453
#endif
454

    
455
void avio_flush(AVIOContext *s);
456

    
457

    
458
/**
459
 * Read size bytes from AVIOContext into buf.
460
 * @return number of bytes read or AVERROR
461
 */
462
int avio_read(AVIOContext *s, unsigned char *buf, int size);
463

    
464
/** @note return 0 if EOF, so you cannot use it if EOF handling is
465
    necessary */
466
int          avio_r8  (AVIOContext *s);
467
unsigned int avio_rl16(AVIOContext *s);
468
unsigned int avio_rl24(AVIOContext *s);
469
unsigned int avio_rl32(AVIOContext *s);
470
uint64_t     avio_rl64(AVIOContext *s);
471

    
472
/**
473
 * Read a string from pb into buf. The reading will terminate when either
474
 * a NULL character was encountered, maxlen bytes have been read, or nothing
475
 * more can be read from pb. The result is guaranteed to be NULL-terminated, it
476
 * will be truncated if buf is too small.
477
 * Note that the string is not interpreted or validated in any way, it
478
 * might get truncated in the middle of a sequence for multi-byte encodings.
479
 *
480
 * @return number of bytes read (is always <= maxlen).
481
 * If reading ends on EOF or error, the return value will be one more than
482
 * bytes actually read.
483
 */
484
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
485

    
486
/**
487
 * Read a UTF-16 string from pb and convert it to UTF-8.
488
 * The reading will terminate when either a null or invalid character was
489
 * encountered or maxlen bytes have been read.
490
 * @return number of bytes read (is always <= maxlen)
491
 */
492
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
493
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
494

    
495
#if FF_API_OLD_AVIO
496
/**
497
 * @deprecated use avio_get_str instead
498
 */
499
attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen);
500
#endif
501
unsigned int avio_rb16(AVIOContext *s);
502
unsigned int avio_rb24(AVIOContext *s);
503
unsigned int avio_rb32(AVIOContext *s);
504
uint64_t     avio_rb64(AVIOContext *s);
505

    
506
#if FF_API_OLD_AVIO
507
/**
508
 * @deprecated Use AVIOContext.seekable field directly.
509
 */
510
attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
511
{
512
    return !s->seekable;
513
}
514
#endif
515

    
516
#if FF_API_URL_RESETBUF
517
/** Reset the buffer for reading or writing.
518
 * @note Will drop any data currently in the buffer without transmitting it.
519
 * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
520
 *        to set up the buffer for writing. */
521
int url_resetbuf(AVIOContext *s, int flags);
522
#endif
523

    
524
/**
525
 * @defgroup open_modes URL open modes
526
 * The flags argument to avio_open must be one of the following
527
 * constants, optionally ORed with other flags.
528
 * @{
529
 */
530
#define AVIO_RDONLY 0  /**< read-only */
531
#define AVIO_WRONLY 1  /**< write-only */
532
#define AVIO_RDWR   2  /**< read-write */
533
/**
534
 * @}
535
 */
536

    
537
/**
538
 * Use non-blocking mode.
539
 * If this flag is set, operations on the context will return
540
 * AVERROR(EAGAIN) if they can not be performed immediately.
541
 * If this flag is not set, operations on the context will never return
542
 * AVERROR(EAGAIN).
543
 * Note that this flag does not affect the opening/connecting of the
544
 * context. Connecting a protocol will always block if necessary (e.g. on
545
 * network protocols) but never hang (e.g. on busy devices).
546
 * Warning: non-blocking protocols is work-in-progress; this flag may be
547
 * silently ignored.
548
 */
549
#define AVIO_FLAG_NONBLOCK 4
550

    
551
/**
552
 * Create and initialize a AVIOContext for accessing the
553
 * resource indicated by url.
554
 * @note When the resource indicated by url has been opened in
555
 * read+write mode, the AVIOContext can be used only for writing.
556
 *
557
 * @param s Used to return the pointer to the created AVIOContext.
558
 * In case of failure the pointed to value is set to NULL.
559
 * @param flags flags which control how the resource indicated by url
560
 * is to be opened
561
 * @return 0 in case of success, a negative value corresponding to an
562
 * AVERROR code in case of failure
563
 */
564
int avio_open(AVIOContext **s, const char *url, int flags);
565

    
566
int avio_close(AVIOContext *s);
567

    
568
#if FF_API_OLD_AVIO
569
attribute_deprecated URLContext *url_fileno(AVIOContext *s);
570

    
571
/**
572
 * @deprecated use AVIOContext.max_packet_size directly.
573
 */
574
attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
575

    
576
attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
577

    
578
/** return the written or read size */
579
attribute_deprecated int url_close_buf(AVIOContext *s);
580
#endif
581

    
582
/**
583
 * Open a write only memory stream.
584
 *
585
 * @param s new IO context
586
 * @return zero if no error.
587
 */
588
int avio_open_dyn_buf(AVIOContext **s);
589

    
590
/**
591
 * Return the written size and a pointer to the buffer. The buffer
592
 * must be freed with av_free().
593
 * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
594
 *
595
 * @param s IO context
596
 * @param pbuffer pointer to a byte buffer
597
 * @return the length of the byte buffer
598
 */
599
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
600

    
601
#if FF_API_UDP_GET_FILE
602
int udp_get_file_handle(URLContext *h);
603
#endif
604

    
605
/**
606
 * Iterate through names of available protocols.
607
 *
608
 * @param opaque A private pointer representing current protocol.
609
 *        It must be a pointer to NULL on first iteration and will
610
 *        be updated by successive calls to avio_enum_protocols.
611
 * @param output If set to 1, iterate over output protocols,
612
 *               otherwise over input protocols.
613
 *
614
 * @return A static string containing the name of current protocol or NULL
615
 */
616
const char *avio_enum_protocols(void **opaque, int output);
617

    
618
#endif /* AVFORMAT_AVIO_H */