Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
libavformat
avio.h
Go to the documentation of this file.
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
29
#include <stdint.h>
30
31
#include "
libavutil/common.h
"
32
#include "
libavutil/dict.h
"
33
#include "
libavutil/log.h
"
34
35
#include "
libavformat/version.h
"
36
37
38
#define AVIO_SEEKABLE_NORMAL 0x0001
51
typedef struct AVIOInterruptCB {
52
int (*callback)(
void
*);
53
void
*
opaque
;
54
}
AVIOInterruptCB
;
55
68
typedef
struct
AVIOContext
{
81
const
AVClass
*
av_class
;
82
unsigned
char
*
buffer
;
83
int
buffer_size
;
84
unsigned
char
*
buf_ptr
;
85
unsigned
char
*
buf_end
;
89
void
*
opaque
;
91
int (*
read_packet
)(
void
*
opaque
,
uint8_t
*buf,
int
buf_size);
92
int (*
write_packet
)(
void
*
opaque
,
uint8_t
*buf,
int
buf_size);
93
int64_t (*
seek
)(
void
*
opaque
, int64_t offset,
int
whence);
94
int64_t
pos
;
95
int
must_flush
;
96
int
eof_reached
;
97
int
write_flag
;
98
int
max_packet_size
;
99
unsigned
long
checksum
;
100
unsigned
char
*
checksum_ptr
;
101
unsigned
long (*
update_checksum
)(
unsigned
long
checksum
,
const
uint8_t
*buf,
unsigned
int
size
);
102
int
error
;
106
int (*
read_pause
)(
void
*
opaque
,
int
pause);
112
int64_t (*
read_seek
)(
void
*
opaque
,
int
stream_index,
113
int64_t timestamp,
int
flags
);
117
int
seekable
;
118
}
AVIOContext
;
119
120
/* unbuffered I/O */
121
134
int
avio_check
(
const
char
*url,
int
flags
);
135
153
AVIOContext
*
avio_alloc_context
(
154
unsigned
char
*
buffer
,
155
int
buffer_size,
156
int
write_flag,
157
void
*opaque,
158
int
(*
read_packet
)(
void
*opaque,
uint8_t
*buf,
int
buf_size),
159
int
(*
write_packet
)(
void
*opaque,
uint8_t
*buf,
int
buf_size),
160
int64_t (*seek)(
void
*opaque, int64_t offset,
int
whence));
161
162
void
avio_w8
(
AVIOContext
*s,
int
b
);
163
void
avio_write
(
AVIOContext
*s,
const
unsigned
char
*buf,
int
size
);
164
void
avio_wl64
(
AVIOContext
*s, uint64_t val);
165
void
avio_wb64
(
AVIOContext
*s, uint64_t val);
166
void
avio_wl32
(
AVIOContext
*s,
unsigned
int
val);
167
void
avio_wb32
(
AVIOContext
*s,
unsigned
int
val);
168
void
avio_wl24
(
AVIOContext
*s,
unsigned
int
val);
169
void
avio_wb24
(
AVIOContext
*s,
unsigned
int
val);
170
void
avio_wl16
(
AVIOContext
*s,
unsigned
int
val);
171
void
avio_wb16
(
AVIOContext
*s,
unsigned
int
val);
172
177
int
avio_put_str
(
AVIOContext
*s,
const
char
*str);
178
183
int
avio_put_str16le
(
AVIOContext
*s,
const
char
*str);
184
190
#define AVSEEK_SIZE 0x10000
191
198
#define AVSEEK_FORCE 0x20000
199
204
int64_t
avio_seek
(
AVIOContext
*s, int64_t offset,
int
whence);
205
210
static
av_always_inline
int64_t
avio_skip
(
AVIOContext
*s, int64_t offset)
211
{
212
return
avio_seek
(s, offset, SEEK_CUR);
213
}
214
219
static
av_always_inline
int64_t
avio_tell
(
AVIOContext
*s)
220
{
221
return
avio_seek
(s, 0, SEEK_CUR);
222
}
223
228
int64_t
avio_size
(
AVIOContext
*s);
229
231
int
avio_printf
(
AVIOContext
*s,
const
char
*fmt, ...) av_printf_format(2, 3);
232
233
void
avio_flush
(
AVIOContext
*s);
234
235
240
int
avio_read
(
AVIOContext
*s,
unsigned
char
*buf,
int
size
);
241
249
int
avio_r8
(
AVIOContext
*s);
250
unsigned
int
avio_rl16
(
AVIOContext
*s);
251
unsigned
int
avio_rl24
(
AVIOContext
*s);
252
unsigned
int
avio_rl32
(
AVIOContext
*s);
253
uint64_t
avio_rl64
(
AVIOContext
*s);
254
unsigned
int
avio_rb16
(
AVIOContext
*s);
255
unsigned
int
avio_rb24
(
AVIOContext
*s);
256
unsigned
int
avio_rb32
(
AVIOContext
*s);
257
uint64_t
avio_rb64
(
AVIOContext
*s);
274
int
avio_get_str
(
AVIOContext
*pb,
int
maxlen,
char
*buf,
int
buflen);
275
282
int
avio_get_str16le
(
AVIOContext
*pb,
int
maxlen,
char
*buf,
int
buflen);
283
int
avio_get_str16be
(
AVIOContext
*pb,
int
maxlen,
char
*buf,
int
buflen);
284
285
292
#define AVIO_FLAG_READ 1
293
#define AVIO_FLAG_WRITE 2
294
#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE)
311
#define AVIO_FLAG_NONBLOCK 8
312
326
int
avio_open
(
AVIOContext
**s,
const
char
*url,
int
flags
);
327
345
int
avio_open2
(
AVIOContext
**s,
const
char
*url,
int
flags
,
346
const
AVIOInterruptCB
*
int_cb
,
AVDictionary
**
options
);
347
358
int
avio_close
(
AVIOContext
*s);
359
371
int
avio_closep
(
AVIOContext
**s);
372
373
380
int
avio_open_dyn_buf
(
AVIOContext
**s);
381
391
int
avio_close_dyn_buf
(
AVIOContext
*s,
uint8_t
**pbuffer);
392
404
const
char
*
avio_enum_protocols
(
void
**opaque,
int
output);
405
411
int
avio_pause
(
AVIOContext
*h,
int
pause);
412
430
int64_t
avio_seek_time
(
AVIOContext
*h,
int
stream_index,
431
int64_t timestamp,
int
flags
);
432
433
#endif
/* AVFORMAT_AVIO_H */