Statistics
| Branch: | Revision:

ffmpeg / libavformat / avio.h @ 893816ba

History | View | Annotate | Download (21.6 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
 * Buffered I/O operations
26
 */
27

    
28
#include <stdint.h>
29

    
30
#include "libavutil/common.h"
31
#include "libavutil/log.h"
32

    
33
#include "libavformat/version.h"
34

    
35

    
36
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
37

    
38
/**
39
 * Bytestream IO Context.
40
 * New fields can be added to the end with minor version bumps.
41
 * Removal, reordering and changes to existing fields require a major
42
 * version bump.
43
 * sizeof(AVIOContext) must not be used outside libav*.
44
 */
45
typedef struct {
46
    unsigned char *buffer;
47
    int buffer_size;
48
    unsigned char *buf_ptr, *buf_end;
49
    void *opaque;
50
    int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
51
    int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
52
    int64_t (*seek)(void *opaque, int64_t offset, int whence);
53
    int64_t pos;            /**< position in the file of the current buffer */
54
    int must_flush;         /**< true if the next seek should flush */
55
    int eof_reached;        /**< true if eof reached */
56
    int write_flag;         /**< true if open for writing */
57
#if FF_API_OLD_AVIO
58
    attribute_deprecated int is_streamed;
59
#endif
60
    int max_packet_size;
61
    unsigned long checksum;
62
    unsigned char *checksum_ptr;
63
    unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
64
    int error;              /**< contains the error code or 0 if no error happened */
65
    int (*read_pause)(void *opaque, int pause);
66
    int64_t (*read_seek)(void *opaque, int stream_index,
67
                         int64_t timestamp, int flags);
68
    /**
69
     * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
70
     */
71
    int seekable;
72
} AVIOContext;
73

    
74
/* unbuffered I/O */
75

    
76
#if FF_API_OLD_AVIO
77
/**
78
 * URL Context.
79
 * New fields can be added to the end with minor version bumps.
80
 * Removal, reordering and changes to existing fields require a major
81
 * version bump.
82
 * sizeof(URLContext) must not be used outside libav*.
83
 * @deprecated This struct will be made private
84
 */
85
typedef struct URLContext {
86
#if FF_API_URL_CLASS
87
    const AVClass *av_class; ///< information for av_log(). Set by url_open().
88
#endif
89
    struct URLProtocol *prot;
90
    int flags;
91
    int is_streamed;  /**< true if streamed (no seek possible), default = false */
92
    int max_packet_size;  /**< if non zero, the stream is packetized with this max packet size */
93
    void *priv_data;
94
    char *filename; /**< specified URL */
95
    int is_connected;
96
} URLContext;
97

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

    
100
/**
101
 * @deprecated This struct is to be made private. Use the higher-level
102
 *             AVIOContext-based API instead.
103
 */
104
typedef struct URLProtocol {
105
    const char *name;
106
    int (*url_open)(URLContext *h, const char *url, int flags);
107
    int (*url_read)(URLContext *h, unsigned char *buf, int size);
108
    int (*url_write)(URLContext *h, const unsigned char *buf, int size);
109
    int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
110
    int (*url_close)(URLContext *h);
111
    struct URLProtocol *next;
112
    int (*url_read_pause)(URLContext *h, int pause);
113
    int64_t (*url_read_seek)(URLContext *h, int stream_index,
114
                             int64_t timestamp, int flags);
115
    int (*url_get_file_handle)(URLContext *h);
116
    int priv_data_size;
117
    const AVClass *priv_data_class;
118
    int flags;
119
} URLProtocol;
120

    
121
typedef struct URLPollEntry {
122
    URLContext *handle;
123
    int events;
124
    int revents;
125
} URLPollEntry;
126

    
127
/* not implemented */
128
attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
129

    
130
/**
131
 * @defgroup open_modes URL open modes
132
 * The flags argument to url_open and cosins must be one of the following
133
 * constants, optionally ORed with other flags.
134
 * @{
135
 */
136
#define URL_RDONLY 0  /**< read-only */
137
#define URL_WRONLY 1  /**< write-only */
138
#define URL_RDWR   2  /**< read-write */
139
/**
140
 * @}
141
 */
142

    
143
/**
144
 * Use non-blocking mode.
145
 * If this flag is set, operations on the context will return
146
 * AVERROR(EAGAIN) if they can not be performed immediately.
147
 * If this flag is not set, operations on the context will never return
148
 * AVERROR(EAGAIN).
149
 * Note that this flag does not affect the opening/connecting of the
150
 * context. Connecting a protocol will always block if necessary (e.g. on
151
 * network protocols) but never hang (e.g. on busy devices).
152
 * Warning: non-blocking protocols is work-in-progress; this flag may be
153
 * silently ignored.
154
 */
155
#define URL_FLAG_NONBLOCK 4
156

    
157
typedef int URLInterruptCB(void);
158
extern URLInterruptCB *url_interrupt_cb;
159

    
160
/**
161
 * @defgroup old_url_funcs Old url_* functions
162
 * @deprecated use the buffered API based on AVIOContext instead
163
 * @{
164
 */
165
attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
166
                                            const char *url, int flags);
167
attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags);
168
attribute_deprecated int url_connect(URLContext *h);
169
attribute_deprecated int url_open(URLContext **h, const char *url, int flags);
170
attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size);
171
attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size);
172
attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size);
173
attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence);
174
attribute_deprecated int url_close(URLContext *h);
175
attribute_deprecated int64_t url_filesize(URLContext *h);
176
attribute_deprecated int url_get_file_handle(URLContext *h);
177
attribute_deprecated int url_get_max_packet_size(URLContext *h);
178
attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size);
179
attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
180
attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
181
                                              int64_t timestamp, int flags);
182
attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void));
183
/**
184
 * If protocol is NULL, returns the first registered protocol,
185
 * if protocol is non-NULL, returns the next registered protocol after protocol,
186
 * or NULL if protocol is the last one.
187
 */
188
attribute_deprecated URLProtocol *av_protocol_next(URLProtocol *p);
189
/**
190
 * Register the URLProtocol protocol.
191
 *
192
 * @param size the size of the URLProtocol struct referenced
193
 */
194
attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
195
/**
196
 * @}
197
 */
198

    
199

    
200
typedef attribute_deprecated AVIOContext ByteIOContext;
201

    
202
attribute_deprecated int init_put_byte(AVIOContext *s,
203
                  unsigned char *buffer,
204
                  int buffer_size,
205
                  int write_flag,
206
                  void *opaque,
207
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
208
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
209
                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
210
attribute_deprecated AVIOContext *av_alloc_put_byte(
211
                  unsigned char *buffer,
212
                  int buffer_size,
213
                  int write_flag,
214
                  void *opaque,
215
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
216
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
217
                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
218

    
219
/**
220
 * @defgroup old_avio_funcs Old put_/get_*() functions
221
 * @deprecated use the avio_ -prefixed functions instead.
222
 * @{
223
 */
224
attribute_deprecated int          get_buffer(AVIOContext *s, unsigned char *buf, int size);
225
attribute_deprecated int          get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
226
attribute_deprecated int          get_byte(AVIOContext *s);
227
attribute_deprecated unsigned int get_le16(AVIOContext *s);
228
attribute_deprecated unsigned int get_le24(AVIOContext *s);
229
attribute_deprecated unsigned int get_le32(AVIOContext *s);
230
attribute_deprecated uint64_t     get_le64(AVIOContext *s);
231
attribute_deprecated unsigned int get_be16(AVIOContext *s);
232
attribute_deprecated unsigned int get_be24(AVIOContext *s);
233
attribute_deprecated unsigned int get_be32(AVIOContext *s);
234
attribute_deprecated uint64_t     get_be64(AVIOContext *s);
235

    
236
attribute_deprecated void         put_byte(AVIOContext *s, int b);
237
attribute_deprecated void         put_nbyte(AVIOContext *s, int b, int count);
238
attribute_deprecated void         put_buffer(AVIOContext *s, const unsigned char *buf, int size);
239
attribute_deprecated void         put_le64(AVIOContext *s, uint64_t val);
240
attribute_deprecated void         put_be64(AVIOContext *s, uint64_t val);
241
attribute_deprecated void         put_le32(AVIOContext *s, unsigned int val);
242
attribute_deprecated void         put_be32(AVIOContext *s, unsigned int val);
243
attribute_deprecated void         put_le24(AVIOContext *s, unsigned int val);
244
attribute_deprecated void         put_be24(AVIOContext *s, unsigned int val);
245
attribute_deprecated void         put_le16(AVIOContext *s, unsigned int val);
246
attribute_deprecated void         put_be16(AVIOContext *s, unsigned int val);
247
attribute_deprecated void         put_tag(AVIOContext *s, const char *tag);
248
/**
249
 * @}
250
 */
251

    
252
attribute_deprecated int     av_url_read_fpause(AVIOContext *h,    int pause);
253
attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h,    int stream_index,
254
                                                int64_t timestamp, int flags);
255

    
256
/**
257
 * @defgroup old_url_f_funcs Old url_f* functions
258
 * @deprecated use the avio_ -prefixed functions instead.
259
 * @{
260
 */
261
attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
262
attribute_deprecated int url_fclose(AVIOContext *s);
263
attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
264
attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
265
attribute_deprecated int64_t url_ftell(AVIOContext *s);
266
attribute_deprecated int64_t url_fsize(AVIOContext *s);
267
#define URL_EOF (-1)
268
attribute_deprecated int url_fgetc(AVIOContext *s);
269
attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size);
270
#ifdef __GNUC__
271
attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
272
#else
273
attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...);
274
#endif
275
attribute_deprecated void put_flush_packet(AVIOContext *s);
276
attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
277
attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
278
attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
279
attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h);
280
/**
281
 * @}
282
 */
283

    
284
/**
285
 * @deprecated use AVIOContext.eof_reached
286
 */
287
attribute_deprecated int url_feof(AVIOContext *s);
288
attribute_deprecated int url_ferror(AVIOContext *s);
289

    
290
attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
291
attribute_deprecated int udp_get_local_port(URLContext *h);
292

    
293
attribute_deprecated void init_checksum(AVIOContext *s,
294
                   unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
295
                   unsigned long checksum);
296
attribute_deprecated unsigned long get_checksum(AVIOContext *s);
297
attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
298
/** @note unlike fgets, the EOL character is not returned and a whole
299
    line is parsed. return NULL if first char read was EOF */
300
attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size);
301
/**
302
 * @deprecated use avio_get_str instead
303
 */
304
attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen);
305
/**
306
 * @deprecated Use AVIOContext.seekable field directly.
307
 */
308
attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
309
{
310
    return !s->seekable;
311
}
312
attribute_deprecated URLContext *url_fileno(AVIOContext *s);
313

    
314
/**
315
 * @deprecated use AVIOContext.max_packet_size directly.
316
 */
317
attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
318

    
319
attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
320

    
321
/** return the written or read size */
322
attribute_deprecated int url_close_buf(AVIOContext *s);
323
#endif // FF_API_OLD_AVIO
324

    
325
/**
326
 * Return a non-zero value if the resource indicated by url
327
 * exists, 0 otherwise.
328
 */
329
int url_exist(const char *url);
330

    
331
/**
332
 * The callback is called in blocking functions to test regulary if
333
 * asynchronous interruption is needed. AVERROR_EXIT is returned
334
 * in this case by the interrupted function. 'NULL' means no interrupt
335
 * callback is given.
336
 */
337
void avio_set_interrupt_cb(int (*interrupt_cb)(void));
338

    
339
#if FF_API_REGISTER_PROTOCOL
340
extern URLProtocol *first_protocol;
341
#endif
342

    
343
#if FF_API_REGISTER_PROTOCOL
344
/**
345
 * @deprecated Use av_register_protocol() instead.
346
 */
347
attribute_deprecated int register_protocol(URLProtocol *protocol);
348

    
349
/**
350
 * @deprecated Use av_register_protocol2() instead.
351
 */
352
attribute_deprecated int av_register_protocol(URLProtocol *protocol);
353
#endif
354

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

    
380
void avio_w8(AVIOContext *s, int b);
381
void avio_write(AVIOContext *s, const unsigned char *buf, int size);
382
void avio_wl64(AVIOContext *s, uint64_t val);
383
void avio_wb64(AVIOContext *s, uint64_t val);
384
void avio_wl32(AVIOContext *s, unsigned int val);
385
void avio_wb32(AVIOContext *s, unsigned int val);
386
void avio_wl24(AVIOContext *s, unsigned int val);
387
void avio_wb24(AVIOContext *s, unsigned int val);
388
void avio_wl16(AVIOContext *s, unsigned int val);
389
void avio_wb16(AVIOContext *s, unsigned int val);
390

    
391
/**
392
 * Write a NULL-terminated string.
393
 * @return number of bytes written.
394
 */
395
int avio_put_str(AVIOContext *s, const char *str);
396

    
397
/**
398
 * Convert an UTF-8 string to UTF-16LE and write it.
399
 * @return number of bytes written.
400
 */
401
int avio_put_str16le(AVIOContext *s, const char *str);
402

    
403
/**
404
 * Passing this as the "whence" parameter to a seek function causes it to
405
 * return the filesize without seeking anywhere. Supporting this is optional.
406
 * If it is not supported then the seek function will return <0.
407
 */
408
#define AVSEEK_SIZE 0x10000
409

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

    
418
/**
419
 * fseek() equivalent for AVIOContext.
420
 * @return new position or AVERROR.
421
 */
422
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
423

    
424
/**
425
 * Skip given number of bytes forward
426
 * @return new position or AVERROR.
427
 */
428
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
429
{
430
    return avio_seek(s, offset, SEEK_CUR);
431
}
432

    
433
/**
434
 * ftell() equivalent for AVIOContext.
435
 * @return position or AVERROR.
436
 */
437
static av_always_inline int64_t avio_tell(AVIOContext *s)
438
{
439
    return avio_seek(s, 0, SEEK_CUR);
440
}
441

    
442
/**
443
 * Get the filesize.
444
 * @return filesize or AVERROR
445
 */
446
int64_t avio_size(AVIOContext *s);
447

    
448
/** @warning currently size is limited */
449
#ifdef __GNUC__
450
int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
451
#else
452
int avio_printf(AVIOContext *s, const char *fmt, ...);
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
/**
465
 * @defgroup avio_read Functions for reading from AVIOContext.
466
 * @{
467
 *
468
 * @note return 0 if EOF, so you cannot use it if EOF handling is
469
 *       necessary
470
 */
471
int          avio_r8  (AVIOContext *s);
472
unsigned int avio_rl16(AVIOContext *s);
473
unsigned int avio_rl24(AVIOContext *s);
474
unsigned int avio_rl32(AVIOContext *s);
475
uint64_t     avio_rl64(AVIOContext *s);
476
unsigned int avio_rb16(AVIOContext *s);
477
unsigned int avio_rb24(AVIOContext *s);
478
unsigned int avio_rb32(AVIOContext *s);
479
uint64_t     avio_rb64(AVIOContext *s);
480
/**
481
 * @}
482
 */
483

    
484
/**
485
 * Read a string from pb into buf. The reading will terminate when either
486
 * a NULL character was encountered, maxlen bytes have been read, or nothing
487
 * more can be read from pb. The result is guaranteed to be NULL-terminated, it
488
 * will be truncated if buf is too small.
489
 * Note that the string is not interpreted or validated in any way, it
490
 * might get truncated in the middle of a sequence for multi-byte encodings.
491
 *
492
 * @return number of bytes read (is always <= maxlen).
493
 * If reading ends on EOF or error, the return value will be one more than
494
 * bytes actually read.
495
 */
496
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
497

    
498
/**
499
 * Read a UTF-16 string from pb and convert it to UTF-8.
500
 * The reading will terminate when either a null or invalid character was
501
 * encountered or maxlen bytes have been read.
502
 * @return number of bytes read (is always <= maxlen)
503
 */
504
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
505
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
506

    
507

    
508
#if FF_API_URL_RESETBUF
509
/** Reset the buffer for reading or writing.
510
 * @note Will drop any data currently in the buffer without transmitting it.
511
 * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
512
 *        to set up the buffer for writing. */
513
int url_resetbuf(AVIOContext *s, int flags);
514
#endif
515

    
516
/**
517
 * @defgroup open_modes URL open modes
518
 * The flags argument to avio_open must be one of the following
519
 * constants, optionally ORed with other flags.
520
 * @{
521
 */
522
#define AVIO_RDONLY 0  /**< read-only */
523
#define AVIO_WRONLY 1  /**< write-only */
524
#define AVIO_RDWR   2  /**< read-write */
525
/**
526
 * @}
527
 */
528

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

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

    
558
int avio_close(AVIOContext *s);
559

    
560
/**
561
 * Open a write only memory stream.
562
 *
563
 * @param s new IO context
564
 * @return zero if no error.
565
 */
566
int avio_open_dyn_buf(AVIOContext **s);
567

    
568
/**
569
 * Return the written size and a pointer to the buffer. The buffer
570
 * must be freed with av_free().
571
 * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
572
 *
573
 * @param s IO context
574
 * @param pbuffer pointer to a byte buffer
575
 * @return the length of the byte buffer
576
 */
577
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
578

    
579
#if FF_API_UDP_GET_FILE
580
int udp_get_file_handle(URLContext *h);
581
#endif
582

    
583
/**
584
 * Iterate through names of available protocols.
585
 *
586
 * @param opaque A private pointer representing current protocol.
587
 *        It must be a pointer to NULL on first iteration and will
588
 *        be updated by successive calls to avio_enum_protocols.
589
 * @param output If set to 1, iterate over output protocols,
590
 *               otherwise over input protocols.
591
 *
592
 * @return A static string containing the name of current protocol or NULL
593
 */
594
const char *avio_enum_protocols(void **opaque, int output);
595

    
596
#endif /* AVFORMAT_AVIO_H */