Statistics
| Branch: | Revision:

ffmpeg / libavformat / avio.h @ 026e1757

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

    
60
#if FF_API_OLD_AVIO
61
typedef struct URLPollEntry {
62
    URLContext *handle;
63
    int events;
64
    int revents;
65
} URLPollEntry;
66

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

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

    
94
typedef int URLInterruptCB(void);
95

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

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

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

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

    
139

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

    
143
typedef struct URLProtocol {
144
    const char *name;
145
    int (*url_open)(URLContext *h, const char *url, int flags);
146
    int (*url_read)(URLContext *h, unsigned char *buf, int size);
147
    int (*url_write)(URLContext *h, const unsigned char *buf, int size);
148
    int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
149
    int (*url_close)(URLContext *h);
150
    struct URLProtocol *next;
151
    int (*url_read_pause)(URLContext *h, int pause);
152
    int64_t (*url_read_seek)(URLContext *h, int stream_index,
153
                             int64_t timestamp, int flags);
154
    int (*url_get_file_handle)(URLContext *h);
155
    int priv_data_size;
156
    const AVClass *priv_data_class;
157
    int flags;
158
} URLProtocol;
159

    
160
#if FF_API_REGISTER_PROTOCOL
161
extern URLProtocol *first_protocol;
162
#endif
163

    
164
#if FF_API_OLD_AVIO
165
extern URLInterruptCB *url_interrupt_cb;
166
#endif
167

    
168
/**
169
 * If protocol is NULL, returns the first registered protocol,
170
 * if protocol is non-NULL, returns the next registered protocol after protocol,
171
 * or NULL if protocol is the last one.
172
 */
173
URLProtocol *av_protocol_next(URLProtocol *p);
174

    
175
#if FF_API_REGISTER_PROTOCOL
176
/**
177
 * @deprecated Use av_register_protocol() instead.
178
 */
179
attribute_deprecated int register_protocol(URLProtocol *protocol);
180

    
181
/**
182
 * @deprecated Use av_register_protocol2() instead.
183
 */
184
attribute_deprecated int av_register_protocol(URLProtocol *protocol);
185
#endif
186

    
187
#if FF_API_OLD_AVIO
188
/**
189
 * Register the URLProtocol protocol.
190
 *
191
 * @param size the size of the URLProtocol struct referenced
192
 */
193
attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
194
#endif
195

    
196
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
197

    
198
/**
199
 * @}
200
 */
201

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

    
238
#if FF_API_OLD_AVIO
239
typedef attribute_deprecated AVIOContext ByteIOContext;
240

    
241
attribute_deprecated int init_put_byte(AVIOContext *s,
242
                  unsigned char *buffer,
243
                  int buffer_size,
244
                  int write_flag,
245
                  void *opaque,
246
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
247
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
248
                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
249
attribute_deprecated AVIOContext *av_alloc_put_byte(
250
                  unsigned char *buffer,
251
                  int buffer_size,
252
                  int write_flag,
253
                  void *opaque,
254
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
255
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
256
                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
257

    
258
/**
259
 * @defgroup old_avio_funcs Old put_/get_*() functions
260
 * @deprecated use the avio_ -prefixed functions instead.
261
 * @{
262
 */
263
attribute_deprecated int          get_buffer(AVIOContext *s, unsigned char *buf, int size);
264
attribute_deprecated int          get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
265
attribute_deprecated int          get_byte(AVIOContext *s);
266
attribute_deprecated unsigned int get_le16(AVIOContext *s);
267
attribute_deprecated unsigned int get_le24(AVIOContext *s);
268
attribute_deprecated unsigned int get_le32(AVIOContext *s);
269
attribute_deprecated uint64_t     get_le64(AVIOContext *s);
270
attribute_deprecated unsigned int get_be16(AVIOContext *s);
271
attribute_deprecated unsigned int get_be24(AVIOContext *s);
272
attribute_deprecated unsigned int get_be32(AVIOContext *s);
273
attribute_deprecated uint64_t     get_be64(AVIOContext *s);
274

    
275
attribute_deprecated void         put_byte(AVIOContext *s, int b);
276
attribute_deprecated void         put_nbyte(AVIOContext *s, int b, int count);
277
attribute_deprecated void         put_buffer(AVIOContext *s, const unsigned char *buf, int size);
278
attribute_deprecated void         put_le64(AVIOContext *s, uint64_t val);
279
attribute_deprecated void         put_be64(AVIOContext *s, uint64_t val);
280
attribute_deprecated void         put_le32(AVIOContext *s, unsigned int val);
281
attribute_deprecated void         put_be32(AVIOContext *s, unsigned int val);
282
attribute_deprecated void         put_le24(AVIOContext *s, unsigned int val);
283
attribute_deprecated void         put_be24(AVIOContext *s, unsigned int val);
284
attribute_deprecated void         put_le16(AVIOContext *s, unsigned int val);
285
attribute_deprecated void         put_be16(AVIOContext *s, unsigned int val);
286
attribute_deprecated void         put_tag(AVIOContext *s, const char *tag);
287
/**
288
 * @}
289
 */
290

    
291
attribute_deprecated int     av_url_read_fpause(AVIOContext *h,    int pause);
292
attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h,    int stream_index,
293
                                                int64_t timestamp, int flags);
294

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

    
323
/**
324
 * @deprecated use AVIOContext.eof_reached
325
 */
326
attribute_deprecated int url_feof(AVIOContext *s);
327
attribute_deprecated int url_ferror(AVIOContext *s);
328

    
329
attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
330
attribute_deprecated int udp_get_local_port(URLContext *h);
331

    
332
attribute_deprecated void init_checksum(AVIOContext *s,
333
                   unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
334
                   unsigned long checksum);
335
attribute_deprecated unsigned long get_checksum(AVIOContext *s);
336
#endif
337

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

    
363
void avio_w8(AVIOContext *s, int b);
364
void avio_write(AVIOContext *s, const unsigned char *buf, int size);
365
void avio_wl64(AVIOContext *s, uint64_t val);
366
void avio_wb64(AVIOContext *s, uint64_t val);
367
void avio_wl32(AVIOContext *s, unsigned int val);
368
void avio_wb32(AVIOContext *s, unsigned int val);
369
void avio_wl24(AVIOContext *s, unsigned int val);
370
void avio_wb24(AVIOContext *s, unsigned int val);
371
void avio_wl16(AVIOContext *s, unsigned int val);
372
void avio_wb16(AVIOContext *s, unsigned int val);
373

    
374
#if FF_API_OLD_AVIO
375
attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
376
#endif
377

    
378
/**
379
 * Write a NULL-terminated string.
380
 * @return number of bytes written.
381
 */
382
int avio_put_str(AVIOContext *s, const char *str);
383

    
384
/**
385
 * Convert an UTF-8 string to UTF-16LE and write it.
386
 * @return number of bytes written.
387
 */
388
int avio_put_str16le(AVIOContext *s, const char *str);
389

    
390
/**
391
 * Passing this as the "whence" parameter to a seek function causes it to
392
 * return the filesize without seeking anywhere. Supporting this is optional.
393
 * If it is not supported then the seek function will return <0.
394
 */
395
#define AVSEEK_SIZE 0x10000
396

    
397
/**
398
 * Oring this flag as into the "whence" parameter to a seek function causes it to
399
 * seek by any means (like reopening and linear reading) or other normally unreasonble
400
 * means that can be extreemly slow.
401
 * This may be ignored by the seek code.
402
 */
403
#define AVSEEK_FORCE 0x20000
404

    
405
/**
406
 * fseek() equivalent for AVIOContext.
407
 * @return new position or AVERROR.
408
 */
409
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
410

    
411
/**
412
 * Skip given number of bytes forward
413
 * @return new position or AVERROR.
414
 */
415
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
416
{
417
    return avio_seek(s, offset, SEEK_CUR);
418
}
419

    
420
/**
421
 * ftell() equivalent for AVIOContext.
422
 * @return position or AVERROR.
423
 */
424
static av_always_inline int64_t avio_tell(AVIOContext *s)
425
{
426
    return avio_seek(s, 0, SEEK_CUR);
427
}
428

    
429
/**
430
 * Get the filesize.
431
 * @return filesize or AVERROR
432
 */
433
int64_t avio_size(AVIOContext *s);
434

    
435
/** @warning currently size is limited */
436
#ifdef __GNUC__
437
int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
438
#else
439
int avio_printf(AVIOContext *s, const char *fmt, ...);
440
#endif
441

    
442
#if FF_API_OLD_AVIO
443
/** @note unlike fgets, the EOL character is not returned and a whole
444
    line is parsed. return NULL if first char read was EOF */
445
attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size);
446
#endif
447

    
448
void avio_flush(AVIOContext *s);
449

    
450

    
451
/**
452
 * Read size bytes from AVIOContext into buf.
453
 * @return number of bytes read or AVERROR
454
 */
455
int avio_read(AVIOContext *s, unsigned char *buf, int size);
456

    
457
/** @note return 0 if EOF, so you cannot use it if EOF handling is
458
    necessary */
459
int          avio_r8  (AVIOContext *s);
460
unsigned int avio_rl16(AVIOContext *s);
461
unsigned int avio_rl24(AVIOContext *s);
462
unsigned int avio_rl32(AVIOContext *s);
463
uint64_t     avio_rl64(AVIOContext *s);
464

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

    
479
/**
480
 * Read a UTF-16 string from pb and convert it to UTF-8.
481
 * The reading will terminate when either a null or invalid character was
482
 * encountered or maxlen bytes have been read.
483
 * @return number of bytes read (is always <= maxlen)
484
 */
485
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
486
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
487

    
488
#if FF_API_OLD_AVIO
489
/**
490
 * @deprecated use avio_get_str instead
491
 */
492
attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen);
493
#endif
494
unsigned int avio_rb16(AVIOContext *s);
495
unsigned int avio_rb24(AVIOContext *s);
496
unsigned int avio_rb32(AVIOContext *s);
497
uint64_t     avio_rb64(AVIOContext *s);
498

    
499
#if FF_API_OLD_AVIO
500
/**
501
 * @deprecated Use AVIOContext.seekable field directly.
502
 */
503
attribute_deprecated static inline int url_is_streamed(AVIOContext *s)
504
{
505
    return !s->seekable;
506
}
507
#endif
508

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

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

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

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

    
559
int avio_close(AVIOContext *s);
560

    
561
#if FF_API_OLD_AVIO
562
attribute_deprecated URLContext *url_fileno(AVIOContext *s);
563

    
564
/**
565
 * @deprecated use AVIOContext.max_packet_size directly.
566
 */
567
attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
568

    
569
attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
570

    
571
/** return the written or read size */
572
attribute_deprecated int url_close_buf(AVIOContext *s);
573
#endif
574

    
575
/**
576
 * Open a write only memory stream.
577
 *
578
 * @param s new IO context
579
 * @return zero if no error.
580
 */
581
int avio_open_dyn_buf(AVIOContext **s);
582

    
583
/**
584
 * Return the written size and a pointer to the buffer. The buffer
585
 * must be freed with av_free().
586
 * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
587
 *
588
 * @param s IO context
589
 * @param pbuffer pointer to a byte buffer
590
 * @return the length of the byte buffer
591
 */
592
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
593

    
594
#if FF_API_UDP_GET_FILE
595
int udp_get_file_handle(URLContext *h);
596
#endif
597

    
598
#endif /* AVFORMAT_AVIO_H */