annotate lib/libavformat/avio.h @ 2134:992d2e6f907d

preparation for libavcodec
author zipi
date Tue, 31 Dec 2013 14:52:14 +0000
parents
children
rev   line source
2134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
1 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
2 * copyright (c) 2001 Fabrice Bellard
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
3 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
4 * This file is part of FFmpeg.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
5 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
10 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
14 * Lesser General Public License for more details.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
15 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
19 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
20 #ifndef AVFORMAT_AVIO_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
21 #define AVFORMAT_AVIO_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
22
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
23 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
24 * @file
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
25 * @ingroup lavf_io
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
26 * Buffered I/O operations
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
27 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
28
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
29 #include <stdint.h>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
30
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
31 #include "../libavutil/common.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
32 #include "../libavutil/dict.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
33 #include "../libavutil/log.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
34
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
35 #include "version.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
36
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
37
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
38 #define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
39
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
40 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
41 * Callback for checking whether to abort blocking functions.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
42 * AVERROR_EXIT is returned in this case by the interrupted
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
43 * function. During blocking operations, callback is called with
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
44 * opaque as parameter. If the callback returns 1, the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
45 * blocking operation will be aborted.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
46 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
47 * No members can be added to this struct without a major bump, if
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
48 * new elements have been added after this struct in AVFormatContext
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
49 * or AVIOContext.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
50 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
51 typedef struct AVIOInterruptCB {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
52 int (*callback)(void*);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
53 void *opaque;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
54 } AVIOInterruptCB;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
55
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
56 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
57 * Bytestream IO Context.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
58 * New fields can be added to the end with minor version bumps.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
59 * Removal, reordering and changes to existing fields require a major
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
60 * version bump.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
61 * sizeof(AVIOContext) must not be used outside libav*.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
62 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
63 * @note None of the function pointers in AVIOContext should be called
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
64 * directly, they should only be set by the client application
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
65 * when implementing custom I/O. Normally these are set to the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
66 * function pointers specified in avio_alloc_context()
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
67 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
68 typedef struct AVIOContext {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
69 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
70 * A class for private options.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
71 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
72 * If this AVIOContext is created by avio_open2(), av_class is set and
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
73 * passes the options down to protocols.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
74 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
75 * If this AVIOContext is manually allocated, then av_class may be set by
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
76 * the caller.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
77 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
78 * warning -- this field can be NULL, be sure to not pass this AVIOContext
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
79 * to any av_opt_* functions in that case.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
80 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
81 const AVClass *av_class;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
82 unsigned char *buffer; /**< Start of the buffer. */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
83 int buffer_size; /**< Maximum buffer size */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
84 unsigned char *buf_ptr; /**< Current position in the buffer */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
85 unsigned char *buf_end; /**< End of the data, may be less than
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
86 buffer+buffer_size if the read function returned
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
87 less data than requested, e.g. for streams where
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
88 no more data has been received yet. */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
89 void *opaque; /**< A private pointer, passed to the read/write/seek/...
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
90 functions. */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
91 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
92 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
93 int64_t (*seek)(void *opaque, int64_t offset, int whence);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
94 int64_t pos; /**< position in the file of the current buffer */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
95 int must_flush; /**< true if the next seek should flush */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
96 int eof_reached; /**< true if eof reached */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
97 int write_flag; /**< true if open for writing */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
98 int max_packet_size;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
99 unsigned long checksum;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
100 unsigned char *checksum_ptr;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
101 unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
102 int error; /**< contains the error code or 0 if no error happened */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
103 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
104 * Pause or resume playback for network streaming protocols - e.g. MMS.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
105 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
106 int (*read_pause)(void *opaque, int pause);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
107 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
108 * Seek to a given timestamp in stream with the specified stream_index.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
109 * Needed for some network streaming protocols which don't support seeking
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
110 * to byte position.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
111 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
112 int64_t (*read_seek)(void *opaque, int stream_index,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
113 int64_t timestamp, int flags);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
114 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
115 * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
116 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
117 int seekable;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
118
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
119 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
120 * max filesize, used to limit allocations
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
121 * This field is internal to libavformat and access from outside is not allowed.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
122 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
123 int64_t maxsize;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
124
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
125 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
126 * avio_read and avio_write should if possible be satisfied directly
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
127 * instead of going through a buffer, and avio_seek will always
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
128 * call the underlying seek function directly.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
129 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
130 int direct;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
131
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
132 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
133 * Bytes read statistic
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
134 * This field is internal to libavformat and access from outside is not allowed.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
135 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
136 int64_t bytes_read;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
137
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
138 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
139 * seek statistic
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
140 * This field is internal to libavformat and access from outside is not allowed.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
141 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
142 int seek_count;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
143
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
144 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
145 * writeout statistic
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
146 * This field is internal to libavformat and access from outside is not allowed.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
147 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
148 int writeout_count;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
149 } AVIOContext;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
150
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
151 /* unbuffered I/O */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
152
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
153 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
154 * Return AVIO_FLAG_* access flags corresponding to the access permissions
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
155 * of the resource in url, or a negative value corresponding to an
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
156 * AVERROR code in case of failure. The returned access flags are
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
157 * masked by the value in flags.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
158 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
159 * @note This function is intrinsically unsafe, in the sense that the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
160 * checked resource may change its existence or permission status from
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
161 * one call to another. Thus you should not trust the returned value,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
162 * unless you are sure that no other processes are accessing the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
163 * checked resource.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
164 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
165 int avio_check(const char *url, int flags);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
166
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
167 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
168 * Allocate and initialize an AVIOContext for buffered I/O. It must be later
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
169 * freed with av_free().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
170 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
171 * @param buffer Memory block for input/output operations via AVIOContext.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
172 * The buffer must be allocated with av_malloc() and friends.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
173 * @param buffer_size The buffer size is very important for performance.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
174 * For protocols with fixed blocksize it should be set to this blocksize.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
175 * For others a typical size is a cache page, e.g. 4kb.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
176 * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
177 * @param opaque An opaque pointer to user-specific data.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
178 * @param read_packet A function for refilling the buffer, may be NULL.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
179 * @param write_packet A function for writing the buffer contents, may be NULL.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
180 * The function may not change the input buffers content.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
181 * @param seek A function for seeking to specified byte position, may be NULL.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
182 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
183 * @return Allocated AVIOContext or NULL on failure.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
184 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
185 AVIOContext *avio_alloc_context(
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
186 unsigned char *buffer,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
187 int buffer_size,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
188 int write_flag,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
189 void *opaque,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
190 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
191 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
192 int64_t (*seek)(void *opaque, int64_t offset, int whence));
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
193
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
194 void avio_w8(AVIOContext *s, int b);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
195 void avio_write(AVIOContext *s, const unsigned char *buf, int size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
196 void avio_wl64(AVIOContext *s, uint64_t val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
197 void avio_wb64(AVIOContext *s, uint64_t val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
198 void avio_wl32(AVIOContext *s, unsigned int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
199 void avio_wb32(AVIOContext *s, unsigned int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
200 void avio_wl24(AVIOContext *s, unsigned int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
201 void avio_wb24(AVIOContext *s, unsigned int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
202 void avio_wl16(AVIOContext *s, unsigned int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
203 void avio_wb16(AVIOContext *s, unsigned int val);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
204
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
205 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
206 * Write a NULL-terminated string.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
207 * @return number of bytes written.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
208 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
209 int avio_put_str(AVIOContext *s, const char *str);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
210
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
211 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
212 * Convert an UTF-8 string to UTF-16LE and write it.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
213 * @return number of bytes written.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
214 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
215 int avio_put_str16le(AVIOContext *s, const char *str);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
216
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
217 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
218 * Passing this as the "whence" parameter to a seek function causes it to
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
219 * return the filesize without seeking anywhere. Supporting this is optional.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
220 * If it is not supported then the seek function will return <0.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
221 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
222 #define AVSEEK_SIZE 0x10000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
223
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
224 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
225 * Oring this flag as into the "whence" parameter to a seek function causes it to
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
226 * seek by any means (like reopening and linear reading) or other normally unreasonable
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
227 * means that can be extremely slow.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
228 * This may be ignored by the seek code.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
229 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
230 #define AVSEEK_FORCE 0x20000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
231
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
232 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
233 * fseek() equivalent for AVIOContext.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
234 * @return new position or AVERROR.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
235 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
236 int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
237
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
238 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
239 * Skip given number of bytes forward
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
240 * @return new position or AVERROR.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
241 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
242 int64_t avio_skip(AVIOContext *s, int64_t offset);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
243
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
244 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
245 * ftell() equivalent for AVIOContext.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
246 * @return position or AVERROR.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
247 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
248 static av_always_inline int64_t avio_tell(AVIOContext *s)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
249 {
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
250 return avio_seek(s, 0, SEEK_CUR);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
251 }
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
252
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
253 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
254 * Get the filesize.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
255 * @return filesize or AVERROR
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
256 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
257 int64_t avio_size(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
258
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
259 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
260 * feof() equivalent for AVIOContext.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
261 * @return non zero if and only if end of file
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
262 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
263 int url_feof(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
264
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
265 /** @warning currently size is limited */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
266 int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
267
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
268 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
269 * Force flushing of buffered data to the output s.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
270 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
271 * Force the buffered data to be immediately written to the output,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
272 * without to wait to fill the internal buffer.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
273 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
274 void avio_flush(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
275
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
276 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
277 * Read size bytes from AVIOContext into buf.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
278 * @return number of bytes read or AVERROR
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
279 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
280 int avio_read(AVIOContext *s, unsigned char *buf, int size);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
281
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
282 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
283 * @name Functions for reading from AVIOContext
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
284 * @{
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
285 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
286 * @note return 0 if EOF, so you cannot use it if EOF handling is
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
287 * necessary
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
288 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
289 int avio_r8 (AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
290 unsigned int avio_rl16(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
291 unsigned int avio_rl24(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
292 unsigned int avio_rl32(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
293 uint64_t avio_rl64(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
294 unsigned int avio_rb16(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
295 unsigned int avio_rb24(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
296 unsigned int avio_rb32(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
297 uint64_t avio_rb64(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
298 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
299 * @}
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
300 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
301
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
302 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
303 * Read a string from pb into buf. The reading will terminate when either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
304 * a NULL character was encountered, maxlen bytes have been read, or nothing
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
305 * more can be read from pb. The result is guaranteed to be NULL-terminated, it
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
306 * will be truncated if buf is too small.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
307 * Note that the string is not interpreted or validated in any way, it
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
308 * might get truncated in the middle of a sequence for multi-byte encodings.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
309 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
310 * @return number of bytes read (is always <= maxlen).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
311 * If reading ends on EOF or error, the return value will be one more than
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
312 * bytes actually read.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
313 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
314 int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
315
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
316 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
317 * Read a UTF-16 string from pb and convert it to UTF-8.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
318 * The reading will terminate when either a null or invalid character was
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
319 * encountered or maxlen bytes have been read.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
320 * @return number of bytes read (is always <= maxlen)
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
321 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
322 int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
323 int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
324
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
325
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
326 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
327 * @name URL open modes
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
328 * The flags argument to avio_open must be one of the following
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
329 * constants, optionally ORed with other flags.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
330 * @{
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
331 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
332 #define AVIO_FLAG_READ 1 /**< read-only */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
333 #define AVIO_FLAG_WRITE 2 /**< write-only */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
334 #define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
335 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
336 * @}
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
337 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
338
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
339 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
340 * Use non-blocking mode.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
341 * If this flag is set, operations on the context will return
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
342 * AVERROR(EAGAIN) if they can not be performed immediately.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
343 * If this flag is not set, operations on the context will never return
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
344 * AVERROR(EAGAIN).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
345 * Note that this flag does not affect the opening/connecting of the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
346 * context. Connecting a protocol will always block if necessary (e.g. on
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
347 * network protocols) but never hang (e.g. on busy devices).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
348 * Warning: non-blocking protocols is work-in-progress; this flag may be
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
349 * silently ignored.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
350 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
351 #define AVIO_FLAG_NONBLOCK 8
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
352
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
353 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
354 * Use direct mode.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
355 * avio_read and avio_write should if possible be satisfied directly
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
356 * instead of going through a buffer, and avio_seek will always
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
357 * call the underlying seek function directly.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
358 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
359 #define AVIO_FLAG_DIRECT 0x8000
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
360
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
361 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
362 * Create and initialize a AVIOContext for accessing the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
363 * resource indicated by url.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
364 * @note When the resource indicated by url has been opened in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
365 * read+write mode, the AVIOContext can be used only for writing.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
366 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
367 * @param s Used to return the pointer to the created AVIOContext.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
368 * In case of failure the pointed to value is set to NULL.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
369 * @param flags flags which control how the resource indicated by url
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
370 * is to be opened
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
371 * @return 0 in case of success, a negative value corresponding to an
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
372 * AVERROR code in case of failure
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
373 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
374 int avio_open(AVIOContext **s, const char *url, int flags);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
375
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
376 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
377 * Create and initialize a AVIOContext for accessing the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
378 * resource indicated by url.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
379 * @note When the resource indicated by url has been opened in
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
380 * read+write mode, the AVIOContext can be used only for writing.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
381 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
382 * @param s Used to return the pointer to the created AVIOContext.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
383 * In case of failure the pointed to value is set to NULL.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
384 * @param flags flags which control how the resource indicated by url
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
385 * is to be opened
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
386 * @param int_cb an interrupt callback to be used at the protocols level
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
387 * @param options A dictionary filled with protocol-private options. On return
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
388 * this parameter will be destroyed and replaced with a dict containing options
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
389 * that were not found. May be NULL.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
390 * @return 0 in case of success, a negative value corresponding to an
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
391 * AVERROR code in case of failure
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
392 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
393 int avio_open2(AVIOContext **s, const char *url, int flags,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
394 const AVIOInterruptCB *int_cb, AVDictionary **options);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
395
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
396 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
397 * Close the resource accessed by the AVIOContext s and free it.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
398 * This function can only be used if s was opened by avio_open().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
399 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
400 * The internal buffer is automatically flushed before closing the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
401 * resource.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
402 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
403 * @return 0 on success, an AVERROR < 0 on error.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
404 * @see avio_closep
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
405 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
406 int avio_close(AVIOContext *s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
407
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
408 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
409 * Close the resource accessed by the AVIOContext *s, free it
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
410 * and set the pointer pointing to it to NULL.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
411 * This function can only be used if s was opened by avio_open().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
412 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
413 * The internal buffer is automatically flushed before closing the
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
414 * resource.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
415 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
416 * @return 0 on success, an AVERROR < 0 on error.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
417 * @see avio_close
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
418 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
419 int avio_closep(AVIOContext **s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
420
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
421
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
422 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
423 * Open a write only memory stream.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
424 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
425 * @param s new IO context
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
426 * @return zero if no error.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
427 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
428 int avio_open_dyn_buf(AVIOContext **s);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
429
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
430 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
431 * Return the written size and a pointer to the buffer. The buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
432 * must be freed with av_free().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
433 * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
434 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
435 * @param s IO context
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
436 * @param pbuffer pointer to a byte buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
437 * @return the length of the byte buffer
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
438 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
439 int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
440
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
441 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
442 * Iterate through names of available protocols.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
443 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
444 * @param opaque A private pointer representing current protocol.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
445 * It must be a pointer to NULL on first iteration and will
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
446 * be updated by successive calls to avio_enum_protocols.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
447 * @param output If set to 1, iterate over output protocols,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
448 * otherwise over input protocols.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
449 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
450 * @return A static string containing the name of current protocol or NULL
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
451 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
452 const char *avio_enum_protocols(void **opaque, int output);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
453
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
454 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
455 * Pause and resume playing - only meaningful if using a network streaming
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
456 * protocol (e.g. MMS).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
457 * @param pause 1 for pause, 0 for resume
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
458 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
459 int avio_pause(AVIOContext *h, int pause);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
460
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
461 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
462 * Seek to a given timestamp relative to some component stream.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
463 * Only meaningful if using a network streaming protocol (e.g. MMS.).
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
464 * @param stream_index The stream index that the timestamp is relative to.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
465 * If stream_index is (-1) the timestamp should be in AV_TIME_BASE
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
466 * units from the beginning of the presentation.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
467 * If a stream_index >= 0 is used and the protocol does not support
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
468 * seeking based on component streams, the call will fail.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
469 * @param timestamp timestamp in AVStream.time_base units
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
470 * or if there is no stream specified then in AV_TIME_BASE units.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
471 * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
472 * and AVSEEK_FLAG_ANY. The protocol may silently ignore
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
473 * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
474 * fail if used and not supported.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
475 * @return >= 0 on success
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
476 * @see AVInputFormat::read_seek
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
477 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
478 int64_t avio_seek_time(AVIOContext *h, int stream_index,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
479 int64_t timestamp, int flags);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
480
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
481 #endif /* AVFORMAT_AVIO_H */