avio: rename ByteIOContext to AVIOContext.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
oldabi
Anton Khirnov 14 years ago committed by Ronald S. Bultje
parent 70aa916e46
commit ae628ec1fd
  1. 10
      ffserver.c
  2. 4
      libavformat/4xm.c
  3. 2
      libavformat/adtsenc.c
  4. 6
      libavformat/aiffdec.c
  5. 6
      libavformat/aiffenc.c
  6. 4
      libavformat/amr.c
  7. 4
      libavformat/anm.c
  8. 2
      libavformat/apc.c
  9. 2
      libavformat/ape.c
  10. 4
      libavformat/apetag.c
  11. 8
      libavformat/applehttp.c
  12. 2
      libavformat/asf.h
  13. 28
      libavformat/asfdec.c
  14. 26
      libavformat/asfenc.c
  15. 2
      libavformat/assdec.c
  16. 10
      libavformat/au.c
  17. 6
      libavformat/avc.c
  18. 4
      libavformat/avc.h
  19. 10
      libavformat/avformat.h
  20. 16
      libavformat/avidec.c
  21. 16
      libavformat/avienc.c
  22. 156
      libavformat/avio.h
  23. 140
      libavformat/aviobuf.c
  24. 6
      libavformat/bethsoftvid.c
  25. 4
      libavformat/bfi.c
  26. 4
      libavformat/bink.c
  27. 4
      libavformat/c93.c
  28. 12
      libavformat/cafdec.c
  29. 2
      libavformat/daud.c
  30. 8
      libavformat/dsicin.c
  31. 2
      libavformat/dxa.c
  32. 2
      libavformat/eacdata.c
  33. 16
      libavformat/electronicarts.c
  34. 10
      libavformat/ffmdec.c
  35. 6
      libavformat/ffmenc.c
  36. 2
      libavformat/ffmetadec.c
  37. 4
      libavformat/ffmetaenc.c
  38. 2
      libavformat/filmstripdec.c
  39. 2
      libavformat/filmstripenc.c
  40. 6
      libavformat/flacenc.c
  41. 2
      libavformat/flacenc.h
  42. 2
      libavformat/flacenc_header.c
  43. 4
      libavformat/flic.c
  44. 6
      libavformat/flvdec.c
  45. 14
      libavformat/flvenc.c
  46. 10
      libavformat/gif.c
  47. 18
      libavformat/gxf.c
  48. 52
      libavformat/gxfenc.c
  49. 8
      libavformat/id3v2.c
  50. 4
      libavformat/idcin.c
  51. 4
      libavformat/idroqdec.c
  52. 4
      libavformat/iff.c
  53. 4
      libavformat/img2.c
  54. 8
      libavformat/internal.h
  55. 8
      libavformat/ipmovie.c
  56. 6
      libavformat/isom.c
  57. 12
      libavformat/isom.h
  58. 4
      libavformat/iss.c
  59. 4
      libavformat/ivfenc.c
  60. 12
      libavformat/libnut.c
  61. 2
      libavformat/lmlm4.c
  62. 6
      libavformat/lxfdec.c
  63. 22
      libavformat/matroskadec.c
  64. 56
      libavformat/matroskaenc.c
  65. 4
      libavformat/mm.c
  66. 12
      libavformat/mmf.c
  67. 2
      libavformat/mmst.c
  68. 98
      libavformat/mov.c
  69. 136
      libavformat/movenc.c
  70. 10
      libavformat/movenchint.c
  71. 4
      libavformat/mp3enc.c
  72. 6
      libavformat/mpc8.c
  73. 8
      libavformat/mpeg.c
  74. 4
      libavformat/mpegenc.c
  75. 10
      libavformat/mpegts.c
  76. 2
      libavformat/mpegtsenc.c
  77. 4
      libavformat/msnwc_tcp.c
  78. 4
      libavformat/mtv.c
  79. 6
      libavformat/mvi.c
  80. 36
      libavformat/mxfdec.c
  81. 66
      libavformat/mxfenc.c
  82. 8
      libavformat/nsvdec.c
  83. 40
      libavformat/nutdec.c
  84. 36
      libavformat/nutenc.c
  85. 6
      libavformat/nuv.c
  86. 6
      libavformat/oggdec.c
  87. 4
      libavformat/oggenc.c
  88. 4
      libavformat/psxstr.c
  89. 6
      libavformat/pva.c
  90. 4
      libavformat/qcp.c
  91. 4
      libavformat/rdt.c
  92. 12
      libavformat/riff.c
  93. 12
      libavformat/riff.h
  94. 4
      libavformat/rl2.c
  95. 12
      libavformat/rm.h
  96. 24
      libavformat/rmdec.c
  97. 14
      libavformat/rmenc.c
  98. 8
      libavformat/rpl.c
  99. 2
      libavformat/rsodec.c
  100. 4
      libavformat/rsoenc.c
  101. Some files were not shown because too many files have changed in this diff Show More

@ -163,7 +163,7 @@ typedef struct HTTPContext {
/* RTSP state specific */ /* RTSP state specific */
uint8_t *pb_buffer; /* XXX: use that in all the code */ uint8_t *pb_buffer; /* XXX: use that in all the code */
ByteIOContext *pb; AVIOContext *pb;
int seq; /* RTSP sequence number */ int seq; /* RTSP sequence number */
/* RTP state specific */ /* RTP state specific */
@ -1854,7 +1854,7 @@ static int http_parse_request(HTTPContext *c)
return 0; return 0;
} }
static void fmt_bytecount(ByteIOContext *pb, int64_t count) static void fmt_bytecount(AVIOContext *pb, int64_t count)
{ {
static const char *suffix = " kMGTP"; static const char *suffix = " kMGTP";
const char *s; const char *s;
@ -1871,7 +1871,7 @@ static void compute_status(HTTPContext *c)
char *p; char *p;
time_t ti; time_t ti;
int i, len; int i, len;
ByteIOContext *pb; AVIOContext *pb;
if (url_open_dyn_buf(&pb) < 0) { if (url_open_dyn_buf(&pb) < 0) {
/* XXX: return an error ? */ /* XXX: return an error ? */
@ -2491,7 +2491,7 @@ static int http_send_data(HTTPContext *c)
if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP) { if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP) {
/* RTP packets are sent inside the RTSP TCP connection */ /* RTP packets are sent inside the RTSP TCP connection */
ByteIOContext *pb; AVIOContext *pb;
int interleaved_index, size; int interleaved_index, size;
uint8_t header[4]; uint8_t header[4];
HTTPContext *rtsp_c; HTTPContext *rtsp_c;
@ -2712,7 +2712,7 @@ static int http_receive_data(HTTPContext *c)
} else { } else {
/* We have a header in our hands that contains useful data */ /* We have a header in our hands that contains useful data */
AVFormatContext *s = NULL; AVFormatContext *s = NULL;
ByteIOContext *pb; AVIOContext *pb;
AVInputFormat *fmt_in; AVInputFormat *fmt_in;
int i; int i;

@ -92,7 +92,7 @@ static int fourxm_probe(AVProbeData *p)
static int fourxm_read_header(AVFormatContext *s, static int fourxm_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int fourcc_tag; unsigned int fourcc_tag;
unsigned int size; unsigned int size;
int header_size; int header_size;
@ -244,7 +244,7 @@ static int fourxm_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
FourxmDemuxContext *fourxm = s->priv_data; FourxmDemuxContext *fourxm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int fourcc_tag; unsigned int fourcc_tag;
unsigned int size, out_size; unsigned int size, out_size;
int ret = 0; int ret = 0;

@ -118,7 +118,7 @@ int ff_adts_write_frame_header(ADTSContext *ctx,
static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ADTSContext *adts = s->priv_data; ADTSContext *adts = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint8_t buf[ADTS_HEADER_SIZE]; uint8_t buf[ADTS_HEADER_SIZE];
if (!pkt->size) if (!pkt->size)

@ -47,7 +47,7 @@ static enum CodecID aiff_codec_get_id(int bps)
} }
/* returns the size of the found tag */ /* returns the size of the found tag */
static int get_tag(ByteIOContext *pb, uint32_t * tag) static int get_tag(AVIOContext *pb, uint32_t * tag)
{ {
int size; int size;
@ -83,7 +83,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
} }
/* Returns the number of sound data frames or negative on error */ /* Returns the number of sound data frames or negative on error */
static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec, static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
int size, unsigned version) int size, unsigned version)
{ {
AVExtFloat ext; AVExtFloat ext;
@ -177,7 +177,7 @@ static int aiff_read_header(AVFormatContext *s,
int64_t offset = 0; int64_t offset = 0;
uint32_t tag; uint32_t tag;
unsigned version = AIFF_C_VERSION1; unsigned version = AIFF_C_VERSION1;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream * st; AVStream * st;
AIFFInputContext *aiff = s->priv_data; AIFFInputContext *aiff = s->priv_data;

@ -31,7 +31,7 @@ typedef struct {
static int aiff_write_header(AVFormatContext *s) static int aiff_write_header(AVFormatContext *s)
{ {
AIFFOutputContext *aiff = s->priv_data; AIFFOutputContext *aiff = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;
AVExtFloat sample_rate; AVExtFloat sample_rate;
int aifc = 0; int aifc = 0;
@ -104,14 +104,14 @@ static int aiff_write_header(AVFormatContext *s)
static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt) static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size); put_buffer(pb, pkt->data, pkt->size);
return 0; return 0;
} }
static int aiff_write_trailer(AVFormatContext *s) static int aiff_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AIFFOutputContext *aiff = s->priv_data; AIFFOutputContext *aiff = s->priv_data;
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;

@ -33,7 +33,7 @@ static const char AMRWB_header [] = "#!AMR-WB\n";
#if CONFIG_AMR_MUXER #if CONFIG_AMR_MUXER
static int amr_write_header(AVFormatContext *s) static int amr_write_header(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;
s->priv_data = NULL; s->priv_data = NULL;
@ -78,7 +78,7 @@ static int amr_probe(AVProbeData *p)
static int amr_read_header(AVFormatContext *s, static int amr_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
uint8_t header[9]; uint8_t header[9];

@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
AnmDemuxContext *anm = s->priv_data; AnmDemuxContext *anm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
int i, ret; int i, ret;
@ -177,7 +177,7 @@ static int read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
AnmDemuxContext *anm = s->priv_data; AnmDemuxContext *anm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
Page *p; Page *p;
int tmp, record_size; int tmp, record_size;

@ -32,7 +32,7 @@ static int apc_probe(AVProbeData *p)
static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
get_le32(pb); /* CRYO */ get_le32(pb); /* CRYO */

@ -151,7 +151,7 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx)
static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
APEContext *ape = s->priv_data; APEContext *ape = s->priv_data;
AVStream *st; AVStream *st;
uint32_t tag; uint32_t tag;

@ -33,7 +33,7 @@
static int ape_tag_read_field(AVFormatContext *s) static int ape_tag_read_field(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint8_t key[1024], *value; uint8_t key[1024], *value;
uint32_t size, flags; uint32_t size, flags;
int i, c; int i, c;
@ -65,7 +65,7 @@ static int ape_tag_read_field(AVFormatContext *s)
void ff_ape_parse_tag(AVFormatContext *s) void ff_ape_parse_tag(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int file_size = url_fsize(pb); int file_size = url_fsize(pb);
uint32_t val, fields, tag_bytes; uint32_t val, fields, tag_bytes;
uint8_t buf[8]; uint8_t buf[8];

@ -50,13 +50,13 @@ struct segment {
/* /*
* Each variant has its own demuxer. If it currently is active, * Each variant has its own demuxer. If it currently is active,
* it has an open ByteIOContext too, and potentially an AVPacket * it has an open AVIOContext too, and potentially an AVPacket
* containing the next packet from this stream. * containing the next packet from this stream.
*/ */
struct variant { struct variant {
int bandwidth; int bandwidth;
char url[MAX_URL_SIZE]; char url[MAX_URL_SIZE];
ByteIOContext *pb; AVIOContext *pb;
AVFormatContext *ctx; AVFormatContext *ctx;
AVPacket pkt; AVPacket pkt;
int stream_offset; int stream_offset;
@ -78,7 +78,7 @@ typedef struct AppleHTTPContext {
int max_start_seq, min_end_seq; int max_start_seq, min_end_seq;
} AppleHTTPContext; } AppleHTTPContext;
static int read_chomp_line(ByteIOContext *s, char *buf, int maxlen) static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
{ {
int len = ff_get_line(s, buf, maxlen); int len = ff_get_line(s, buf, maxlen);
while (len > 0 && isspace(buf[len - 1])) while (len > 0 && isspace(buf[len - 1]))
@ -202,7 +202,7 @@ static void handle_variant_args(struct variant_info *info, const char *key,
} }
static int parse_playlist(AppleHTTPContext *c, const char *url, static int parse_playlist(AppleHTTPContext *c, const char *url,
struct variant *var, ByteIOContext *in) struct variant *var, AVIOContext *in)
{ {
int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0; int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
char line[1024]; char line[1024];

@ -178,6 +178,6 @@ static av_always_inline int ff_guidcmp(const void *g1, const void *g2)
return memcmp(g1, g2, sizeof(ff_asf_guid)); return memcmp(g1, g2, sizeof(ff_asf_guid));
} }
void ff_get_guid(ByteIOContext *s, ff_asf_guid *g); void ff_get_guid(AVIOContext *s, ff_asf_guid *g);
#endif /* AVFORMAT_ASF_H */ #endif /* AVFORMAT_ASF_H */

@ -132,7 +132,7 @@ static void print_guid(const ff_asf_guid *g)
#define print_guid(g) #define print_guid(g)
#endif #endif
void ff_get_guid(ByteIOContext *s, ff_asf_guid *g) void ff_get_guid(AVIOContext *s, ff_asf_guid *g)
{ {
assert(sizeof(*g) == 16); assert(sizeof(*g) == 16);
get_buffer(s, *g, sizeof(*g)); get_buffer(s, *g, sizeof(*g));
@ -147,7 +147,7 @@ static int asf_probe(AVProbeData *pd)
return 0; return 0;
} }
static int get_value(ByteIOContext *pb, int type){ static int get_value(AVIOContext *pb, int type){
switch(type){ switch(type){
case 2: return get_le32(pb); case 2: return get_le32(pb);
case 3: return get_le32(pb); case 3: return get_le32(pb);
@ -188,7 +188,7 @@ finish:
static int asf_read_file_properties(AVFormatContext *s, int64_t size) static int asf_read_file_properties(AVFormatContext *s, int64_t size)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ff_get_guid(pb, &asf->hdr.guid); ff_get_guid(pb, &asf->hdr.guid);
asf->hdr.file_size = get_le64(pb); asf->hdr.file_size = get_le64(pb);
@ -210,7 +210,7 @@ static int asf_read_file_properties(AVFormatContext *s, int64_t size)
static int asf_read_stream_properties(AVFormatContext *s, int64_t size) static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
ASFStream *asf_st; ASFStream *asf_st;
ff_asf_guid g; ff_asf_guid g;
@ -396,7 +396,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ff_asf_guid g; ff_asf_guid g;
int ext_len, payload_ext_ct, stream_ct, i; int ext_len, payload_ext_ct, stream_ct, i;
uint32_t ext_d, leak_rate, stream_num; uint32_t ext_d, leak_rate, stream_num;
@ -443,7 +443,7 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
static int asf_read_content_desc(AVFormatContext *s, int64_t size) static int asf_read_content_desc(AVFormatContext *s, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int len1, len2, len3, len4, len5; int len1, len2, len3, len4, len5;
len1 = get_le16(pb); len1 = get_le16(pb);
@ -462,7 +462,7 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size)
static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
int desc_count, i, ret; int desc_count, i, ret;
@ -497,7 +497,7 @@ static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size)
static int asf_read_language_list(AVFormatContext *s, int64_t size) static int asf_read_language_list(AVFormatContext *s, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
int j, ret; int j, ret;
int stream_count = get_le16(pb); int stream_count = get_le16(pb);
@ -515,7 +515,7 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size)
static int asf_read_metadata(AVFormatContext *s, int64_t size) static int asf_read_metadata(AVFormatContext *s, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
int n, stream_num, name_len, value_len, value_type, value_num; int n, stream_num, name_len, value_len, value_type, value_num;
int ret, i; int ret, i;
@ -547,7 +547,7 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
static int asf_read_marker(AVFormatContext *s, int64_t size) static int asf_read_marker(AVFormatContext *s, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i, count, name_len, ret; int i, count, name_len, ret;
char name[1024]; char name[1024];
@ -582,7 +582,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ff_asf_guid g; ff_asf_guid g;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i; int i;
int64_t gsize; int64_t gsize;
@ -716,7 +716,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
* @param pb context to read data from * @param pb context to read data from
* @return 0 on success, <0 on error * @return 0 on success, <0 on error
*/ */
static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb) static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
uint32_t packet_length, padsize; uint32_t packet_length, padsize;
@ -801,7 +801,7 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
* *
* @return <0 if error * @return <0 if error
*/ */
static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
int rsize = 1; int rsize = 1;
int num = get_byte(pb); int num = get_byte(pb);
@ -880,7 +880,7 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
* @return 0 if data was stored in pkt, <0 on error or 1 if more ASF * @return 0 if data was stored in pkt, <0 on error or 1 if more ASF
* packets need to be loaded (through asf_get_packet()) * packets need to be loaded (through asf_get_packet())
*/ */
static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ASFStream *asf_st = 0; ASFStream *asf_st = 0;

@ -202,7 +202,7 @@ typedef struct {
int packet_timestamp_end; int packet_timestamp_end;
unsigned int packet_nb_payloads; unsigned int packet_nb_payloads;
uint8_t packet_buf[PACKET_SIZE]; uint8_t packet_buf[PACKET_SIZE];
ByteIOContext pb; AVIOContext pb;
/* only for reading */ /* only for reading */
uint64_t data_offset; ///< beginning of the first data packet uint64_t data_offset; ///< beginning of the first data packet
@ -222,17 +222,17 @@ static const AVCodecTag codec_asf_bmp_tags[] = {
#define PREROLL_TIME 3100 #define PREROLL_TIME 3100
static void put_guid(ByteIOContext *s, const ff_asf_guid *g) static void put_guid(AVIOContext *s, const ff_asf_guid *g)
{ {
assert(sizeof(*g) == 16); assert(sizeof(*g) == 16);
put_buffer(s, *g, sizeof(*g)); put_buffer(s, *g, sizeof(*g));
} }
static void put_str16(ByteIOContext *s, const char *tag) static void put_str16(AVIOContext *s, const char *tag)
{ {
int len; int len;
uint8_t *pb; uint8_t *pb;
ByteIOContext *dyn_buf; AVIOContext *dyn_buf;
if (url_open_dyn_buf(&dyn_buf) < 0) if (url_open_dyn_buf(&dyn_buf) < 0)
return; return;
@ -243,7 +243,7 @@ static void put_str16(ByteIOContext *s, const char *tag)
av_freep(&pb); av_freep(&pb);
} }
static int64_t put_header(ByteIOContext *pb, const ff_asf_guid *g) static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g)
{ {
int64_t pos; int64_t pos;
@ -254,7 +254,7 @@ static int64_t put_header(ByteIOContext *pb, const ff_asf_guid *g)
} }
/* update header size */ /* update header size */
static void end_header(ByteIOContext *pb, int64_t pos) static void end_header(AVIOContext *pb, int64_t pos)
{ {
int64_t pos1; int64_t pos1;
@ -268,7 +268,7 @@ static void end_header(ByteIOContext *pb, int64_t pos)
static void put_chunk(AVFormatContext *s, int type, int payload_length, int flags) static void put_chunk(AVFormatContext *s, int type, int payload_length, int flags)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int length; int length;
length = payload_length + 8; length = payload_length + 8;
@ -294,7 +294,7 @@ static int64_t unix_to_file_time(int ti)
static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size) static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVMetadataTag *tags[5]; AVMetadataTag *tags[5];
int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
int has_title; int has_title;
@ -363,7 +363,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
if (has_title) { if (has_title) {
int len; int len;
uint8_t *buf; uint8_t *buf;
ByteIOContext *dyn_buf; AVIOContext *dyn_buf;
if (url_open_dyn_buf(&dyn_buf) < 0) if (url_open_dyn_buf(&dyn_buf) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -479,7 +479,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
const char *desc; const char *desc;
int len; int len;
uint8_t *buf; uint8_t *buf;
ByteIOContext *dyn_buf; AVIOContext *dyn_buf;
enc = s->streams[n]->codec; enc = s->streams[n]->codec;
p = avcodec_find_encoder(enc->codec_id); p = avcodec_find_encoder(enc->codec_id);
@ -602,7 +602,7 @@ static int put_payload_parsing_info(
) )
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ppi_size, i; int ppi_size, i;
int64_t start= url_ftell(pb); int64_t start= url_ftell(pb);
@ -691,7 +691,7 @@ static void put_payload_header(
) )
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
ByteIOContext *pb = &asf->pb; AVIOContext *pb = &asf->pb;
int val; int val;
val = stream->num; val = stream->num;
@ -832,7 +832,7 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
// //
static int asf_write_index(AVFormatContext *s, ASFIndex *index, uint16_t max, uint32_t count) static int asf_write_index(AVFormatContext *s, ASFIndex *index, uint16_t max, uint32_t count)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i; int i;
put_guid(pb, &ff_asf_simple_index_header); put_guid(pb, &ff_asf_simple_index_header);

@ -76,7 +76,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
int i, len, header_remaining; int i, len, header_remaining;
ASSContext *ass = s->priv_data; ASSContext *ass = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
int allocated[2]={0}; int allocated[2]={0};
uint8_t *p, **dst[2]={0}; uint8_t *p, **dst[2]={0};

@ -49,7 +49,7 @@ static const AVCodecTag codec_au_tags[] = {
#if CONFIG_AU_MUXER #if CONFIG_AU_MUXER
/* AUDIO_FILE header */ /* AUDIO_FILE header */
static int put_au_header(ByteIOContext *pb, AVCodecContext *enc) static int put_au_header(AVIOContext *pb, AVCodecContext *enc)
{ {
if(!enc->codec_tag) if(!enc->codec_tag)
return -1; return -1;
@ -64,7 +64,7 @@ static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
static int au_write_header(AVFormatContext *s) static int au_write_header(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
s->priv_data = NULL; s->priv_data = NULL;
@ -80,14 +80,14 @@ static int au_write_header(AVFormatContext *s)
static int au_write_packet(AVFormatContext *s, AVPacket *pkt) static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size); put_buffer(pb, pkt->data, pkt->size);
return 0; return 0;
} }
static int au_write_trailer(AVFormatContext *s) static int au_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t file_size; int64_t file_size;
if (!url_is_streamed(s->pb)) { if (!url_is_streamed(s->pb)) {
@ -121,7 +121,7 @@ static int au_read_header(AVFormatContext *s,
{ {
int size; int size;
unsigned int tag; unsigned int tag;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int id, channels, rate; unsigned int id, channels, rate;
enum CodecID codec; enum CodecID codec;
AVStream *st; AVStream *st;

@ -67,7 +67,7 @@ const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end){
return out; return out;
} }
int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size) int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
{ {
const uint8_t *p = buf_in; const uint8_t *p = buf_in;
const uint8_t *end = p + size; const uint8_t *end = p + size;
@ -88,7 +88,7 @@ int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
{ {
ByteIOContext *pb; AVIOContext *pb;
int ret = url_open_dyn_buf(&pb); int ret = url_open_dyn_buf(&pb);
if(ret < 0) if(ret < 0)
return ret; return ret;
@ -100,7 +100,7 @@ int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
return 0; return 0;
} }
int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len) int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
{ {
if (len > 6) { if (len > 6) {
/* check for h264 start code */ /* check for h264 start code */

@ -25,9 +25,9 @@
#include <stdint.h> #include <stdint.h>
#include "avio.h" #include "avio.h"
int ff_avc_parse_nal_units(ByteIOContext *s, const uint8_t *buf, int size); int ff_avc_parse_nal_units(AVIOContext *s, const uint8_t *buf, int size);
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size); int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size);
int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len); int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len);
const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end); const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end);
#endif /* AVFORMAT_AVC_H */ #endif /* AVFORMAT_AVC_H */

@ -193,7 +193,7 @@ void av_metadata_free(AVMetadata **m);
* @param size desired payload size * @param size desired payload size
* @return >0 (read size) if OK, AVERROR_xxx otherwise * @return >0 (read size) if OK, AVERROR_xxx otherwise
*/ */
int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); int av_get_packet(AVIOContext *s, AVPacket *pkt, int size);
/** /**
@ -209,7 +209,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
* @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data
* will not be lost even if an error occurs. * will not be lost even if an error occurs.
*/ */
int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size); int av_append_packet(AVIOContext *s, AVPacket *pkt, int size);
/*************************************************/ /*************************************************/
/* fractional numbers for exact pts handling */ /* fractional numbers for exact pts handling */
@ -688,7 +688,7 @@ typedef struct AVFormatContext {
struct AVInputFormat *iformat; struct AVInputFormat *iformat;
struct AVOutputFormat *oformat; struct AVOutputFormat *oformat;
void *priv_data; void *priv_data;
ByteIOContext *pb; AVIOContext *pb;
unsigned int nb_streams; unsigned int nb_streams;
#if FF_API_MAX_STREAMS #if FF_API_MAX_STREAMS
AVStream *streams[MAX_STREAMS]; AVStream *streams[MAX_STREAMS];
@ -1060,7 +1060,7 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score
* @return 0 in case of success, a negative value corresponding to an * @return 0 in case of success, a negative value corresponding to an
* AVERROR code otherwise * AVERROR code otherwise
*/ */
int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt,
const char *filename, void *logctx, const char *filename, void *logctx,
unsigned int offset, unsigned int max_probe_size); unsigned int offset, unsigned int max_probe_size);
@ -1069,7 +1069,7 @@ int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt,
* This does not open the needed codecs for decoding the stream[s]. * This does not open the needed codecs for decoding the stream[s].
*/ */
int av_open_input_stream(AVFormatContext **ic_ptr, int av_open_input_stream(AVFormatContext **ic_ptr,
ByteIOContext *pb, const char *filename, AVIOContext *pb, const char *filename,
AVInputFormat *fmt, AVFormatParameters *ap); AVInputFormat *fmt, AVFormatParameters *ap);
/** /**

@ -100,7 +100,7 @@ static inline int get_duration(AVIStream *ast, int len){
return 1; return 1;
} }
static int get_riff(AVFormatContext *s, ByteIOContext *pb) static int get_riff(AVFormatContext *s, AVIOContext *pb)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
char header[8]; char header[8];
@ -126,7 +126,7 @@ static int get_riff(AVFormatContext *s, ByteIOContext *pb)
static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int longs_pre_entry= get_le16(pb); int longs_pre_entry= get_le16(pb);
int index_sub_type = get_byte(pb); int index_sub_type = get_byte(pb);
int index_type = get_byte(pb); int index_type = get_byte(pb);
@ -246,7 +246,7 @@ static void clean_index(AVFormatContext *s){
static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size) static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
char key[5] = {0}, *value; char key[5] = {0}, *value;
size += (size & 1); size += (size & 1);
@ -335,7 +335,7 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int tag, tag1, handler; unsigned int tag, tag1, handler;
int codec_type, stream_index, frame_period, bit_rate; int codec_type, stream_index, frame_period, bit_rate;
unsigned int size; unsigned int size;
@ -752,7 +752,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
AVIStream *ast = st->priv_data; AVIStream *ast = st->priv_data;
AVInputFormat *sub_demuxer; AVInputFormat *sub_demuxer;
AVRational time_base; AVRational time_base;
ByteIOContext *pb = av_alloc_put_byte(pkt->data + 7, AVIOContext *pb = av_alloc_put_byte(pkt->data + 7,
pkt->size - 7, pkt->size - 7,
0, NULL, NULL, NULL, NULL); 0, NULL, NULL, NULL, NULL);
AVProbeData pd; AVProbeData pd;
@ -834,7 +834,7 @@ static int get_stream_idx(int *d){
static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int n, d[8]; int n, d[8];
unsigned int size; unsigned int size;
int64_t i, sync; int64_t i, sync;
@ -1110,7 +1110,7 @@ resync:
static int avi_read_idx1(AVFormatContext *s, int size) static int avi_read_idx1(AVFormatContext *s, int size)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int nb_index_entries, i; int nb_index_entries, i;
AVStream *st; AVStream *st;
AVIStream *ast; AVIStream *ast;
@ -1192,7 +1192,7 @@ static int guess_ni_flag(AVFormatContext *s){
static int avi_load_index(AVFormatContext *s) static int avi_load_index(AVFormatContext *s)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint32_t tag, size; uint32_t tag, size;
int64_t pos= url_ftell(pb); int64_t pos= url_ftell(pb);
int ret = -1; int ret = -1;

@ -63,7 +63,7 @@ static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
return &idx->cluster[cl][id]; return &idx->cluster[cl][id];
} }
static int64_t avi_start_new_riff(AVFormatContext *s, ByteIOContext *pb, static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb,
const char* riff_tag, const char* list_tag) const char* riff_tag, const char* list_tag)
{ {
AVIContext *avi= s->priv_data; AVIContext *avi= s->priv_data;
@ -102,7 +102,7 @@ static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
return tag; return tag;
} }
static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str) static void avi_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
{ {
int len = strlen(str); int len = strlen(str);
if (len > 0) { if (len > 0) {
@ -117,7 +117,7 @@ static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *s
static int avi_write_counters(AVFormatContext* s, int riff_id) static int avi_write_counters(AVFormatContext* s, int riff_id)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
int n, au_byterate, au_ssize, au_scale, nb_frames = 0; int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
int64_t file_size; int64_t file_size;
@ -152,7 +152,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
static int avi_write_header(AVFormatContext *s) static int avi_write_header(AVFormatContext *s)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale; int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
AVCodecContext *stream, *video_enc; AVCodecContext *stream, *video_enc;
int64_t list1, list2, strh, strf; int64_t list1, list2, strh, strf;
@ -393,7 +393,7 @@ static int avi_write_header(AVFormatContext *s)
static int avi_write_ix(AVFormatContext *s) static int avi_write_ix(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
char tag[5]; char tag[5];
char ix_tag[] = "ix00"; char ix_tag[] = "ix00";
@ -451,7 +451,7 @@ static int avi_write_ix(AVFormatContext *s)
static int avi_write_idx1(AVFormatContext *s) static int avi_write_idx1(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
int64_t idx_chunk; int64_t idx_chunk;
int i; int i;
@ -503,7 +503,7 @@ static int avi_write_idx1(AVFormatContext *s)
static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned char tag[5]; unsigned char tag[5];
unsigned int flags=0; unsigned int flags=0;
const int stream_index= pkt->stream_index; const int stream_index= pkt->stream_index;
@ -578,7 +578,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
static int avi_write_trailer(AVFormatContext *s) static int avi_write_trailer(AVFormatContext *s)
{ {
AVIContext *avi = s->priv_data; AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int res = 0; int res = 0;
int i, j, n, nb_frames; int i, j, n, nb_frames;
int64_t file_size; int64_t file_size;

@ -334,7 +334,7 @@ int av_register_protocol2(URLProtocol *protocol, int size);
* New fields can be added to the end with minor version bumps. * New fields can be added to the end with minor version bumps.
* Removal, reordering and changes to existing fields require a major * Removal, reordering and changes to existing fields require a major
* version bump. * version bump.
* sizeof(ByteIOContext) must not be used outside libav*. * sizeof(AVIOContext) must not be used outside libav*.
*/ */
typedef struct { typedef struct {
unsigned char *buffer; unsigned char *buffer;
@ -357,9 +357,13 @@ typedef struct {
int (*read_pause)(void *opaque, int pause); int (*read_pause)(void *opaque, int pause);
int64_t (*read_seek)(void *opaque, int stream_index, int64_t (*read_seek)(void *opaque, int stream_index,
int64_t timestamp, int flags); int64_t timestamp, int flags);
} ByteIOContext; } AVIOContext;
int init_put_byte(ByteIOContext *s, #if FF_API_OLD_AVIO
typedef attribute_deprecated AVIOContext ByteIOContext;
#endif
int init_put_byte(AVIOContext *s,
unsigned char *buffer, unsigned char *buffer,
int buffer_size, int buffer_size,
int write_flag, int write_flag,
@ -367,7 +371,7 @@ int init_put_byte(ByteIOContext *s,
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence)); int64_t (*seek)(void *opaque, int64_t offset, int whence));
ByteIOContext *av_alloc_put_byte( AVIOContext *av_alloc_put_byte(
unsigned char *buffer, unsigned char *buffer,
int buffer_size, int buffer_size,
int write_flag, int write_flag,
@ -376,111 +380,111 @@ ByteIOContext *av_alloc_put_byte(
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence)); int64_t (*seek)(void *opaque, int64_t offset, int whence));
void put_byte(ByteIOContext *s, int b); void put_byte(AVIOContext *s, int b);
void put_nbyte(ByteIOContext *s, int b, int count); void put_nbyte(AVIOContext *s, int b, int count);
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); void put_buffer(AVIOContext *s, const unsigned char *buf, int size);
void put_le64(ByteIOContext *s, uint64_t val); void put_le64(AVIOContext *s, uint64_t val);
void put_be64(ByteIOContext *s, uint64_t val); void put_be64(AVIOContext *s, uint64_t val);
void put_le32(ByteIOContext *s, unsigned int val); void put_le32(AVIOContext *s, unsigned int val);
void put_be32(ByteIOContext *s, unsigned int val); void put_be32(AVIOContext *s, unsigned int val);
void put_le24(ByteIOContext *s, unsigned int val); void put_le24(AVIOContext *s, unsigned int val);
void put_be24(ByteIOContext *s, unsigned int val); void put_be24(AVIOContext *s, unsigned int val);
void put_le16(ByteIOContext *s, unsigned int val); void put_le16(AVIOContext *s, unsigned int val);
void put_be16(ByteIOContext *s, unsigned int val); void put_be16(AVIOContext *s, unsigned int val);
void put_tag(ByteIOContext *s, const char *tag); void put_tag(AVIOContext *s, const char *tag);
#if FF_API_OLD_AVIO #if FF_API_OLD_AVIO
attribute_deprecated void put_strz(ByteIOContext *s, const char *buf); attribute_deprecated void put_strz(AVIOContext *s, const char *buf);
#endif #endif
/** /**
* Write a NULL-terminated string. * Write a NULL-terminated string.
* @return number of bytes written. * @return number of bytes written.
*/ */
int avio_put_str(ByteIOContext *s, const char *str); int avio_put_str(AVIOContext *s, const char *str);
/** /**
* Convert an UTF-8 string to UTF-16LE and write it. * Convert an UTF-8 string to UTF-16LE and write it.
* @return number of bytes written. * @return number of bytes written.
*/ */
int avio_put_str16le(ByteIOContext *s, const char *str); int avio_put_str16le(AVIOContext *s, const char *str);
/** /**
* fseek() equivalent for ByteIOContext. * fseek() equivalent for AVIOContext.
* @return new position or AVERROR. * @return new position or AVERROR.
*/ */
int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence); int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
/** /**
* Skip given number of bytes forward. * Skip given number of bytes forward.
* @param offset number of bytes * @param offset number of bytes
* @return 0 on success, <0 on error * @return 0 on success, <0 on error
*/ */
int url_fskip(ByteIOContext *s, int64_t offset); int url_fskip(AVIOContext *s, int64_t offset);
/** /**
* ftell() equivalent for ByteIOContext. * ftell() equivalent for AVIOContext.
* @return position or AVERROR. * @return position or AVERROR.
*/ */
int64_t url_ftell(ByteIOContext *s); int64_t url_ftell(AVIOContext *s);
/** /**
* Get the filesize. * Get the filesize.
* @return filesize or AVERROR * @return filesize or AVERROR
*/ */
int64_t url_fsize(ByteIOContext *s); int64_t url_fsize(AVIOContext *s);
/** /**
* feof() equivalent for ByteIOContext. * feof() equivalent for AVIOContext.
* @return non zero if and only if end of file * @return non zero if and only if end of file
*/ */
int url_feof(ByteIOContext *s); int url_feof(AVIOContext *s);
int url_ferror(ByteIOContext *s); int url_ferror(AVIOContext *s);
int av_url_read_fpause(ByteIOContext *h, int pause); int av_url_read_fpause(AVIOContext *h, int pause);
int64_t av_url_read_fseek(ByteIOContext *h, int stream_index, int64_t av_url_read_fseek(AVIOContext *h, int stream_index,
int64_t timestamp, int flags); int64_t timestamp, int flags);
#define URL_EOF (-1) #define URL_EOF (-1)
/** @note return URL_EOF (-1) if EOF */ /** @note return URL_EOF (-1) if EOF */
int url_fgetc(ByteIOContext *s); int url_fgetc(AVIOContext *s);
/** @warning currently size is limited */ /** @warning currently size is limited */
#ifdef __GNUC__ #ifdef __GNUC__
int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
#else #else
int url_fprintf(ByteIOContext *s, const char *fmt, ...); int url_fprintf(AVIOContext *s, const char *fmt, ...);
#endif #endif
/** @note unlike fgets, the EOL character is not returned and a whole /** @note unlike fgets, the EOL character is not returned and a whole
line is parsed. return NULL if first char read was EOF */ line is parsed. return NULL if first char read was EOF */
char *url_fgets(ByteIOContext *s, char *buf, int buf_size); char *url_fgets(AVIOContext *s, char *buf, int buf_size);
void put_flush_packet(ByteIOContext *s); void put_flush_packet(AVIOContext *s);
/** /**
* Read size bytes from ByteIOContext into buf. * Read size bytes from AVIOContext into buf.
* @return number of bytes read or AVERROR * @return number of bytes read or AVERROR
*/ */
int get_buffer(ByteIOContext *s, unsigned char *buf, int size); int get_buffer(AVIOContext *s, unsigned char *buf, int size);
/** /**
* Read size bytes from ByteIOContext into buf. * Read size bytes from AVIOContext into buf.
* This reads at most 1 packet. If that is not enough fewer bytes will be * This reads at most 1 packet. If that is not enough fewer bytes will be
* returned. * returned.
* @return number of bytes read or AVERROR * @return number of bytes read or AVERROR
*/ */
int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size); int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
/** @note return 0 if EOF, so you cannot use it if EOF handling is /** @note return 0 if EOF, so you cannot use it if EOF handling is
necessary */ necessary */
int get_byte(ByteIOContext *s); int get_byte(AVIOContext *s);
unsigned int get_le24(ByteIOContext *s); unsigned int get_le24(AVIOContext *s);
unsigned int get_le32(ByteIOContext *s); unsigned int get_le32(AVIOContext *s);
uint64_t get_le64(ByteIOContext *s); uint64_t get_le64(AVIOContext *s);
unsigned int get_le16(ByteIOContext *s); unsigned int get_le16(AVIOContext *s);
/** /**
* Read a UTF-16 string from pb and convert it to UTF-8. * Read a UTF-16 string from pb and convert it to UTF-8.
@ -488,77 +492,77 @@ unsigned int get_le16(ByteIOContext *s);
* encountered or maxlen bytes have been read. * encountered or maxlen bytes have been read.
* @return number of bytes read (is always <= maxlen) * @return number of bytes read (is always <= maxlen)
*/ */
int avio_get_str16le(ByteIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
int avio_get_str16be(ByteIOContext *pb, int maxlen, char *buf, int buflen); int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
char *get_strz(ByteIOContext *s, char *buf, int maxlen); char *get_strz(AVIOContext *s, char *buf, int maxlen);
unsigned int get_be16(ByteIOContext *s); unsigned int get_be16(AVIOContext *s);
unsigned int get_be24(ByteIOContext *s); unsigned int get_be24(AVIOContext *s);
unsigned int get_be32(ByteIOContext *s); unsigned int get_be32(AVIOContext *s);
uint64_t get_be64(ByteIOContext *s); uint64_t get_be64(AVIOContext *s);
uint64_t ff_get_v(ByteIOContext *bc); uint64_t ff_get_v(AVIOContext *bc);
static inline int url_is_streamed(ByteIOContext *s) static inline int url_is_streamed(AVIOContext *s)
{ {
return s->is_streamed; return s->is_streamed;
} }
/** /**
* Create and initialize a ByteIOContext for accessing the * Create and initialize a AVIOContext for accessing the
* resource referenced by the URLContext h. * resource referenced by the URLContext h.
* @note When the URLContext h has been opened in read+write mode, the * @note When the URLContext h has been opened in read+write mode, the
* ByteIOContext can be used only for writing. * AVIOContext can be used only for writing.
* *
* @param s Used to return the pointer to the created ByteIOContext. * @param s Used to return the pointer to the created AVIOContext.
* In case of failure the pointed to value is set to NULL. * In case of failure the pointed to value is set to NULL.
* @return 0 in case of success, a negative value corresponding to an * @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure * AVERROR code in case of failure
*/ */
int url_fdopen(ByteIOContext **s, URLContext *h); int url_fdopen(AVIOContext **s, URLContext *h);
/** @warning must be called before any I/O */ /** @warning must be called before any I/O */
int url_setbufsize(ByteIOContext *s, int buf_size); int url_setbufsize(AVIOContext *s, int buf_size);
#if FF_API_URL_RESETBUF #if FF_API_URL_RESETBUF
/** Reset the buffer for reading or writing. /** Reset the buffer for reading or writing.
* @note Will drop any data currently in the buffer without transmitting it. * @note Will drop any data currently in the buffer without transmitting it.
* @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
* to set up the buffer for writing. */ * to set up the buffer for writing. */
int url_resetbuf(ByteIOContext *s, int flags); int url_resetbuf(AVIOContext *s, int flags);
#endif #endif
/** /**
* Rewind the ByteIOContext using the specified buffer containing the first buf_size bytes of the file. * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file.
* Used after probing to avoid seeking. * Used after probing to avoid seeking.
* Joins buf and s->buffer, taking any overlap into consideration. * Joins buf and s->buffer, taking any overlap into consideration.
* @note s->buffer must overlap with buf or they can't be joined and the function fails * @note s->buffer must overlap with buf or they can't be joined and the function fails
* @note This function is NOT part of the public API * @note This function is NOT part of the public API
* *
* @param s The read-only ByteIOContext to rewind * @param s The read-only AVIOContext to rewind
* @param buf The probe buffer containing the first buf_size bytes of the file * @param buf The probe buffer containing the first buf_size bytes of the file
* @param buf_size The size of buf * @param buf_size The size of buf
* @return 0 in case of success, a negative value corresponding to an * @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure * AVERROR code in case of failure
*/ */
int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size); int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size);
/** /**
* Create and initialize a ByteIOContext for accessing the * Create and initialize a AVIOContext for accessing the
* resource indicated by url. * resource indicated by url.
* @note When the resource indicated by url has been opened in * @note When the resource indicated by url has been opened in
* read+write mode, the ByteIOContext can be used only for writing. * read+write mode, the AVIOContext can be used only for writing.
* *
* @param s Used to return the pointer to the created ByteIOContext. * @param s Used to return the pointer to the created AVIOContext.
* In case of failure the pointed to value is set to NULL. * In case of failure the pointed to value is set to NULL.
* @param flags flags which control how the resource indicated by url * @param flags flags which control how the resource indicated by url
* is to be opened * is to be opened
* @return 0 in case of success, a negative value corresponding to an * @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure * AVERROR code in case of failure
*/ */
int url_fopen(ByteIOContext **s, const char *url, int flags); int url_fopen(AVIOContext **s, const char *url, int flags);
int url_fclose(ByteIOContext *s); int url_fclose(AVIOContext *s);
URLContext *url_fileno(ByteIOContext *s); URLContext *url_fileno(AVIOContext *s);
/** /**
* Return the maximum packet size associated to packetized buffered file * Return the maximum packet size associated to packetized buffered file
@ -568,12 +572,12 @@ URLContext *url_fileno(ByteIOContext *s);
* @param s buffered file handle * @param s buffered file handle
* @return maximum packet size in bytes * @return maximum packet size in bytes
*/ */
int url_fget_max_packet_size(ByteIOContext *s); int url_fget_max_packet_size(AVIOContext *s);
int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags); int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
/** return the written or read size */ /** return the written or read size */
int url_close_buf(ByteIOContext *s); int url_close_buf(AVIOContext *s);
/** /**
* Open a write only memory stream. * Open a write only memory stream.
@ -581,7 +585,7 @@ int url_close_buf(ByteIOContext *s);
* @param s new IO context * @param s new IO context
* @return zero if no error. * @return zero if no error.
*/ */
int url_open_dyn_buf(ByteIOContext **s); int url_open_dyn_buf(AVIOContext **s);
/** /**
* Open a write only packetized memory stream with a maximum packet * Open a write only packetized memory stream with a maximum packet
@ -592,7 +596,7 @@ int url_open_dyn_buf(ByteIOContext **s);
* @param max_packet_size maximum packet size (must be > 0) * @param max_packet_size maximum packet size (must be > 0)
* @return zero if no error. * @return zero if no error.
*/ */
int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size); int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
/** /**
* Return the written size and a pointer to the buffer. The buffer * Return the written size and a pointer to the buffer. The buffer
@ -604,12 +608,12 @@ int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size);
* @param pbuffer pointer to a byte buffer * @param pbuffer pointer to a byte buffer
* @return the length of the byte buffer * @return the length of the byte buffer
*/ */
int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
unsigned int len); unsigned int len);
unsigned long get_checksum(ByteIOContext *s); unsigned long get_checksum(AVIOContext *s);
void init_checksum(ByteIOContext *s, void init_checksum(AVIOContext *s,
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
unsigned long checksum); unsigned long checksum);

@ -35,12 +35,12 @@
*/ */
#define SHORT_SEEK_THRESHOLD 4096 #define SHORT_SEEK_THRESHOLD 4096
static void fill_buffer(ByteIOContext *s); static void fill_buffer(AVIOContext *s);
#if !FF_API_URL_RESETBUF #if !FF_API_URL_RESETBUF
static int url_resetbuf(ByteIOContext *s, int flags); static int url_resetbuf(AVIOContext *s, int flags);
#endif #endif
int init_put_byte(ByteIOContext *s, int init_put_byte(AVIOContext *s,
unsigned char *buffer, unsigned char *buffer,
int buffer_size, int buffer_size,
int write_flag, int write_flag,
@ -73,7 +73,7 @@ int init_put_byte(ByteIOContext *s,
return 0; return 0;
} }
ByteIOContext *av_alloc_put_byte( AVIOContext *av_alloc_put_byte(
unsigned char *buffer, unsigned char *buffer,
int buffer_size, int buffer_size,
int write_flag, int write_flag,
@ -82,13 +82,13 @@ ByteIOContext *av_alloc_put_byte(
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence)) int64_t (*seek)(void *opaque, int64_t offset, int whence))
{ {
ByteIOContext *s = av_mallocz(sizeof(ByteIOContext)); AVIOContext *s = av_mallocz(sizeof(AVIOContext));
init_put_byte(s, buffer, buffer_size, write_flag, opaque, init_put_byte(s, buffer, buffer_size, write_flag, opaque,
read_packet, write_packet, seek); read_packet, write_packet, seek);
return s; return s;
} }
static void flush_buffer(ByteIOContext *s) static void flush_buffer(AVIOContext *s)
{ {
if (s->buf_ptr > s->buffer) { if (s->buf_ptr > s->buffer) {
if (s->write_packet && !s->error){ if (s->write_packet && !s->error){
@ -106,14 +106,14 @@ static void flush_buffer(ByteIOContext *s)
s->buf_ptr = s->buffer; s->buf_ptr = s->buffer;
} }
void put_byte(ByteIOContext *s, int b) void put_byte(AVIOContext *s, int b)
{ {
*(s->buf_ptr)++ = b; *(s->buf_ptr)++ = b;
if (s->buf_ptr >= s->buf_end) if (s->buf_ptr >= s->buf_end)
flush_buffer(s); flush_buffer(s);
} }
void put_nbyte(ByteIOContext *s, int b, int count) void put_nbyte(AVIOContext *s, int b, int count)
{ {
while (count > 0) { while (count > 0) {
int len = FFMIN(s->buf_end - s->buf_ptr, count); int len = FFMIN(s->buf_end - s->buf_ptr, count);
@ -127,7 +127,7 @@ void put_nbyte(ByteIOContext *s, int b, int count)
} }
} }
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) void put_buffer(AVIOContext *s, const unsigned char *buf, int size)
{ {
while (size > 0) { while (size > 0) {
int len = FFMIN(s->buf_end - s->buf_ptr, size); int len = FFMIN(s->buf_end - s->buf_ptr, size);
@ -142,13 +142,13 @@ void put_buffer(ByteIOContext *s, const unsigned char *buf, int size)
} }
} }
void put_flush_packet(ByteIOContext *s) void put_flush_packet(AVIOContext *s)
{ {
flush_buffer(s); flush_buffer(s);
s->must_flush = 0; s->must_flush = 0;
} }
int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence) int64_t url_fseek(AVIOContext *s, int64_t offset, int whence)
{ {
int64_t offset1; int64_t offset1;
int64_t pos; int64_t pos;
@ -205,18 +205,18 @@ int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
return offset; return offset;
} }
int url_fskip(ByteIOContext *s, int64_t offset) int url_fskip(AVIOContext *s, int64_t offset)
{ {
int64_t ret = url_fseek(s, offset, SEEK_CUR); int64_t ret = url_fseek(s, offset, SEEK_CUR);
return ret < 0 ? ret : 0; return ret < 0 ? ret : 0;
} }
int64_t url_ftell(ByteIOContext *s) int64_t url_ftell(AVIOContext *s)
{ {
return url_fseek(s, 0, SEEK_CUR); return url_fseek(s, 0, SEEK_CUR);
} }
int64_t url_fsize(ByteIOContext *s) int64_t url_fsize(AVIOContext *s)
{ {
int64_t size; int64_t size;
@ -235,21 +235,21 @@ int64_t url_fsize(ByteIOContext *s)
return size; return size;
} }
int url_feof(ByteIOContext *s) int url_feof(AVIOContext *s)
{ {
if(!s) if(!s)
return 0; return 0;
return s->eof_reached; return s->eof_reached;
} }
int url_ferror(ByteIOContext *s) int url_ferror(AVIOContext *s)
{ {
if(!s) if(!s)
return 0; return 0;
return s->error; return s->error;
} }
void put_le32(ByteIOContext *s, unsigned int val) void put_le32(AVIOContext *s, unsigned int val)
{ {
put_byte(s, val); put_byte(s, val);
put_byte(s, val >> 8); put_byte(s, val >> 8);
@ -257,7 +257,7 @@ void put_le32(ByteIOContext *s, unsigned int val)
put_byte(s, val >> 24); put_byte(s, val >> 24);
} }
void put_be32(ByteIOContext *s, unsigned int val) void put_be32(AVIOContext *s, unsigned int val)
{ {
put_byte(s, val >> 24); put_byte(s, val >> 24);
put_byte(s, val >> 16); put_byte(s, val >> 16);
@ -266,13 +266,13 @@ void put_be32(ByteIOContext *s, unsigned int val)
} }
#if FF_API_OLD_AVIO #if FF_API_OLD_AVIO
void put_strz(ByteIOContext *s, const char *str) void put_strz(AVIOContext *s, const char *str)
{ {
avio_put_str(s, str); avio_put_str(s, str);
} }
#endif #endif
int avio_put_str(ByteIOContext *s, const char *str) int avio_put_str(AVIOContext *s, const char *str)
{ {
int len = 1; int len = 1;
if (str) { if (str) {
@ -283,7 +283,7 @@ int avio_put_str(ByteIOContext *s, const char *str)
return len; return len;
} }
int avio_put_str16le(ByteIOContext *s, const char *str) int avio_put_str16le(AVIOContext *s, const char *str)
{ {
const uint8_t *q = str; const uint8_t *q = str;
int ret = 0; int ret = 0;
@ -309,7 +309,7 @@ int ff_get_v_length(uint64_t val){
return i; return i;
} }
void ff_put_v(ByteIOContext *bc, uint64_t val){ void ff_put_v(AVIOContext *bc, uint64_t val){
int i= ff_get_v_length(val); int i= ff_get_v_length(val);
while(--i>0) while(--i>0)
@ -318,43 +318,43 @@ void ff_put_v(ByteIOContext *bc, uint64_t val){
put_byte(bc, val&127); put_byte(bc, val&127);
} }
void put_le64(ByteIOContext *s, uint64_t val) void put_le64(AVIOContext *s, uint64_t val)
{ {
put_le32(s, (uint32_t)(val & 0xffffffff)); put_le32(s, (uint32_t)(val & 0xffffffff));
put_le32(s, (uint32_t)(val >> 32)); put_le32(s, (uint32_t)(val >> 32));
} }
void put_be64(ByteIOContext *s, uint64_t val) void put_be64(AVIOContext *s, uint64_t val)
{ {
put_be32(s, (uint32_t)(val >> 32)); put_be32(s, (uint32_t)(val >> 32));
put_be32(s, (uint32_t)(val & 0xffffffff)); put_be32(s, (uint32_t)(val & 0xffffffff));
} }
void put_le16(ByteIOContext *s, unsigned int val) void put_le16(AVIOContext *s, unsigned int val)
{ {
put_byte(s, val); put_byte(s, val);
put_byte(s, val >> 8); put_byte(s, val >> 8);
} }
void put_be16(ByteIOContext *s, unsigned int val) void put_be16(AVIOContext *s, unsigned int val)
{ {
put_byte(s, val >> 8); put_byte(s, val >> 8);
put_byte(s, val); put_byte(s, val);
} }
void put_le24(ByteIOContext *s, unsigned int val) void put_le24(AVIOContext *s, unsigned int val)
{ {
put_le16(s, val & 0xffff); put_le16(s, val & 0xffff);
put_byte(s, val >> 16); put_byte(s, val >> 16);
} }
void put_be24(ByteIOContext *s, unsigned int val) void put_be24(AVIOContext *s, unsigned int val)
{ {
put_be16(s, val >> 8); put_be16(s, val >> 8);
put_byte(s, val); put_byte(s, val);
} }
void put_tag(ByteIOContext *s, const char *tag) void put_tag(AVIOContext *s, const char *tag)
{ {
while (*tag) { while (*tag) {
put_byte(s, *tag++); put_byte(s, *tag++);
@ -363,7 +363,7 @@ void put_tag(ByteIOContext *s, const char *tag)
/* Input stream */ /* Input stream */
static void fill_buffer(ByteIOContext *s) static void fill_buffer(AVIOContext *s)
{ {
uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_ptr : s->buffer; uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_ptr : s->buffer;
int len= s->buffer_size - (dst - s->buffer); int len= s->buffer_size - (dst - s->buffer);
@ -410,14 +410,14 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len); return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len);
} }
unsigned long get_checksum(ByteIOContext *s) unsigned long get_checksum(AVIOContext *s)
{ {
s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr); s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
s->update_checksum= NULL; s->update_checksum= NULL;
return s->checksum; return s->checksum;
} }
void init_checksum(ByteIOContext *s, void init_checksum(AVIOContext *s,
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
unsigned long checksum) unsigned long checksum)
{ {
@ -429,7 +429,7 @@ void init_checksum(ByteIOContext *s,
} }
/* XXX: put an inline version */ /* XXX: put an inline version */
int get_byte(ByteIOContext *s) int get_byte(AVIOContext *s)
{ {
if (s->buf_ptr >= s->buf_end) if (s->buf_ptr >= s->buf_end)
fill_buffer(s); fill_buffer(s);
@ -438,7 +438,7 @@ int get_byte(ByteIOContext *s)
return 0; return 0;
} }
int url_fgetc(ByteIOContext *s) int url_fgetc(AVIOContext *s)
{ {
if (s->buf_ptr >= s->buf_end) if (s->buf_ptr >= s->buf_end)
fill_buffer(s); fill_buffer(s);
@ -447,7 +447,7 @@ int url_fgetc(ByteIOContext *s)
return URL_EOF; return URL_EOF;
} }
int get_buffer(ByteIOContext *s, unsigned char *buf, int size) int get_buffer(AVIOContext *s, unsigned char *buf, int size)
{ {
int len, size1; int len, size1;
@ -494,7 +494,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
return size1 - size; return size1 - size;
} }
int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
{ {
int len; int len;
@ -517,7 +517,7 @@ int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
return len; return len;
} }
unsigned int get_le16(ByteIOContext *s) unsigned int get_le16(AVIOContext *s)
{ {
unsigned int val; unsigned int val;
val = get_byte(s); val = get_byte(s);
@ -525,7 +525,7 @@ unsigned int get_le16(ByteIOContext *s)
return val; return val;
} }
unsigned int get_le24(ByteIOContext *s) unsigned int get_le24(AVIOContext *s)
{ {
unsigned int val; unsigned int val;
val = get_le16(s); val = get_le16(s);
@ -533,7 +533,7 @@ unsigned int get_le24(ByteIOContext *s)
return val; return val;
} }
unsigned int get_le32(ByteIOContext *s) unsigned int get_le32(AVIOContext *s)
{ {
unsigned int val; unsigned int val;
val = get_le16(s); val = get_le16(s);
@ -541,7 +541,7 @@ unsigned int get_le32(ByteIOContext *s)
return val; return val;
} }
uint64_t get_le64(ByteIOContext *s) uint64_t get_le64(AVIOContext *s)
{ {
uint64_t val; uint64_t val;
val = (uint64_t)get_le32(s); val = (uint64_t)get_le32(s);
@ -549,7 +549,7 @@ uint64_t get_le64(ByteIOContext *s)
return val; return val;
} }
unsigned int get_be16(ByteIOContext *s) unsigned int get_be16(AVIOContext *s)
{ {
unsigned int val; unsigned int val;
val = get_byte(s) << 8; val = get_byte(s) << 8;
@ -557,14 +557,14 @@ unsigned int get_be16(ByteIOContext *s)
return val; return val;
} }
unsigned int get_be24(ByteIOContext *s) unsigned int get_be24(AVIOContext *s)
{ {
unsigned int val; unsigned int val;
val = get_be16(s) << 8; val = get_be16(s) << 8;
val |= get_byte(s); val |= get_byte(s);
return val; return val;
} }
unsigned int get_be32(ByteIOContext *s) unsigned int get_be32(AVIOContext *s)
{ {
unsigned int val; unsigned int val;
val = get_be16(s) << 16; val = get_be16(s) << 16;
@ -572,7 +572,7 @@ unsigned int get_be32(ByteIOContext *s)
return val; return val;
} }
char *get_strz(ByteIOContext *s, char *buf, int maxlen) char *get_strz(AVIOContext *s, char *buf, int maxlen)
{ {
int i = 0; int i = 0;
char c; char c;
@ -587,7 +587,7 @@ char *get_strz(ByteIOContext *s, char *buf, int maxlen)
return buf; return buf;
} }
int ff_get_line(ByteIOContext *s, char *buf, int maxlen) int ff_get_line(AVIOContext *s, char *buf, int maxlen)
{ {
int i = 0; int i = 0;
char c; char c;
@ -603,7 +603,7 @@ int ff_get_line(ByteIOContext *s, char *buf, int maxlen)
} }
#define GET_STR16(type, read) \ #define GET_STR16(type, read) \
int avio_get_str16 ##type(ByteIOContext *pb, int maxlen, char *buf, int buflen)\ int avio_get_str16 ##type(AVIOContext *pb, int maxlen, char *buf, int buflen)\
{\ {\
char* q = buf;\ char* q = buf;\
int ret = 0;\ int ret = 0;\
@ -624,7 +624,7 @@ GET_STR16(be, get_be16)
#undef GET_STR16 #undef GET_STR16
uint64_t get_be64(ByteIOContext *s) uint64_t get_be64(AVIOContext *s)
{ {
uint64_t val; uint64_t val;
val = (uint64_t)get_be32(s) << 32; val = (uint64_t)get_be32(s) << 32;
@ -632,7 +632,7 @@ uint64_t get_be64(ByteIOContext *s)
return val; return val;
} }
uint64_t ff_get_v(ByteIOContext *bc){ uint64_t ff_get_v(AVIOContext *bc){
uint64_t val = 0; uint64_t val = 0;
int tmp; int tmp;
@ -643,7 +643,7 @@ uint64_t ff_get_v(ByteIOContext *bc){
return val; return val;
} }
int url_fdopen(ByteIOContext **s, URLContext *h) int url_fdopen(AVIOContext **s, URLContext *h)
{ {
uint8_t *buffer; uint8_t *buffer;
int buffer_size, max_packet_size; int buffer_size, max_packet_size;
@ -658,7 +658,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h)
if (!buffer) if (!buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
*s = av_mallocz(sizeof(ByteIOContext)); *s = av_mallocz(sizeof(AVIOContext));
if(!*s) { if(!*s) {
av_free(buffer); av_free(buffer);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -680,7 +680,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h)
return 0; return 0;
} }
int url_setbufsize(ByteIOContext *s, int buf_size) int url_setbufsize(AVIOContext *s, int buf_size)
{ {
uint8_t *buffer; uint8_t *buffer;
buffer = av_malloc(buf_size); buffer = av_malloc(buf_size);
@ -696,9 +696,9 @@ int url_setbufsize(ByteIOContext *s, int buf_size)
} }
#if FF_API_URL_RESETBUF #if FF_API_URL_RESETBUF
int url_resetbuf(ByteIOContext *s, int flags) int url_resetbuf(AVIOContext *s, int flags)
#else #else
static int url_resetbuf(ByteIOContext *s, int flags) static int url_resetbuf(AVIOContext *s, int flags)
#endif #endif
{ {
#if FF_API_URL_RESETBUF #if FF_API_URL_RESETBUF
@ -718,7 +718,7 @@ static int url_resetbuf(ByteIOContext *s, int flags)
return 0; return 0;
} }
int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size) int ff_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size)
{ {
int64_t buffer_start; int64_t buffer_start;
int buffer_size; int buffer_size;
@ -757,7 +757,7 @@ int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size
return 0; return 0;
} }
int url_fopen(ByteIOContext **s, const char *filename, int flags) int url_fopen(AVIOContext **s, const char *filename, int flags)
{ {
URLContext *h; URLContext *h;
int err; int err;
@ -773,7 +773,7 @@ int url_fopen(ByteIOContext **s, const char *filename, int flags)
return 0; return 0;
} }
int url_fclose(ByteIOContext *s) int url_fclose(AVIOContext *s)
{ {
URLContext *h = s->opaque; URLContext *h = s->opaque;
@ -782,13 +782,13 @@ int url_fclose(ByteIOContext *s)
return url_close(h); return url_close(h);
} }
URLContext *url_fileno(ByteIOContext *s) URLContext *url_fileno(AVIOContext *s)
{ {
return s->opaque; return s->opaque;
} }
#if CONFIG_MUXERS #if CONFIG_MUXERS
int url_fprintf(ByteIOContext *s, const char *fmt, ...) int url_fprintf(AVIOContext *s, const char *fmt, ...)
{ {
va_list ap; va_list ap;
char buf[4096]; char buf[4096];
@ -802,7 +802,7 @@ int url_fprintf(ByteIOContext *s, const char *fmt, ...)
} }
#endif //CONFIG_MUXERS #endif //CONFIG_MUXERS
char *url_fgets(ByteIOContext *s, char *buf, int buf_size) char *url_fgets(AVIOContext *s, char *buf, int buf_size)
{ {
int c; int c;
char *q; char *q;
@ -823,19 +823,19 @@ char *url_fgets(ByteIOContext *s, char *buf, int buf_size)
return buf; return buf;
} }
int url_fget_max_packet_size(ByteIOContext *s) int url_fget_max_packet_size(AVIOContext *s)
{ {
return s->max_packet_size; return s->max_packet_size;
} }
int av_url_read_fpause(ByteIOContext *s, int pause) int av_url_read_fpause(AVIOContext *s, int pause)
{ {
if (!s->read_pause) if (!s->read_pause)
return AVERROR(ENOSYS); return AVERROR(ENOSYS);
return s->read_pause(s->opaque, pause); return s->read_pause(s->opaque, pause);
} }
int64_t av_url_read_fseek(ByteIOContext *s, int stream_index, int64_t av_url_read_fseek(AVIOContext *s, int stream_index,
int64_t timestamp, int flags) int64_t timestamp, int flags)
{ {
URLContext *h = s->opaque; URLContext *h = s->opaque;
@ -859,10 +859,10 @@ int64_t av_url_read_fseek(ByteIOContext *s, int stream_index,
* back to the server even if CONFIG_MUXERS is false. */ * back to the server even if CONFIG_MUXERS is false. */
#if CONFIG_MUXERS || CONFIG_NETWORK #if CONFIG_MUXERS || CONFIG_NETWORK
/* buffer handling */ /* buffer handling */
int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags) int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
{ {
int ret; int ret;
*s = av_mallocz(sizeof(ByteIOContext)); *s = av_mallocz(sizeof(AVIOContext));
if(!*s) if(!*s)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ret = init_put_byte(*s, buf, buf_size, ret = init_put_byte(*s, buf, buf_size,
@ -873,7 +873,7 @@ int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags)
return ret; return ret;
} }
int url_close_buf(ByteIOContext *s) int url_close_buf(AVIOContext *s)
{ {
put_flush_packet(s); put_flush_packet(s);
return s->buf_ptr - s->buffer; return s->buf_ptr - s->buffer;
@ -947,7 +947,7 @@ static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence)
return 0; return 0;
} }
static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size) static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size)
{ {
DynBuffer *d; DynBuffer *d;
int ret; int ret;
@ -958,7 +958,7 @@ static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size)
d = av_mallocz(sizeof(DynBuffer) + io_buffer_size); d = av_mallocz(sizeof(DynBuffer) + io_buffer_size);
if (!d) if (!d)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
*s = av_mallocz(sizeof(ByteIOContext)); *s = av_mallocz(sizeof(AVIOContext));
if(!*s) { if(!*s) {
av_free(d); av_free(d);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@ -977,19 +977,19 @@ static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size)
return ret; return ret;
} }
int url_open_dyn_buf(ByteIOContext **s) int url_open_dyn_buf(AVIOContext **s)
{ {
return url_open_dyn_buf_internal(s, 0); return url_open_dyn_buf_internal(s, 0);
} }
int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size) int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
{ {
if (max_packet_size <= 0) if (max_packet_size <= 0)
return -1; return -1;
return url_open_dyn_buf_internal(s, max_packet_size); return url_open_dyn_buf_internal(s, max_packet_size);
} }
int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
{ {
DynBuffer *d = s->opaque; DynBuffer *d = s->opaque;
int size; int size;

@ -60,7 +60,7 @@ static int vid_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
BVID_DemuxContext *vid = s->priv_data; BVID_DemuxContext *vid = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *stream; AVStream *stream;
/* load main header. Contents: /* load main header. Contents:
@ -97,7 +97,7 @@ static int vid_read_header(AVFormatContext *s,
} }
#define BUFFER_PADDING_SIZE 1000 #define BUFFER_PADDING_SIZE 1000
static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt, static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
uint8_t block_type, AVFormatContext *s, int npixels) uint8_t block_type, AVFormatContext *s, int npixels)
{ {
uint8_t * vidbuf_start = NULL; uint8_t * vidbuf_start = NULL;
@ -174,7 +174,7 @@ static int vid_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
BVID_DemuxContext *vid = s->priv_data; BVID_DemuxContext *vid = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned char block_type; unsigned char block_type;
int audio_length; int audio_length;
int ret_value; int ret_value;

@ -49,7 +49,7 @@ static int bfi_probe(AVProbeData * p)
static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
{ {
BFIContext *bfi = s->priv_data; BFIContext *bfi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *vstream; AVStream *vstream;
AVStream *astream; AVStream *astream;
int fps, chunk_header; int fps, chunk_header;
@ -107,7 +107,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
{ {
BFIContext *bfi = s->priv_data; BFIContext *bfi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret, audio_offset, video_offset, chunk_size, audio_size = 0; int ret, audio_offset, video_offset, chunk_size, audio_size = 0;
if (bfi->nframes == 0 || url_feof(pb)) { if (bfi->nframes == 0 || url_feof(pb)) {
return AVERROR(EIO); return AVERROR(EIO);

@ -70,7 +70,7 @@ static int probe(AVProbeData *p)
static int read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
BinkDemuxContext *bink = s->priv_data; BinkDemuxContext *bink = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint32_t fps_num, fps_den; uint32_t fps_num, fps_den;
AVStream *vst, *ast; AVStream *vst, *ast;
unsigned int i; unsigned int i;
@ -177,7 +177,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
static int read_packet(AVFormatContext *s, AVPacket *pkt) static int read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
BinkDemuxContext *bink = s->priv_data; BinkDemuxContext *bink = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret; int ret;
if (bink->current_track < 0) { if (bink->current_track < 0) {

@ -60,7 +60,7 @@ static int read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
AVStream *video; AVStream *video;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
C93DemuxContext *c93 = s->priv_data; C93DemuxContext *c93 = s->priv_data;
int i; int i;
int framecount = 0; int framecount = 0;
@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s,
static int read_packet(AVFormatContext *s, AVPacket *pkt) static int read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
C93DemuxContext *c93 = s->priv_data; C93DemuxContext *c93 = s->priv_data;
C93BlockRecord *br = &c93->block_records[c93->current_block]; C93BlockRecord *br = &c93->block_records[c93->current_block];
int datasize; int datasize;

@ -53,7 +53,7 @@ static int probe(AVProbeData *p)
/** Read audio description chunk */ /** Read audio description chunk */
static int read_desc_chunk(AVFormatContext *s) static int read_desc_chunk(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
CaffContext *caf = s->priv_data; CaffContext *caf = s->priv_data;
AVStream *st; AVStream *st;
int flags; int flags;
@ -93,7 +93,7 @@ static int read_desc_chunk(AVFormatContext *s)
/** Read magic cookie chunk */ /** Read magic cookie chunk */
static int read_kuki_chunk(AVFormatContext *s, int64_t size) static int read_kuki_chunk(AVFormatContext *s, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
@ -144,7 +144,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
/** Read packet table chunk */ /** Read packet table chunk */
static int read_pakt_chunk(AVFormatContext *s, int64_t size) static int read_pakt_chunk(AVFormatContext *s, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
CaffContext *caf = s->priv_data; CaffContext *caf = s->priv_data;
int64_t pos = 0, ccount; int64_t pos = 0, ccount;
@ -179,7 +179,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
/** Read information chunk */ /** Read information chunk */
static void read_info_chunk(AVFormatContext *s, int64_t size) static void read_info_chunk(AVFormatContext *s, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int i; unsigned int i;
unsigned int nb_entries = get_be32(pb); unsigned int nb_entries = get_be32(pb);
for (i = 0; i < nb_entries; i++) { for (i = 0; i < nb_entries; i++) {
@ -194,7 +194,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size)
static int read_header(AVFormatContext *s, static int read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
CaffContext *caf = s->priv_data; CaffContext *caf = s->priv_data;
AVStream *st; AVStream *st;
uint32_t tag = 0; uint32_t tag = 0;
@ -301,7 +301,7 @@ static int read_header(AVFormatContext *s,
static int read_packet(AVFormatContext *s, AVPacket *pkt) static int read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
CaffContext *caf = s->priv_data; CaffContext *caf = s->priv_data;
int res, pkt_size = 0, pkt_frames = 0; int res, pkt_size = 0, pkt_frames = 0;

@ -36,7 +36,7 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
} }
static int daud_packet(AVFormatContext *s, AVPacket *pkt) { static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret, size; int ret, size;
if (url_feof(pb)) if (url_feof(pb))
return AVERROR(EIO); return AVERROR(EIO);

@ -70,7 +70,7 @@ static int cin_probe(AVProbeData *p)
return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_MAX;
} }
static int cin_read_file_header(CinDemuxContext *cin, ByteIOContext *pb) { static int cin_read_file_header(CinDemuxContext *cin, AVIOContext *pb) {
CinFileHeader *hdr = &cin->file_header; CinFileHeader *hdr = &cin->file_header;
if (get_le32(pb) != 0x55AA0000) if (get_le32(pb) != 0x55AA0000)
@ -95,7 +95,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
int rc; int rc;
CinDemuxContext *cin = s->priv_data; CinDemuxContext *cin = s->priv_data;
CinFileHeader *hdr = &cin->file_header; CinFileHeader *hdr = &cin->file_header;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
rc = cin_read_file_header(cin, pb); rc = cin_read_file_header(cin, pb);
@ -138,7 +138,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
return 0; return 0;
} }
static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) { static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) {
CinFrameHeader *hdr = &cin->frame_header; CinFrameHeader *hdr = &cin->frame_header;
hdr->video_frame_type = get_byte(pb); hdr->video_frame_type = get_byte(pb);
@ -159,7 +159,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
CinDemuxContext *cin = s->priv_data; CinDemuxContext *cin = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
CinFrameHeader *hdr = &cin->frame_header; CinFrameHeader *hdr = &cin->frame_header;
int rc, palette_type, pkt_size; int rc, palette_type, pkt_size;
int ret; int ret;

@ -52,7 +52,7 @@ static int dxa_probe(AVProbeData *p)
static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
DXAContext *c = s->priv_data; DXAContext *c = s->priv_data;
AVStream *st, *ast; AVStream *st, *ast;
uint32_t tag; uint32_t tag;

@ -47,7 +47,7 @@ static int cdata_probe(AVProbeData *p)
static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
CdataDemuxContext *cdata = s->priv_data; CdataDemuxContext *cdata = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int sample_rate, header; unsigned int sample_rate, header;
AVStream *st; AVStream *st;

@ -77,7 +77,7 @@ typedef struct EaDemuxContext {
int num_samples; int num_samples;
} EaDemuxContext; } EaDemuxContext;
static uint32_t read_arbitary(ByteIOContext *pb) { static uint32_t read_arbitary(AVIOContext *pb) {
uint8_t size, byte; uint8_t size, byte;
int i; int i;
uint32_t word; uint32_t word;
@ -102,7 +102,7 @@ static int process_audio_header_elements(AVFormatContext *s)
{ {
int inHeader = 1; int inHeader = 1;
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int compression_type = -1, revision = -1, revision2 = -1; int compression_type = -1, revision = -1, revision2 = -1;
ea->bytes = 2; ea->bytes = 2;
@ -215,7 +215,7 @@ static int process_audio_header_elements(AVFormatContext *s)
static int process_audio_header_eacs(AVFormatContext *s) static int process_audio_header_eacs(AVFormatContext *s)
{ {
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int compression_type; int compression_type;
ea->sample_rate = ea->big_endian ? get_be32(pb) : get_le32(pb); ea->sample_rate = ea->big_endian ? get_be32(pb) : get_le32(pb);
@ -247,7 +247,7 @@ static int process_audio_header_eacs(AVFormatContext *s)
static int process_audio_header_sead(AVFormatContext *s) static int process_audio_header_sead(AVFormatContext *s)
{ {
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ea->sample_rate = get_le32(pb); ea->sample_rate = get_le32(pb);
ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */ ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */
@ -260,7 +260,7 @@ static int process_audio_header_sead(AVFormatContext *s)
static int process_video_header_mdec(AVFormatContext *s) static int process_video_header_mdec(AVFormatContext *s)
{ {
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
url_fskip(pb, 4); url_fskip(pb, 4);
ea->width = get_le16(pb); ea->width = get_le16(pb);
ea->height = get_le16(pb); ea->height = get_le16(pb);
@ -272,7 +272,7 @@ static int process_video_header_mdec(AVFormatContext *s)
static int process_video_header_vp6(AVFormatContext *s) static int process_video_header_vp6(AVFormatContext *s)
{ {
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
url_fskip(pb, 16); url_fskip(pb, 16);
ea->time_base.den = get_le32(pb); ea->time_base.den = get_le32(pb);
@ -289,7 +289,7 @@ static int process_video_header_vp6(AVFormatContext *s)
static int process_ea_header(AVFormatContext *s) { static int process_ea_header(AVFormatContext *s) {
uint32_t blockid, size = 0; uint32_t blockid, size = 0;
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i; int i;
for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) { for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
@ -459,7 +459,7 @@ static int ea_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret = 0; int ret = 0;
int packet_read = 0; int packet_read = 0;
unsigned int chunk_type, chunk_size; unsigned int chunk_type, chunk_size;

@ -105,7 +105,7 @@ static int ffm_read_data(AVFormatContext *s,
uint8_t *buf, int size, int header) uint8_t *buf, int size, int header)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int len, fill_size, size1, frame_offset, id; int len, fill_size, size1, frame_offset, id;
size1 = size; size1 = size;
@ -170,7 +170,7 @@ static int ffm_read_data(AVFormatContext *s,
static void ffm_seek1(AVFormatContext *s, int64_t pos1) static void ffm_seek1(AVFormatContext *s, int64_t pos1)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos; int64_t pos;
pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
@ -183,7 +183,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1)
static int64_t get_dts(AVFormatContext *s, int64_t pos) static int64_t get_dts(AVFormatContext *s, int64_t pos)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t dts; int64_t dts;
ffm_seek1(s, pos); ffm_seek1(s, pos);
@ -198,7 +198,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos)
static void adjust_write_index(AVFormatContext *s) static void adjust_write_index(AVFormatContext *s)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pts; int64_t pts;
//int64_t orig_write_index = ffm->write_index; //int64_t orig_write_index = ffm->write_index;
int64_t pos_min, pos_max; int64_t pos_min, pos_max;
@ -267,7 +267,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
AVStream *st; AVStream *st;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *codec; AVCodecContext *codec;
int i, nb_streams; int i, nb_streams;
uint32_t tag; uint32_t tag;

@ -27,7 +27,7 @@ static void flush_packet(AVFormatContext *s)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
int fill_size, h; int fill_size, h;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
fill_size = ffm->packet_end - ffm->packet_ptr; fill_size = ffm->packet_end - ffm->packet_ptr;
memset(ffm->packet_ptr, 0, fill_size); memset(ffm->packet_ptr, 0, fill_size);
@ -84,7 +84,7 @@ static int ffm_write_header(AVFormatContext *s)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
AVStream *st; AVStream *st;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *codec; AVCodecContext *codec;
int bit_rate, i; int bit_rate, i;
@ -228,7 +228,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
static int ffm_write_trailer(AVFormatContext *s) static int ffm_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
/* flush packets */ /* flush packets */

@ -30,7 +30,7 @@ static int probe(AVProbeData *p)
return 0; return 0;
} }
static void get_line(ByteIOContext *s, uint8_t *buf, int size) static void get_line(AVIOContext *s, uint8_t *buf, int size)
{ {
do { do {
uint8_t c; uint8_t c;

@ -25,7 +25,7 @@
#include "ffmeta.h" #include "ffmeta.h"
static void write_escape_str(ByteIOContext *s, const uint8_t *str) static void write_escape_str(AVIOContext *s, const uint8_t *str)
{ {
const uint8_t *p = str; const uint8_t *p = str;
@ -37,7 +37,7 @@ static void write_escape_str(ByteIOContext *s, const uint8_t *str)
} }
} }
static void write_tags(ByteIOContext *s, AVMetadata *m) static void write_tags(AVIOContext *s, AVMetadata *m)
{ {
AVMetadataTag *t = NULL; AVMetadataTag *t = NULL;
while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) { while ((t = av_metadata_get(m, "", t, AV_METADATA_IGNORE_SUFFIX))) {

@ -37,7 +37,7 @@ static int read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
FilmstripDemuxContext *film = s->priv_data; FilmstripDemuxContext *film = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
if (url_is_streamed(s->pb)) if (url_is_streamed(s->pb))

@ -53,7 +53,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
static int write_trailer(AVFormatContext *s) static int write_trailer(AVFormatContext *s)
{ {
FilmstripMuxContext *film = s->priv_data; FilmstripMuxContext *film = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
int i; int i;

@ -27,7 +27,7 @@
#include "libavcodec/bytestream.h" #include "libavcodec/bytestream.h"
static int flac_write_block_padding(ByteIOContext *pb, unsigned int n_padding_bytes, static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes,
int last_block) int last_block)
{ {
put_byte(pb, last_block ? 0x81 : 0x01); put_byte(pb, last_block ? 0x81 : 0x01);
@ -39,7 +39,7 @@ static int flac_write_block_padding(ByteIOContext *pb, unsigned int n_padding_by
return 0; return 0;
} }
static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m, static int flac_write_block_comment(AVIOContext *pb, AVMetadata **m,
int last_block, int bitexact) int last_block, int bitexact)
{ {
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT; const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
@ -90,7 +90,7 @@ static int flac_write_header(struct AVFormatContext *s)
static int flac_write_trailer(struct AVFormatContext *s) static int flac_write_trailer(struct AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint8_t *streaminfo; uint8_t *streaminfo;
enum FLACExtradataFormat format; enum FLACExtradataFormat format;
int64_t file_size; int64_t file_size;

@ -26,7 +26,7 @@
#include "libavcodec/bytestream.h" #include "libavcodec/bytestream.h"
#include "avformat.h" #include "avformat.h"
int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec, int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
int last_block); int last_block);
#endif /* AVFORMAT_FLACENC_H */ #endif /* AVFORMAT_FLACENC_H */

@ -24,7 +24,7 @@
#include "avformat.h" #include "avformat.h"
#include "flacenc.h" #include "flacenc.h"
int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec, int ff_flac_write_header(AVIOContext *pb, AVCodecContext *codec,
int last_block) int last_block)
{ {
uint8_t header[8] = { uint8_t header[8] = {

@ -86,7 +86,7 @@ static int flic_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
FlicDemuxContext *flic = s->priv_data; FlicDemuxContext *flic = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned char header[FLIC_HEADER_SIZE]; unsigned char header[FLIC_HEADER_SIZE];
AVStream *st, *ast; AVStream *st, *ast;
int speed; int speed;
@ -198,7 +198,7 @@ static int flic_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
FlicDemuxContext *flic = s->priv_data; FlicDemuxContext *flic = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int packet_read = 0; int packet_read = 0;
unsigned int size; unsigned int size;
int magic; int magic;

@ -110,7 +110,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
return 0; return 0;
} }
static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) { static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) {
int length = get_be16(ioc); int length = get_be16(ioc);
if(length >= buffsize) { if(length >= buffsize) {
url_fskip(ioc, length); url_fskip(ioc, length);
@ -126,7 +126,7 @@ static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) {
static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) { static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) {
AVCodecContext *acodec, *vcodec; AVCodecContext *acodec, *vcodec;
ByteIOContext *ioc; AVIOContext *ioc;
AMFDataType amf_type; AMFDataType amf_type;
char str_val[256]; char str_val[256];
double num_val; double num_val;
@ -213,7 +213,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
AMFDataType type; AMFDataType type;
AVStream *stream, *astream, *vstream; AVStream *stream, *astream, *vstream;
ByteIOContext *ioc; AVIOContext *ioc;
int i; int i;
char buffer[11]; //only needs to hold the string "onMetaData". Anything longer is something we don't want. char buffer[11]; //only needs to hold the string "onMetaData". Anything longer is something we don't want.

@ -139,14 +139,14 @@ static int get_audio_flags(AVCodecContext *enc){
return flags; return flags;
} }
static void put_amf_string(ByteIOContext *pb, const char *str) static void put_amf_string(AVIOContext *pb, const char *str)
{ {
size_t len = strlen(str); size_t len = strlen(str);
put_be16(pb, len); put_be16(pb, len);
put_buffer(pb, str, len); put_buffer(pb, str, len);
} }
static void put_avc_eos_tag(ByteIOContext *pb, unsigned ts) { static void put_avc_eos_tag(AVIOContext *pb, unsigned ts) {
put_byte(pb, FLV_TAG_TYPE_VIDEO); put_byte(pb, FLV_TAG_TYPE_VIDEO);
put_be24(pb, 5); /* Tag Data Size */ put_be24(pb, 5); /* Tag Data Size */
put_be24(pb, ts); /* lower 24 bits of timestamp in ms*/ put_be24(pb, ts); /* lower 24 bits of timestamp in ms*/
@ -158,20 +158,20 @@ static void put_avc_eos_tag(ByteIOContext *pb, unsigned ts) {
put_be32(pb, 16); /* Size of FLV tag */ put_be32(pb, 16); /* Size of FLV tag */
} }
static void put_amf_double(ByteIOContext *pb, double d) static void put_amf_double(AVIOContext *pb, double d)
{ {
put_byte(pb, AMF_DATA_TYPE_NUMBER); put_byte(pb, AMF_DATA_TYPE_NUMBER);
put_be64(pb, av_dbl2int(d)); put_be64(pb, av_dbl2int(d));
} }
static void put_amf_bool(ByteIOContext *pb, int b) { static void put_amf_bool(AVIOContext *pb, int b) {
put_byte(pb, AMF_DATA_TYPE_BOOL); put_byte(pb, AMF_DATA_TYPE_BOOL);
put_byte(pb, !!b); put_byte(pb, !!b);
} }
static int flv_write_header(AVFormatContext *s) static int flv_write_header(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
FLVContext *flv = s->priv_data; FLVContext *flv = s->priv_data;
AVCodecContext *audio_enc = NULL, *video_enc = NULL; AVCodecContext *audio_enc = NULL, *video_enc = NULL;
int i; int i;
@ -330,7 +330,7 @@ static int flv_write_trailer(AVFormatContext *s)
{ {
int64_t file_size; int64_t file_size;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
FLVContext *flv = s->priv_data; FLVContext *flv = s->priv_data;
int i; int i;
@ -357,7 +357,7 @@ static int flv_write_trailer(AVFormatContext *s)
static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[pkt->stream_index]->codec; AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
FLVContext *flv = s->priv_data; FLVContext *flv = s->priv_data;
unsigned ts; unsigned ts;

@ -107,7 +107,7 @@ static const rgb_triplet gif_clut[216] = {
}; };
/* GIF header */ /* GIF header */
static int gif_image_write_header(ByteIOContext *pb, static int gif_image_write_header(AVIOContext *pb,
int width, int height, int loop_count, int width, int height, int loop_count,
uint32_t *palette) uint32_t *palette)
{ {
@ -179,7 +179,7 @@ static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b)
} }
static int gif_image_write_image(ByteIOContext *pb, static int gif_image_write_image(AVIOContext *pb,
int x1, int y1, int width, int height, int x1, int y1, int width, int height,
const uint8_t *buf, int linesize, int pix_fmt) const uint8_t *buf, int linesize, int pix_fmt)
{ {
@ -252,7 +252,7 @@ typedef struct {
static int gif_write_header(AVFormatContext *s) static int gif_write_header(AVFormatContext *s)
{ {
GIFContext *gif = s->priv_data; GIFContext *gif = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *enc, *video_enc; AVCodecContext *enc, *video_enc;
int i, width, height, loop_count /*, rate*/; int i, width, height, loop_count /*, rate*/;
@ -294,7 +294,7 @@ static int gif_write_header(AVFormatContext *s)
static int gif_write_video(AVFormatContext *s, static int gif_write_video(AVFormatContext *s,
AVCodecContext *enc, const uint8_t *buf, int size) AVCodecContext *enc, const uint8_t *buf, int size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
GIFContext *gif = s->priv_data; GIFContext *gif = s->priv_data;
int jiffies; int jiffies;
int64_t delay; int64_t delay;
@ -337,7 +337,7 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
static int gif_write_trailer(AVFormatContext *s) static int gif_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
put_byte(pb, 0x3b); put_byte(pb, 0x3b);
put_flush_packet(s->pb); put_flush_packet(s->pb);

@ -33,12 +33,12 @@ struct gxf_stream_info {
/** /**
* \brief parses a packet header, extracting type and length * \brief parses a packet header, extracting type and length
* \param pb ByteIOContext to read header from * \param pb AVIOContext to read header from
* \param type detected packet type is stored here * \param type detected packet type is stored here
* \param length detected packet length, excluding header is stored here * \param length detected packet length, excluding header is stored here
* \return 0 if header not found or contains invalid data, 1 otherwise * \return 0 if header not found or contains invalid data, 1 otherwise
*/ */
static int parse_packet_header(ByteIOContext *pb, GXFPktType *type, int *length) { static int parse_packet_header(AVIOContext *pb, GXFPktType *type, int *length) {
if (get_be32(pb)) if (get_be32(pb))
return 0; return 0;
if (get_byte(pb) != 1) if (get_byte(pb) != 1)
@ -157,7 +157,7 @@ static int get_sindex(AVFormatContext *s, int id, int format) {
* \param len length of tag section, will be adjusted to contain remaining bytes * \param len length of tag section, will be adjusted to contain remaining bytes
* \param si struct to store collected information into * \param si struct to store collected information into
*/ */
static void gxf_material_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) { static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si) {
si->first_field = AV_NOPTS_VALUE; si->first_field = AV_NOPTS_VALUE;
si->last_field = AV_NOPTS_VALUE; si->last_field = AV_NOPTS_VALUE;
while (*len >= 2) { while (*len >= 2) {
@ -206,7 +206,7 @@ static AVRational fps_umf2avr(uint32_t flags) {
* \param len length of tag section, will be adjusted to contain remaining bytes * \param len length of tag section, will be adjusted to contain remaining bytes
* \param si struct to store collected information into * \param si struct to store collected information into
*/ */
static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) { static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si) {
si->frames_per_second = (AVRational){0, 0}; si->frames_per_second = (AVRational){0, 0};
si->fields_per_frame = 0; si->fields_per_frame = 0;
while (*len >= 2) { while (*len >= 2) {
@ -231,7 +231,7 @@ static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *
* \brief read index from FLT packet into stream 0 av_index * \brief read index from FLT packet into stream 0 av_index
*/ */
static void gxf_read_index(AVFormatContext *s, int pkt_len) { static void gxf_read_index(AVFormatContext *s, int pkt_len) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
uint32_t fields_per_map = get_le32(pb); uint32_t fields_per_map = get_le32(pb);
uint32_t map_cnt = get_le32(pb); uint32_t map_cnt = get_le32(pb);
@ -259,7 +259,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
} }
static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
GXFPktType pkt_type; GXFPktType pkt_type;
int map_len; int map_len;
int len; int len;
@ -387,7 +387,7 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t
int cur_track; int cur_track;
int64_t cur_timestamp = AV_NOPTS_VALUE; int64_t cur_timestamp = AV_NOPTS_VALUE;
int len; int len;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
GXFPktType type; GXFPktType type;
tmp = get_be32(pb); tmp = get_be32(pb);
start: start:
@ -419,7 +419,7 @@ out:
} }
static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
GXFPktType pkt_type; GXFPktType pkt_type;
int pkt_len; int pkt_len;
while (!url_feof(pb)) { while (!url_feof(pb)) {
@ -506,7 +506,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
int64_t *pos, int64_t pos_limit) { int64_t *pos, int64_t pos_limit) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t res; int64_t res;
if (url_fseek(pb, *pos, SEEK_SET) < 0) if (url_fseek(pb, *pos, SEEK_SET) < 0)
return AV_NOPTS_VALUE; return AV_NOPTS_VALUE;

@ -113,14 +113,14 @@ static int gxf_find_lines_index(AVStream *st)
return -1; return -1;
} }
static void gxf_write_padding(ByteIOContext *pb, int64_t to_pad) static void gxf_write_padding(AVIOContext *pb, int64_t to_pad)
{ {
for (; to_pad > 0; to_pad--) { for (; to_pad > 0; to_pad--) {
put_byte(pb, 0); put_byte(pb, 0);
} }
} }
static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos) static int64_t updatePacketSize(AVIOContext *pb, int64_t pos)
{ {
int64_t curpos; int64_t curpos;
int size; int size;
@ -137,7 +137,7 @@ static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos)
return curpos - pos; return curpos - pos;
} }
static int64_t updateSize(ByteIOContext *pb, int64_t pos) static int64_t updateSize(AVIOContext *pb, int64_t pos)
{ {
int64_t curpos; int64_t curpos;
@ -148,7 +148,7 @@ static int64_t updateSize(ByteIOContext *pb, int64_t pos)
return curpos - pos; return curpos - pos;
} }
static void gxf_write_packet_header(ByteIOContext *pb, GXFPktType type) static void gxf_write_packet_header(AVIOContext *pb, GXFPktType type)
{ {
put_be32(pb, 0); /* packet leader for synchro */ put_be32(pb, 0); /* packet leader for synchro */
put_byte(pb, 1); put_byte(pb, 1);
@ -159,7 +159,7 @@ static void gxf_write_packet_header(ByteIOContext *pb, GXFPktType type)
put_byte(pb, 0xE2); /* trailer 2 */ put_byte(pb, 0xE2); /* trailer 2 */
} }
static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st) static int gxf_write_mpeg_auxiliary(AVIOContext *pb, AVStream *st)
{ {
GXFStreamContext *sc = st->priv_data; GXFStreamContext *sc = st->priv_data;
char buffer[1024]; char buffer[1024];
@ -197,7 +197,7 @@ static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st)
return size + 3; return size + 3;
} }
static int gxf_write_timecode_auxiliary(ByteIOContext *pb, GXFStreamContext *sc) static int gxf_write_timecode_auxiliary(AVIOContext *pb, GXFStreamContext *sc)
{ {
put_byte(pb, 0); /* fields */ put_byte(pb, 0); /* fields */
put_byte(pb, 0); /* seconds */ put_byte(pb, 0); /* seconds */
@ -210,7 +210,7 @@ static int gxf_write_timecode_auxiliary(ByteIOContext *pb, GXFStreamContext *sc)
static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index) static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos; int64_t pos;
int mpeg = sc->track_type == 4 || sc->track_type == 9; int mpeg = sc->track_type == 4 || sc->track_type == 9;
@ -267,7 +267,7 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc,
static int gxf_write_material_data_section(AVFormatContext *s) static int gxf_write_material_data_section(AVFormatContext *s)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos; int64_t pos;
const char *filename = strrchr(s->filename, '/'); const char *filename = strrchr(s->filename, '/');
@ -315,7 +315,7 @@ static int gxf_write_material_data_section(AVFormatContext *s)
static int gxf_write_track_description_section(AVFormatContext *s) static int gxf_write_track_description_section(AVFormatContext *s)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos; int64_t pos;
int i; int i;
@ -332,7 +332,7 @@ static int gxf_write_track_description_section(AVFormatContext *s)
static int gxf_write_map_packet(AVFormatContext *s, int rewrite) static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
if (!rewrite) { if (!rewrite) {
@ -362,7 +362,7 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
static int gxf_write_flt_packet(AVFormatContext *s) static int gxf_write_flt_packet(AVFormatContext *s)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1; int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1;
int flt_entries = gxf->nb_fields / fields_per_flt; int flt_entries = gxf->nb_fields / fields_per_flt;
@ -387,7 +387,7 @@ static int gxf_write_flt_packet(AVFormatContext *s)
static int gxf_write_umf_material_description(AVFormatContext *s) static int gxf_write_umf_material_description(AVFormatContext *s)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int timecode_base = gxf->time_base.den == 60000 ? 60 : 50; int timecode_base = gxf->time_base.den == 60000 ? 60 : 50;
// XXX drop frame // XXX drop frame
@ -418,7 +418,7 @@ static int gxf_write_umf_material_description(AVFormatContext *s)
static int gxf_write_umf_payload(AVFormatContext *s) static int gxf_write_umf_payload(AVFormatContext *s)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
put_le32(pb, gxf->umf_length); /* total length of the umf data */ put_le32(pb, gxf->umf_length); /* total length of the umf data */
put_le32(pb, 3); /* version */ put_le32(pb, 3); /* version */
@ -437,7 +437,7 @@ static int gxf_write_umf_payload(AVFormatContext *s)
static int gxf_write_umf_track_description(AVFormatContext *s) static int gxf_write_umf_track_description(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int i; int i;
@ -455,7 +455,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s)
return url_ftell(pb) - pos; return url_ftell(pb) - pos;
} }
static int gxf_write_umf_media_mpeg(ByteIOContext *pb, AVStream *st) static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
{ {
GXFStreamContext *sc = st->priv_data; GXFStreamContext *sc = st->priv_data;
@ -478,7 +478,7 @@ static int gxf_write_umf_media_mpeg(ByteIOContext *pb, AVStream *st)
return 32; return 32;
} }
static int gxf_write_umf_media_timecode(ByteIOContext *pb, GXFStreamContext *sc) static int gxf_write_umf_media_timecode(AVIOContext *pb, GXFStreamContext *sc)
{ {
put_le32(pb, 1); /* non drop frame */ put_le32(pb, 1); /* non drop frame */
put_le32(pb, 0); /* reserved */ put_le32(pb, 0); /* reserved */
@ -491,7 +491,7 @@ static int gxf_write_umf_media_timecode(ByteIOContext *pb, GXFStreamContext *sc)
return 32; return 32;
} }
static int gxf_write_umf_media_dv(ByteIOContext *pb, GXFStreamContext *sc) static int gxf_write_umf_media_dv(AVIOContext *pb, GXFStreamContext *sc)
{ {
int i; int i;
@ -501,7 +501,7 @@ static int gxf_write_umf_media_dv(ByteIOContext *pb, GXFStreamContext *sc)
return 32; return 32;
} }
static int gxf_write_umf_media_audio(ByteIOContext *pb, GXFStreamContext *sc) static int gxf_write_umf_media_audio(AVIOContext *pb, GXFStreamContext *sc)
{ {
put_le64(pb, av_dbl2int(1)); /* sound level to begin to */ put_le64(pb, av_dbl2int(1)); /* sound level to begin to */
put_le64(pb, av_dbl2int(1)); /* sound level to begin to */ put_le64(pb, av_dbl2int(1)); /* sound level to begin to */
@ -513,7 +513,7 @@ static int gxf_write_umf_media_audio(ByteIOContext *pb, GXFStreamContext *sc)
} }
#if 0 #if 0
static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc) static int gxf_write_umf_media_mjpeg(AVIOContext *pb, GXFStreamContext *sc)
{ {
put_be64(pb, 0); /* FIXME FLOAT max chroma quant level */ put_be64(pb, 0); /* FIXME FLOAT max chroma quant level */
put_be64(pb, 0); /* FIXME FLOAT max luma quant level */ put_be64(pb, 0); /* FIXME FLOAT max luma quant level */
@ -526,7 +526,7 @@ static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc)
static int gxf_write_umf_media_description(AVFormatContext *s) static int gxf_write_umf_media_description(AVFormatContext *s)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos; int64_t pos;
int i, j; int i, j;
@ -588,7 +588,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
static int gxf_write_umf_packet(AVFormatContext *s) static int gxf_write_umf_packet(AVFormatContext *s)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
gxf_write_packet_header(pb, PKT_UMF); gxf_write_packet_header(pb, PKT_UMF);
@ -625,7 +625,7 @@ static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc)
static int gxf_write_header(AVFormatContext *s) static int gxf_write_header(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
GXFStreamContext *vsc = NULL; GXFStreamContext *vsc = NULL;
uint8_t tracks[255] = {0}; uint8_t tracks[255] = {0};
@ -754,7 +754,7 @@ static int gxf_write_header(AVFormatContext *s)
return 0; return 0;
} }
static int gxf_write_eos_packet(ByteIOContext *pb) static int gxf_write_eos_packet(AVIOContext *pb)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -765,7 +765,7 @@ static int gxf_write_eos_packet(ByteIOContext *pb)
static int gxf_write_trailer(AVFormatContext *s) static int gxf_write_trailer(AVFormatContext *s)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t end; int64_t end;
int i; int i;
@ -809,7 +809,7 @@ static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int si
static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size) static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[pkt->stream_index]; AVStream *st = s->streams[pkt->stream_index];
GXFStreamContext *sc = st->priv_data; GXFStreamContext *sc = st->priv_data;
unsigned field_nb; unsigned field_nb;
@ -856,7 +856,7 @@ static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt) static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
GXFContext *gxf = s->priv_data; GXFContext *gxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[pkt->stream_index]; AVStream *st = s->streams[pkt->stream_index];
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int padding = 0; int padding = 0;

@ -50,7 +50,7 @@ int ff_id3v2_tag_len(const uint8_t * buf)
return len; return len;
} }
static unsigned int get_size(ByteIOContext *s, int len) static unsigned int get_size(AVIOContext *s, int len)
{ {
int v = 0; int v = 0;
while (len--) while (len--)
@ -58,13 +58,13 @@ static unsigned int get_size(ByteIOContext *s, int len)
return v; return v;
} }
static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const char *key) static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const char *key)
{ {
char *q, dst[512]; char *q, dst[512];
const char *val = NULL; const char *val = NULL;
int len, dstlen = sizeof(dst) - 1; int len, dstlen = sizeof(dst) - 1;
unsigned genre; unsigned genre;
unsigned int (*get)(ByteIOContext*) = get_be16; unsigned int (*get)(AVIOContext*) = get_be16;
dst[0] = 0; dst[0] = 0;
if (taglen < 1) if (taglen < 1)
@ -142,7 +142,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
int64_t next; int64_t next;
int taghdrlen; int taghdrlen;
const char *reason; const char *reason;
ByteIOContext pb; AVIOContext pb;
unsigned char *buffer = NULL; unsigned char *buffer = NULL;
int buffer_size = 0; int buffer_size = 0;

@ -142,7 +142,7 @@ static int idcin_probe(AVProbeData *p)
static int idcin_read_header(AVFormatContext *s, static int idcin_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
IdcinDemuxContext *idcin = s->priv_data; IdcinDemuxContext *idcin = s->priv_data;
AVStream *st; AVStream *st;
unsigned int width, height; unsigned int width, height;
@ -221,7 +221,7 @@ static int idcin_read_packet(AVFormatContext *s,
unsigned int command; unsigned int command;
unsigned int chunk_size; unsigned int chunk_size;
IdcinDemuxContext *idcin = s->priv_data; IdcinDemuxContext *idcin = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i; int i;
int palette_scale; int palette_scale;
unsigned char r, g, b; unsigned char r, g, b;

@ -68,7 +68,7 @@ static int roq_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
RoqDemuxContext *roq = s->priv_data; RoqDemuxContext *roq = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int framerate; int framerate;
AVStream *st; AVStream *st;
unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
@ -100,7 +100,7 @@ static int roq_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
RoqDemuxContext *roq = s->priv_data; RoqDemuxContext *roq = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret = 0; int ret = 0;
unsigned int chunk_size; unsigned int chunk_size;
unsigned int chunk_type; unsigned int chunk_type;

@ -124,7 +124,7 @@ static int iff_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
IffDemuxContext *iff = s->priv_data; IffDemuxContext *iff = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
uint32_t chunk_id, data_size; uint32_t chunk_id, data_size;
int compression = -1; int compression = -1;
@ -276,7 +276,7 @@ static int iff_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
IffDemuxContext *iff = s->priv_data; IffDemuxContext *iff = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[0]; AVStream *st = s->streams[0];
int ret; int ret;

@ -255,7 +255,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
char filename[1024]; char filename[1024];
int i; int i;
int size[3]={0}, ret[3]={0}; int size[3]={0}, ret[3]={0};
ByteIOContext *f[3]; AVIOContext *f[3];
AVCodecContext *codec= s1->streams[0]->codec; AVCodecContext *codec= s1->streams[0]->codec;
if (!s->is_pipe) { if (!s->is_pipe) {
@ -339,7 +339,7 @@ static int write_header(AVFormatContext *s)
static int write_packet(AVFormatContext *s, AVPacket *pkt) static int write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
VideoData *img = s->priv_data; VideoData *img = s->priv_data;
ByteIOContext *pb[3]; AVIOContext *pb[3];
char filename[1024]; char filename[1024];
AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec; AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec;
int i; int i;

@ -157,20 +157,20 @@ int ff_get_v_length(uint64_t val);
/** /**
* Put val using a variable number of bytes. * Put val using a variable number of bytes.
*/ */
void ff_put_v(ByteIOContext *bc, uint64_t val); void ff_put_v(AVIOContext *bc, uint64_t val);
/** /**
* Read a whole line of text from ByteIOContext. Stop reading after reaching * Read a whole line of text from AVIOContext. Stop reading after reaching
* either a \n, a \0 or EOF. The returned string is always \0 terminated, * either a \n, a \0 or EOF. The returned string is always \0 terminated,
* and may be truncated if the buffer is too small. * and may be truncated if the buffer is too small.
* *
* @param s the read-only ByteIOContext * @param s the read-only AVIOContext
* @param buf buffer to store the read line * @param buf buffer to store the read line
* @param maxlen size of the buffer * @param maxlen size of the buffer
* @return the length of the string written in the buffer, not including the * @return the length of the string written in the buffer, not including the
* final \0 * final \0
*/ */
int ff_get_line(ByteIOContext *s, char *buf, int maxlen); int ff_get_line(AVIOContext *s, char *buf, int maxlen);
#define SPACE_CHARS " \t\r\n" #define SPACE_CHARS " \t\r\n"

@ -120,7 +120,7 @@ typedef struct IPMVEContext {
} IPMVEContext; } IPMVEContext;
static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb, static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
AVPacket *pkt) { AVPacket *pkt) {
int chunk_type; int chunk_type;
@ -203,7 +203,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
/* This function loads and processes a single chunk in an IP movie file. /* This function loads and processes a single chunk in an IP movie file.
* It returns the type of chunk that was processed. */ * It returns the type of chunk that was processed. */
static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb, static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
AVPacket *pkt) AVPacket *pkt)
{ {
unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
@ -521,7 +521,7 @@ static int ipmovie_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
IPMVEContext *ipmovie = s->priv_data; IPMVEContext *ipmovie = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVPacket pkt; AVPacket pkt;
AVStream *st; AVStream *st;
unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
@ -602,7 +602,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
IPMVEContext *ipmovie = s->priv_data; IPMVEContext *ipmovie = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret; int ret;
ret = process_ipmovie_chunk(ipmovie, pb, pkt); ret = process_ipmovie_chunk(ipmovie, pb, pkt);

@ -341,7 +341,7 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4])
return 1; return 1;
} }
int ff_mp4_read_descr_len(ByteIOContext *pb) int ff_mp4_read_descr_len(AVIOContext *pb)
{ {
int len = 0; int len = 0;
int count = 4; int count = 4;
@ -354,7 +354,7 @@ int ff_mp4_read_descr_len(ByteIOContext *pb)
return len; return len;
} }
int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag) int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag)
{ {
int len; int len;
*tag = get_byte(pb); *tag = get_byte(pb);
@ -372,7 +372,7 @@ static const AVCodecTag mp4_audio_types[] = {
{ CODEC_ID_NONE, AOT_NULL }, { CODEC_ID_NONE, AOT_NULL },
}; };
int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb) int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb)
{ {
int len, tag; int len, tag;
int object_type_id = get_byte(pb); int object_type_id = get_byte(pb);

@ -88,7 +88,7 @@ typedef struct {
} MOVTrackExt; } MOVTrackExt;
typedef struct MOVStreamContext { typedef struct MOVStreamContext {
ByteIOContext *pb; AVIOContext *pb;
int ffindex; ///< AVStream index int ffindex; ///< AVStream index
int next_chunk; int next_chunk;
unsigned int chunk_count; unsigned int chunk_count;
@ -141,18 +141,18 @@ typedef struct MOVContext {
int chapter_track; int chapter_track;
} MOVContext; } MOVContext;
int ff_mp4_read_descr_len(ByteIOContext *pb); int ff_mp4_read_descr_len(AVIOContext *pb);
int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag); int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag);
int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb); int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb);
#define MP4IODescrTag 0x02 #define MP4IODescrTag 0x02
#define MP4ESDescrTag 0x03 #define MP4ESDescrTag 0x03
#define MP4DecConfigDescrTag 0x04 #define MP4DecConfigDescrTag 0x04
#define MP4DecSpecificDescrTag 0x05 #define MP4DecSpecificDescrTag 0x05
int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom); int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom);
enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags); enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries); int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries);
#endif /* AVFORMAT_ISOM_H */ #endif /* AVFORMAT_ISOM_H */

@ -39,7 +39,7 @@ typedef struct {
int sample_start_pos; int sample_start_pos;
} IssDemuxContext; } IssDemuxContext;
static void get_token(ByteIOContext *s, char *buf, int maxlen) static void get_token(AVIOContext *s, char *buf, int maxlen)
{ {
int i = 0; int i = 0;
char c; char c;
@ -68,7 +68,7 @@ static int iss_probe(AVProbeData *p)
static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
IssDemuxContext *iss = s->priv_data; IssDemuxContext *iss = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
char token[MAX_TOKEN_SIZE]; char token[MAX_TOKEN_SIZE];
int stereo, rate_divisor; int stereo, rate_divisor;

@ -23,7 +23,7 @@
static int ivf_write_header(AVFormatContext *s) static int ivf_write_header(AVFormatContext *s)
{ {
AVCodecContext *ctx; AVCodecContext *ctx;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
if (s->nb_streams != 1) { if (s->nb_streams != 1) {
av_log(s, AV_LOG_ERROR, "Format supports only exactly one video stream\n"); av_log(s, AV_LOG_ERROR, "Format supports only exactly one video stream\n");
@ -49,7 +49,7 @@ static int ivf_write_header(AVFormatContext *s)
static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt) static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
put_le32(pb, pkt->size); put_le32(pb, pkt->size);
put_le64(pb, pkt->pts); put_le64(pb, pkt->pts);
put_buffer(pb, pkt->data, pkt->size); put_buffer(pb, pkt->data, pkt->size);

@ -46,7 +46,7 @@ static const AVCodecTag nut_tags[] = {
#if CONFIG_LIBNUT_MUXER #if CONFIG_LIBNUT_MUXER
static int av_write(void * h, size_t len, const uint8_t * buf) { static int av_write(void * h, size_t len, const uint8_t * buf) {
ByteIOContext * bc = h; AVIOContext * bc = h;
put_buffer(bc, buf, len); put_buffer(bc, buf, len);
//put_flush_packet(bc); //put_flush_packet(bc);
return len; return len;
@ -54,7 +54,7 @@ static int av_write(void * h, size_t len, const uint8_t * buf) {
static int nut_write_header(AVFormatContext * avf) { static int nut_write_header(AVFormatContext * avf) {
NUTContext * priv = avf->priv_data; NUTContext * priv = avf->priv_data;
ByteIOContext * bc = avf->pb; AVIOContext * bc = avf->pb;
nut_muxer_opts_tt mopts = { nut_muxer_opts_tt mopts = {
.output = { .output = {
.priv = bc, .priv = bc,
@ -137,7 +137,7 @@ static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) {
} }
static int nut_write_trailer(AVFormatContext * avf) { static int nut_write_trailer(AVFormatContext * avf) {
ByteIOContext * bc = avf->pb; AVIOContext * bc = avf->pb;
NUTContext * priv = avf->priv_data; NUTContext * priv = avf->priv_data;
int i; int i;
@ -172,12 +172,12 @@ static int nut_probe(AVProbeData *p) {
} }
static size_t av_read(void * h, size_t len, uint8_t * buf) { static size_t av_read(void * h, size_t len, uint8_t * buf) {
ByteIOContext * bc = h; AVIOContext * bc = h;
return get_buffer(bc, buf, len); return get_buffer(bc, buf, len);
} }
static off_t av_seek(void * h, long long pos, int whence) { static off_t av_seek(void * h, long long pos, int whence) {
ByteIOContext * bc = h; AVIOContext * bc = h;
if (whence == SEEK_END) { if (whence == SEEK_END) {
pos = url_fsize(bc) + pos; pos = url_fsize(bc) + pos;
whence = SEEK_SET; whence = SEEK_SET;
@ -187,7 +187,7 @@ static off_t av_seek(void * h, long long pos, int whence) {
static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
NUTContext * priv = avf->priv_data; NUTContext * priv = avf->priv_data;
ByteIOContext * bc = avf->pb; AVIOContext * bc = avf->pb;
nut_demuxer_opts_tt dopts = { nut_demuxer_opts_tt dopts = {
.input = { .input = {
.priv = bc, .priv = bc,

@ -78,7 +78,7 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
} }
static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret; int ret;
unsigned int frame_type, packet_size, padding, frame_size; unsigned int frame_type, packet_size, padding, frame_size;

@ -111,7 +111,7 @@ static int sync(AVFormatContext *s, uint8_t *header)
*/ */
static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *format) static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *format)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int track_size, samples, ret; int track_size, samples, ret;
AVStream *st; AVStream *st;
@ -198,7 +198,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
LXFDemuxContext *lxf = s->priv_data; LXFDemuxContext *lxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint8_t header[LXF_PACKET_HEADER_SIZE], header_data[LXF_HEADER_DATA_SIZE]; uint8_t header[LXF_PACKET_HEADER_SIZE], header_data[LXF_HEADER_DATA_SIZE];
int ret; int ret;
AVStream *st; AVStream *st;
@ -281,7 +281,7 @@ static void deplanarize(LXFDemuxContext *lxf, AVStream *ast, uint8_t *out, int b
static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
LXFDemuxContext *lxf = s->priv_data; LXFDemuxContext *lxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint8_t header[LXF_PACKET_HEADER_SIZE], *buf; uint8_t header[LXF_PACKET_HEADER_SIZE], *buf;
AVStream *ast = NULL; AVStream *ast = NULL;
uint32_t stream, format; uint32_t stream, format;

@ -515,7 +515,7 @@ static const char *matroska_doctypes[] = { "matroska", "webm" };
*/ */
static int ebml_level_end(MatroskaDemuxContext *matroska) static int ebml_level_end(MatroskaDemuxContext *matroska)
{ {
ByteIOContext *pb = matroska->ctx->pb; AVIOContext *pb = matroska->ctx->pb;
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
if (matroska->num_levels > 0) { if (matroska->num_levels > 0) {
@ -536,7 +536,7 @@ static int ebml_level_end(MatroskaDemuxContext *matroska)
* number. * number.
* Returns: number of bytes read, < 0 on error * Returns: number of bytes read, < 0 on error
*/ */
static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb, static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
int max_size, uint64_t *number) int max_size, uint64_t *number)
{ {
int read = 1, n = 1; int read = 1, n = 1;
@ -581,7 +581,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
* This needs special handling for the "unknown length" case which has multiple * This needs special handling for the "unknown length" case which has multiple
* encodings. * encodings.
*/ */
static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb, static int ebml_read_length(MatroskaDemuxContext *matroska, AVIOContext *pb,
uint64_t *number) uint64_t *number)
{ {
int res = ebml_read_num(matroska, pb, 8, number); int res = ebml_read_num(matroska, pb, 8, number);
@ -594,7 +594,7 @@ static int ebml_read_length(MatroskaDemuxContext *matroska, ByteIOContext *pb,
* Read the next element as an unsigned int. * Read the next element as an unsigned int.
* 0 is success, < 0 is failure. * 0 is success, < 0 is failure.
*/ */
static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num) static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num)
{ {
int n = 0; int n = 0;
@ -613,7 +613,7 @@ static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
* Read the next element as a float. * Read the next element as a float.
* 0 is success, < 0 is failure. * 0 is success, < 0 is failure.
*/ */
static int ebml_read_float(ByteIOContext *pb, int size, double *num) static int ebml_read_float(AVIOContext *pb, int size, double *num)
{ {
if (size == 0) { if (size == 0) {
*num = 0; *num = 0;
@ -631,7 +631,7 @@ static int ebml_read_float(ByteIOContext *pb, int size, double *num)
* Read the next element as an ASCII string. * Read the next element as an ASCII string.
* 0 is success, < 0 is failure. * 0 is success, < 0 is failure.
*/ */
static int ebml_read_ascii(ByteIOContext *pb, int size, char **str) static int ebml_read_ascii(AVIOContext *pb, int size, char **str)
{ {
av_free(*str); av_free(*str);
/* EBML strings are usually not 0-terminated, so we allocate one /* EBML strings are usually not 0-terminated, so we allocate one
@ -651,7 +651,7 @@ static int ebml_read_ascii(ByteIOContext *pb, int size, char **str)
* Read the next element as binary data. * Read the next element as binary data.
* 0 is success, < 0 is failure. * 0 is success, < 0 is failure.
*/ */
static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin) static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin)
{ {
av_free(bin->data); av_free(bin->data);
if (!(bin->data = av_malloc(length))) if (!(bin->data = av_malloc(length)))
@ -674,7 +674,7 @@ static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
*/ */
static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length) static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length)
{ {
ByteIOContext *pb = matroska->ctx->pb; AVIOContext *pb = matroska->ctx->pb;
MatroskaLevel *level; MatroskaLevel *level;
if (matroska->num_levels >= EBML_MAX_DEPTH) { if (matroska->num_levels >= EBML_MAX_DEPTH) {
@ -697,7 +697,7 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length)
static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska, static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska,
uint8_t *data, uint32_t size, uint64_t *num) uint8_t *data, uint32_t size, uint64_t *num)
{ {
ByteIOContext pb; AVIOContext pb;
init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL); init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL);
return ebml_read_num(matroska, &pb, FFMIN(size, 8), num); return ebml_read_num(matroska, &pb, FFMIN(size, 8), num);
} }
@ -791,7 +791,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska,
[EBML_BIN] = 0x10000000, [EBML_BIN] = 0x10000000,
// no limits for anything else // no limits for anything else
}; };
ByteIOContext *pb = matroska->ctx->pb; AVIOContext *pb = matroska->ctx->pb;
uint32_t id = syntax->id; uint32_t id = syntax->id;
uint64_t length; uint64_t length;
int res; int res;
@ -1242,7 +1242,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
uint8_t *extradata = NULL; uint8_t *extradata = NULL;
int extradata_size = 0; int extradata_size = 0;
int extradata_offset = 0; int extradata_offset = 0;
ByteIOContext b; AVIOContext b;
/* Apply some sanity checks. */ /* Apply some sanity checks. */
if (track->type != MATROSKA_TRACK_TYPE_VIDEO && if (track->type != MATROSKA_TRACK_TYPE_VIDEO &&

@ -74,7 +74,7 @@ typedef struct {
typedef struct MatroskaMuxContext { typedef struct MatroskaMuxContext {
int mode; int mode;
ByteIOContext *dyn_bc; AVIOContext *dyn_bc;
ebml_master segment; ebml_master segment;
int64_t segment_offset; int64_t segment_offset;
ebml_master cluster; ebml_master cluster;
@ -108,7 +108,7 @@ static int ebml_id_size(unsigned int id)
return (av_log2(id+1)-1)/7+1; return (av_log2(id+1)-1)/7+1;
} }
static void put_ebml_id(ByteIOContext *pb, unsigned int id) static void put_ebml_id(AVIOContext *pb, unsigned int id)
{ {
int i = ebml_id_size(id); int i = ebml_id_size(id);
while (i--) while (i--)
@ -120,7 +120,7 @@ static void put_ebml_id(ByteIOContext *pb, unsigned int id)
* *
* @param bytes The number of bytes the size should occupy (maximum: 8). * @param bytes The number of bytes the size should occupy (maximum: 8).
*/ */
static void put_ebml_size_unknown(ByteIOContext *pb, int bytes) static void put_ebml_size_unknown(AVIOContext *pb, int bytes)
{ {
assert(bytes <= 8); assert(bytes <= 8);
put_byte(pb, 0x1ff >> bytes); put_byte(pb, 0x1ff >> bytes);
@ -144,7 +144,7 @@ static int ebml_num_size(uint64_t num)
* @param bytes The number of bytes that need to be used to write the number. * @param bytes The number of bytes that need to be used to write the number.
* If zero, any number of bytes can be used. * If zero, any number of bytes can be used.
*/ */
static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes) static void put_ebml_num(AVIOContext *pb, uint64_t num, int bytes)
{ {
int i, needed_bytes = ebml_num_size(num); int i, needed_bytes = ebml_num_size(num);
@ -163,7 +163,7 @@ static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes)
put_byte(pb, num >> i*8); put_byte(pb, num >> i*8);
} }
static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val) static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val)
{ {
int i, bytes = 1; int i, bytes = 1;
uint64_t tmp = val; uint64_t tmp = val;
@ -175,14 +175,14 @@ static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t va
put_byte(pb, val >> i*8); put_byte(pb, val >> i*8);
} }
static void put_ebml_float(ByteIOContext *pb, unsigned int elementid, double val) static void put_ebml_float(AVIOContext *pb, unsigned int elementid, double val)
{ {
put_ebml_id(pb, elementid); put_ebml_id(pb, elementid);
put_ebml_num(pb, 8, 0); put_ebml_num(pb, 8, 0);
put_be64(pb, av_dbl2int(val)); put_be64(pb, av_dbl2int(val));
} }
static void put_ebml_binary(ByteIOContext *pb, unsigned int elementid, static void put_ebml_binary(AVIOContext *pb, unsigned int elementid,
const void *buf, int size) const void *buf, int size)
{ {
put_ebml_id(pb, elementid); put_ebml_id(pb, elementid);
@ -190,7 +190,7 @@ static void put_ebml_binary(ByteIOContext *pb, unsigned int elementid,
put_buffer(pb, buf, size); put_buffer(pb, buf, size);
} }
static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const char *str) static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char *str)
{ {
put_ebml_binary(pb, elementid, str, strlen(str)); put_ebml_binary(pb, elementid, str, strlen(str));
} }
@ -201,7 +201,7 @@ static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const cha
* *
* @param size The number of bytes to reserve, which must be at least 2. * @param size The number of bytes to reserve, which must be at least 2.
*/ */
static void put_ebml_void(ByteIOContext *pb, uint64_t size) static void put_ebml_void(AVIOContext *pb, uint64_t size)
{ {
int64_t currentpos = url_ftell(pb); int64_t currentpos = url_ftell(pb);
@ -219,7 +219,7 @@ static void put_ebml_void(ByteIOContext *pb, uint64_t size)
put_byte(pb, 0); put_byte(pb, 0);
} }
static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid, uint64_t expectedsize) static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, uint64_t expectedsize)
{ {
int bytes = expectedsize ? ebml_num_size(expectedsize) : 8; int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
put_ebml_id(pb, elementid); put_ebml_id(pb, elementid);
@ -227,7 +227,7 @@ static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid,
return (ebml_master){ url_ftell(pb), bytes }; return (ebml_master){ url_ftell(pb), bytes };
} }
static void end_ebml_master(ByteIOContext *pb, ebml_master master) static void end_ebml_master(AVIOContext *pb, ebml_master master)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -237,7 +237,7 @@ static void end_ebml_master(ByteIOContext *pb, ebml_master master)
url_fseek(pb, pos, SEEK_SET); url_fseek(pb, pos, SEEK_SET);
} }
static void put_xiph_size(ByteIOContext *pb, int size) static void put_xiph_size(AVIOContext *pb, int size)
{ {
int i; int i;
for (i = 0; i < size / 255; i++) for (i = 0; i < size / 255; i++)
@ -256,7 +256,7 @@ static void put_xiph_size(ByteIOContext *pb, int size)
* @param numelements The maximum number of elements that will be indexed * @param numelements The maximum number of elements that will be indexed
* by this seek head, 0 if unlimited. * by this seek head, 0 if unlimited.
*/ */
static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, int64_t segment_offset, int numelements) static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset, int numelements)
{ {
mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead)); mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
if (new_seekhead == NULL) if (new_seekhead == NULL)
@ -304,7 +304,7 @@ static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid
* @return The file offset where the seekhead was written, * @return The file offset where the seekhead was written,
* -1 if an error occurred. * -1 if an error occurred.
*/ */
static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead)
{ {
ebml_master metaseek, seekentry; ebml_master metaseek, seekentry;
int64_t currentpos; int64_t currentpos;
@ -373,7 +373,7 @@ static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t clus
return 0; return 0;
} }
static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks) static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks)
{ {
ebml_master cues_element; ebml_master cues_element;
int64_t currentpos; int64_t currentpos;
@ -408,7 +408,7 @@ static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks)
return currentpos; return currentpos;
} }
static int put_xiph_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec) static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec)
{ {
uint8_t *header_start[3]; uint8_t *header_start[3];
int header_len[3]; int header_len[3];
@ -463,9 +463,9 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int
} }
} }
static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec, int native_id, int qt_id) static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec, int native_id, int qt_id)
{ {
ByteIOContext *dyn_cp; AVIOContext *dyn_cp;
uint8_t *codecpriv; uint8_t *codecpriv;
int ret, codecpriv_size; int ret, codecpriv_size;
@ -522,7 +522,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
static int mkv_write_tracks(AVFormatContext *s) static int mkv_write_tracks(AVFormatContext *s)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ebml_master tracks; ebml_master tracks;
int i, j, ret; int i, j, ret;
@ -650,7 +650,7 @@ static int mkv_write_tracks(AVFormatContext *s)
static int mkv_write_chapters(AVFormatContext *s) static int mkv_write_chapters(AVFormatContext *s)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ebml_master chapters, editionentry; ebml_master chapters, editionentry;
AVRational scale = {1, 1E9}; AVRational scale = {1, 1E9};
int i, ret; int i, ret;
@ -691,7 +691,7 @@ static int mkv_write_chapters(AVFormatContext *s)
return 0; return 0;
} }
static void mkv_write_simpletag(ByteIOContext *pb, AVMetadataTag *t) static void mkv_write_simpletag(AVIOContext *pb, AVMetadataTag *t)
{ {
uint8_t *key = av_strdup(t->key); uint8_t *key = av_strdup(t->key);
uint8_t *p = key; uint8_t *p = key;
@ -790,7 +790,7 @@ static int mkv_write_tags(AVFormatContext *s)
static int mkv_write_header(AVFormatContext *s) static int mkv_write_header(AVFormatContext *s)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
ebml_master ebml_header, segment_info; ebml_master ebml_header, segment_info;
AVMetadataTag *tag; AVMetadataTag *tag;
int ret, i; int ret, i;
@ -901,7 +901,7 @@ static int ass_get_duration(const uint8_t *p)
return end - start; return end - start;
} }
static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
int i, layer = 0, max_duration = 0, size, line_size, data_size = pkt->size; int i, layer = 0, max_duration = 0, size, line_size, data_size = pkt->size;
@ -946,7 +946,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket
return max_duration; return max_duration;
} }
static void mkv_write_block(AVFormatContext *s, ByteIOContext *pb, static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
unsigned int blockid, AVPacket *pkt, int flags) unsigned int blockid, AVPacket *pkt, int flags)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
@ -992,7 +992,7 @@ static int srt_get_duration(uint8_t **buf)
return duration; return duration;
} }
static int mkv_write_srt_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt) static int mkv_write_srt_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
{ {
ebml_master blockgroup; ebml_master blockgroup;
AVPacket pkt2 = *pkt; AVPacket pkt2 = *pkt;
@ -1026,7 +1026,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s)
static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *codec = s->streams[pkt->stream_index]->codec; AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
int keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); int keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY);
int duration = pkt->duration; int duration = pkt->duration;
@ -1090,7 +1090,7 @@ static int mkv_copy_packet(MatroskaMuxContext *mkv, const AVPacket *pkt)
static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt) static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb; AVIOContext *pb = url_is_streamed(s->pb) ? mkv->dyn_bc : s->pb;
AVCodecContext *codec = s->streams[pkt->stream_index]->codec; AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY); int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY);
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
@ -1132,7 +1132,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
static int mkv_write_trailer(AVFormatContext *s) static int mkv_write_trailer(AVFormatContext *s)
{ {
MatroskaMuxContext *mkv = s->priv_data; MatroskaMuxContext *mkv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t currentpos, cuespos; int64_t currentpos, cuespos;
int ret; int ret;

@ -84,7 +84,7 @@ static int read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
MmDemuxContext *mm = s->priv_data; MmDemuxContext *mm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
unsigned int type, length; unsigned int type, length;
@ -137,7 +137,7 @@ static int read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
MmDemuxContext *mm = s->priv_data; MmDemuxContext *mm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned char preamble[MM_PREAMBLE_SIZE]; unsigned char preamble[MM_PREAMBLE_SIZE];
unsigned int type, length; unsigned int type, length;

@ -47,7 +47,7 @@ static int mmf_rate_code(int rate)
} }
/* Copy of end_tag() from avienc.c, but for big-endian chunk size */ /* Copy of end_tag() from avienc.c, but for big-endian chunk size */
static void end_tag_be(ByteIOContext *pb, int64_t start) static void end_tag_be(AVIOContext *pb, int64_t start)
{ {
int64_t pos; int64_t pos;
@ -60,7 +60,7 @@ static void end_tag_be(ByteIOContext *pb, int64_t start)
static int mmf_write_header(AVFormatContext *s) static int mmf_write_header(AVFormatContext *s)
{ {
MMFContext *mmf = s->priv_data; MMFContext *mmf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos; int64_t pos;
int rate; int rate;
@ -108,13 +108,13 @@ static int mmf_write_header(AVFormatContext *s)
static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt) static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size); put_buffer(pb, pkt->data, pkt->size);
return 0; return 0;
} }
/* Write a variable-length symbol */ /* Write a variable-length symbol */
static void put_varlength(ByteIOContext *pb, int val) static void put_varlength(AVIOContext *pb, int val)
{ {
if(val < 128) if(val < 128)
put_byte(pb, val); put_byte(pb, val);
@ -127,7 +127,7 @@ static void put_varlength(ByteIOContext *pb, int val)
static int mmf_write_trailer(AVFormatContext *s) static int mmf_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
MMFContext *mmf = s->priv_data; MMFContext *mmf = s->priv_data;
int64_t pos, size; int64_t pos, size;
int gatetime; int gatetime;
@ -183,7 +183,7 @@ static int mmf_read_header(AVFormatContext *s,
{ {
MMFContext *mmf = s->priv_data; MMFContext *mmf = s->priv_data;
unsigned int tag; unsigned int tag;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
int64_t file_size, size; int64_t file_size, size;
int rate, params; int rate, params;

@ -152,7 +152,7 @@ static int send_command_packet(MMSTContext *mmst)
static void mms_put_utf16(MMSContext *mms, uint8_t *src) static void mms_put_utf16(MMSContext *mms, uint8_t *src)
{ {
ByteIOContext bic; AVIOContext bic;
int size = mms->write_out_ptr - mms->out_buffer; int size = mms->write_out_ptr - mms->out_buffer;
int len; int len;
init_put_byte(&bic, mms->write_out_ptr, init_put_byte(&bic, mms->write_out_ptr,

@ -73,12 +73,12 @@
/* links atom IDs to parse functions */ /* links atom IDs to parse functions */
typedef struct MOVParseTableEntry { typedef struct MOVParseTableEntry {
uint32_t type; uint32_t type;
int (*parse)(MOVContext *ctx, ByteIOContext *pb, MOVAtom atom); int (*parse)(MOVContext *ctx, AVIOContext *pb, MOVAtom atom);
} MOVParseTableEntry; } MOVParseTableEntry;
static const MOVParseTableEntry mov_default_parse_table[]; static const MOVParseTableEntry mov_default_parse_table[];
static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len) static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len)
{ {
char buf[16]; char buf[16];
@ -110,7 +110,7 @@ static const uint32_t mac_to_unicode[128] = {
0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7, 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
}; };
static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len, static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len,
char *dst, int dstlen) char *dst, int dstlen)
{ {
char *p = dst; char *p = dst;
@ -128,7 +128,7 @@ static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len,
return p - dst; return p - dst;
} }
static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
#ifdef MOV_EXPORT_ALL_METADATA #ifdef MOV_EXPORT_ALL_METADATA
char tmp_key[5]; char tmp_key[5];
@ -137,7 +137,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
const char *key = NULL; const char *key = NULL;
uint16_t str_size, langcode = 0; uint16_t str_size, langcode = 0;
uint32_t data_type = 0; uint32_t data_type = 0;
int (*parse)(MOVContext*, ByteIOContext*, unsigned) = NULL; int (*parse)(MOVContext*, AVIOContext*, unsigned) = NULL;
switch (atom.type) { switch (atom.type) {
case MKTAG(0xa9,'n','a','m'): key = "title"; break; case MKTAG(0xa9,'n','a','m'): key = "title"; break;
@ -218,7 +218,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
int64_t start; int64_t start;
int i, nb_chapters, str_len, version; int i, nb_chapters, str_len, version;
@ -250,7 +250,7 @@ static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
int64_t total_size = 0; int64_t total_size = 0;
MOVAtom a; MOVAtom a;
@ -259,7 +259,7 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
if (atom.size < 0) if (atom.size < 0)
atom.size = INT64_MAX; atom.size = INT64_MAX;
while (total_size + 8 < atom.size && !url_feof(pb)) { while (total_size + 8 < atom.size && !url_feof(pb)) {
int (*parse)(MOVContext*, ByteIOContext*, MOVAtom) = NULL; int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
a.size = atom.size; a.size = atom.size;
a.type=0; a.type=0;
if(atom.size >= 8) { if(atom.size >= 8) {
@ -319,7 +319,7 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -423,7 +423,7 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
uint32_t type; uint32_t type;
@ -460,7 +460,7 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom) int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
int tag, len; int tag, len;
@ -483,12 +483,12 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
return ff_mov_read_esds(c->fc, pb, atom); return ff_mov_read_esds(c->fc, pb, atom);
} }
static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
int ac3info, acmod, lfeon; int ac3info, acmod, lfeon;
@ -505,7 +505,7 @@ static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
const int num = get_be32(pb); const int num = get_be32(pb);
const int den = get_be32(pb); const int den = get_be32(pb);
@ -529,7 +529,7 @@ static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
} }
/* this atom contains actual media data */ /* this atom contains actual media data */
static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_mdat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
if(atom.size == 0) /* wrong one (MP4) */ if(atom.size == 0) /* wrong one (MP4) */
return 0; return 0;
@ -538,7 +538,7 @@ static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
} }
/* read major brand, minor version and compatible brands and store them as metadata */ /* read major brand, minor version and compatible brands and store them as metadata */
static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
uint32_t minor_ver; uint32_t minor_ver;
int comp_brand_size; int comp_brand_size;
@ -570,7 +570,7 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
} }
/* this atom should contain all header atoms */ /* this atom should contain all header atoms */
static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
if (mov_read_default(c, pb, atom) < 0) if (mov_read_default(c, pb, atom) < 0)
return -1; return -1;
@ -580,7 +580,7 @@ static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; /* now go for mdat */ return 0; /* now go for mdat */
} }
static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
c->fragment.moof_offset = url_ftell(pb) - 8; c->fragment.moof_offset = url_ftell(pb) - 8;
av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset); av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
@ -600,7 +600,7 @@ static void mov_metadata_creation_time(AVMetadata **metadata, time_t time)
} }
} }
static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -639,7 +639,7 @@ static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
time_t creation_time; time_t creation_time;
int version = get_byte(pb); /* version */ int version = get_byte(pb); /* version */
@ -677,7 +677,7 @@ static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
@ -701,7 +701,7 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
int little_endian; int little_endian;
@ -734,7 +734,7 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
} }
/* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */ /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */
static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
uint64_t size; uint64_t size;
@ -758,7 +758,7 @@ static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
@ -789,7 +789,7 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
* This function reads atom content and puts data in extradata without tag * This function reads atom content and puts data in extradata without tag
* nor size unlike mov_read_extradata. * nor size unlike mov_read_extradata.
*/ */
static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
@ -814,7 +814,7 @@ static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
* but can have extradata appended at the end after the 40 bytes belonging * but can have extradata appended at the end after the 40 bytes belonging
* to the struct. * to the struct.
*/ */
static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
@ -837,7 +837,7 @@ static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -908,7 +908,7 @@ enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
return CODEC_ID_NONE; return CODEC_ID_NONE;
} }
int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries) int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -1244,7 +1244,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
return 0; return 0;
} }
static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
int entries; int entries;
@ -1255,7 +1255,7 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return ff_mov_read_stsd_entries(c, pb, entries); return ff_mov_read_stsd_entries(c, pb, entries);
} }
static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -1288,7 +1288,7 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -1317,7 +1317,7 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -1349,7 +1349,7 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -1417,7 +1417,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -1464,7 +1464,7 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -1682,7 +1682,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
} }
} }
static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref) static int mov_open_dref(AVIOContext **pb, char *src, MOVDref *ref)
{ {
/* try relative path, we do not try the absolute because it can leak information about our /* try relative path, we do not try the absolute because it can leak information about our
system to an attacker */ system to an attacker */
@ -1725,7 +1725,7 @@ static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref)
return AVERROR(ENOENT); return AVERROR(ENOENT);
} }
static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
AVStream *st; AVStream *st;
MOVStreamContext *sc; MOVStreamContext *sc;
@ -1824,7 +1824,7 @@ static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
int ret; int ret;
c->itunes_metadata = 1; c->itunes_metadata = 1;
@ -1833,7 +1833,7 @@ static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return ret; return ret;
} }
static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
while (atom.size > 8) { while (atom.size > 8) {
uint32_t tag = get_le32(pb); uint32_t tag = get_le32(pb);
@ -1847,7 +1847,7 @@ static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
int i; int i;
int width; int width;
@ -1930,7 +1930,7 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
MOVFragment *frag = &c->fragment; MOVFragment *frag = &c->fragment;
MOVTrackExt *trex = NULL; MOVTrackExt *trex = NULL;
@ -1965,13 +1965,13 @@ static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_chap(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
c->chapter_track = get_be32(pb); c->chapter_track = get_be32(pb);
return 0; return 0;
} }
static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
MOVTrackExt *trex; MOVTrackExt *trex;
@ -1992,7 +1992,7 @@ static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0; return 0;
} }
static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
MOVFragment *frag = &c->fragment; MOVFragment *frag = &c->fragment;
AVStream *st = NULL; AVStream *st = NULL;
@ -2070,7 +2070,7 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
/* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */ /* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */
/* like the files created with Adobe Premiere 5.0, for samples see */ /* like the files created with Adobe Premiere 5.0, for samples see */
/* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */ /* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */
static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
int err; int err;
@ -2090,10 +2090,10 @@ static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return err; return err;
} }
static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
#if CONFIG_ZLIB #if CONFIG_ZLIB
ByteIOContext ctx; AVIOContext ctx;
uint8_t *cmov_data; uint8_t *cmov_data;
uint8_t *moov_data; /* uncompressed data */ uint8_t *moov_data; /* uncompressed data */
long cmov_len, moov_len; long cmov_len, moov_len;
@ -2142,7 +2142,7 @@ free_and_return:
} }
/* edit list atom */ /* edit list atom */
static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom) static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{ {
MOVStreamContext *sc; MOVStreamContext *sc;
int i, edit_count; int i, edit_count;
@ -2343,7 +2343,7 @@ finish:
static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
MOVContext *mov = s->priv_data; MOVContext *mov = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int err; int err;
MOVAtom atom = { AV_RL32("root") }; MOVAtom atom = { AV_RL32("root") };

@ -36,7 +36,7 @@
#include <assert.h> #include <assert.h>
//FIXME support 64 bit variant with wide placeholders //FIXME support 64 bit variant with wide placeholders
static int64_t updateSize(ByteIOContext *pb, int64_t pos) static int64_t updateSize(AVIOContext *pb, int64_t pos)
{ {
int64_t curpos = url_ftell(pb); int64_t curpos = url_ftell(pb);
url_fseek(pb, pos, SEEK_SET); url_fseek(pb, pos, SEEK_SET);
@ -47,7 +47,7 @@ static int64_t updateSize(ByteIOContext *pb, int64_t pos)
} }
/* Chunk offset atom */ /* Chunk offset atom */
static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track)
{ {
int i; int i;
int mode64 = 0; // use 32 bit size variant if possible int mode64 = 0; // use 32 bit size variant if possible
@ -70,7 +70,7 @@ static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track)
} }
/* Sample size atom */ /* Sample size atom */
static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track)
{ {
int equalChunks = 1; int equalChunks = 1;
int i, j, entries = 0, tst = -1, oldtst = -1; int i, j, entries = 0, tst = -1, oldtst = -1;
@ -107,7 +107,7 @@ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track)
} }
/* Sample to chunk atom */ /* Sample to chunk atom */
static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
{ {
int index = 0, oldval = -1, i; int index = 0, oldval = -1, i;
int64_t entryPos, curpos; int64_t entryPos, curpos;
@ -137,7 +137,7 @@ static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track)
} }
/* Sync sample atom */ /* Sync sample atom */
static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track, uint32_t flag) static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag)
{ {
int64_t curpos, entryPos; int64_t curpos, entryPos;
int i, index = 0; int i, index = 0;
@ -160,7 +160,7 @@ static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track, uint32_t flag)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track)
{ {
put_be32(pb, 0x11); /* size */ put_be32(pb, 0x11); /* size */
if (track->mode == MODE_MOV) put_tag(pb, "samr"); if (track->mode == MODE_MOV) put_tag(pb, "samr");
@ -174,7 +174,7 @@ static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track)
return 0x11; return 0x11;
} }
static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track)
{ {
GetBitContext gbc; GetBitContext gbc;
PutBitContext pbc; PutBitContext pbc;
@ -222,13 +222,13 @@ static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track)
* This function writes extradata "as is". * This function writes extradata "as is".
* Extradata must be formated like a valid atom (with size and tag) * Extradata must be formated like a valid atom (with size and tag)
*/ */
static int mov_write_extradata_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_extradata_tag(AVIOContext *pb, MOVTrack *track)
{ {
put_buffer(pb, track->enc->extradata, track->enc->extradata_size); put_buffer(pb, track->enc->extradata, track->enc->extradata_size);
return track->enc->extradata_size; return track->enc->extradata_size;
} }
static int mov_write_enda_tag(ByteIOContext *pb) static int mov_write_enda_tag(AVIOContext *pb)
{ {
put_be32(pb, 10); put_be32(pb, 10);
put_tag(pb, "enda"); put_tag(pb, "enda");
@ -243,7 +243,7 @@ static unsigned int descrLength(unsigned int len)
return len + 1 + i; return len + 1 + i;
} }
static void putDescr(ByteIOContext *pb, int tag, unsigned int size) static void putDescr(AVIOContext *pb, int tag, unsigned int size)
{ {
int i= descrLength(size) - size - 2; int i= descrLength(size) - size - 2;
put_byte(pb, tag); put_byte(pb, tag);
@ -252,7 +252,7 @@ static void putDescr(ByteIOContext *pb, int tag, unsigned int size)
put_byte(pb, size & 0x7F); put_byte(pb, size & 0x7F);
} }
static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
@ -314,7 +314,7 @@ static int mov_pcm_le_gt16(enum CodecID codec_id)
codec_id == CODEC_ID_PCM_F64LE; codec_id == CODEC_ID_PCM_F64LE;
} }
static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); put_be32(pb, 0);
@ -324,7 +324,7 @@ static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -360,7 +360,7 @@ static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_glbl_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track)
{ {
put_be32(pb, track->vosLen+8); put_be32(pb, track->vosLen+8);
put_tag(pb, "glbl"); put_tag(pb, "glbl");
@ -397,7 +397,7 @@ static int mov_get_lpcm_flags(enum CodecID codec_id)
} }
} }
static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int version = 0; int version = 0;
@ -490,7 +490,7 @@ static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_d263_tag(ByteIOContext *pb) static int mov_write_d263_tag(AVIOContext *pb)
{ {
put_be32(pb, 0xf); /* size */ put_be32(pb, 0xf); /* size */
put_tag(pb, "d263"); put_tag(pb, "d263");
@ -503,7 +503,7 @@ static int mov_write_d263_tag(ByteIOContext *pb)
} }
/* TODO: No idea about these values */ /* TODO: No idea about these values */
static int mov_write_svq3_tag(ByteIOContext *pb) static int mov_write_svq3_tag(AVIOContext *pb)
{ {
put_be32(pb, 0x15); put_be32(pb, 0x15);
put_tag(pb, "SMI "); put_tag(pb, "SMI ");
@ -515,7 +515,7 @@ static int mov_write_svq3_tag(ByteIOContext *pb)
return 0x15; return 0x15;
} }
static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -526,7 +526,7 @@ static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track)
} }
/* also used by all avid codecs (dv, imx, meridien) and their variants */ /* also used by all avid codecs (dv, imx, meridien) and their variants */
static int mov_write_avid_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
{ {
int i; int i;
put_be32(pb, 24); /* size */ put_be32(pb, 24); /* size */
@ -738,7 +738,7 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
* Needed to make file play in iPods running newest firmware * Needed to make file play in iPods running newest firmware
* goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1 * goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1
*/ */
static int mov_write_uuid_tag_ipod(ByteIOContext *pb) static int mov_write_uuid_tag_ipod(AVIOContext *pb)
{ {
put_be32(pb, 28); put_be32(pb, 28);
put_tag(pb, "uuid"); put_tag(pb, "uuid");
@ -750,7 +750,7 @@ static int mov_write_uuid_tag_ipod(ByteIOContext *pb)
return 28; return 28;
} }
static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -765,7 +765,7 @@ static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_pasp_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
{ {
AVRational sar; AVRational sar;
av_reduce(&sar.num, &sar.den, track->enc->sample_aspect_ratio.num, av_reduce(&sar.num, &sar.den, track->enc->sample_aspect_ratio.num,
@ -778,7 +778,7 @@ static int mov_write_pasp_tag(ByteIOContext *pb, MOVTrack *track)
return 16; return 16;
} }
static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
char compressor_name[32]; char compressor_name[32];
@ -848,7 +848,7 @@ static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_rtp_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -868,7 +868,7 @@ static int mov_write_rtp_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -886,7 +886,7 @@ static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track)
{ {
MOVStts *ctts_entries; MOVStts *ctts_entries;
uint32_t entries = 0; uint32_t entries = 0;
@ -920,7 +920,7 @@ static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track)
} }
/* Time to sample atom */ /* Time to sample atom */
static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track)
{ {
MOVStts *stts_entries; MOVStts *stts_entries;
uint32_t entries = -1; uint32_t entries = -1;
@ -961,7 +961,7 @@ static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track)
return atom_size; return atom_size;
} }
static int mov_write_dref_tag(ByteIOContext *pb) static int mov_write_dref_tag(AVIOContext *pb)
{ {
put_be32(pb, 28); /* size */ put_be32(pb, 28); /* size */
put_tag(pb, "dref"); put_tag(pb, "dref");
@ -975,7 +975,7 @@ static int mov_write_dref_tag(ByteIOContext *pb)
return 28; return 28;
} }
static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -997,7 +997,7 @@ static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_dinf_tag(ByteIOContext *pb) static int mov_write_dinf_tag(AVIOContext *pb)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -1006,7 +1006,7 @@ static int mov_write_dinf_tag(ByteIOContext *pb)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_nmhd_tag(ByteIOContext *pb) static int mov_write_nmhd_tag(AVIOContext *pb)
{ {
put_be32(pb, 12); put_be32(pb, 12);
put_tag(pb, "nmhd"); put_tag(pb, "nmhd");
@ -1014,7 +1014,7 @@ static int mov_write_nmhd_tag(ByteIOContext *pb)
return 12; return 12;
} }
static int mov_write_gmhd_tag(ByteIOContext *pb) static int mov_write_gmhd_tag(AVIOContext *pb)
{ {
put_be32(pb, 0x20); /* size */ put_be32(pb, 0x20); /* size */
put_tag(pb, "gmhd"); put_tag(pb, "gmhd");
@ -1030,7 +1030,7 @@ static int mov_write_gmhd_tag(ByteIOContext *pb)
return 0x20; return 0x20;
} }
static int mov_write_smhd_tag(ByteIOContext *pb) static int mov_write_smhd_tag(AVIOContext *pb)
{ {
put_be32(pb, 16); /* size */ put_be32(pb, 16); /* size */
put_tag(pb, "smhd"); put_tag(pb, "smhd");
@ -1040,7 +1040,7 @@ static int mov_write_smhd_tag(ByteIOContext *pb)
return 16; return 16;
} }
static int mov_write_vmhd_tag(ByteIOContext *pb) static int mov_write_vmhd_tag(AVIOContext *pb)
{ {
put_be32(pb, 0x14); /* size (always 0x14) */ put_be32(pb, 0x14); /* size (always 0x14) */
put_tag(pb, "vmhd"); put_tag(pb, "vmhd");
@ -1049,7 +1049,7 @@ static int mov_write_vmhd_tag(ByteIOContext *pb)
return 0x14; return 0x14;
} }
static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
{ {
const char *hdlr, *descr = NULL, *hdlr_type = NULL; const char *hdlr, *descr = NULL, *hdlr_type = NULL;
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -1092,7 +1092,7 @@ static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_hmhd_tag(ByteIOContext *pb) static int mov_write_hmhd_tag(AVIOContext *pb)
{ {
/* This atom must be present, but leaving the values at zero /* This atom must be present, but leaving the values at zero
* seems harmless. */ * seems harmless. */
@ -1107,7 +1107,7 @@ static int mov_write_hmhd_tag(ByteIOContext *pb)
return 28; return 28;
} }
static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -1129,7 +1129,7 @@ static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
{ {
int version = track->trackDuration < INT32_MAX ? 0 : 1; int version = track->trackDuration < INT32_MAX ? 0 : 1;
@ -1159,7 +1159,7 @@ static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track)
return 32; return 32;
} }
static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -1170,7 +1170,7 @@ static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
{ {
int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
track->timescale, AV_ROUND_UP); track->timescale, AV_ROUND_UP);
@ -1229,7 +1229,7 @@ static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
} }
// This box seems important for the psp playback ... without it the movie seems to hang // This box seems important for the psp playback ... without it the movie seems to hang
static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
{ {
put_be32(pb, 0x24); /* size */ put_be32(pb, 0x24); /* size */
put_tag(pb, "edts"); put_tag(pb, "edts");
@ -1247,7 +1247,7 @@ static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track)
return 0x24; return 0x24;
} }
static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track) static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track)
{ {
put_be32(pb, 20); // size put_be32(pb, 20); // size
put_tag(pb, "tref"); put_tag(pb, "tref");
@ -1258,7 +1258,7 @@ static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track)
} }
// goes at the end of each track! ... Critical for PSP playback ("Incompatible data" without it) // goes at the end of each track! ... Critical for PSP playback ("Incompatible data" without it)
static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov) static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov)
{ {
put_be32(pb, 0x34); /* size ... reports as 28 in mp4box! */ put_be32(pb, 0x34); /* size ... reports as 28 in mp4box! */
put_tag(pb, "uuid"); put_tag(pb, "uuid");
@ -1276,7 +1276,7 @@ static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov)
return 0x34; return 0x34;
} }
static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index) static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index)
{ {
char buf[1000] = ""; char buf[1000] = "";
int len; int len;
@ -1295,7 +1295,7 @@ static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index)
return len + 24; return len + 24;
} }
static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
put_be32(pb, 0); /* size */ put_be32(pb, 0); /* size */
@ -1315,7 +1315,7 @@ static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
#if 0 #if 0
/* TODO: Not sorted out, but not necessary either */ /* TODO: Not sorted out, but not necessary either */
static int mov_write_iods_tag(ByteIOContext *pb, MOVMuxContext *mov) static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
{ {
put_be32(pb, 0x15); /* size */ put_be32(pb, 0x15); /* size */
put_tag(pb, "iods"); put_tag(pb, "iods");
@ -1329,7 +1329,7 @@ static int mov_write_iods_tag(ByteIOContext *pb, MOVMuxContext *mov)
} }
#endif #endif
static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov) static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
{ {
int maxTrackID = 1, i; int maxTrackID = 1, i;
int64_t maxTrackLenTemp, maxTrackLen = 0; int64_t maxTrackLenTemp, maxTrackLen = 0;
@ -1390,7 +1390,7 @@ static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov)
return 0x6c; return 0x6c;
} }
static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov, static int mov_write_itunes_hdlr_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
put_be32(pb, 33); /* size */ put_be32(pb, 33); /* size */
@ -1406,7 +1406,7 @@ static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov,
} }
/* helper function to write a data tag with the specified string as data */ /* helper function to write a data tag with the specified string as data */
static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lang, int long_style) static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang, int long_style)
{ {
if(long_style){ if(long_style){
int size = 16 + strlen(data); int size = 16 + strlen(data);
@ -1426,7 +1426,7 @@ static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int la
} }
} }
static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int lang, int long_style){ static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){
int size = 0; int size = 0;
if (value && value[0]) { if (value && value[0]) {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -1438,7 +1438,7 @@ static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char
return size; return size;
} }
static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb, static int mov_write_string_metadata(AVFormatContext *s, AVIOContext *pb,
const char *name, const char *tag, const char *name, const char *tag,
int long_style) int long_style)
{ {
@ -1463,7 +1463,7 @@ static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb,
} }
/* iTunes track number */ /* iTunes track number */
static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov, static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0); AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0);
@ -1485,7 +1485,7 @@ static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov,
} }
/* iTunes meta data list */ /* iTunes meta data list */
static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov, static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -1513,7 +1513,7 @@ static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov,
} }
/* iTunes meta data tag */ /* iTunes meta data tag */
static int mov_write_meta_tag(ByteIOContext *pb, MOVMuxContext *mov, static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
int size = 0; int size = 0;
@ -1538,7 +1538,7 @@ static int utf8len(const uint8_t *b)
return len; return len;
} }
static int ascii_to_wc(ByteIOContext *pb, const uint8_t *b) static int ascii_to_wc(AVIOContext *pb, const uint8_t *b)
{ {
int val; int val;
while(*b){ while(*b){
@ -1554,7 +1554,7 @@ static uint16_t language_code(const char *str)
return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F); return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F);
} }
static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s, static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
const char *tag, const char *str) const char *tag, const char *str)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -1576,7 +1576,7 @@ static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s,
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_chpl_tag(ByteIOContext *pb, AVFormatContext *s) static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
int i, nb_chapters = FFMIN(s->nb_chapters, 255); int i, nb_chapters = FFMIN(s->nb_chapters, 255);
@ -1602,10 +1602,10 @@ static int mov_write_chpl_tag(ByteIOContext *pb, AVFormatContext *s)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
ByteIOContext *pb_buf; AVIOContext *pb_buf;
int i, ret, size; int i, ret, size;
uint8_t *buf; uint8_t *buf;
@ -1655,7 +1655,7 @@ static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov,
return 0; return 0;
} }
static void mov_write_psp_udta_tag(ByteIOContext *pb, static void mov_write_psp_udta_tag(AVIOContext *pb,
const char *str, const char *lang, int type) const char *str, const char *lang, int type)
{ {
int len = utf8len(str)+1; int len = utf8len(str)+1;
@ -1668,7 +1668,7 @@ static void mov_write_psp_udta_tag(ByteIOContext *pb,
ascii_to_wc(pb, str); ascii_to_wc(pb, str);
} }
static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s) static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
{ {
AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0); AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0);
int64_t pos, pos2; int64_t pos, pos2;
@ -1706,7 +1706,7 @@ static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s)
return 0; return 0;
} }
static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov, static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s) AVFormatContext *s)
{ {
int i; int i;
@ -1750,7 +1750,7 @@ static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov,
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static int mov_write_mdat_tag(ByteIOContext *pb, MOVMuxContext *mov) static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov)
{ {
put_be32(pb, 8); // placeholder for extended size field (64 bit) put_be32(pb, 8); // placeholder for extended size field (64 bit)
put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free"); put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free");
@ -1762,7 +1762,7 @@ static int mov_write_mdat_tag(ByteIOContext *pb, MOVMuxContext *mov)
} }
/* TODO: This needs to be more general */ /* TODO: This needs to be more general */
static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s) static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
{ {
MOVMuxContext *mov = s->priv_data; MOVMuxContext *mov = s->priv_data;
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
@ -1818,7 +1818,7 @@ static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s)
return updateSize(pb, pos); return updateSize(pb, pos);
} }
static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s) static void mov_write_uuidprof_tag(AVIOContext *pb, AVFormatContext *s)
{ {
AVCodecContext *VideoCodec = s->streams[0]->codec; AVCodecContext *VideoCodec = s->streams[0]->codec;
AVCodecContext *AudioCodec = s->streams[1]->codec; AVCodecContext *AudioCodec = s->streams[1]->codec;
@ -1903,7 +1903,7 @@ static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags)
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
MOVMuxContext *mov = s->priv_data; MOVMuxContext *mov = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
MOVTrack *trk = &mov->tracks[pkt->stream_index]; MOVTrack *trk = &mov->tracks[pkt->stream_index];
AVCodecContext *enc = trk->enc; AVCodecContext *enc = trk->enc;
unsigned int samplesInChunk = 0; unsigned int samplesInChunk = 0;
@ -2040,7 +2040,7 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
static int mov_write_header(AVFormatContext *s) static int mov_write_header(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
MOVMuxContext *mov = s->priv_data; MOVMuxContext *mov = s->priv_data;
int i, hint_track = 0; int i, hint_track = 0;
@ -2192,7 +2192,7 @@ static int mov_write_header(AVFormatContext *s)
static int mov_write_trailer(AVFormatContext *s) static int mov_write_trailer(AVFormatContext *s)
{ {
MOVMuxContext *mov = s->priv_data; MOVMuxContext *mov = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int res = 0; int res = 0;
int i; int i;

@ -245,7 +245,7 @@ static int find_sample_match(const uint8_t *data, int len,
} }
static void output_immediate(const uint8_t *data, int size, static void output_immediate(const uint8_t *data, int size,
ByteIOContext *out, int *entries) AVIOContext *out, int *entries)
{ {
while (size > 0) { while (size > 0) {
int len = size; int len = size;
@ -264,7 +264,7 @@ static void output_immediate(const uint8_t *data, int size,
} }
} }
static void output_match(ByteIOContext *out, int match_sample, static void output_match(AVIOContext *out, int match_sample,
int match_offset, int match_len, int *entries) int match_offset, int match_len, int *entries)
{ {
put_byte(out, 2); /* sample constructor */ put_byte(out, 2); /* sample constructor */
@ -278,7 +278,7 @@ static void output_match(ByteIOContext *out, int match_sample,
} }
static void describe_payload(const uint8_t *data, int size, static void describe_payload(const uint8_t *data, int size,
ByteIOContext *out, int *entries, AVIOContext *out, int *entries,
HintSampleQueue *queue) HintSampleQueue *queue)
{ {
/* Describe the payload using different constructors */ /* Describe the payload using different constructors */
@ -309,7 +309,7 @@ static void describe_payload(const uint8_t *data, int size,
* @param pts pointer where the timestamp for the written RTP hint is stored * @param pts pointer where the timestamp for the written RTP hint is stored
* @return the number of RTP packets in the written hint * @return the number of RTP packets in the written hint
*/ */
static int write_hint_packets(ByteIOContext *out, const uint8_t *data, static int write_hint_packets(AVIOContext *out, const uint8_t *data,
int size, MOVTrack *trk, int64_t *pts) int size, MOVTrack *trk, int64_t *pts)
{ {
int64_t curpos; int64_t curpos;
@ -392,7 +392,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
AVFormatContext *rtp_ctx = trk->rtp_ctx; AVFormatContext *rtp_ctx = trk->rtp_ctx;
uint8_t *buf = NULL; uint8_t *buf = NULL;
int size; int size;
ByteIOContext *hintbuf = NULL; AVIOContext *hintbuf = NULL;
AVPacket hint_pkt; AVPacket hint_pkt;
int ret = 0, count; int ret = 0, count;

@ -93,8 +93,8 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
{ {
int len; int len;
uint8_t *pb; uint8_t *pb;
int (*put)(ByteIOContext*, const char*); int (*put)(AVIOContext*, const char*);
ByteIOContext *dyn_buf; AVIOContext *dyn_buf;
if (url_open_dyn_buf(&dyn_buf) < 0) if (url_open_dyn_buf(&dyn_buf) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

@ -117,7 +117,7 @@ static inline int64_t gb_get_v(GetBitContext *gb)
return v; return v;
} }
static void mpc8_get_chunk_header(ByteIOContext *pb, int *tag, int64_t *size) static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size)
{ {
int64_t pos; int64_t pos;
pos = url_ftell(pb); pos = url_ftell(pb);
@ -171,7 +171,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, int64_t size) static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, int64_t size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pos, off; int64_t pos, off;
switch(tag){ switch(tag){
@ -189,7 +189,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in
static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
MPCContext *c = s->priv_data; MPCContext *c = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
int tag = 0; int tag = 0;
int64_t size, pos; int64_t size, pos;

@ -124,7 +124,7 @@ static int mpegps_read_header(AVFormatContext *s,
return 0; return 0;
} }
static int64_t get_pts(ByteIOContext *pb, int c) static int64_t get_pts(AVIOContext *pb, int c)
{ {
uint8_t buf[5]; uint8_t buf[5];
@ -134,7 +134,7 @@ static int64_t get_pts(ByteIOContext *pb, int c)
return ff_parse_pes_pts(buf); return ff_parse_pes_pts(buf);
} }
static int find_next_start_code(ByteIOContext *pb, int *size_ptr, static int find_next_start_code(AVIOContext *pb, int *size_ptr,
int32_t *header_state) int32_t *header_state)
{ {
unsigned int state, v; unsigned int state, v;
@ -163,7 +163,7 @@ static int find_next_start_code(ByteIOContext *pb, int *size_ptr,
#if 0 /* unused, remove? */ #if 0 /* unused, remove? */
/* XXX: optimize */ /* XXX: optimize */
static int find_prev_start_code(ByteIOContext *pb, int *size_ptr) static int find_prev_start_code(AVIOContext *pb, int *size_ptr)
{ {
int64_t pos, pos_start; int64_t pos, pos_start;
int max_size, start_code; int max_size, start_code;
@ -202,7 +202,7 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr)
* *
* @return number of bytes occupied by PSM in the bitstream * @return number of bytes occupied by PSM in the bitstream
*/ */
static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb) static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb)
{ {
int psm_length, ps_info_length, es_map_length; int psm_length, ps_info_length, es_map_length;

@ -491,7 +491,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
static inline void put_timestamp(ByteIOContext *pb, int id, int64_t timestamp) static inline void put_timestamp(AVIOContext *pb, int id, int64_t timestamp)
{ {
put_byte(pb, put_byte(pb,
(id << 4) | (id << 4) |
@ -613,7 +613,7 @@ static int get_packet_payload_size(AVFormatContext *ctx, int stream_index,
#endif #endif
/* Write an MPEG padding packet header. */ /* Write an MPEG padding packet header. */
static void put_padding_packet(AVFormatContext *ctx, ByteIOContext *pb,int packet_bytes) static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes)
{ {
MpegMuxContext *s = ctx->priv_data; MpegMuxContext *s = ctx->priv_data;
int i; int i;

@ -851,7 +851,7 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size,
int *es_id, uint8_t **dec_config_descr, int *es_id, uint8_t **dec_config_descr,
int *dec_config_descr_size) int *dec_config_descr_size)
{ {
ByteIOContext pb; AVIOContext pb;
int tag; int tag;
unsigned len; unsigned len;
@ -913,7 +913,7 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
get16(pp, desc_end); get16(pp, desc_end);
if (st->codec->codec_id == CODEC_ID_AAC_LATM && if (st->codec->codec_id == CODEC_ID_AAC_LATM &&
mp4_dec_config_descr_len && mp4_es_id == pid) { mp4_dec_config_descr_len && mp4_es_id == pid) {
ByteIOContext pb; AVIOContext pb;
init_put_byte(&pb, mp4_dec_config_descr, init_put_byte(&pb, mp4_dec_config_descr,
mp4_dec_config_descr_len, 0, NULL, NULL, NULL, NULL); mp4_dec_config_descr_len, 0, NULL, NULL, NULL, NULL);
ff_mp4_read_dec_config_descr(fc, st, &pb); ff_mp4_read_dec_config_descr(fc, st, &pb);
@ -1307,7 +1307,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
get_packet_size() ?) */ get_packet_size() ?) */
static int mpegts_resync(AVFormatContext *s) static int mpegts_resync(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int c, i; int c, i;
for(i = 0;i < MAX_RESYNC_SIZE; i++) { for(i = 0;i < MAX_RESYNC_SIZE; i++) {
@ -1327,7 +1327,7 @@ static int mpegts_resync(AVFormatContext *s)
/* return -1 if error or EOF. Return 0 if OK. */ /* return -1 if error or EOF. Return 0 if OK. */
static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int skip, len; int skip, len;
for(;;) { for(;;) {
@ -1439,7 +1439,7 @@ static int mpegts_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
MpegTSContext *ts = s->priv_data; MpegTSContext *ts = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint8_t buf[5*1024]; uint8_t buf[5*1024];
int len; int len;
int64_t pos; int64_t pos;

@ -593,7 +593,7 @@ static void retransmit_si_info(AVFormatContext *s)
} }
} }
static int64_t get_pcr(const MpegTSWrite *ts, ByteIOContext *pb) static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb)
{ {
return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) + return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) +
ts->first_pcr; ts->first_pcr;

@ -71,7 +71,7 @@ static int msnwc_tcp_probe(AVProbeData *p)
static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
{ {
ByteIOContext *pb = ctx->pb; AVIOContext *pb = ctx->pb;
AVCodecContext *codec; AVCodecContext *codec;
AVStream *st; AVStream *st;
@ -100,7 +100,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
{ {
ByteIOContext *pb = ctx->pb; AVIOContext *pb = ctx->pb;
uint16_t keyframe; uint16_t keyframe;
uint32_t size, timestamp; uint32_t size, timestamp;

@ -79,7 +79,7 @@ static int mtv_probe(AVProbeData *p)
static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
MTVDemuxContext *mtv = s->priv_data; MTVDemuxContext *mtv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
unsigned int audio_subsegments; unsigned int audio_subsegments;
@ -156,7 +156,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
MTVDemuxContext *mtv = s->priv_data; MTVDemuxContext *mtv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int ret; int ret;
#if !HAVE_BIGENDIAN #if !HAVE_BIGENDIAN
int i; int i;

@ -27,7 +27,7 @@
#define MVI_VIDEO_STREAM_INDEX 1 #define MVI_VIDEO_STREAM_INDEX 1
typedef struct MviDemuxContext { typedef struct MviDemuxContext {
unsigned int (*get_int)(ByteIOContext *); unsigned int (*get_int)(AVIOContext *);
uint32_t audio_data_size; uint32_t audio_data_size;
uint64_t audio_size_counter; uint64_t audio_size_counter;
uint64_t audio_frame_size; uint64_t audio_frame_size;
@ -38,7 +38,7 @@ typedef struct MviDemuxContext {
static int read_header(AVFormatContext *s, AVFormatParameters *ap) static int read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
MviDemuxContext *mvi = s->priv_data; MviDemuxContext *mvi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *ast, *vst; AVStream *ast, *vst;
unsigned int version, frames_count, msecs_per_frame, player_version; unsigned int version, frames_count, msecs_per_frame, player_version;
@ -100,7 +100,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
int ret, count; int ret, count;
MviDemuxContext *mvi = s->priv_data; MviDemuxContext *mvi = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
if (mvi->video_frame_size == 0) { if (mvi->video_frame_size == 0) {
mvi->video_frame_size = (mvi->get_int)(pb); mvi->video_frame_size = (mvi->get_int)(pb);

@ -140,7 +140,7 @@ enum MXFWrappingScheme {
Clip, Clip,
}; };
typedef int MXFMetadataReadFunc(void *arg, ByteIOContext *pb, int tag, int size, UID uid); typedef int MXFMetadataReadFunc(void *arg, AVIOContext *pb, int tag, int size, UID uid);
typedef struct { typedef struct {
const UID key; const UID key;
@ -161,7 +161,7 @@ static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x
#define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y))) #define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
static int64_t klv_decode_ber_length(ByteIOContext *pb) static int64_t klv_decode_ber_length(AVIOContext *pb)
{ {
uint64_t size = get_byte(pb); uint64_t size = get_byte(pb);
if (size & 0x80) { /* long form */ if (size & 0x80) { /* long form */
@ -176,7 +176,7 @@ static int64_t klv_decode_ber_length(ByteIOContext *pb)
return size; return size;
} }
static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size) static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size)
{ {
int i, b; int i, b;
for (i = 0; i < size && !url_feof(pb); i++) { for (i = 0; i < size && !url_feof(pb); i++) {
@ -189,7 +189,7 @@ static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size)
return i == size; return i == size;
} }
static int klv_read_packet(KLVPacket *klv, ByteIOContext *pb) static int klv_read_packet(KLVPacket *klv, AVIOContext *pb)
{ {
if (!mxf_read_sync(pb, mxf_klv_key, 4)) if (!mxf_read_sync(pb, mxf_klv_key, 4))
return -1; return -1;
@ -215,7 +215,7 @@ static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv)
} }
/* XXX: use AVBitStreamFilter */ /* XXX: use AVBitStreamFilter */
static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length) static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length)
{ {
const uint8_t *buf_ptr, *end_ptr; const uint8_t *buf_ptr, *end_ptr;
uint8_t *data_ptr; uint8_t *data_ptr;
@ -246,7 +246,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
{ {
static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b}; static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b};
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t end = url_ftell(pb) + klv->length; int64_t end = url_ftell(pb) + klv->length;
uint64_t size; uint64_t size;
uint64_t orig_size; uint64_t orig_size;
@ -344,7 +344,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR_EOF; return AVERROR_EOF;
} }
static int mxf_read_primer_pack(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFContext *mxf = arg; MXFContext *mxf = arg;
int item_num = get_be32(pb); int item_num = get_be32(pb);
@ -376,7 +376,7 @@ static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
return 0; return 0;
} }
static int mxf_read_cryptographic_context(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFCryptoContext *cryptocontext = arg; MXFCryptoContext *cryptocontext = arg;
if (size != 16) if (size != 16)
@ -386,7 +386,7 @@ static int mxf_read_cryptographic_context(void *arg, ByteIOContext *pb, int tag,
return 0; return 0;
} }
static int mxf_read_content_storage(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFContext *mxf = arg; MXFContext *mxf = arg;
switch (tag) { switch (tag) {
@ -404,7 +404,7 @@ static int mxf_read_content_storage(void *arg, ByteIOContext *pb, int tag, int s
return 0; return 0;
} }
static int mxf_read_source_clip(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFStructuralComponent *source_clip = arg; MXFStructuralComponent *source_clip = arg;
switch(tag) { switch(tag) {
@ -426,7 +426,7 @@ static int mxf_read_source_clip(void *arg, ByteIOContext *pb, int tag, int size,
return 0; return 0;
} }
static int mxf_read_material_package(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFPackage *package = arg; MXFPackage *package = arg;
switch(tag) { switch(tag) {
@ -444,7 +444,7 @@ static int mxf_read_material_package(void *arg, ByteIOContext *pb, int tag, int
return 0; return 0;
} }
static int mxf_read_track(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFTrack *track = arg; MXFTrack *track = arg;
switch(tag) { switch(tag) {
@ -465,7 +465,7 @@ static int mxf_read_track(void *arg, ByteIOContext *pb, int tag, int size, UID u
return 0; return 0;
} }
static int mxf_read_sequence(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFSequence *sequence = arg; MXFSequence *sequence = arg;
switch(tag) { switch(tag) {
@ -489,7 +489,7 @@ static int mxf_read_sequence(void *arg, ByteIOContext *pb, int tag, int size, UI
return 0; return 0;
} }
static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFPackage *package = arg; MXFPackage *package = arg;
switch(tag) { switch(tag) {
@ -515,7 +515,7 @@ static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int si
return 0; return 0;
} }
static int mxf_read_index_table_segment(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
switch(tag) { switch(tag) {
case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break; case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break;
@ -528,7 +528,7 @@ static int mxf_read_index_table_segment(void *arg, ByteIOContext *pb, int tag, i
return 0; return 0;
} }
static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor) static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor)
{ {
int code, value, ofs = 0; int code, value, ofs = 0;
char layout[16] = {0}; char layout[16] = {0};
@ -547,7 +547,7 @@ static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor)
ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt); ff_mxf_decode_pixel_layout(layout, &descriptor->pix_fmt);
} }
static int mxf_read_generic_descriptor(void *arg, ByteIOContext *pb, int tag, int size, UID uid) static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int size, UID uid)
{ {
MXFDescriptor *descriptor = arg; MXFDescriptor *descriptor = arg;
switch(tag) { switch(tag) {
@ -864,7 +864,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type) static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadFunc *read_child, int ctx_size, enum MXFMetadataSetType type)
{ {
ByteIOContext *pb = mxf->fc->pb; AVIOContext *pb = mxf->fc->pb;
MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf; MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf;
uint64_t klv_end = url_ftell(pb) + klv->length; uint64_t klv_end = url_ftell(pb) + klv->length;

@ -305,7 +305,7 @@ static const MXFLocalTagPair mxf_local_tag_batch[] = {
{ 0x3D0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x02,0x01,0x00,0x00,0x00}}, /* Block Align */ { 0x3D0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x02,0x01,0x00,0x00,0x00}}, /* Block Align */
}; };
static void mxf_write_uuid(ByteIOContext *pb, enum MXFMetadataSetType type, int value) static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int value)
{ {
put_buffer(pb, uuid_base, 12); put_buffer(pb, uuid_base, 12);
put_be16(pb, type); put_be16(pb, type);
@ -321,7 +321,7 @@ static void mxf_write_umid(AVFormatContext *s, int type)
put_byte(s->pb, type); put_byte(s->pb, type);
} }
static void mxf_write_refs_count(ByteIOContext *pb, int ref_count) static void mxf_write_refs_count(AVIOContext *pb, int ref_count)
{ {
put_be32(pb, ref_count); put_be32(pb, ref_count);
put_be32(pb, 16); put_be32(pb, 16);
@ -335,7 +335,7 @@ static int klv_ber_length(uint64_t len)
return (av_log2(len) >> 3) + 2; return (av_log2(len) >> 3) + 2;
} }
static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len) static int klv_encode_ber_length(AVIOContext *pb, uint64_t len)
{ {
// Determine the best BER size // Determine the best BER size
int size; int size;
@ -356,7 +356,7 @@ static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len)
return 0; return 0;
} }
static void klv_encode_ber4_length(ByteIOContext *pb, int len) static void klv_encode_ber4_length(AVIOContext *pb, int len)
{ {
put_byte(pb, 0x80 + 3); put_byte(pb, 0x80 + 3);
put_be24(pb, len); put_be24(pb, len);
@ -376,7 +376,7 @@ static int mxf_get_essence_container_ul_index(enum CodecID id)
static void mxf_write_primer_pack(AVFormatContext *s) static void mxf_write_primer_pack(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int local_tag_number, i = 0; int local_tag_number, i = 0;
local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch); local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch);
@ -393,13 +393,13 @@ static void mxf_write_primer_pack(AVFormatContext *s)
} }
} }
static void mxf_write_local_tag(ByteIOContext *pb, int size, int tag) static void mxf_write_local_tag(AVIOContext *pb, int size, int tag)
{ {
put_be16(pb, tag); put_be16(pb, tag);
put_be16(pb, size); put_be16(pb, size);
} }
static void mxf_write_metadata_key(ByteIOContext *pb, unsigned int value) static void mxf_write_metadata_key(AVIOContext *pb, unsigned int value)
{ {
put_buffer(pb, header_metadata_key, 13); put_buffer(pb, header_metadata_key, 13);
put_be24(pb, value); put_be24(pb, value);
@ -429,7 +429,7 @@ static const MXFCodecUL *mxf_get_data_definition_ul(int type)
static void mxf_write_essence_container_refs(AVFormatContext *s) static void mxf_write_essence_container_refs(AVFormatContext *s)
{ {
MXFContext *c = s->priv_data; MXFContext *c = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i; int i;
mxf_write_refs_count(pb, c->essence_container_count); mxf_write_refs_count(pb, c->essence_container_count);
@ -443,7 +443,7 @@ static void mxf_write_essence_container_refs(AVFormatContext *s)
static void mxf_write_preface(AVFormatContext *s) static void mxf_write_preface(AVFormatContext *s)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
mxf_write_metadata_key(pb, 0x012f00); mxf_write_metadata_key(pb, 0x012f00);
PRINT_KEY(s, "preface key", pb->buf_ptr - 16); PRINT_KEY(s, "preface key", pb->buf_ptr - 16);
@ -487,7 +487,7 @@ static void mxf_write_preface(AVFormatContext *s)
/* /*
* Write a local tag containing an ascii string as utf-16 * Write a local tag containing an ascii string as utf-16
*/ */
static void mxf_write_local_tag_utf16(ByteIOContext *pb, int tag, const char *value) static void mxf_write_local_tag_utf16(AVIOContext *pb, int tag, const char *value)
{ {
int i, size = strlen(value); int i, size = strlen(value);
mxf_write_local_tag(pb, size*2, tag); mxf_write_local_tag(pb, size*2, tag);
@ -498,7 +498,7 @@ static void mxf_write_local_tag_utf16(ByteIOContext *pb, int tag, const char *va
static void mxf_write_identification(AVFormatContext *s) static void mxf_write_identification(AVFormatContext *s)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
const char *company = "FFmpeg"; const char *company = "FFmpeg";
const char *product = "OP1a Muxer"; const char *product = "OP1a Muxer";
const char *version; const char *version;
@ -536,7 +536,7 @@ static void mxf_write_identification(AVFormatContext *s)
static void mxf_write_content_storage(AVFormatContext *s) static void mxf_write_content_storage(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
mxf_write_metadata_key(pb, 0x011800); mxf_write_metadata_key(pb, 0x011800);
PRINT_KEY(s, "content storage key", pb->buf_ptr - 16); PRINT_KEY(s, "content storage key", pb->buf_ptr - 16);
@ -562,7 +562,7 @@ static void mxf_write_content_storage(AVFormatContext *s)
static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
MXFStreamContext *sc = st->priv_data; MXFStreamContext *sc = st->priv_data;
mxf_write_metadata_key(pb, 0x013b00); mxf_write_metadata_key(pb, 0x013b00);
@ -603,7 +603,7 @@ static const uint8_t smpte_12m_timecode_track_data_ul[] = { 0x06,0x0E,0x2B,0x34,
static void mxf_write_common_fields(AVFormatContext *s, AVStream *st) static void mxf_write_common_fields(AVFormatContext *s, AVStream *st)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
// find data define uls // find data define uls
mxf_write_local_tag(pb, 16, 0x0201); mxf_write_local_tag(pb, 16, 0x0201);
@ -622,7 +622,7 @@ static void mxf_write_common_fields(AVFormatContext *s, AVStream *st)
static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
enum MXFMetadataSetType component; enum MXFMetadataSetType component;
mxf_write_metadata_key(pb, 0x010f00); mxf_write_metadata_key(pb, 0x010f00);
@ -650,7 +650,7 @@ static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadat
static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
mxf_write_metadata_key(pb, 0x011400); mxf_write_metadata_key(pb, 0x011400);
klv_encode_ber_length(pb, 75); klv_encode_ber_length(pb, 75);
@ -677,7 +677,7 @@ static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum
static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type) static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i; int i;
mxf_write_metadata_key(pb, 0x011100); mxf_write_metadata_key(pb, 0x011100);
@ -714,7 +714,7 @@ static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enu
static void mxf_write_multi_descriptor(AVFormatContext *s) static void mxf_write_multi_descriptor(AVFormatContext *s)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
const uint8_t *ul; const uint8_t *ul;
int i; int i;
@ -752,7 +752,7 @@ static void mxf_write_generic_desc(AVFormatContext *s, AVStream *st, const UID k
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
MXFStreamContext *sc = st->priv_data; MXFStreamContext *sc = st->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
put_buffer(pb, key, 16); put_buffer(pb, key, 16);
klv_encode_ber4_length(pb, size+20+8+12+20); klv_encode_ber4_length(pb, size+20+8+12+20);
@ -780,7 +780,7 @@ static const UID mxf_generic_sound_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0
static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
{ {
MXFStreamContext *sc = st->priv_data; MXFStreamContext *sc = st->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int stored_height = (st->codec->height+15)/16*16; int stored_height = (st->codec->height+15)/16*16;
int display_height; int display_height;
int f1, f2; int f1, f2;
@ -856,7 +856,7 @@ static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st) static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int profile_and_level = (st->codec->profile<<4) | st->codec->level; int profile_and_level = (st->codec->profile<<4) | st->codec->level;
mxf_write_cdci_common(s, st, mxf_mpegvideo_descriptor_key, 8+5); mxf_write_cdci_common(s, st, mxf_mpegvideo_descriptor_key, 8+5);
@ -874,7 +874,7 @@ static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st)
static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
mxf_write_generic_desc(s, st, key, size+5+12+8+8); mxf_write_generic_desc(s, st, key, size+5+12+8+8);
@ -896,7 +896,7 @@ static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con
static void mxf_write_wav_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size) static void mxf_write_wav_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
mxf_write_generic_sound_common(s, st, key, size+6+8); mxf_write_generic_sound_common(s, st, key, size+6+8);
@ -926,7 +926,7 @@ static void mxf_write_generic_sound_desc(AVFormatContext *s, AVStream *st)
static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type) static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i, track_count = s->nb_streams+1; int i, track_count = s->nb_streams+1;
if (type == MaterialPackage) { if (type == MaterialPackage) {
@ -996,7 +996,7 @@ static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type)
static int mxf_write_essence_container_data(AVFormatContext *s) static int mxf_write_essence_container_data(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
mxf_write_metadata_key(pb, 0x012300); mxf_write_metadata_key(pb, 0x012300);
klv_encode_ber_length(pb, 72); klv_encode_ber_length(pb, 72);
@ -1039,7 +1039,7 @@ static unsigned klv_fill_size(uint64_t size)
static void mxf_write_index_table_segment(AVFormatContext *s) static void mxf_write_index_table_segment(AVFormatContext *s)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int i, j, temporal_reordering = 0; int i, j, temporal_reordering = 0;
int key_index = mxf->last_key_index; int key_index = mxf->last_key_index;
@ -1187,7 +1187,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
const uint8_t *key, int write_metadata) const uint8_t *key, int write_metadata)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t header_byte_count_offset; int64_t header_byte_count_offset;
unsigned index_byte_count = 0; unsigned index_byte_count = 0;
uint64_t partition_offset = url_ftell(pb); uint64_t partition_offset = url_ftell(pb);
@ -1557,7 +1557,7 @@ static uint32_t ff_framenum_to_12m_time_code(unsigned frame, int drop, int fps)
static void mxf_write_system_item(AVFormatContext *s) static void mxf_write_system_item(AVFormatContext *s)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned frame; unsigned frame;
uint32_t time_code; uint32_t time_code;
@ -1598,7 +1598,7 @@ static void mxf_write_system_item(AVFormatContext *s)
static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt) static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int packet_size = (uint64_t)st->codec->bit_rate*mxf->time_base.num / int packet_size = (uint64_t)st->codec->bit_rate*mxf->time_base.num /
(8*mxf->time_base.den); // frame size (8*mxf->time_base.den); // frame size
int pad; int pad;
@ -1628,7 +1628,7 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke
static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt) static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int frame_size = pkt->size / st->codec->block_align; int frame_size = pkt->size / st->codec->block_align;
uint8_t *samples = pkt->data; uint8_t *samples = pkt->data;
uint8_t *end = pkt->data + pkt->size; uint8_t *end = pkt->data + pkt->size;
@ -1660,7 +1660,7 @@ static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacke
static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st = s->streams[pkt->stream_index]; AVStream *st = s->streams[pkt->stream_index];
MXFStreamContext *sc = st->priv_data; MXFStreamContext *sc = st->priv_data;
MXFIndexEntry ie = {0}; MXFIndexEntry ie = {0};
@ -1739,7 +1739,7 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
static void mxf_write_random_index_pack(AVFormatContext *s) static void mxf_write_random_index_pack(AVFormatContext *s)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint64_t pos = url_ftell(pb); uint64_t pos = url_ftell(pb);
int i; int i;
@ -1766,7 +1766,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s)
static int mxf_write_footer(AVFormatContext *s) static int mxf_write_footer(AVFormatContext *s)
{ {
MXFContext *mxf = s->priv_data; MXFContext *mxf = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count; mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count;

@ -221,7 +221,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header);
static int nsv_resync(AVFormatContext *s) static int nsv_resync(AVFormatContext *s)
{ {
NSVContext *nsv = s->priv_data; NSVContext *nsv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint32_t v = 0; uint32_t v = 0;
int i; int i;
@ -266,7 +266,7 @@ static int nsv_resync(AVFormatContext *s)
static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
NSVContext *nsv = s->priv_data; NSVContext *nsv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int file_size, size; unsigned int file_size, size;
int64_t duration; int64_t duration;
int strings_size; int strings_size;
@ -387,7 +387,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
NSVContext *nsv = s->priv_data; NSVContext *nsv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint32_t vtag, atag; uint32_t vtag, atag;
uint16_t vwidth, vheight; uint16_t vwidth, vheight;
AVRational framerate; AVRational framerate;
@ -537,7 +537,7 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int nsv_read_chunk(AVFormatContext *s, int fill_header) static int nsv_read_chunk(AVFormatContext *s, int fill_header)
{ {
NSVContext *nsv = s->priv_data; NSVContext *nsv = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st[2] = {NULL, NULL}; AVStream *st[2] = {NULL, NULL};
NSVStream *nst; NSVStream *nst;
AVPacket *pkt; AVPacket *pkt;

@ -35,7 +35,7 @@
#define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */ #define NUT_MAX_STREAMS 256 /* arbitrary sanity check value */
#endif #endif
static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){ static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){
unsigned int len= ff_get_v(bc); unsigned int len= ff_get_v(bc);
if(len && maxlen) if(len && maxlen)
@ -54,14 +54,14 @@ static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){
return 0; return 0;
} }
static int64_t get_s(ByteIOContext *bc){ static int64_t get_s(AVIOContext *bc){
int64_t v = ff_get_v(bc) + 1; int64_t v = ff_get_v(bc) + 1;
if (v&1) return -(v>>1); if (v&1) return -(v>>1);
else return (v>>1); else return (v>>1);
} }
static uint64_t get_fourcc(ByteIOContext *bc){ static uint64_t get_fourcc(AVIOContext *bc){
unsigned int len= ff_get_v(bc); unsigned int len= ff_get_v(bc);
if (len==2) return get_le16(bc); if (len==2) return get_le16(bc);
@ -70,21 +70,21 @@ static uint64_t get_fourcc(ByteIOContext *bc){
} }
#ifdef TRACE #ifdef TRACE
static inline uint64_t get_v_trace(ByteIOContext *bc, char *file, char *func, int line){ static inline uint64_t get_v_trace(AVIOContext *bc, char *file, char *func, int line){
uint64_t v= ff_get_v(bc); uint64_t v= ff_get_v(bc);
av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
return v; return v;
} }
static inline int64_t get_s_trace(ByteIOContext *bc, char *file, char *func, int line){ static inline int64_t get_s_trace(AVIOContext *bc, char *file, char *func, int line){
int64_t v= get_s(bc); int64_t v= get_s(bc);
av_log(NULL, AV_LOG_DEBUG, "get_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); av_log(NULL, AV_LOG_DEBUG, "get_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
return v; return v;
} }
static inline uint64_t get_vb_trace(ByteIOContext *bc, char *file, char *func, int line){ static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int line){
uint64_t v= get_vb(bc); uint64_t v= get_vb(bc);
av_log(NULL, AV_LOG_DEBUG, "get_vb %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); av_log(NULL, AV_LOG_DEBUG, "get_vb %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
@ -95,7 +95,7 @@ static inline uint64_t get_vb_trace(ByteIOContext *bc, char *file, char *func, i
#define get_vb(bc) get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__) #define get_vb(bc) get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#endif #endif
static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum, uint64_t startcode) static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode)
{ {
int64_t size; int64_t size;
// start= url_ftell(bc) - 8; // start= url_ftell(bc) - 8;
@ -115,7 +115,7 @@ static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_ch
return size; return size;
} }
static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){
uint64_t state=0; uint64_t state=0;
if(pos >= 0) if(pos >= 0)
@ -144,7 +144,7 @@ static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){
* @param pos the start position of the search, or -1 if the current position * @param pos the start position of the search, or -1 if the current position
* @return the position of the startcode or -1 if not found * @return the position of the startcode or -1 if not found
*/ */
static int64_t find_startcode(ByteIOContext *bc, uint64_t code, int64_t pos){ static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos){
for(;;){ for(;;){
uint64_t startcode= find_any_startcode(bc, pos); uint64_t startcode= find_any_startcode(bc, pos);
if(startcode == code) if(startcode == code)
@ -175,7 +175,7 @@ static int nut_probe(AVProbeData *p){
}\ }\
dst= tmp; dst= tmp;
static int skip_reserved(ByteIOContext *bc, int64_t pos){ static int skip_reserved(AVIOContext *bc, int64_t pos){
pos -= url_ftell(bc); pos -= url_ftell(bc);
if(pos<0){ if(pos<0){
url_fseek(bc, pos, SEEK_CUR); url_fseek(bc, pos, SEEK_CUR);
@ -189,7 +189,7 @@ static int skip_reserved(ByteIOContext *bc, int64_t pos){
static int decode_main_header(NUTContext *nut){ static int decode_main_header(NUTContext *nut){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
uint64_t tmp, end; uint64_t tmp, end;
unsigned int stream_count; unsigned int stream_count;
int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_idx; int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_idx;
@ -299,7 +299,7 @@ static int decode_main_header(NUTContext *nut){
static int decode_stream_header(NUTContext *nut){ static int decode_stream_header(NUTContext *nut){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
StreamContext *stc; StreamContext *stc;
int class, stream_id; int class, stream_id;
uint64_t tmp, end; uint64_t tmp, end;
@ -397,7 +397,7 @@ static void set_disposition_bits(AVFormatContext* avf, char* value, int stream_i
static int decode_info_header(NUTContext *nut){ static int decode_info_header(NUTContext *nut){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
uint64_t tmp, chapter_start, chapter_len; uint64_t tmp, chapter_start, chapter_len;
unsigned int stream_id_plus1, count; unsigned int stream_id_plus1, count;
int chapter_id, i; int chapter_id, i;
@ -477,7 +477,7 @@ static int decode_info_header(NUTContext *nut){
static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
int64_t end, tmp; int64_t end, tmp;
nut->last_syncpoint_pos= url_ftell(bc)-8; nut->last_syncpoint_pos= url_ftell(bc)-8;
@ -505,7 +505,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
static int find_and_decode_index(NUTContext *nut){ static int find_and_decode_index(NUTContext *nut){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
uint64_t tmp, end; uint64_t tmp, end;
int i, j, syncpoint_count; int i, j, syncpoint_count;
int64_t filesize= url_fsize(bc); int64_t filesize= url_fsize(bc);
@ -603,7 +603,7 @@ fail:
static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
NUTContext *nut = s->priv_data; NUTContext *nut = s->priv_data;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
int64_t pos; int64_t pos;
int initialized_stream_count; int initialized_stream_count;
@ -666,7 +666,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code){ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
StreamContext *stc; StreamContext *stc;
int size, flags, size_mul, pts_delta, i, reserved_count; int size, flags, size_mul, pts_delta, i, reserved_count;
uint64_t tmp; uint64_t tmp;
@ -736,7 +736,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
int size, stream_id, discard; int size, stream_id, discard;
int64_t pts, last_IP_pts; int64_t pts, last_IP_pts;
StreamContext *stc; StreamContext *stc;
@ -777,7 +777,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
NUTContext *nut = s->priv_data; NUTContext *nut = s->priv_data;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
int i, frame_code=0, ret, skip; int i, frame_code=0, ret, skip;
int64_t ts, back_ptr; int64_t ts, back_ptr;
@ -833,7 +833,7 @@ av_log(s, AV_LOG_DEBUG, "sync\n");
static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit){ static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit){
NUTContext *nut = s->priv_data; NUTContext *nut = s->priv_data;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
int64_t pos, pts, back_ptr; int64_t pos, pts, back_ptr;
av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit); av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit);

@ -241,7 +241,7 @@ static void build_frame_code(AVFormatContext *s){
nut->frame_code['N'].flags= FLAG_INVALID; nut->frame_code['N'].flags= FLAG_INVALID;
} }
static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){ static void put_tt(NUTContext *nut, StreamContext *nus, AVIOContext *bc, uint64_t val){
val *= nut->time_base_count; val *= nut->time_base_count;
val += nus->time_base - nut->time_base; val += nus->time_base - nut->time_base;
ff_put_v(bc, val); ff_put_v(bc, val);
@ -250,25 +250,25 @@ static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint6
/** /**
* Store a string as vb. * Store a string as vb.
*/ */
static void put_str(ByteIOContext *bc, const char *string){ static void put_str(AVIOContext *bc, const char *string){
int len= strlen(string); int len= strlen(string);
ff_put_v(bc, len); ff_put_v(bc, len);
put_buffer(bc, string, len); put_buffer(bc, string, len);
} }
static void put_s(ByteIOContext *bc, int64_t val){ static void put_s(AVIOContext *bc, int64_t val){
ff_put_v(bc, 2*FFABS(val) - (val>0)); ff_put_v(bc, 2*FFABS(val) - (val>0));
} }
#ifdef TRACE #ifdef TRACE
static inline void ff_put_v_trace(ByteIOContext *bc, uint64_t v, char *file, char *func, int line){ static inline void ff_put_v_trace(AVIOContext *bc, uint64_t v, char *file, char *func, int line){
av_log(NULL, AV_LOG_DEBUG, "ff_put_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); av_log(NULL, AV_LOG_DEBUG, "ff_put_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
ff_put_v(bc, v); ff_put_v(bc, v);
} }
static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *func, int line){ static inline void put_s_trace(AVIOContext *bc, int64_t v, char *file, char *func, int line){
av_log(NULL, AV_LOG_DEBUG, "put_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); av_log(NULL, AV_LOG_DEBUG, "put_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
put_s(bc, v); put_s(bc, v);
@ -278,7 +278,7 @@ static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *f
#endif #endif
//FIXME remove calculate_checksum //FIXME remove calculate_checksum
static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){ static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){
uint8_t *dyn_buf=NULL; uint8_t *dyn_buf=NULL;
int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
int forw_ptr= dyn_size + 4*calculate_checksum; int forw_ptr= dyn_size + 4*calculate_checksum;
@ -299,7 +299,7 @@ static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc
av_free(dyn_buf); av_free(dyn_buf);
} }
static void write_mainheader(NUTContext *nut, ByteIOContext *bc){ static void write_mainheader(NUTContext *nut, AVIOContext *bc){
int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx; int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx;
int64_t tmp_match; int64_t tmp_match;
@ -370,7 +370,7 @@ static void write_mainheader(NUTContext *nut, ByteIOContext *bc){
} }
} }
static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStream *st, int i){ static int write_streamheader(AVFormatContext *avctx, AVIOContext *bc, AVStream *st, int i){
NUTContext *nut = avctx->priv_data; NUTContext *nut = avctx->priv_data;
AVCodecContext *codec = st->codec; AVCodecContext *codec = st->codec;
ff_put_v(bc, i); ff_put_v(bc, i);
@ -422,17 +422,17 @@ static int write_streamheader(AVFormatContext *avctx, ByteIOContext *bc, AVStrea
return 0; return 0;
} }
static int add_info(ByteIOContext *bc, const char *type, const char *value){ static int add_info(AVIOContext *bc, const char *type, const char *value){
put_str(bc, type); put_str(bc, type);
put_s(bc, -1); put_s(bc, -1);
put_str(bc, value); put_str(bc, value);
return 1; return 1;
} }
static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
AVMetadataTag *t = NULL; AVMetadataTag *t = NULL;
ByteIOContext *dyn_bc; AVIOContext *dyn_bc;
uint8_t *dyn_buf=NULL; uint8_t *dyn_buf=NULL;
int count=0, dyn_size; int count=0, dyn_size;
int ret = url_open_dyn_buf(&dyn_bc); int ret = url_open_dyn_buf(&dyn_bc);
@ -455,10 +455,10 @@ static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){
return 0; return 0;
} }
static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){
AVFormatContext *s= nut->avf; AVFormatContext *s= nut->avf;
AVStream* st = s->streams[stream_id]; AVStream* st = s->streams[stream_id];
ByteIOContext *dyn_bc; AVIOContext *dyn_bc;
uint8_t *dyn_buf=NULL; uint8_t *dyn_buf=NULL;
int count=0, dyn_size, i; int count=0, dyn_size, i;
int ret = url_open_dyn_buf(&dyn_bc); int ret = url_open_dyn_buf(&dyn_bc);
@ -486,9 +486,9 @@ static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){
return count; return count;
} }
static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
NUTContext *nut = avctx->priv_data; NUTContext *nut = avctx->priv_data;
ByteIOContext *dyn_bc; AVIOContext *dyn_bc;
int i, ret; int i, ret;
ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL); ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL);
@ -537,7 +537,7 @@ static int write_headers(AVFormatContext *avctx, ByteIOContext *bc){
static int write_header(AVFormatContext *s){ static int write_header(AVFormatContext *s){
NUTContext *nut = s->priv_data; NUTContext *nut = s->priv_data;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
int i, j, ret; int i, j, ret;
nut->avf= s; nut->avf= s;
@ -628,7 +628,7 @@ static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){
static int write_packet(AVFormatContext *s, AVPacket *pkt){ static int write_packet(AVFormatContext *s, AVPacket *pkt){
NUTContext *nut = s->priv_data; NUTContext *nut = s->priv_data;
StreamContext *nus= &nut->stream[pkt->stream_index]; StreamContext *nus= &nut->stream[pkt->stream_index];
ByteIOContext *bc = s->pb, *dyn_bc; AVIOContext *bc = s->pb, *dyn_bc;
FrameCode *fc; FrameCode *fc;
int64_t coded_pts; int64_t coded_pts;
int best_length, frame_code, flags, needed_flags, i, header_idx, best_header_idx; int best_length, frame_code, flags, needed_flags, i, header_idx, best_header_idx;
@ -781,7 +781,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
static int write_trailer(AVFormatContext *s){ static int write_trailer(AVFormatContext *s){
NUTContext *nut= s->priv_data; NUTContext *nut= s->priv_data;
ByteIOContext *bc= s->pb; AVIOContext *bc= s->pb;
while(nut->header_count<3) while(nut->header_count<3)
write_headers(s, bc); write_headers(s, bc);

@ -55,7 +55,7 @@ static int nuv_probe(AVProbeData *p) {
* \param myth set if this is a MythTVVideo format file * \param myth set if this is a MythTVVideo format file
* \return 1 if all required codec data was found * \return 1 if all required codec data was found
*/ */
static int get_codec_data(ByteIOContext *pb, AVStream *vst, static int get_codec_data(AVIOContext *pb, AVStream *vst,
AVStream *ast, int myth) { AVStream *ast, int myth) {
nuv_frametype frametype; nuv_frametype frametype;
if (!vst && !myth) if (!vst && !myth)
@ -122,7 +122,7 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst,
static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
NUVContext *ctx = s->priv_data; NUVContext *ctx = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
char id_string[12]; char id_string[12];
double aspect, fps; double aspect, fps;
int is_mythtv, width, height, v_packs, a_packs; int is_mythtv, width, height, v_packs, a_packs;
@ -191,7 +191,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
NUVContext *ctx = s->priv_data; NUVContext *ctx = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
uint8_t hdr[HDRSIZE]; uint8_t hdr[HDRSIZE];
nuv_frametype frametype; nuv_frametype frametype;
int ret, size; int ret, size;

@ -84,7 +84,7 @@ static int
ogg_restore (AVFormatContext * s, int discard) ogg_restore (AVFormatContext * s, int discard)
{ {
struct ogg *ogg = s->priv_data; struct ogg *ogg = s->priv_data;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
struct ogg_state *ost = ogg->state; struct ogg_state *ost = ogg->state;
int i; int i;
@ -194,7 +194,7 @@ ogg_new_buf(struct ogg *ogg, int idx)
static int static int
ogg_read_page (AVFormatContext * s, int *str) ogg_read_page (AVFormatContext * s, int *str)
{ {
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
struct ogg *ogg = s->priv_data; struct ogg *ogg = s->priv_data;
struct ogg_stream *os; struct ogg_stream *os;
int i = 0; int i = 0;
@ -601,7 +601,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
{ {
struct ogg *ogg = s->priv_data; struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + stream_index; struct ogg_stream *os = ogg->streams + stream_index;
ByteIOContext *bc = s->pb; AVIOContext *bc = s->pb;
int64_t pts = AV_NOPTS_VALUE; int64_t pts = AV_NOPTS_VALUE;
int i; int i;
url_fseek(bc, *pos_arg, SEEK_SET); url_fseek(bc, *pos_arg, SEEK_SET);

@ -64,7 +64,7 @@ typedef struct {
OGGPageList *page_list; OGGPageList *page_list;
} OGGContext; } OGGContext;
static void ogg_update_checksum(AVFormatContext *s, ByteIOContext *pb, int64_t crc_offset) static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
{ {
int64_t pos = url_ftell(pb); int64_t pos = url_ftell(pb);
uint32_t checksum = get_checksum(pb); uint32_t checksum = get_checksum(pb);
@ -76,7 +76,7 @@ static void ogg_update_checksum(AVFormatContext *s, ByteIOContext *pb, int64_t c
static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
{ {
OGGStreamContext *oggstream = s->streams[page->stream_index]->priv_data; OGGStreamContext *oggstream = s->streams[page->stream_index]->priv_data;
ByteIOContext *pb; AVIOContext *pb;
int64_t crc_offset; int64_t crc_offset;
int ret, size; int ret, size;
uint8_t *buf; uint8_t *buf;

@ -98,7 +98,7 @@ static int str_probe(AVProbeData *p)
static int str_read_header(AVFormatContext *s, static int str_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
StrDemuxContext *str = s->priv_data; StrDemuxContext *str = s->priv_data;
unsigned char sector[RAW_CD_SECTOR_SIZE]; unsigned char sector[RAW_CD_SECTOR_SIZE];
int start; int start;
@ -127,7 +127,7 @@ static int str_read_header(AVFormatContext *s,
static int str_read_packet(AVFormatContext *s, static int str_read_packet(AVFormatContext *s,
AVPacket *ret_pkt) AVPacket *ret_pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
StrDemuxContext *str = s->priv_data; StrDemuxContext *str = s->priv_data;
unsigned char sector[RAW_CD_SECTOR_SIZE]; unsigned char sector[RAW_CD_SECTOR_SIZE];
int channel; int channel;

@ -67,7 +67,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
static int read_part_of_packet(AVFormatContext *s, int64_t *pts, static int read_part_of_packet(AVFormatContext *s, int64_t *pts,
int *len, int *strid, int read_packet) { int *len, int *strid, int read_packet) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
PVAContext *pvactx = s->priv_data; PVAContext *pvactx = s->priv_data;
int syncword, streamid, reserved, flags, length, pts_flag; int syncword, streamid, reserved, flags, length, pts_flag;
int64_t pva_pts = AV_NOPTS_VALUE, startpos; int64_t pva_pts = AV_NOPTS_VALUE, startpos;
@ -157,7 +157,7 @@ recover:
} }
static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) { static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t pva_pts; int64_t pva_pts;
int ret, length, streamid; int ret, length, streamid;
@ -173,7 +173,7 @@ static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) {
static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
int64_t *pos, int64_t pos_limit) { int64_t *pos, int64_t pos_limit) {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
PVAContext *pvactx = s->priv_data; PVAContext *pvactx = s->priv_data;
int length, streamid; int length, streamid;
int64_t res = AV_NOPTS_VALUE; int64_t res = AV_NOPTS_VALUE;

@ -82,7 +82,7 @@ static int qcp_probe(AVProbeData *pd)
static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
QCPContext *c = s->priv_data; QCPContext *c = s->priv_data;
AVStream *st = av_new_stream(s, 0); AVStream *st = av_new_stream(s, 0);
uint8_t buf[16]; uint8_t buf[16];
@ -136,7 +136,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
QCPContext *c = s->priv_data; QCPContext *c = s->priv_data;
unsigned int chunk_size, tag; unsigned int chunk_size, tag;

@ -130,7 +130,7 @@ ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
static int static int
rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
{ {
ByteIOContext pb; AVIOContext pb;
int size; int size;
uint32_t tag; uint32_t tag;
@ -295,7 +295,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
const uint8_t *buf, int len, int flags) const uint8_t *buf, int len, int flags)
{ {
int seq = 1, res; int seq = 1, res;
ByteIOContext pb; AVIOContext pb;
if (rdt->audio_pkt_cnt == 0) { if (rdt->audio_pkt_cnt == 0) {
int pos; int pos;

@ -319,14 +319,14 @@ const AVCodecTag ff_codec_wav_tags[] = {
}; };
#if CONFIG_MUXERS #if CONFIG_MUXERS
int64_t ff_start_tag(ByteIOContext *pb, const char *tag) int64_t ff_start_tag(AVIOContext *pb, const char *tag)
{ {
put_tag(pb, tag); put_tag(pb, tag);
put_le32(pb, 0); put_le32(pb, 0);
return url_ftell(pb); return url_ftell(pb);
} }
void ff_end_tag(ByteIOContext *pb, int64_t start) void ff_end_tag(AVIOContext *pb, int64_t start)
{ {
int64_t pos; int64_t pos;
@ -338,7 +338,7 @@ void ff_end_tag(ByteIOContext *pb, int64_t start)
/* WAVEFORMATEX header */ /* WAVEFORMATEX header */
/* returns the size or -1 on error */ /* returns the size or -1 on error */
int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc) int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
{ {
int bps, blkalign, bytespersec; int bps, blkalign, bytespersec;
int hdrsize = 18; int hdrsize = 18;
@ -445,7 +445,7 @@ int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
} }
/* BITMAPINFOHEADER header */ /* BITMAPINFOHEADER header */
void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf) void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf)
{ {
put_le32(pb, 40 + enc->extradata_size); /* size */ put_le32(pb, 40 + enc->extradata_size); /* size */
put_le32(pb, enc->width); put_le32(pb, enc->width);
@ -477,7 +477,7 @@ void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag
* WAVEFORMATEX adds 'WORD cbSize' and basically makes itself * WAVEFORMATEX adds 'WORD cbSize' and basically makes itself
* an openended structure. * an openended structure.
*/ */
void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size) void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
{ {
int id; int id;
@ -544,7 +544,7 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps)
return id; return id;
} }
int ff_get_bmp_header(ByteIOContext *pb, AVStream *st) int ff_get_bmp_header(AVIOContext *pb, AVStream *st)
{ {
int tag1; int tag1;
get_le32(pb); /* size */ get_le32(pb); /* size */

@ -32,20 +32,20 @@
#include "avio.h" #include "avio.h"
#include "internal.h" #include "internal.h"
int64_t ff_start_tag(ByteIOContext *pb, const char *tag); int64_t ff_start_tag(AVIOContext *pb, const char *tag);
void ff_end_tag(ByteIOContext *pb, int64_t start); void ff_end_tag(AVIOContext *pb, int64_t start);
/** /**
* Read BITMAPINFOHEADER structure and set AVStream codec width, height and * Read BITMAPINFOHEADER structure and set AVStream codec width, height and
* bits_per_encoded_sample fields. Does not read extradata. * bits_per_encoded_sample fields. Does not read extradata.
* @return codec tag * @return codec tag
*/ */
int ff_get_bmp_header(ByteIOContext *pb, AVStream *st); int ff_get_bmp_header(AVIOContext *pb, AVStream *st);
void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf);
int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc); int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc);
enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps); enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps);
void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size); void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size);
extern const AVCodecTag ff_codec_bmp_tags[]; extern const AVCodecTag ff_codec_bmp_tags[];
extern const AVCodecTag ff_codec_wav_tags[]; extern const AVCodecTag ff_codec_wav_tags[];

@ -74,7 +74,7 @@ static int rl2_probe(AVProbeData *p)
static av_cold int rl2_read_header(AVFormatContext *s, static av_cold int rl2_read_header(AVFormatContext *s,
AVFormatParameters *ap) AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
unsigned int frame_count; unsigned int frame_count;
unsigned int audio_frame_counter = 0; unsigned int audio_frame_counter = 0;
@ -214,7 +214,7 @@ static int rl2_read_packet(AVFormatContext *s,
AVPacket *pkt) AVPacket *pkt)
{ {
Rl2DemuxContext *rl2 = s->priv_data; Rl2DemuxContext *rl2 = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVIndexEntry *sample = NULL; AVIndexEntry *sample = NULL;
int i; int i;
int ret = 0; int ret = 0;

@ -41,7 +41,7 @@ extern AVInputFormat ff_rdt_demuxer;
* Read the MDPR chunk, which contains stream-specific codec initialization * Read the MDPR chunk, which contains stream-specific codec initialization
* parameters. * parameters.
* *
* @param s context containing RMContext and ByteIOContext for stream reading * @param s context containing RMContext and AVIOContext for stream reading
* @param pb context to read the data from * @param pb context to read the data from
* @param st the stream that the MDPR chunk belongs to and where to store the * @param st the stream that the MDPR chunk belongs to and where to store the
* parameters read from the chunk into * parameters read from the chunk into
@ -49,14 +49,14 @@ extern AVInputFormat ff_rdt_demuxer;
* @param codec_data_size size of the MDPR chunk * @param codec_data_size size of the MDPR chunk
* @return 0 on success, errno codes on error * @return 0 on success, errno codes on error
*/ */
int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, int ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *rst, AVStream *st, RMStream *rst,
int codec_data_size); int codec_data_size);
/** /**
* Parse one rm-stream packet from the input bytestream. * Parse one rm-stream packet from the input bytestream.
* *
* @param s context containing RMContext and ByteIOContext for stream reading * @param s context containing RMContext and AVIOContext for stream reading
* @param pb context to read the data from * @param pb context to read the data from
* @param st stream to which the packet to be read belongs * @param st stream to which the packet to be read belongs
* @param rst Real-specific stream information * @param rst Real-specific stream information
@ -70,7 +70,7 @@ int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
* value >0 means that no data was placed in pkt, but that cached * value >0 means that no data was placed in pkt, but that cached
* data is available by calling ff_rm_retrieve_cache(). * data is available by calling ff_rm_retrieve_cache().
*/ */
int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, int ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *rst, int len, AVStream *st, RMStream *rst, int len,
AVPacket *pkt, int *seq, int flags, int64_t ts); AVPacket *pkt, int *seq, int flags, int64_t ts);
@ -82,7 +82,7 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
* a positive number, the amount of cached packets. Using this function, each * a positive number, the amount of cached packets. Using this function, each
* of those packets can be retrieved sequentially. * of those packets can be retrieved sequentially.
* *
* @param s context containing RMContext and ByteIOContext for stream reading * @param s context containing RMContext and AVIOContext for stream reading
* @param pb context to read the data from * @param pb context to read the data from
* @param st stream that this packet belongs to * @param st stream that this packet belongs to
* @param rst Real-specific stream information * @param rst Real-specific stream information
@ -90,7 +90,7 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
* @return the number of samples left for subsequent calls to this same * @return the number of samples left for subsequent calls to this same
* function, or 0 if all samples have been retrieved. * function, or 0 if all samples have been retrieved.
*/ */
int ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, int ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *rst, AVPacket *pkt); AVStream *st, RMStream *rst, AVPacket *pkt);
/** /**

@ -64,7 +64,7 @@ static const unsigned char sipr_swaps[38][2] = {
const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 }; const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 };
static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len) static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len)
{ {
int i; int i;
char *q, r; char *q, r;
@ -78,12 +78,12 @@ static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len)
if (buf_size > 0) *q = '\0'; if (buf_size > 0) *q = '\0';
} }
static void get_str8(ByteIOContext *pb, char *buf, int buf_size) static void get_str8(AVIOContext *pb, char *buf, int buf_size)
{ {
get_strl(pb, buf, buf_size, get_byte(pb)); get_strl(pb, buf, buf_size, get_byte(pb));
} }
static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned size) static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned size)
{ {
if (size >= 1<<24) if (size >= 1<<24)
return -1; return -1;
@ -120,7 +120,7 @@ void ff_rm_free_rmstream (RMStream *rms)
av_free_packet(&rms->pkt); av_free_packet(&rms->pkt);
} }
static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *ast, int read_all) AVStream *st, RMStream *ast, int read_all)
{ {
char buf[256]; char buf[256];
@ -264,7 +264,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
} }
int int
ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *rst, int codec_data_size) AVStream *st, RMStream *rst, int codec_data_size)
{ {
unsigned int v; unsigned int v;
@ -330,7 +330,7 @@ skip:
* of the INDX chunk, and will bail out if not. */ * of the INDX chunk, and will bail out if not. */
static int rm_read_index(AVFormatContext *s) static int rm_read_index(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int size, n_pkts, str_id, next_off, n, pos, pts; unsigned int size, n_pkts, str_id, next_off, n, pos, pts;
AVStream *st; AVStream *st;
@ -387,7 +387,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
RMDemuxContext *rm = s->priv_data; RMDemuxContext *rm = s->priv_data;
AVStream *st; AVStream *st;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int tag; unsigned int tag;
int tag_size; int tag_size;
unsigned int start_time, duration; unsigned int start_time, duration;
@ -490,7 +490,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
return 0; return 0;
} }
static int get_num(ByteIOContext *pb, int *len) static int get_num(AVIOContext *pb, int *len)
{ {
int n, n1; int n, n1;
@ -511,7 +511,7 @@ static int get_num(ByteIOContext *pb, int *len)
static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){
RMDemuxContext *rm = s->priv_data; RMDemuxContext *rm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
uint32_t state=0xFFFFFFFF; uint32_t state=0xFFFFFFFF;
@ -577,7 +577,7 @@ skip:
return -1; return -1;
} }
static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb, static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
RMDemuxContext *rm, RMStream *vst, RMDemuxContext *rm, RMStream *vst,
AVPacket *pkt, int len, int *pseq) AVPacket *pkt, int len, int *pseq)
{ {
@ -700,7 +700,7 @@ void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
} }
int int
ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *ast, int len, AVPacket *pkt, AVStream *st, RMStream *ast, int len, AVPacket *pkt,
int *seq, int flags, int64_t timestamp) int *seq, int flags, int64_t timestamp)
{ {
@ -791,7 +791,7 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
} }
int int
ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,
AVStream *st, RMStream *ast, AVPacket *pkt) AVStream *st, RMStream *ast, AVPacket *pkt)
{ {
RMDemuxContext *rm = s->priv_data; RMDemuxContext *rm = s->priv_data;

@ -44,7 +44,7 @@ typedef struct {
#define BUFFER_DURATION 0 #define BUFFER_DURATION 0
static void put_str(ByteIOContext *s, const char *tag) static void put_str(AVIOContext *s, const char *tag)
{ {
put_be16(s,strlen(tag)); put_be16(s,strlen(tag));
while (*tag) { while (*tag) {
@ -52,7 +52,7 @@ static void put_str(ByteIOContext *s, const char *tag)
} }
} }
static void put_str8(ByteIOContext *s, const char *tag) static void put_str8(AVIOContext *s, const char *tag)
{ {
put_byte(s, strlen(tag)); put_byte(s, strlen(tag));
while (*tag) { while (*tag) {
@ -64,7 +64,7 @@ static int rv10_write_header(AVFormatContext *ctx,
int data_size, int index_pos) int data_size, int index_pos)
{ {
RMMuxContext *rm = ctx->priv_data; RMMuxContext *rm = ctx->priv_data;
ByteIOContext *s = ctx->pb; AVIOContext *s = ctx->pb;
StreamInfo *stream; StreamInfo *stream;
unsigned char *data_offset_ptr, *start_ptr; unsigned char *data_offset_ptr, *start_ptr;
const char *desc, *mimetype; const char *desc, *mimetype;
@ -283,7 +283,7 @@ static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream,
int length, int key_frame) int length, int key_frame)
{ {
int timestamp; int timestamp;
ByteIOContext *s = ctx->pb; AVIOContext *s = ctx->pb;
stream->nb_packets++; stream->nb_packets++;
stream->packet_total_size += length; stream->packet_total_size += length;
@ -347,7 +347,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
{ {
uint8_t *buf1; uint8_t *buf1;
RMMuxContext *rm = s->priv_data; RMMuxContext *rm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
StreamInfo *stream = rm->audio_stream; StreamInfo *stream = rm->audio_stream;
int i; int i;
@ -375,7 +375,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int flags) static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int flags)
{ {
RMMuxContext *rm = s->priv_data; RMMuxContext *rm = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
StreamInfo *stream = rm->video_stream; StreamInfo *stream = rm->video_stream;
int key_frame = !!(flags & AV_PKT_FLAG_KEY); int key_frame = !!(flags & AV_PKT_FLAG_KEY);
@ -430,7 +430,7 @@ static int rm_write_trailer(AVFormatContext *s)
{ {
RMMuxContext *rm = s->priv_data; RMMuxContext *rm = s->priv_data;
int data_size, index_pos, i; int data_size, index_pos, i;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
if (!url_is_streamed(s->pb)) { if (!url_is_streamed(s->pb)) {
/* end of file: finish to write header */ /* end of file: finish to write header */

@ -47,7 +47,7 @@ typedef struct RPLContext {
uint32_t frame_in_part; uint32_t frame_in_part;
} RPLContext; } RPLContext;
static int read_line(ByteIOContext * pb, char* line, int bufsize) static int read_line(AVIOContext * pb, char* line, int bufsize)
{ {
int i; int i;
for (i = 0; i < bufsize - 1; i++) { for (i = 0; i < bufsize - 1; i++) {
@ -76,7 +76,7 @@ static int32_t read_int(const char* line, const char** endptr, int* error)
return result; return result;
} }
static int32_t read_line_and_int(ByteIOContext * pb, int* error) static int32_t read_line_and_int(AVIOContext * pb, int* error)
{ {
char line[RPL_LINE_LENGTH]; char line[RPL_LINE_LENGTH];
const char *endptr; const char *endptr;
@ -110,7 +110,7 @@ static AVRational read_fps(const char* line, int* error)
static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
RPLContext *rpl = s->priv_data; RPLContext *rpl = s->priv_data;
AVStream *vst = NULL, *ast = NULL; AVStream *vst = NULL, *ast = NULL;
int total_audio_size; int total_audio_size;
@ -274,7 +274,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
RPLContext *rpl = s->priv_data; RPLContext *rpl = s->priv_data;
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream* stream; AVStream* stream;
AVIndexEntry* index_entry; AVIndexEntry* index_entry;
uint32_t ret; uint32_t ret;

@ -29,7 +29,7 @@
static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int id, rate, bps; int id, rate, bps;
unsigned int size; unsigned int size;
enum CodecID codec; enum CodecID codec;

@ -27,7 +27,7 @@
static int rso_write_header(AVFormatContext *s) static int rso_write_header(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec; AVCodecContext *enc = s->streams[0]->codec;
if (!enc->codec_tag) if (!enc->codec_tag)
@ -73,7 +73,7 @@ static int rso_write_packet(AVFormatContext *s, AVPacket *pkt)
static int rso_write_trailer(AVFormatContext *s) static int rso_write_trailer(AVFormatContext *s)
{ {
ByteIOContext *pb = s->pb; AVIOContext *pb = s->pb;
int64_t file_size; int64_t file_size;
uint16_t coded_file_size; uint16_t coded_file_size;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save