aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorBjörn Axelsson <gecko@acc.umu.se>2007-11-21 07:41:00 +0000
committerAndreas Öman <andreas@lonelycoder.com>2007-11-21 07:41:00 +0000
commit899681cd1dbf4cd7c3b86af23bca25e20a54f4d0 (patch)
tree6f4556497efab1d703d1289b170c936154c6bbd5 /libavformat
parent79815f622d90499f882ad968a1351134535cbbab (diff)
downloadffmpeg-899681cd1dbf4cd7c3b86af23bca25e20a54f4d0.tar.gz
Use dynamically allocated ByteIOContext in AVFormatContext
patch by: Björn Axelsson, bjorn d axelsson a intinor d se thread: [PATCH] Remove static ByteIOContexts, 06 nov 2007 Originally committed as revision 11071 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/4xm.c12
-rw-r--r--libavformat/adtsenc.c4
-rw-r--r--libavformat/aiff.c14
-rw-r--r--libavformat/amr.c16
-rw-r--r--libavformat/apc.c4
-rw-r--r--libavformat/ape.c12
-rw-r--r--libavformat/asf-enc.c26
-rw-r--r--libavformat/asf.c42
-rw-r--r--libavformat/au.c14
-rw-r--r--libavformat/avformat.h6
-rw-r--r--libavformat/avidec.c18
-rw-r--r--libavformat/avienc.c14
-rw-r--r--libavformat/avio.h10
-rw-r--r--libavformat/aviobuf.c67
-rw-r--r--libavformat/avs.c32
-rw-r--r--libavformat/bethsoftvid.c4
-rw-r--r--libavformat/c93.c4
-rw-r--r--libavformat/crcenc.c4
-rw-r--r--libavformat/daud.c2
-rw-r--r--libavformat/dsicin.c4
-rw-r--r--libavformat/dv.c10
-rw-r--r--libavformat/dvenc.c4
-rw-r--r--libavformat/dxa.c24
-rw-r--r--libavformat/eacdata.c4
-rw-r--r--libavformat/electronicarts.c12
-rw-r--r--libavformat/ffm.c22
-rw-r--r--libavformat/flic.c4
-rw-r--r--libavformat/flvdec.c62
-rw-r--r--libavformat/flvenc.c6
-rw-r--r--libavformat/framecrcenc.c4
-rw-r--r--libavformat/gif.c12
-rw-r--r--libavformat/gifdec.c2
-rw-r--r--libavformat/gxf.c12
-rw-r--r--libavformat/gxfenc.c8
-rw-r--r--libavformat/idcin.c6
-rw-r--r--libavformat/idroq.c6
-rw-r--r--libavformat/img2.c12
-rw-r--r--libavformat/ipmovie.c4
-rw-r--r--libavformat/libnut.c8
-rw-r--r--libavformat/matroskadec.c36
-rw-r--r--libavformat/matroskaenc.c30
-rw-r--r--libavformat/mm.c6
-rw-r--r--libavformat/mmf.c14
-rw-r--r--libavformat/mov.c8
-rw-r--r--libavformat/movenc.c25
-rw-r--r--libavformat/mp3.c98
-rw-r--r--libavformat/mpc.c36
-rw-r--r--libavformat/mpc8.c20
-rw-r--r--libavformat/mpeg.c84
-rw-r--r--libavformat/mpegenc.c86
-rw-r--r--libavformat/mpegts.c34
-rw-r--r--libavformat/mpegtsenc.c10
-rw-r--r--libavformat/mpjpeg.c12
-rw-r--r--libavformat/mtv.c4
-rw-r--r--libavformat/mxf.c30
-rw-r--r--libavformat/nsvdec.c8
-rw-r--r--libavformat/nutdec.c24
-rw-r--r--libavformat/nutenc.c68
-rw-r--r--libavformat/nuv.c4
-rw-r--r--libavformat/oggdec.c14
-rw-r--r--libavformat/oggenc.c38
-rw-r--r--libavformat/psxstr.c4
-rw-r--r--libavformat/raw.c44
-rw-r--r--libavformat/rmdec.c24
-rw-r--r--libavformat/rmenc.c14
-rw-r--r--libavformat/rtp.c84
-rw-r--r--libavformat/rtsp.c2
-rw-r--r--libavformat/segafilm.c4
-rw-r--r--libavformat/sierravmd.c4
-rw-r--r--libavformat/siff.c16
-rw-r--r--libavformat/smacker.c30
-rw-r--r--libavformat/sol.c6
-rw-r--r--libavformat/swf.c30
-rw-r--r--libavformat/thp.c4
-rw-r--r--libavformat/tiertexseq.c4
-rw-r--r--libavformat/tta.c30
-rw-r--r--libavformat/txd.c8
-rw-r--r--libavformat/utils.c51
-rw-r--r--libavformat/vocdec.c4
-rw-r--r--libavformat/vocenc.c6
-rw-r--r--libavformat/wav.c22
-rw-r--r--libavformat/wc3movie.c4
-rw-r--r--libavformat/westwood.c8
-rw-r--r--libavformat/wv.c14
-rw-r--r--libavformat/yuv4mpeg.c8
85 files changed, 848 insertions, 797 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 5f982e3c88..151e9c9c81 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -92,7 +92,7 @@ static int fourxm_probe(AVProbeData *p)
static int fourxm_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int fourcc_tag;
unsigned int size;
int header_size;
@@ -224,7 +224,7 @@ static int fourxm_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
FourxmDemuxContext *fourxm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int fourcc_tag;
unsigned int size, out_size;
int ret = 0;
@@ -235,7 +235,7 @@ static int fourxm_read_packet(AVFormatContext *s,
while (!packet_read) {
- if ((ret = get_buffer(&s->pb, header, 8)) < 0)
+ if ((ret = get_buffer(s->pb, header, 8)) < 0)
return ret;
fourcc_tag = AV_RL32(&header[0]);
size = AV_RL32(&header[4]);
@@ -265,9 +265,9 @@ static int fourxm_read_packet(AVFormatContext *s,
return AVERROR(EIO);
pkt->stream_index = fourxm->video_stream_index;
pkt->pts = fourxm->video_pts;
- pkt->pos = url_ftell(&s->pb);
+ pkt->pos = url_ftell(s->pb);
memcpy(pkt->data, header, 8);
- ret = get_buffer(&s->pb, &pkt->data[8], size);
+ ret = get_buffer(s->pb, &pkt->data[8], size);
if (ret < 0)
av_free_packet(pkt);
@@ -282,7 +282,7 @@ static int fourxm_read_packet(AVFormatContext *s,
size-=8;
if (track_number == fourxm->selected_track) {
- ret= av_get_packet(&s->pb, pkt, size);
+ ret= av_get_packet(s->pb, pkt, size);
if(ret<0)
return AVERROR(EIO);
pkt->stream_index =
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 9795e407e6..1949fcf542 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -84,7 +84,7 @@ static int adts_write_frame_header(AVFormatContext *s, int size)
put_bits(&pb, 2, 0); /* number_of_raw_data_blocks_in_frame */
flush_put_bits(&pb);
- put_buffer(&s->pb, buf, ADTS_HEADER_SIZE);
+ put_buffer(s->pb, buf, ADTS_HEADER_SIZE);
return 0;
}
@@ -92,7 +92,7 @@ static int adts_write_frame_header(AVFormatContext *s, int size)
static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
{
ADTSContext *adts = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
if (!pkt->size)
return 0;
diff --git a/libavformat/aiff.c b/libavformat/aiff.c
index ea98554654..f840c176da 100644
--- a/libavformat/aiff.c
+++ b/libavformat/aiff.c
@@ -161,7 +161,7 @@ typedef struct {
static int aiff_write_header(AVFormatContext *s)
{
AIFFOutputContext *aiff = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec;
AVExtFloat sample_rate;
int aifc = 0;
@@ -231,14 +231,14 @@ static int aiff_write_header(AVFormatContext *s)
static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size);
return 0;
}
static int aiff_write_trailer(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AIFFOutputContext *aiff = s->priv_data;
AVCodecContext *enc = s->streams[0]->codec;
@@ -250,7 +250,7 @@ static int aiff_write_trailer(AVFormatContext *s)
end_size++;
}
- if (!url_is_streamed(&s->pb)) {
+ if (!url_is_streamed(s->pb)) {
/* File length */
url_fseek(pb, aiff->form, SEEK_SET);
put_be32(pb, (uint32_t)(file_size - aiff->form - 4));
@@ -293,7 +293,7 @@ static int aiff_read_header(AVFormatContext *s,
offset_t offset = 0;
uint32_t tag;
unsigned version = AIFF_C_VERSION1;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream * st = s->streams[0];
/* check FORM header */
@@ -399,11 +399,11 @@ static int aiff_read_packet(AVFormatContext *s,
int res;
/* End of stream may be reached */
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
/* Now for that packet */
- res = av_get_packet(&s->pb, pkt, (MAX_SIZE / st->codec->block_align) * st->codec->block_align);
+ res = av_get_packet(s->pb, pkt, (MAX_SIZE / st->codec->block_align) * st->codec->block_align);
if (res < 0)
return res;
diff --git a/libavformat/amr.c b/libavformat/amr.c
index c0a8707b6a..d8c5399e3f 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -33,7 +33,7 @@ static const char AMRWB_header [] = "#!AMR-WB\n";
#ifdef CONFIG_MUXERS
static int amr_write_header(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[0]->codec;
s->priv_data = NULL;
@@ -56,8 +56,8 @@ static int amr_write_header(AVFormatContext *s)
static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- put_buffer(&s->pb, pkt->data, pkt->size);
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, pkt->data, pkt->size);
+ put_flush_packet(s->pb);
return 0;
}
#endif /* CONFIG_MUXERS */
@@ -78,7 +78,7 @@ static int amr_probe(AVProbeData *p)
static int amr_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
uint8_t header[9];
@@ -120,13 +120,13 @@ static int amr_read_packet(AVFormatContext *s,
AVCodecContext *enc = s->streams[0]->codec;
int read, size = 0, toc, mode;
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
{
return AVERROR(EIO);
}
//FIXME this is wrong, this should rather be in a AVParset
- toc=get_byte(&s->pb);
+ toc=get_byte(s->pb);
mode = (toc >> 3) & 0x0F;
if (enc->codec_id == CODEC_ID_AMR_NB)
@@ -152,10 +152,10 @@ static int amr_read_packet(AVFormatContext *s,
}
pkt->stream_index = 0;
- pkt->pos= url_ftell(&s->pb);
+ pkt->pos= url_ftell(s->pb);
pkt->data[0]=toc;
pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
- read = get_buffer(&s->pb, pkt->data+1, size-1);
+ read = get_buffer(s->pb, pkt->data+1, size-1);
if (read != size-1)
{
diff --git a/libavformat/apc.c b/libavformat/apc.c
index 683c0c257b..97de8c88ed 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -32,7 +32,7 @@ static int apc_probe(AVProbeData *p)
static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
get_le32(pb); /* CRYO */
@@ -74,7 +74,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
{
- if (av_get_packet(&s->pb, pkt, MAX_READ_SIZE) <= 0)
+ if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0)
return AVERROR(EIO);
pkt->stream_index = 0;
return 0;
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 54ffa9e1ec..358ad2e8b2 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -110,7 +110,7 @@ typedef struct {
static void ape_tag_read_field(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint8_t buf[1024];
uint32_t size;
int i;
@@ -143,7 +143,7 @@ static void ape_tag_read_field(AVFormatContext *s)
static void ape_parse_tag(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int file_size = url_fsize(pb);
uint32_t val, fields, tag_bytes;
uint8_t buf[8];
@@ -270,7 +270,7 @@ static void ape_dumpinfo(APEContext * ape_ctx)
static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
APEContext *ape = s->priv_data;
AVStream *st;
uint32_t tag;
@@ -456,12 +456,12 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
APEContext *ape = s->priv_data;
uint32_t extra_size = 8;
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR_IO;
if (ape->currentframe > ape->totalframes)
return AVERROR_IO;
- url_fseek (&s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
+ url_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
/* Calculate how many blocks there are in this frame */
if (ape->currentframe == (ape->totalframes - 1))
@@ -474,7 +474,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
AV_WL32(pkt->data , nblocks);
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
- ret = get_buffer(&s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
+ ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
pkt->pts = ape->frames[ape->currentframe].pts;
pkt->stream_index = 0;
diff --git a/libavformat/asf-enc.c b/libavformat/asf-enc.c
index 736c1365af..407dfd91f4 100644
--- a/libavformat/asf-enc.c
+++ b/libavformat/asf-enc.c
@@ -244,7 +244,7 @@ static void end_header(ByteIOContext *pb, int64_t pos)
static void put_chunk(AVFormatContext *s, int type, int payload_length, int flags)
{
ASFContext *asf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int length;
length = payload_length + 8;
@@ -270,7 +270,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)
{
ASFContext *asf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
int has_title;
AVCodecContext *enc;
@@ -506,7 +506,7 @@ static int asf_write_header(AVFormatContext *s)
return -1;
}
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
asf->packet_nb_payloads = 0;
asf->packet_timestamp_start = -1;
@@ -535,7 +535,7 @@ static int put_payload_parsing_info(
)
{
ASFContext *asf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ppi_size, i;
int64_t start= url_ftell(pb);
@@ -600,9 +600,9 @@ static void flush_packet(AVFormatContext *s)
assert(packet_hdr_size <= asf->packet_size_left);
memset(asf->packet_buf + packet_filled_size, 0, asf->packet_size_left);
- put_buffer(&s->pb, asf->packet_buf, asf->packet_size - packet_hdr_size);
+ put_buffer(s->pb, asf->packet_buf, asf->packet_size - packet_hdr_size);
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
asf->nb_packets++;
asf->packet_nb_payloads = 0;
asf->packet_timestamp_start = -1;
@@ -766,7 +766,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)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int i;
put_guid(pb, &simple_index_header);
@@ -793,22 +793,22 @@ static int asf_write_trailer(AVFormatContext *s)
flush_packet(s);
/* write index */
- data_size = url_ftell(&s->pb);
+ data_size = url_ftell(s->pb);
if ((!asf->is_streamed) && (asf->nb_index_count != 0)) {
asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);
}
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
- if (asf->is_streamed || url_is_streamed(&s->pb)) {
+ if (asf->is_streamed || url_is_streamed(s->pb)) {
put_chunk(s, 0x4524, 0, 0); /* end of stream */
} else {
/* rewrite an updated header */
- file_size = url_ftell(&s->pb);
- url_fseek(&s->pb, 0, SEEK_SET);
+ file_size = url_ftell(s->pb);
+ url_fseek(s->pb, 0, SEEK_SET);
asf_write_header1(s, file_size, data_size - asf->data_offset);
}
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
av_free(asf->index_ptr);
return 0;
}
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 47277dfbac..b2f54d9639 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -148,7 +148,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
ASFContext *asf = s->priv_data;
GUID g;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
ASFStream *asf_st;
int size, i;
@@ -582,12 +582,12 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int asf_get_packet(AVFormatContext *s)
{
ASFContext *asf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint32_t packet_length, padsize;
int rsize = 8;
int c, d, e, off;
- off= (url_ftell(&s->pb) - s->data_offset) % asf->packet_size + 3;
+ off= (url_ftell(s->pb) - s->data_offset) % asf->packet_size + 3;
c=d=e=-1;
while(off-- > 0){
@@ -658,7 +658,7 @@ static int asf_get_packet(AVFormatContext *s)
*/
static int asf_read_frame_header(AVFormatContext *s){
ASFContext *asf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int rsize = 1;
int num = get_byte(pb);
int64_t ts0, ts1;
@@ -731,7 +731,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
{
ASFContext *asf = s->priv_data;
ASFStream *asf_st = 0;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
//static int pc = 0;
for (;;) {
if(url_feof(pb))
@@ -745,7 +745,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
/* fail safe */
url_fskip(pb, ret);
- asf->packet_pos= url_ftell(&s->pb);
+ asf->packet_pos= url_ftell(s->pb);
if (asf->data_object_size != (uint64_t)-1 &&
(asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
return AVERROR(EIO); /* Do not exceed the size of the data object */
@@ -968,7 +968,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
pos= (pos+asf->packet_size-1-s->data_offset)/asf->packet_size*asf->packet_size+ s->data_offset;
*ppos= pos;
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
//printf("asf_read_pts\n");
asf_reset_header(s);
@@ -1012,21 +1012,21 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
int i;
int pct,ict;
- current_pos = url_ftell(&s->pb);
+ current_pos = url_ftell(s->pb);
- url_fseek(&s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
- get_guid(&s->pb, &g);
+ url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
+ get_guid(s->pb, &g);
if (!memcmp(&g, &index_guid, sizeof(GUID))) {
- gsize = get_le64(&s->pb);
- get_guid(&s->pb, &g);
- itime=get_le64(&s->pb);
- pct=get_le32(&s->pb);
- ict=get_le32(&s->pb);
+ gsize = get_le64(s->pb);
+ get_guid(s->pb, &g);
+ itime=get_le64(s->pb);
+ pct=get_le32(s->pb);
+ ict=get_le32(s->pb);
av_log(NULL, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict);
for (i=0;i<ict;i++){
- int pktnum=get_le32(&s->pb);
- int pktct =get_le16(&s->pb);
+ int pktnum=get_le32(s->pb);
+ int pktct =get_le16(s->pb);
av_log(NULL, AV_LOG_DEBUG, "pktnum:%d, pktct:%d\n", pktnum, pktct);
pos=s->data_offset + asf->packet_size*(int64_t)pktnum;
@@ -1036,7 +1036,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
}
asf->index_read= 1;
}
- url_fseek(&s->pb, current_pos, SEEK_SET);
+ url_fseek(s->pb, current_pos, SEEK_SET);
}
static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
@@ -1066,10 +1066,10 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
// various attempts to find key frame have failed so far
// asf_reset_header(s);
- // url_fseek(&s->pb, pos, SEEK_SET);
+ // url_fseek(s->pb, pos, SEEK_SET);
// key_pos = pos;
// for(i=0;i<16;i++){
- // pos = url_ftell(&s->pb);
+ // pos = url_ftell(s->pb);
// if (av_read_frame(s, &pkt) < 0){
// av_log(s, AV_LOG_INFO, "seek failed\n");
// return -1;
@@ -1087,7 +1087,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
/* do the seek */
av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
}
asf_reset_header(s);
return 0;
diff --git a/libavformat/au.c b/libavformat/au.c
index dd9d708ff5..93b4356536 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -59,7 +59,7 @@ static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
static int au_write_header(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
s->priv_data = NULL;
@@ -75,17 +75,17 @@ static int au_write_header(AVFormatContext *s)
static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size);
return 0;
}
static int au_write_trailer(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
offset_t file_size;
- if (!url_is_streamed(&s->pb)) {
+ if (!url_is_streamed(s->pb)) {
/* update file size */
file_size = url_ftell(pb);
@@ -116,7 +116,7 @@ static int au_read_header(AVFormatContext *s,
{
int size;
unsigned int tag;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int id, codec, channels, rate;
AVStream *st;
@@ -158,9 +158,9 @@ static int au_read_packet(AVFormatContext *s,
{
int ret;
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
- ret= av_get_packet(&s->pb, pkt, MAX_SIZE);
+ ret= av_get_packet(s->pb, pkt, MAX_SIZE);
if (ret < 0)
return AVERROR(EIO);
pkt->stream_index = 0;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index afea11bd42..5061b21c9a 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -21,8 +21,8 @@
#ifndef FFMPEG_AVFORMAT_H
#define FFMPEG_AVFORMAT_H
-#define LIBAVFORMAT_VERSION_INT ((51<<16)+(19<<8)+0)
-#define LIBAVFORMAT_VERSION 51.19.0
+#define LIBAVFORMAT_VERSION_INT ((52<<16)+(0<<8)+0)
+#define LIBAVFORMAT_VERSION 52.0.0
#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
@@ -369,7 +369,7 @@ typedef struct AVFormatContext {
struct AVInputFormat *iformat;
struct AVOutputFormat *oformat;
void *priv_data;
- ByteIOContext pb;
+ ByteIOContext *pb;
unsigned int nb_streams;
AVStream *streams[MAX_STREAMS];
char filename[1024]; /**< input or output filename */
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index c6b17a2021..92994ca713 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -106,7 +106,7 @@ static int get_riff(AVIContext *avi, ByteIOContext *pb)
static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
AVIContext *avi = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int longs_pre_entry= get_le16(pb);
int index_sub_type = get_byte(pb);
int index_type = get_byte(pb);
@@ -118,7 +118,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
AVIStream *ast;
int i;
int64_t last_pos= -1;
- int64_t filesize= url_fsize(&s->pb);
+ int64_t filesize= url_fsize(s->pb);
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
@@ -225,7 +225,7 @@ static int avi_read_tag(ByteIOContext *pb, char *buf, int maxlen, unsigned int
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
AVIContext *avi = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint32_t tag, tag1, handler;
int codec_type, stream_index, frame_period, bit_rate;
unsigned int size, nb_frames;
@@ -583,7 +583,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIContext *avi = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int n, d[8], size;
offset_t i, sync;
void* dstr;
@@ -628,7 +628,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
if(i>=0){
int64_t pos= best_st->index_entries[i].pos;
pos += best_ast->packet_size - best_ast->remaining;
- url_fseek(&s->pb, pos + 8, SEEK_SET);
+ url_fseek(s->pb, pos + 8, SEEK_SET);
// av_log(NULL, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
assert(best_ast->remaining <= best_ast->packet_size);
@@ -819,7 +819,7 @@ resync:
static int avi_read_idx1(AVFormatContext *s, int size)
{
AVIContext *avi = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int nb_index_entries, i;
AVStream *st;
AVIStream *ast;
@@ -890,7 +890,7 @@ static int guess_ni_flag(AVFormatContext *s){
static int avi_load_index(AVFormatContext *s)
{
AVIContext *avi = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint32_t tag, size;
offset_t pos= url_ftell(pb);
@@ -965,7 +965,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
/* DV demux so it can synth correct timestamps */
dv_offset_reset(avi->dv_demux, timestamp);
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
avi->stream_index= -1;
return 0;
}
@@ -1005,7 +1005,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
}
/* do the seek */
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
avi->stream_index= -1;
return 0;
}
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 8f379e9b8c..6b62f76d8d 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -105,7 +105,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)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVIContext *avi = s->priv_data;
int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
offset_t file_size;
@@ -138,7 +138,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
static int avi_write_header(AVFormatContext *s)
{
AVIContext *avi = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
AVCodecContext *stream, *video_enc;
offset_t list1, list2, strh, strf;
@@ -332,7 +332,7 @@ static int avi_write_header(AVFormatContext *s)
static int avi_write_ix(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVIContext *avi = s->priv_data;
char tag[5];
char ix_tag[] = "ix00";
@@ -389,7 +389,7 @@ static int avi_write_ix(AVFormatContext *s)
static int avi_write_idx1(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVIContext *avi = s->priv_data;
offset_t idx_chunk;
int i;
@@ -435,7 +435,7 @@ static int avi_write_idx1(AVFormatContext *s)
static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIContext *avi = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned char tag[5];
unsigned int flags=0;
const int stream_index= pkt->stream_index;
@@ -476,7 +476,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
avi->audio_strm_length[stream_index] += size;
}
- if (!url_is_streamed(&s->pb)) {
+ if (!url_is_streamed(s->pb)) {
AVIIndex* idx = &avi->indexes[stream_index];
int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE;
int id = idx->entry % AVI_INDEX_CLUSTER_SIZE;
@@ -509,7 +509,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
static int avi_write_trailer(AVFormatContext *s)
{
AVIContext *avi = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int res = 0;
int i, j, n, nb_frames;
offset_t file_size;
diff --git a/libavformat/avio.h b/libavformat/avio.h
index dda786f5dc..89a347b78f 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -201,7 +201,7 @@ static inline int url_is_streamed(ByteIOContext *s)
/** @note when opened as read/write, the buffers are only used for
writing */
-int url_fdopen(ByteIOContext *s, URLContext *h);
+int url_fdopen(ByteIOContext **s, URLContext *h);
/** @warning must be called before any I/O */
int url_setbufsize(ByteIOContext *s, int buf_size);
@@ -213,7 +213,7 @@ int url_resetbuf(ByteIOContext *s, int flags);
/** @note when opened as read/write, the buffers are only used for
writing */
-int url_fopen(ByteIOContext *s, const char *filename, int flags);
+int url_fopen(ByteIOContext **s, const char *filename, int flags);
int url_fclose(ByteIOContext *s);
URLContext *url_fileno(ByteIOContext *s);
@@ -227,7 +227,7 @@ URLContext *url_fileno(ByteIOContext *s);
*/
int url_fget_max_packet_size(ByteIOContext *s);
-int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags);
+int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags);
/** return the written or read size */
int url_close_buf(ByteIOContext *s);
@@ -238,7 +238,7 @@ int url_close_buf(ByteIOContext *s);
* @param s new IO context
* @return zero if no error.
*/
-int url_open_dyn_buf(ByteIOContext *s);
+int url_open_dyn_buf(ByteIOContext **s);
/**
* Open a write only packetized memory stream with a maximum packet
@@ -249,7 +249,7 @@ int url_open_dyn_buf(ByteIOContext *s);
* @param max_packet_size maximum packet size (must be > 0)
* @return zero if no error.
*/
-int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size);
+int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size);
/**
* Return the written size and a pointer to the buffer. The buffer
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 8bf6c063ea..c79f51fe65 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -111,7 +111,12 @@ void put_flush_packet(ByteIOContext *s)
offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
{
offset_t offset1;
- offset_t pos= s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
+ offset_t pos;
+
+ if(!s)
+ return AVERROR(EINVAL);
+
+ pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
if (whence != SEEK_CUR && whence != SEEK_SET)
return AVERROR(EINVAL);
@@ -167,6 +172,9 @@ offset_t url_fsize(ByteIOContext *s)
{
offset_t size;
+ if(!s)
+ return AVERROR(EINVAL);
+
if (!s->seek)
return AVERROR(EPIPE);
size = s->seek(s->opaque, 0, AVSEEK_SIZE);
@@ -181,11 +189,15 @@ offset_t url_fsize(ByteIOContext *s)
int url_feof(ByteIOContext *s)
{
+ if(!s)
+ return 0;
return s->eof_reached;
}
int url_ferror(ByteIOContext *s)
{
+ if(!s)
+ return 0;
return s->error;
}
@@ -508,7 +520,7 @@ static offset_t url_seek_packet(void *opaque, offset_t offset, int whence)
//return 0;
}
-int url_fdopen(ByteIOContext *s, URLContext *h)
+int url_fdopen(ByteIOContext **s, URLContext *h)
{
uint8_t *buffer;
int buffer_size, max_packet_size;
@@ -524,14 +536,21 @@ int url_fdopen(ByteIOContext *s, URLContext *h)
if (!buffer)
return AVERROR(ENOMEM);
- if (init_put_byte(s, buffer, buffer_size,
+ *s = av_mallocz(sizeof(ByteIOContext));
+ if(!*s) {
+ av_free(buffer);
+ return AVERROR(ENOMEM);
+ }
+
+ if (init_put_byte(*s, buffer, buffer_size,
(h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
url_read_packet, url_write_packet, url_seek_packet) < 0) {
av_free(buffer);
+ av_freep(s);
return AVERROR(EIO);
}
- s->is_streamed = h->is_streamed;
- s->max_packet_size = max_packet_size;
+ (*s)->is_streamed = h->is_streamed;
+ (*s)->max_packet_size = max_packet_size;
return 0;
}
@@ -566,7 +585,7 @@ int url_resetbuf(ByteIOContext *s, int flags)
return 0;
}
-int url_fopen(ByteIOContext *s, const char *filename, int flags)
+int url_fopen(ByteIOContext **s, const char *filename, int flags)
{
URLContext *h;
int err;
@@ -587,7 +606,7 @@ int url_fclose(ByteIOContext *s)
URLContext *h = s->opaque;
av_free(s->buffer);
- memset(s, 0, sizeof(ByteIOContext));
+ av_free(s);
return url_close(h);
}
@@ -641,11 +660,18 @@ int url_fget_max_packet_size(ByteIOContext *s)
* back to the server even if CONFIG_MUXERS is not set. */
#if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK)
/* buffer handling */
-int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags)
+int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags)
{
- return init_put_byte(s, buf, buf_size,
- (flags & URL_WRONLY || flags & URL_RDWR),
- NULL, NULL, NULL, NULL);
+ int ret;
+ *s = av_mallocz(sizeof(ByteIOContext));
+ if(!*s)
+ return AVERROR(ENOMEM);
+ ret = init_put_byte(*s, buf, buf_size,
+ (flags & URL_WRONLY || flags & URL_RDWR),
+ NULL, NULL, NULL, NULL);
+ if(ret != 0)
+ av_freep(s);
+ return ret;
}
int url_close_buf(ByteIOContext *s)
@@ -725,7 +751,7 @@ static offset_t dyn_buf_seek(void *opaque, offset_t offset, int whence)
return 0;
}
-static int url_open_dyn_buf_internal(ByteIOContext *s, int max_packet_size)
+static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size)
{
DynBuffer *d;
int io_buffer_size, ret;
@@ -740,27 +766,35 @@ static int url_open_dyn_buf_internal(ByteIOContext *s, int max_packet_size)
d = av_malloc(sizeof(DynBuffer) + io_buffer_size);
if (!d)
return -1;
+ *s = av_mallocz(sizeof(ByteIOContext));
+ if(!*s) {
+ av_free(d);
+ return AVERROR(ENOMEM);
+ }
d->io_buffer_size = io_buffer_size;
d->buffer = NULL;
d->pos = 0;
d->size = 0;
d->allocated_size = 0;
- ret = init_put_byte(s, d->io_buffer, io_buffer_size,
+ ret = init_put_byte(*s, d->io_buffer, io_buffer_size,
1, d, NULL,
max_packet_size ? dyn_packet_buf_write : dyn_buf_write,
max_packet_size ? NULL : dyn_buf_seek);
if (ret == 0) {
- s->max_packet_size = max_packet_size;
+ (*s)->max_packet_size = max_packet_size;
+ } else {
+ av_free(d);
+ av_freep(s);
}
return ret;
}
-int url_open_dyn_buf(ByteIOContext *s)
+int url_open_dyn_buf(ByteIOContext **s)
{
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(ByteIOContext **s, int max_packet_size)
{
if (max_packet_size <= 0)
return -1;
@@ -777,6 +811,7 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
*pbuffer = d->buffer;
size = d->size;
av_free(d);
+ av_free(s);
return size;
}
#endif /* CONFIG_MUXERS || CONFIG_NETWORK */
diff --git a/libavformat/avs.c b/libavformat/avs.c
index b6ede08ed3..b1d6f89e0d 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -60,12 +60,12 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
s->ctx_flags |= AVFMTCTX_NOHEADER;
- url_fskip(&s->pb, 4);
- avs->width = get_le16(&s->pb);
- avs->height = get_le16(&s->pb);
- avs->bits_per_sample = get_le16(&s->pb);
- avs->fps = get_le16(&s->pb);
- avs->nb_frames = get_le32(&s->pb);
+ url_fskip(s->pb, 4);
+ avs->width = get_le16(s->pb);
+ avs->height = get_le16(s->pb);
+ avs->bits_per_sample = get_le16(s->pb);
+ avs->fps = get_le16(s->pb);
+ avs->nb_frames = get_le32(s->pb);
avs->remaining_frame_size = 0;
avs->remaining_audio_size = 0;
@@ -103,7 +103,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
pkt->data[palette_size + 1] = type;
pkt->data[palette_size + 2] = size & 0xFF;
pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
- ret = get_buffer(&s->pb, pkt->data + palette_size + 4, size - 4) + 4;
+ ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
if (ret < size) {
av_free_packet(pkt);
return AVERROR(EIO);
@@ -122,9 +122,9 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
avs_format_t *avs = s->priv_data;
int ret, size;
- size = url_ftell(&s->pb);
+ size = url_ftell(s->pb);
ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
- size = url_ftell(&s->pb) - size;
+ size = url_ftell(s->pb) - size;
avs->remaining_audio_size -= size;
if (ret == AVERROR(EIO))
@@ -153,20 +153,20 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
while (1) {
if (avs->remaining_frame_size <= 0) {
- if (!get_le16(&s->pb)) /* found EOF */
+ if (!get_le16(s->pb)) /* found EOF */
return AVERROR(EIO);
- avs->remaining_frame_size = get_le16(&s->pb) - 4;
+ avs->remaining_frame_size = get_le16(s->pb) - 4;
}
while (avs->remaining_frame_size > 0) {
- sub_type = get_byte(&s->pb);
- type = get_byte(&s->pb);
- size = get_le16(&s->pb);
+ sub_type = get_byte(s->pb);
+ type = get_byte(s->pb);
+ size = get_le16(s->pb);
avs->remaining_frame_size -= size;
switch (type) {
case AVS_PALETTE:
- ret = get_buffer(&s->pb, palette, size - 4);
+ ret = get_buffer(s->pb, palette, size - 4);
if (ret < size - 4)
return AVERROR(EIO);
palette_size = size;
@@ -203,7 +203,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
break;
default:
- url_fskip(&s->pb, size - 4);
+ url_fskip(s->pb, size - 4);
}
}
}
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 89af4f16fe..594779698b 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -59,7 +59,7 @@ static int vid_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
BVID_DemuxContext *vid = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *stream;
/* load main header. Contents:
@@ -173,7 +173,7 @@ static int vid_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
BVID_DemuxContext *vid = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned char block_type;
int audio_length;
int ret_value;
diff --git a/libavformat/c93.c b/libavformat/c93.c
index 3bc6855c85..996012f6ed 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -56,7 +56,7 @@ static int read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
AVStream *video;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
C93DemuxContext *c93 = s->priv_data;
int i;
int framecount = 0;
@@ -101,7 +101,7 @@ static int read_header(AVFormatContext *s,
static int read_packet(AVFormatContext *s, AVPacket *pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
C93DemuxContext *c93 = s->priv_data;
C93BlockRecord *br = &c93->block_records[c93->current_block];
int datasize;
diff --git a/libavformat/crcenc.c b/libavformat/crcenc.c
index 7b1622706e..dd88031618 100644
--- a/libavformat/crcenc.c
+++ b/libavformat/crcenc.c
@@ -48,8 +48,8 @@ static int crc_write_trailer(struct AVFormatContext *s)
char buf[64];
snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
- put_buffer(&s->pb, buf, strlen(buf));
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, buf, strlen(buf));
+ put_flush_packet(s->pb);
return 0;
}
diff --git a/libavformat/daud.c b/libavformat/daud.c
index e1d901aa16..ff74d05025 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -34,7 +34,7 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
}
static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ret, size;
if (url_feof(pb))
return AVERROR(EIO);
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index b00bfd29b3..14f2be8af5 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -94,7 +94,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
int rc;
CinDemuxContext *cin = s->priv_data;
CinFileHeader *hdr = &cin->file_header;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
rc = cin_read_file_header(cin, pb);
@@ -158,7 +158,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
{
CinDemuxContext *cin = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
CinFrameHeader *hdr = &cin->frame_header;
int rc, palette_type, pkt_size;
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 89fd26a47f..6fb27bfe06 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -347,7 +347,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
// FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
const DVprofile* sys = dv_codec_profile(c->vst->codec);
int64_t offset;
- int64_t size = url_fsize(&s->pb);
+ int64_t size = url_fsize(s->pb);
int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
offset = sys->frame_size * timestamp;
@@ -386,8 +386,8 @@ static int dv_read_header(AVFormatContext *s,
if (!c->dv_demux)
return -1;
- if (get_buffer(&s->pb, c->buf, DV_PROFILE_BYTES) <= 0 ||
- url_fseek(&s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
+ if (get_buffer(s->pb, c->buf, DV_PROFILE_BYTES) <= 0 ||
+ url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
return AVERROR(EIO);
c->dv_demux->sys = dv_frame_profile(c->buf);
@@ -408,7 +408,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (size < 0) {
size = c->dv_demux->sys->frame_size;
- if (get_buffer(&s->pb, c->buf, size) <= 0)
+ if (get_buffer(s->pb, c->buf, size) <= 0)
return AVERROR(EIO);
size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
@@ -426,7 +426,7 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
dv_offset_reset(c, offset / c->sys->frame_size);
- offset = url_fseek(&s->pb, offset, SEEK_SET);
+ offset = url_fseek(s->pb, offset, SEEK_SET);
return (offset < 0)?offset:0;
}
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 2af160f8b4..0d60028182 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -380,8 +380,8 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt)
fsize = dv_assemble_frame(s->priv_data, s->streams[pkt->stream_index],
pkt->data, pkt->size, &frame);
if (fsize > 0) {
- put_buffer(&s->pb, frame, fsize);
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, frame, fsize);
+ put_flush_packet(s->pb);
}
return 0;
}
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index c313df567a..2df73c7ddc 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -45,7 +45,7 @@ static int dxa_probe(AVProbeData *p)
static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
DXAContext *c = s->priv_data;
AVStream *st, *ast;
uint32_t tag;
@@ -144,19 +144,19 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(!c->readvid && c->has_sound && c->bytes_left){
c->readvid = 1;
- url_fseek(&s->pb, c->wavpos, SEEK_SET);
+ url_fseek(s->pb, c->wavpos, SEEK_SET);
size = FFMIN(c->bytes_left, c->bpc);
- ret = av_get_packet(&s->pb, pkt, size);
+ ret = av_get_packet(s->pb, pkt, size);
pkt->stream_index = 1;
if(ret != size)
return AVERROR(EIO);
c->bytes_left -= size;
- c->wavpos = url_ftell(&s->pb);
+ c->wavpos = url_ftell(s->pb);
return 0;
}
- url_fseek(&s->pb, c->vidpos, SEEK_SET);
- while(!url_feof(&s->pb) && c->frames){
- get_buffer(&s->pb, buf, 4);
+ url_fseek(s->pb, c->vidpos, SEEK_SET);
+ while(!url_feof(s->pb) && c->frames){
+ get_buffer(s->pb, buf, 4);
switch(AV_RL32(buf)){
case MKTAG('N', 'U', 'L', 'L'):
if(av_new_packet(pkt, 4 + pal_size) < 0)
@@ -165,16 +165,16 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(pal_size) memcpy(pkt->data, pal, pal_size);
memcpy(pkt->data + pal_size, buf, 4);
c->frames--;
- c->vidpos = url_ftell(&s->pb);
+ c->vidpos = url_ftell(s->pb);
c->readvid = 0;
return 0;
case MKTAG('C', 'M', 'A', 'P'):
pal_size = 768+4;
memcpy(pal, buf, 4);
- get_buffer(&s->pb, pal + 4, 768);
+ get_buffer(s->pb, pal + 4, 768);
break;
case MKTAG('F', 'R', 'A', 'M'):
- get_buffer(&s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
+ get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
size = AV_RB32(buf + 5);
if(size > 0xFFFFFF){
av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
@@ -183,7 +183,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
- ret = get_buffer(&s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
+ ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
if(ret != size){
av_free_packet(pkt);
return AVERROR(EIO);
@@ -191,7 +191,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(pal_size) memcpy(pkt->data, pal, pal_size);
pkt->stream_index = 0;
c->frames--;
- c->vidpos = url_ftell(&s->pb);
+ c->vidpos = url_ftell(s->pb);
c->readvid = 0;
return 0;
default:
diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c
index 48de32e6ee..ffaf85e0eb 100644
--- a/libavformat/eacdata.c
+++ b/libavformat/eacdata.c
@@ -47,7 +47,7 @@ static int cdata_probe(AVProbeData *p)
static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
CdataDemuxContext *cdata = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int sample_rate, header;
AVStream *st;
@@ -83,7 +83,7 @@ static int cdata_read_packet(AVFormatContext *s, AVPacket *pkt)
CdataDemuxContext *cdata = s->priv_data;
int packet_size = 76*cdata->channels;
- if (av_get_packet(&s->pb, pkt, packet_size) != packet_size)
+ if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
return AVERROR(EIO);
pkt->pts = cdata->audio_pts++;
return 1;
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 8214480229..33f2cea481 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -90,7 +90,7 @@ static int process_audio_header_elements(AVFormatContext *s)
{
int inHeader = 1;
EaDemuxContext *ea = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int compression_type = -1, revision = -1;
ea->bytes = 2;
@@ -188,7 +188,7 @@ static int process_audio_header_elements(AVFormatContext *s)
static int process_audio_header_eacs(AVFormatContext *s)
{
EaDemuxContext *ea = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int compression_type;
ea->sample_rate = ea->big_endian ? get_be32(pb) : get_le32(pb);
@@ -220,7 +220,7 @@ static int process_audio_header_eacs(AVFormatContext *s)
static int process_audio_header_sead(AVFormatContext *s)
{
EaDemuxContext *ea = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
ea->sample_rate = get_le32(pb);
ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */
@@ -233,7 +233,7 @@ static int process_audio_header_sead(AVFormatContext *s)
static int process_video_header_vp6(AVFormatContext *s)
{
EaDemuxContext *ea = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
url_fskip(pb, 16);
ea->time_base.den = get_le32(pb);
@@ -250,7 +250,7 @@ static int process_video_header_vp6(AVFormatContext *s)
static int process_ea_header(AVFormatContext *s) {
uint32_t blockid, size = 0;
EaDemuxContext *ea = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int i;
for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
@@ -370,7 +370,7 @@ static int ea_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
EaDemuxContext *ea = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ret = 0;
int packet_read = 0;
unsigned int chunk_type, chunk_size;
diff --git a/libavformat/ffm.c b/libavformat/ffm.c
index 53eb2b29dc..baff5bcfad 100644
--- a/libavformat/ffm.c
+++ b/libavformat/ffm.c
@@ -64,7 +64,7 @@ static void flush_packet(AVFormatContext *s)
{
FFMContext *ffm = s->priv_data;
int fill_size, h;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
fill_size = ffm->packet_end - ffm->packet_ptr;
memset(ffm->packet_ptr, 0, fill_size);
@@ -128,7 +128,7 @@ static int ffm_write_header(AVFormatContext *s)
FFMContext *ffm = s->priv_data;
AVStream *st;
FFMStream *fst;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *codec;
int bit_rate, i;
@@ -278,7 +278,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
static int ffm_write_trailer(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
FFMContext *ffm = s->priv_data;
/* flush packets */
@@ -314,7 +314,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
if (size <= len)
return 1;
}
- pos = url_ftell(&s->pb);
+ pos = url_ftell(s->pb);
if (pos == ffm->write_index) {
/* exactly at the end of stream */
return 0;
@@ -335,7 +335,7 @@ static int ffm_read_data(AVFormatContext *s,
uint8_t *buf, int size, int first)
{
FFMContext *ffm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int len, fill_size, size1, frame_offset;
size1 = size;
@@ -393,7 +393,7 @@ static int ffm_read_data(AVFormatContext *s,
static void adjust_write_index(AVFormatContext *s)
{
FFMContext *ffm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int64_t pts;
//offset_t orig_write_index = ffm->write_index;
offset_t pos_min, pos_max;
@@ -452,7 +452,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
FFMContext *ffm = s->priv_data;
AVStream *st;
FFMStream *fst;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *codec;
int i, nb_streams;
uint32_t tag;
@@ -585,7 +585,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
}
#if 0
printf("pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
- url_ftell(&s->pb), s->pb.pos, ffm->write_index, ffm->file_size);
+ url_ftell(s->pb), s->pb.pos, ffm->write_index, ffm->file_size);
#endif
if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
FRAME_HEADER_SIZE)
@@ -610,7 +610,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
av_new_packet(pkt, size);
pkt->stream_index = ffm->header[0];
- pkt->pos = url_ftell(&s->pb);
+ pkt->pos = url_ftell(s->pb);
if (ffm->header[1] & FLAG_KEY_FRAME)
pkt->flags |= PKT_FLAG_KEY;
@@ -638,7 +638,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
static void ffm_seek1(AVFormatContext *s, offset_t pos1)
{
FFMContext *ffm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
offset_t pos;
pos = pos1 + ffm->write_index;
@@ -652,7 +652,7 @@ static void ffm_seek1(AVFormatContext *s, offset_t pos1)
static int64_t get_pts(AVFormatContext *s, offset_t pos)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int64_t pts;
ffm_seek1(s, pos);
diff --git a/libavformat/flic.c b/libavformat/flic.c
index ed7004faf1..b422fb09ae 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -67,7 +67,7 @@ static int flic_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
FlicDemuxContext *flic = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned char header[FLIC_HEADER_SIZE];
AVStream *st;
int speed;
@@ -142,7 +142,7 @@ static int flic_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
FlicDemuxContext *flic = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int packet_read = 0;
unsigned int size;
int magic;
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 0530335c29..885c4a6fe5 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -71,7 +71,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
vcodec->extradata_size = 1;
vcodec->extradata = av_malloc(1);
}
- vcodec->extradata[0] = get_byte(&s->pb);
+ vcodec->extradata[0] = get_byte(s->pb);
return 1; // 1 byte body size adjustment for flv_read_packet()
default:
av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flv_codecid);
@@ -103,7 +103,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
double num_val;
num_val = 0;
- ioc = &s->pb;
+ ioc = s->pb;
amf_type = get_byte(ioc);
@@ -203,7 +203,7 @@ static int flv_read_metabody(AVFormatContext *s, unsigned int next_pos) {
astream = NULL;
vstream = NULL;
keylen = 0;
- ioc = &s->pb;
+ ioc = s->pb;
//first object needs to be "onMetaData" string
type = get_byte(ioc);
@@ -238,8 +238,8 @@ static int flv_read_header(AVFormatContext *s,
{
int offset, flags;
- url_fskip(&s->pb, 4);
- flags = get_byte(&s->pb);
+ url_fskip(s->pb, 4);
+ flags = get_byte(s->pb);
/* old flvtool cleared this field */
/* FIXME: better fix needed */
if (!flags) {
@@ -256,8 +256,8 @@ static int flv_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
}
- offset = get_be32(&s->pb);
- url_fseek(&s->pb, offset, SEEK_SET);
+ offset = get_be32(s->pb);
+ url_fseek(s->pb, offset, SEEK_SET);
s->start_time = 0;
@@ -270,35 +270,35 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
AVStream *st = NULL;
for(;;){
- pos = url_ftell(&s->pb);
- url_fskip(&s->pb, 4); /* size of previous packet */
- type = get_byte(&s->pb);
- size = get_be24(&s->pb);
- pts = get_be24(&s->pb);
- pts |= get_byte(&s->pb) << 24;
+ pos = url_ftell(s->pb);
+ url_fskip(s->pb, 4); /* size of previous packet */
+ type = get_byte(s->pb);
+ size = get_be24(s->pb);
+ pts = get_be24(s->pb);
+ pts |= get_byte(s->pb) << 24;
// av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, pts:%d\n", type, size, pts);
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
- url_fskip(&s->pb, 3); /* stream id, always 0 */
+ url_fskip(s->pb, 3); /* stream id, always 0 */
flags = 0;
if(size == 0)
continue;
- next= size + url_ftell(&s->pb);
+ next= size + url_ftell(s->pb);
if (type == FLV_TAG_TYPE_AUDIO) {
is_audio=1;
- flags = get_byte(&s->pb);
+ flags = get_byte(s->pb);
} else if (type == FLV_TAG_TYPE_VIDEO) {
is_audio=0;
- flags = get_byte(&s->pb);
+ flags = get_byte(s->pb);
} else {
if (type == FLV_TAG_TYPE_META && size > 13+1+4)
flv_read_metabody(s, next);
else /* skip packet */
av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
- url_fseek(&s->pb, next, SEEK_SET);
+ url_fseek(s->pb, next, SEEK_SET);
continue;
}
@@ -317,7 +317,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
|| st->discard >= AVDISCARD_ALL
){
- url_fseek(&s->pb, next, SEEK_SET);
+ url_fseek(s->pb, next, SEEK_SET);
continue;
}
if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
@@ -326,17 +326,17 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
// if not streamed and no duration from metadata then seek to end to find the duration from the timestamps
- if(!url_is_streamed(&s->pb) && s->duration==AV_NOPTS_VALUE){
+ if(!url_is_streamed(s->pb) && s->duration==AV_NOPTS_VALUE){
int size;
- const int pos= url_ftell(&s->pb);
- const int fsize= url_fsize(&s->pb);
- url_fseek(&s->pb, fsize-4, SEEK_SET);
- size= get_be32(&s->pb);
- url_fseek(&s->pb, fsize-3-size, SEEK_SET);
- if(size == get_be24(&s->pb) + 11){
- s->duration= get_be24(&s->pb) * (int64_t)AV_TIME_BASE / 1000;
+ const int pos= url_ftell(s->pb);
+ const int fsize= url_fsize(s->pb);
+ url_fseek(s->pb, fsize-4, SEEK_SET);
+ size= get_be32(s->pb);
+ url_fseek(s->pb, fsize-3-size, SEEK_SET);
+ if(size == get_be24(s->pb) + 11){
+ s->duration= get_be24(s->pb) * (int64_t)AV_TIME_BASE / 1000;
}
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
}
if(is_audio){
@@ -353,7 +353,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
}
- ret= av_get_packet(&s->pb, pkt, size - 1);
+ ret= av_get_packet(s->pb, pkt, size - 1);
if (ret <= 0) {
return AVERROR(EIO);
}
@@ -380,7 +380,7 @@ static int flv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
int index = av_index_search_timestamp(st, timestamp, flags);
if (index < 0)
return -1;
- url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
+ url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
return 0;
}
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 3901ba76b0..2842faf5b2 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -126,7 +126,7 @@ static void put_amf_bool(ByteIOContext *pb, int b) {
static int flv_write_header(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
FLVContext *flv = s->priv_data;
int i, width, height, samplerate, samplesize, channels, audiocodecid, videocodecid;
double framerate = 0.0;
@@ -256,7 +256,7 @@ static int flv_write_trailer(AVFormatContext *s)
{
int64_t file_size;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
FLVContext *flv = s->priv_data;
file_size = url_ftell(pb);
@@ -273,7 +273,7 @@ static int flv_write_trailer(AVFormatContext *s)
static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
FLVContext *flv = s->priv_data;
int size= pkt->size;
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index 6b3168a6fe..c0133017c2 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -27,8 +27,8 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
char buf[256];
snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
- put_buffer(&s->pb, buf, strlen(buf));
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, buf, strlen(buf));
+ put_flush_packet(s->pb);
return 0;
}
diff --git a/libavformat/gif.c b/libavformat/gif.c
index a5d81fbbcf..8092f374c0 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -313,7 +313,7 @@ typedef struct {
static int gif_write_header(AVFormatContext *s)
{
GIFContext *gif = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *enc, *video_enc;
int i, width, height, loop_count /*, rate*/;
@@ -348,14 +348,14 @@ static int gif_write_header(AVFormatContext *s)
gif_image_write_header(pb, width, height, loop_count, NULL);
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
return 0;
}
static int gif_write_video(AVFormatContext *s,
AVCodecContext *enc, const uint8_t *buf, int size)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
GIFContext *gif = s->priv_data;
int jiffies;
int64_t delay;
@@ -383,7 +383,7 @@ static int gif_write_video(AVFormatContext *s,
gif_image_write_image(pb, 0, 0, enc->width, enc->height,
buf, enc->width * 3, PIX_FMT_RGB24);
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
return 0;
}
@@ -398,10 +398,10 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
static int gif_write_trailer(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
put_byte(pb, 0x3b);
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
return 0;
}
diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c
index 26cbe69962..5803e5e5dc 100644
--- a/libavformat/gifdec.c
+++ b/libavformat/gifdec.c
@@ -526,7 +526,7 @@ static int gif_read_header(AVFormatContext * s1,
AVFormatParameters * ap)
{
GifState *s = s1->priv_data;
- ByteIOContext *f = &s1->pb;
+ ByteIOContext *f = s1->pb;
AVStream *st;
s->f = f;
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 45467c648e..d4bf6f43be 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -228,7 +228,7 @@ static void gxf_track_tags(ByteIOContext *pb, int *len, st_info_t *si) {
* \brief read index from FLT packet into stream 0 av_index
*/
static void gxf_read_index(AVFormatContext *s, int pkt_len) {
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st = s->streams[0];
uint32_t fields_per_map = get_le32(pb);
uint32_t map_cnt = get_le32(pb);
@@ -252,7 +252,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
}
static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
pkt_type_t pkt_type;
int map_len;
int len;
@@ -378,7 +378,7 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t
int cur_track;
int64_t cur_timestamp = AV_NOPTS_VALUE;
int len;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
pkt_type_t type;
tmp = get_be32(pb);
start:
@@ -408,7 +408,7 @@ out:
}
static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
pkt_type_t pkt_type;
int pkt_len;
while (!url_feof(pb)) {
@@ -466,7 +466,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
if (idx < st->nb_index_entries - 2)
maxlen = st->index_entries[idx + 2].pos - pos;
maxlen = FFMAX(maxlen, 200 * 1024);
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
found = gxf_resync_media(s, maxlen, -1, timestamp);
if (FFABS(found - timestamp) > 4)
return -1;
@@ -475,7 +475,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,
int64_t *pos, int64_t pos_limit) {
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int64_t res;
url_fseek(pb, *pos, SEEK_SET);
res = gxf_resync_media(s, pos_limit - *pos, -1, -1);
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 2331bd80f4..469105de5f 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -576,7 +576,7 @@ static int gxf_write_umf_packet(ByteIOContext *pb, GXFContext *ctx)
static int gxf_write_header(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
GXFContext *gxf = s->priv_data;
int i;
@@ -671,7 +671,7 @@ static int gxf_write_eos_packet(ByteIOContext *pb, GXFContext *ctx)
static int gxf_write_trailer(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
GXFContext *gxf = s->priv_data;
offset_t end;
int i;
@@ -763,8 +763,8 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
{
GXFContext *gxf = s->priv_data;
- gxf_write_media_packet(&s->pb, gxf, pkt);
- put_flush_packet(&s->pb);
+ gxf_write_media_packet(s->pb, gxf, pkt);
+ put_flush_packet(s->pb);
return 0;
}
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 56850ec82a..e113f4de1f 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -136,7 +136,7 @@ static int idcin_probe(AVProbeData *p)
static int idcin_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
IdcinDemuxContext *idcin = s->priv_data;
AVStream *st;
unsigned int width, height;
@@ -215,13 +215,13 @@ static int idcin_read_packet(AVFormatContext *s,
unsigned int command;
unsigned int chunk_size;
IdcinDemuxContext *idcin = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int i;
int palette_scale;
unsigned char r, g, b;
unsigned char palette_buffer[768];
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
if (idcin->next_chunk_is_video) {
diff --git a/libavformat/idroq.c b/libavformat/idroq.c
index 122b31e471..394697fcdc 100644
--- a/libavformat/idroq.c
+++ b/libavformat/idroq.c
@@ -69,7 +69,7 @@ static int roq_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
RoqDemuxContext *roq = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
int i;
@@ -174,7 +174,7 @@ static int roq_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
RoqDemuxContext *roq = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ret = 0;
unsigned int chunk_size;
unsigned int chunk_type;
@@ -185,7 +185,7 @@ static int roq_read_packet(AVFormatContext *s,
while (!packet_read) {
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
/* get the next chunk preamble */
diff --git a/libavformat/img2.c b/libavformat/img2.c
index af17040fad..42a2d61e5a 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -239,7 +239,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
char filename[1024];
int i;
int size[3]={0}, ret[3]={0};
- ByteIOContext f1[3], *f[3]= {&f1[0], &f1[1], &f1[2]};
+ ByteIOContext *f[3];
AVCodecContext *codec= s1->streams[0]->codec;
if (!s->is_pipe) {
@@ -251,7 +251,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
s->path, s->img_number)<0 && s->img_number > 1)
return AVERROR(EIO);
for(i=0; i<3; i++){
- if (url_fopen(f[i], filename, URL_RDONLY) < 0)
+ if (url_fopen(&f[i], filename, URL_RDONLY) < 0)
return AVERROR(EIO);
size[i]= url_fsize(f[i]);
@@ -263,7 +263,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
if(codec->codec_id == CODEC_ID_RAWVIDEO && !codec->width)
infer_size(&codec->width, &codec->height, size[0]);
} else {
- f[0] = &s1->pb;
+ f[0] = s1->pb;
if (url_feof(f[0]))
return AVERROR(EIO);
size[0]= 4096;
@@ -322,7 +322,7 @@ static int img_write_header(AVFormatContext *s)
static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
{
VideoData *img = s->priv_data;
- ByteIOContext pb1[3], *pb[3]= {&pb1[0], &pb1[1], &pb1[2]};
+ ByteIOContext *pb[3];
char filename[1024];
AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec;
int i;
@@ -332,7 +332,7 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
img->path, img->img_number) < 0 && img->img_number>1)
return AVERROR(EIO);
for(i=0; i<3; i++){
- if (url_fopen(pb[i], filename, URL_WRONLY) < 0)
+ if (url_fopen(&pb[i], filename, URL_WRONLY) < 0)
return AVERROR(EIO);
if(codec->codec_id != CODEC_ID_RAWVIDEO)
@@ -340,7 +340,7 @@ static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
filename[ strlen(filename) - 1 ]= 'U' + i;
}
} else {
- pb[0] = &s->pb;
+ pb[0] = s->pb;
}
if(codec->codec_id == CODEC_ID_RAWVIDEO){
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index bf403d7c73..311f29f49f 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -517,7 +517,7 @@ static int ipmovie_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
IPMVEContext *ipmovie = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVPacket pkt;
AVStream *st;
unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
@@ -589,7 +589,7 @@ static int ipmovie_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
IPMVEContext *ipmovie = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ret;
ret = process_ipmovie_chunk(ipmovie, pb, pkt);
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index f70a458b65..f5423069f1 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -54,7 +54,7 @@ static int av_write(void * h, size_t len, const uint8_t * buf) {
static int nut_write_header(AVFormatContext * avf) {
NUTContext * priv = avf->priv_data;
- ByteIOContext * bc = &avf->pb;
+ ByteIOContext * bc = avf->pb;
nut_muxer_opts_t mopts = {
.output = {
.priv = bc,
@@ -137,7 +137,7 @@ static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) {
}
static int nut_write_trailer(AVFormatContext * avf) {
- ByteIOContext * bc = &avf->pb;
+ ByteIOContext * bc = avf->pb;
NUTContext * priv = avf->priv_data;
int i;
@@ -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) {
NUTContext * priv = avf->priv_data;
- ByteIOContext * bc = &avf->pb;
+ ByteIOContext * bc = avf->pb;
nut_demuxer_opts_t dopts = {
.input = {
.priv = bc,
@@ -272,7 +272,7 @@ static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
if (pd.flags & NUT_FLAG_KEY) pkt->flags |= PKT_FLAG_KEY;
pkt->pts = pd.pts;
pkt->stream_index = pd.stream;
- pkt->pos = url_ftell(&avf->pb);
+ pkt->pos = url_ftell(avf->pb);
ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 0daf8f19ee..b17e5fbc73 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -176,7 +176,7 @@ typedef struct MatroskaDemuxContext {
static int
ebml_read_element_level_up (MatroskaDemuxContext *matroska)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
offset_t pos = url_ftell(pb);
int num = 0;
@@ -208,7 +208,7 @@ ebml_read_num (MatroskaDemuxContext *matroska,
int max_size,
uint64_t *number)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
int len_mask = 0x80, read = 1, n = 1;
int64_t total = 0;
@@ -325,7 +325,7 @@ static int
ebml_read_seek (MatroskaDemuxContext *matroska,
offset_t offset)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
/* clear ID cache, if any */
matroska->peek_id = 0;
@@ -341,7 +341,7 @@ ebml_read_seek (MatroskaDemuxContext *matroska,
static int
ebml_read_skip (MatroskaDemuxContext *matroska)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
uint32_t id;
uint64_t length;
int res;
@@ -365,7 +365,7 @@ ebml_read_uint (MatroskaDemuxContext *matroska,
uint32_t *id,
uint64_t *num)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
int n = 0, size, res;
uint64_t rlength;
@@ -399,7 +399,7 @@ ebml_read_sint (MatroskaDemuxContext *matroska,
uint32_t *id,
int64_t *num)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
int size, n = 1, negative = 0, res;
uint64_t rlength;
@@ -438,7 +438,7 @@ ebml_read_float (MatroskaDemuxContext *matroska,
uint32_t *id,
double *num)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
int size, res;
uint64_t rlength;
@@ -472,7 +472,7 @@ ebml_read_ascii (MatroskaDemuxContext *matroska,
uint32_t *id,
char **str)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
int size, res;
uint64_t rlength;
@@ -534,7 +534,7 @@ static int
ebml_read_master (MatroskaDemuxContext *matroska,
uint32_t *id)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
uint64_t length;
MatroskaLevel *level;
int res;
@@ -569,7 +569,7 @@ ebml_read_binary (MatroskaDemuxContext *matroska,
uint8_t **binary,
int *size)
{
- ByteIOContext *pb = &matroska->ctx->pb;
+ ByteIOContext *pb = matroska->ctx->pb;
uint64_t rlength;
int res;
@@ -1748,7 +1748,7 @@ matroska_parse_seekhead (MatroskaDemuxContext *matroska)
/* remember the peeked ID and the current position */
peek_id_cache = matroska->peek_id;
- before_pos = url_ftell(&matroska->ctx->pb);
+ before_pos = url_ftell(matroska->ctx->pb);
/* seek */
if ((res = ebml_read_seek(matroska, seek_pos +
@@ -1788,14 +1788,14 @@ matroska_parse_seekhead (MatroskaDemuxContext *matroska)
switch (id) {
case MATROSKA_ID_CUES:
if (!(res = matroska_parse_index(matroska)) ||
- url_feof(&matroska->ctx->pb)) {
+ url_feof(matroska->ctx->pb)) {
matroska->index_parsed = 1;
res = 0;
}
break;
case MATROSKA_ID_TAGS:
if (!(res = matroska_parse_metadata(matroska)) ||
- url_feof(&matroska->ctx->pb)) {
+ url_feof(matroska->ctx->pb)) {
matroska->metadata_parsed = 1;
res = 0;
}
@@ -1931,7 +1931,7 @@ matroska_read_header (AVFormatContext *s,
* after the segment ID/length. */
if ((res = ebml_read_master(matroska, &id)) < 0)
return res;
- matroska->segment_start = url_ftell(&s->pb);
+ matroska->segment_start = url_ftell(s->pb);
matroska->time_scale = 1000000;
/* we've found our segment, start reading the different contents in here */
@@ -2485,7 +2485,7 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
* of the harder things, so this code is a bit complicated.
* See http://www.matroska.org/ for documentation. */
case MATROSKA_ID_BLOCK: {
- pos = url_ftell(&matroska->ctx->pb);
+ pos = url_ftell(matroska->ctx->pb);
res = ebml_read_binary(matroska, &id, &data, &size);
break;
}
@@ -2547,7 +2547,7 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska)
int size;
av_log(matroska->ctx, AV_LOG_DEBUG,
- "parsing cluster at %"PRId64"\n", url_ftell(&matroska->ctx->pb));
+ "parsing cluster at %"PRId64"\n", url_ftell(matroska->ctx->pb));
while (res == 0) {
if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
@@ -2576,7 +2576,7 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska)
break;
case MATROSKA_ID_SIMPLEBLOCK:
- pos = url_ftell(&matroska->ctx->pb);
+ pos = url_ftell(matroska->ctx->pb);
res = ebml_read_binary(matroska, &id, &data, &size);
if (res == 0)
res = matroska_parse_block(matroska, data, size, pos,
@@ -2668,7 +2668,7 @@ matroska_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp,
return 0;
/* do the seek */
- url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
+ url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
matroska->skip_to_stream = st;
matroska->num_packets = 0;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 6f45f446c0..667ea3f534 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -466,19 +466,21 @@ 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)
{
- ByteIOContext dyn_cp;
+ ByteIOContext *dyn_cp;
uint8_t *codecpriv;
- int ret = 0, codecpriv_size;
+ int ret, codecpriv_size;
- url_open_dyn_buf(&dyn_cp);
+ ret = url_open_dyn_buf(&dyn_cp);
+ if(ret < 0)
+ return ret;
if (native_id) {
if (codec->codec_id == CODEC_ID_VORBIS || codec->codec_id == CODEC_ID_THEORA)
- ret = put_xiph_codecpriv(s, &dyn_cp, codec);
+ ret = put_xiph_codecpriv(s, dyn_cp, codec);
else if (codec->codec_id == CODEC_ID_FLAC)
- ret = put_flac_codecpriv(s, &dyn_cp, codec);
+ ret = put_flac_codecpriv(s, dyn_cp, codec);
else if (codec->extradata_size)
- put_buffer(&dyn_cp, codec->extradata, codec->extradata_size);
+ put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
} else if (codec->codec_type == CODEC_TYPE_VIDEO) {
if (!codec->codec_tag)
codec->codec_tag = codec_get_tag(codec_bmp_tags, codec->codec_id);
@@ -487,7 +489,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
ret = -1;
}
- put_bmp_header(&dyn_cp, codec, codec_bmp_tags, 0);
+ put_bmp_header(dyn_cp, codec, codec_bmp_tags, 0);
} else if (codec->codec_type == CODEC_TYPE_AUDIO) {
if (!codec->codec_tag)
@@ -497,10 +499,10 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
ret = -1;
}
- put_wav_header(&dyn_cp, codec);
+ put_wav_header(dyn_cp, codec);
}
- codecpriv_size = url_close_dyn_buf(&dyn_cp, &codecpriv);
+ codecpriv_size = url_close_dyn_buf(dyn_cp, &codecpriv);
if (codecpriv_size)
put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv, codecpriv_size);
av_free(codecpriv);
@@ -510,7 +512,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodec
static int mkv_write_tracks(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
ebml_master tracks;
int i, j, ret;
@@ -613,7 +615,7 @@ static int mkv_write_tracks(AVFormatContext *s)
static int mkv_write_header(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
ebml_master ebml_header, segment_info;
int ret;
@@ -703,7 +705,7 @@ static int mkv_blockgroup_size(AVPacket *pkt)
static void mkv_write_block(AVFormatContext *s, unsigned int blockid, AVPacket *pkt, int flags)
{
MatroskaMuxContext *mkv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
"pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
@@ -719,7 +721,7 @@ static void mkv_write_block(AVFormatContext *s, unsigned int blockid, AVPacket *
static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
{
MatroskaMuxContext *mkv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
int keyframe = !!(pkt->flags & PKT_FLAG_KEY);
int ret;
@@ -761,7 +763,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
static int mkv_write_trailer(AVFormatContext *s)
{
MatroskaMuxContext *mkv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
offset_t currentpos, second_seekhead, cuespos;
int ret;
diff --git a/libavformat/mm.c b/libavformat/mm.c
index 7fb34f3e9b..4e6bac0271 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -72,7 +72,7 @@ static int mm_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
MmDemuxContext *mm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
unsigned int type, length;
@@ -127,7 +127,7 @@ static int mm_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
MmDemuxContext *mm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned char preamble[MM_PREAMBLE_SIZE];
unsigned char pal[MM_PALETTE_SIZE];
unsigned int type, length;
@@ -178,7 +178,7 @@ static int mm_read_packet(AVFormatContext *s,
return 0;
case MM_TYPE_AUDIO :
- if (av_get_packet(&s->pb, pkt, length)<0)
+ if (av_get_packet(s->pb, pkt, length)<0)
return AVERROR(ENOMEM);
pkt->size = length;
pkt->stream_index = 1;
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index be4c6e3cca..84c21a01d2 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -60,7 +60,7 @@ static void end_tag_be(ByteIOContext *pb, offset_t start)
static int mmf_write_header(AVFormatContext *s)
{
MMFContext *mmf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
offset_t pos;
int rate;
@@ -108,7 +108,7 @@ static int mmf_write_header(AVFormatContext *s)
static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
put_buffer(pb, pkt->data, pkt->size);
return 0;
}
@@ -127,12 +127,12 @@ static void put_varlength(ByteIOContext *pb, int val)
static int mmf_write_trailer(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
MMFContext *mmf = s->priv_data;
offset_t pos, size;
int gatetime;
- if (!url_is_streamed(&s->pb)) {
+ if (!url_is_streamed(s->pb)) {
/* Fill in length fields */
end_tag_be(pb, mmf->awapos);
end_tag_be(pb, mmf->atrpos);
@@ -183,7 +183,7 @@ static int mmf_read_header(AVFormatContext *s,
{
MMFContext *mmf = s->priv_data;
unsigned int tag;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
offset_t file_size, size;
int rate, params;
@@ -265,7 +265,7 @@ static int mmf_read_packet(AVFormatContext *s,
AVStream *st;
int ret, size;
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
st = s->streams[0];
@@ -280,7 +280,7 @@ static int mmf_read_packet(AVFormatContext *s,
return AVERROR(EIO);
pkt->stream_index = 0;
- ret = get_buffer(&s->pb, pkt->data, pkt->size);
+ ret = get_buffer(s->pb, pkt->data, pkt->size);
if (ret < 0)
av_free_packet(pkt);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0dbc66fd3d..ae3e5dc8bc 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1423,7 +1423,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
MOVContext *mov = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int i, err;
MOV_atom_t atom = { 0, 0, 0 };
@@ -1516,7 +1516,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
return -1;
/* must be done just before reading, to avoid infinite loop on sample */
sc->current_sample++;
- if (sample->pos >= url_fsize(&s->pb)) {
+ if (sample->pos >= url_fsize(s->pb)) {
av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", sc->ffindex, sample->pos);
return -1;
}
@@ -1526,8 +1526,8 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
dprintf(s, "dv audio pkt size %d\n", pkt->size);
} else {
#endif
- url_fseek(&s->pb, sample->pos, SEEK_SET);
- av_get_packet(&s->pb, pkt, sample->size);
+ url_fseek(s->pb, sample->pos, SEEK_SET);
+ av_get_packet(s->pb, pkt, sample->size);
#ifdef CONFIG_DV_DEMUXER
if (mov->dv_demux) {
void *pkt_destruct_func = pkt->destruct;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index c8d32f3c67..8dd00cdd09 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -442,24 +442,27 @@ static uint8_t *avc_find_startcode( uint8_t *p, uint8_t *end )
return end + 3;
}
-static void avc_parse_nal_units(uint8_t **buf, int *size)
+static int avc_parse_nal_units(uint8_t **buf, int *size)
{
- ByteIOContext pb;
+ ByteIOContext *pb;
uint8_t *p = *buf;
uint8_t *end = p + *size;
uint8_t *nal_start, *nal_end;
+ int ret = url_open_dyn_buf(&pb);
+ if(ret < 0)
+ return ret;
- url_open_dyn_buf(&pb);
nal_start = avc_find_startcode(p, end);
while (nal_start < end) {
while(!*(nal_start++));
nal_end = avc_find_startcode(nal_start, end);
- put_be32(&pb, nal_end - nal_start);
- put_buffer(&pb, nal_start, nal_end - nal_start);
+ put_be32(pb, nal_end - nal_start);
+ put_buffer(pb, nal_start, nal_end - nal_start);
nal_start = nal_end;
}
av_freep(buf);
- *size = url_close_dyn_buf(&pb, buf);
+ *size = url_close_dyn_buf(pb, buf);
+ return 0;
}
static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track)
@@ -1508,11 +1511,11 @@ static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s)
static int mov_write_header(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
MOVContext *mov = s->priv_data;
int i;
- if (url_is_streamed(&s->pb)) {
+ if (url_is_streamed(s->pb)) {
av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n");
return -1;
}
@@ -1579,13 +1582,13 @@ static int mov_write_header(AVFormatContext *s)
static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
{
MOVContext *mov = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
MOVTrack *trk = &mov->tracks[pkt->stream_index];
AVCodecContext *enc = trk->enc;
unsigned int samplesInChunk = 0;
int size= pkt->size;
- if (url_is_streamed(&s->pb)) return 0; /* Can't handle that */
+ if (url_is_streamed(s->pb)) return 0; /* Can't handle that */
if (!size) return 0; /* Discard 0 sized packets */
if (enc->codec_id == CODEC_ID_AMR_NB) {
@@ -1663,7 +1666,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
static int mov_write_trailer(AVFormatContext *s)
{
MOVContext *mov = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int res = 0;
int i;
diff --git a/libavformat/mp3.c b/libavformat/mp3.c
index 9619fb1029..4ad9b67d5b 100644
--- a/libavformat/mp3.c
+++ b/libavformat/mp3.c
@@ -190,20 +190,20 @@ static void id3v2_read_ttag(AVFormatContext *s, int taglen, char *dst, int dstle
taglen--; /* account for encoding type byte */
dstlen--; /* Leave space for zero terminator */
- switch(get_byte(&s->pb)) { /* encoding type */
+ switch(get_byte(s->pb)) { /* encoding type */
case 0: /* ISO-8859-1 (0 - 255 maps directly into unicode) */
q = dst;
while(taglen--) {
uint8_t tmp;
- PUT_UTF8(get_byte(&s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
+ PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
}
*q = '\0';
break;
case 3: /* UTF-8 */
len = FFMIN(taglen, dstlen);
- get_buffer(&s->pb, dst, len);
+ get_buffer(s->pb, dst, len);
dst[len] = 0;
break;
}
@@ -252,23 +252,23 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t fl
}
if(isv34 && flags & 0x40) /* Extended header present, just skip over it */
- url_fskip(&s->pb, id3v2_get_size(&s->pb, 4));
+ url_fskip(s->pb, id3v2_get_size(s->pb, 4));
while(len >= taghdrlen) {
if(isv34) {
- tag = get_be32(&s->pb);
- tlen = id3v2_get_size(&s->pb, 4);
- get_be16(&s->pb); /* flags */
+ tag = get_be32(s->pb);
+ tlen = id3v2_get_size(s->pb, 4);
+ get_be16(s->pb); /* flags */
} else {
- tag = get_be24(&s->pb);
- tlen = id3v2_get_size(&s->pb, 3);
+ tag = get_be24(s->pb);
+ tlen = id3v2_get_size(s->pb, 3);
}
len -= taghdrlen + tlen;
if(len < 0)
break;
- next = url_ftell(&s->pb) + tlen;
+ next = url_ftell(s->pb) + tlen;
switch(tag) {
case MKBETAG('T', 'I', 'T', '2'):
@@ -298,21 +298,21 @@ static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t fl
break;
case 0:
/* padding, skip to end */
- url_fskip(&s->pb, len);
+ url_fskip(s->pb, len);
len = 0;
continue;
}
/* Skip to end of tag */
- url_fseek(&s->pb, next, SEEK_SET);
+ url_fseek(s->pb, next, SEEK_SET);
}
if(version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
- url_fskip(&s->pb, 10);
+ url_fskip(s->pb, 10);
return;
error:
av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
- url_fskip(&s->pb, len);
+ url_fskip(s->pb, len);
}
static void id3v1_get_string(char *str, int str_size,
@@ -435,7 +435,7 @@ static void mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, offset_t base)
const offset_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
MPADecodeContext c;
- v = get_be32(&s->pb);
+ v = get_be32(s->pb);
if(ff_mpa_check_header(v) < 0)
return;
@@ -444,23 +444,23 @@ static void mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, offset_t base)
return;
/* Check for Xing / Info tag */
- url_fseek(&s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
- v = get_be32(&s->pb);
+ url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
+ v = get_be32(s->pb);
if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
- v = get_be32(&s->pb);
+ v = get_be32(s->pb);
if(v & 0x1)
- frames = get_be32(&s->pb);
+ frames = get_be32(s->pb);
}
/* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
- url_fseek(&s->pb, base + 4 + 32, SEEK_SET);
- v = get_be32(&s->pb);
+ url_fseek(s->pb, base + 4 + 32, SEEK_SET);
+ v = get_be32(s->pb);
if(v == MKBETAG('V', 'B', 'R', 'I')) {
/* Check tag version */
- if(get_be16(&s->pb) == 1) {
+ if(get_be16(s->pb) == 1) {
/* skip delay, quality and total bytes */
- url_fseek(&s->pb, 8, SEEK_CUR);
- frames = get_be32(&s->pb);
+ url_fseek(s->pb, 8, SEEK_CUR);
+ frames = get_be32(s->pb);
}
}
@@ -490,21 +490,21 @@ static int mp3_read_header(AVFormatContext *s,
st->start_time = 0;
/* try to get the TAG */
- if (!url_is_streamed(&s->pb)) {
+ if (!url_is_streamed(s->pb)) {
/* XXX: change that */
- filesize = url_fsize(&s->pb);
+ filesize = url_fsize(s->pb);
if (filesize > 128) {
- url_fseek(&s->pb, filesize - 128, SEEK_SET);
- ret = get_buffer(&s->pb, buf, ID3v1_TAG_SIZE);
+ url_fseek(s->pb, filesize - 128, SEEK_SET);
+ ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE);
if (ret == ID3v1_TAG_SIZE) {
id3v1_parse_tag(s, buf);
}
- url_fseek(&s->pb, 0, SEEK_SET);
+ url_fseek(s->pb, 0, SEEK_SET);
}
}
/* if ID3v2 header found, skip it */
- ret = get_buffer(&s->pb, buf, ID3v2_HEADER_SIZE);
+ ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
if (ret != ID3v2_HEADER_SIZE)
return -1;
if (id3v2_match(buf)) {
@@ -515,12 +515,12 @@ static int mp3_read_header(AVFormatContext *s,
(buf[9] & 0x7f);
id3v2_parse(s, len, buf[3], buf[5]);
} else {
- url_fseek(&s->pb, 0, SEEK_SET);
+ url_fseek(s->pb, 0, SEEK_SET);
}
- off = url_ftell(&s->pb);
+ off = url_ftell(s->pb);
mp3_parse_vbr_tags(s, st, off);
- url_fseek(&s->pb, off, SEEK_SET);
+ url_fseek(s->pb, off, SEEK_SET);
/* the parameters will be extracted from the compressed bitstream */
return 0;
@@ -535,7 +535,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
size= MP3_PACKET_SIZE;
- ret= av_get_packet(&s->pb, pkt, size);
+ ret= av_get_packet(s->pb, pkt, size);
pkt->stream_index = 0;
if (ret <= 0) {
@@ -557,20 +557,20 @@ static int mp3_read_close(AVFormatContext *s)
static void id3v2_put_size(AVFormatContext *s, int size)
{
- put_byte(&s->pb, size >> 21 & 0x7f);
- put_byte(&s->pb, size >> 14 & 0x7f);
- put_byte(&s->pb, size >> 7 & 0x7f);
- put_byte(&s->pb, size & 0x7f);
+ put_byte(s->pb, size >> 21 & 0x7f);
+ put_byte(s->pb, size >> 14 & 0x7f);
+ put_byte(s->pb, size >> 7 & 0x7f);
+ put_byte(s->pb, size & 0x7f);
}
static void id3v2_put_ttag(AVFormatContext *s, char *string, uint32_t tag)
{
int len = strlen(string);
- put_be32(&s->pb, tag);
+ put_be32(s->pb, tag);
id3v2_put_size(s, len + 1);
- put_be16(&s->pb, 0);
- put_byte(&s->pb, 3); /* UTF-8 */
- put_buffer(&s->pb, string, len);
+ put_be16(s->pb, 0);
+ put_byte(s->pb, 3); /* UTF-8 */
+ put_buffer(s->pb, string, len);
}
@@ -602,9 +602,9 @@ static int mp3_write_header(struct AVFormatContext *s)
if(totlen == 0)
return 0;
- put_be32(&s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */
- put_byte(&s->pb, 0);
- put_byte(&s->pb, 0); /* flags */
+ put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */
+ put_byte(s->pb, 0);
+ put_byte(s->pb, 0); /* flags */
id3v2_put_size(s, totlen);
@@ -622,8 +622,8 @@ static int mp3_write_header(struct AVFormatContext *s)
static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
- put_buffer(&s->pb, pkt->data, pkt->size);
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, pkt->data, pkt->size);
+ put_flush_packet(s->pb);
return 0;
}
@@ -634,8 +634,8 @@ static int mp3_write_trailer(struct AVFormatContext *s)
/* write the id3v1 tag */
if (s->title[0] != '\0') {
id3v1_create_tag(s, buf);
- put_buffer(&s->pb, buf, ID3v1_TAG_SIZE);
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
+ put_flush_packet(s->pb);
}
return 0;
}
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index ac6733788f..8e6c573dff 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -55,31 +55,31 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st;
int t;
- t = get_le24(&s->pb);
+ t = get_le24(s->pb);
if(t != MKTAG('M', 'P', '+', 0)){
if(t != MKTAG('I', 'D', '3', 0)){
av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
return -1;
}
/* skip ID3 tags and try again */
- url_fskip(&s->pb, 3);
- t = get_byte(&s->pb) << 21;
- t |= get_byte(&s->pb) << 14;
- t |= get_byte(&s->pb) << 7;
- t |= get_byte(&s->pb);
+ url_fskip(s->pb, 3);
+ t = get_byte(s->pb) << 21;
+ t |= get_byte(s->pb) << 14;
+ t |= get_byte(s->pb) << 7;
+ t |= get_byte(s->pb);
av_log(s, AV_LOG_DEBUG, "Skipping %d(%X) bytes of ID3 data\n", t, t);
- url_fskip(&s->pb, t);
- if(get_le24(&s->pb) != MKTAG('M', 'P', '+', 0)){
+ url_fskip(s->pb, t);
+ if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){
av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
return -1;
}
}
- c->ver = get_byte(&s->pb);
+ c->ver = get_byte(s->pb);
if(c->ver != 0x07 && c->ver != 0x17){
av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver);
return -1;
}
- c->fcount = get_le32(&s->pb);
+ c->fcount = get_le32(s->pb);
if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){
av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n");
return -1;
@@ -100,7 +100,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->extradata_size = 16;
st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
- get_buffer(&s->pb, st->codec->extradata, 16);
+ get_buffer(s->pb, st->codec->extradata, 16);
st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3];
av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
/* scan for seekpoints */
@@ -120,22 +120,22 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
return -1;
if(c->curframe != c->lastframe + 1){
- url_fseek(&s->pb, c->frames[c->curframe].pos, SEEK_SET);
+ url_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET);
c->curbits = c->frames[c->curframe].skip;
}
c->lastframe = c->curframe;
c->curframe++;
curbits = c->curbits;
- pos = url_ftell(&s->pb);
- tmp = get_le32(&s->pb);
+ pos = url_ftell(s->pb);
+ tmp = get_le32(s->pb);
if(curbits <= 12){
size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
}else{
- tmp = (tmp << 32) | get_le32(&s->pb);
+ tmp = (tmp << 32) | get_le32(s->pb);
size2 = (tmp >> (44 - curbits)) & 0xFFFFF;
}
curbits += 20;
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
size = ((size2 + curbits + 31) & ~31) >> 3;
if(cur == c->frames_noted){
@@ -155,9 +155,9 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = 0;
pkt->pts = cur;
- ret = get_buffer(&s->pb, pkt->data + 4, size);
+ ret = get_buffer(s->pb, pkt->data + 4, size);
if(c->curbits)
- url_fseek(&s->pb, -4, SEEK_CUR);
+ url_fseek(s->pb, -4, SEEK_CUR);
if(ret < size){
av_free_packet(pkt);
return AVERROR(EIO);
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index b6840b00d6..879c7d2367 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -90,15 +90,15 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
int i, t, seekd;
GetBitContext gb;
- url_fseek(&s->pb, off, SEEK_SET);
- mpc8_get_chunk_header(&s->pb, &tag, &size);
+ url_fseek(s->pb, off, SEEK_SET);
+ mpc8_get_chunk_header(s->pb, &tag, &size);
if(tag != TAG_SEEKTABLE){
av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
return;
}
if(!(buf = av_malloc(size)))
return;
- get_buffer(&s->pb, buf, size);
+ get_buffer(s->pb, buf, size);
init_get_bits(&gb, buf, size * 8);
size = gb_get_v(&gb);
if(size > UINT_MAX/4 || size > c->samples/1152){
@@ -126,7 +126,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)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int64_t pos, off;
switch(tag){
@@ -144,7 +144,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in
static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
MPCContext *c = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
int tag = 0;
int64_t size, pos;
@@ -202,11 +202,11 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
int tag;
int64_t pos, size;
- while(!url_feof(&s->pb)){
- pos = url_ftell(&s->pb);
- mpc8_get_chunk_header(&s->pb, &tag, &size);
+ while(!url_feof(s->pb)){
+ pos = url_ftell(s->pb);
+ mpc8_get_chunk_header(s->pb, &tag, &size);
if(tag == TAG_AUDIOPACKET){
- if(av_get_packet(&s->pb, pkt, size) < 0)
+ if(av_get_packet(s->pb, pkt, size) < 0)
return AVERROR(ENOMEM);
pkt->stream_index = 0;
pkt->pts = c->frame;
@@ -226,7 +226,7 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
int index = av_index_search_timestamp(st, timestamp, flags);
if(index < 0) return -1;
- url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
+ url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
c->frame = st->index_entries[index].timestamp;
return 0;
}
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 4bfd80369e..5c55c485bb 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -122,7 +122,7 @@ static int mpegps_read_header(AVFormatContext *s,
m->sofdec = -1;
do {
- v = get_byte(&s->pb);
+ v = get_byte(s->pb);
m->header_state = m->header_state << 8 | v;
m->sofdec++;
} while (v == sofdec[i] && i++ < 6);
@@ -253,17 +253,17 @@ static int mpegps_read_pes_header(AVFormatContext *s,
int len, size, startcode, c, flags, header_len;
int pes_ext, ext2_len, id_ext, skip;
int64_t pts, dts;
- int64_t last_sync= url_ftell(&s->pb);
+ int64_t last_sync= url_ftell(s->pb);
error_redo:
- url_fseek(&s->pb, last_sync, SEEK_SET);
+ url_fseek(s->pb, last_sync, SEEK_SET);
redo:
/* next start code (should be immediately after) */
m->header_state = 0xff;
size = MAX_SYNC_SIZE;
- startcode = find_next_start_code(&s->pb, &size, &m->header_state);
- last_sync = url_ftell(&s->pb);
- //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(&s->pb));
+ startcode = find_next_start_code(s->pb, &size, &m->header_state);
+ last_sync = url_ftell(s->pb);
+ //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
if (startcode < 0)
return AVERROR(EIO);
if (startcode == PACK_START_CODE)
@@ -271,16 +271,16 @@ static int mpegps_read_pes_header(AVFormatContext *s,
if (startcode == SYSTEM_HEADER_START_CODE)
goto redo;
if (startcode == PADDING_STREAM) {
- url_fskip(&s->pb, get_be16(&s->pb));
+ url_fskip(s->pb, get_be16(s->pb));
goto redo;
}
if (startcode == PRIVATE_STREAM_2) {
- len = get_be16(&s->pb);
+ len = get_be16(s->pb);
if (!m->sofdec) {
while (len-- >= 6) {
- if (get_byte(&s->pb) == 'S') {
+ if (get_byte(s->pb) == 'S') {
uint8_t buf[5];
- get_buffer(&s->pb, buf, sizeof(buf));
+ get_buffer(s->pb, buf, sizeof(buf));
m->sofdec = !memcmp(buf, "ofdec", 5);
len -= sizeof(buf);
break;
@@ -288,11 +288,11 @@ static int mpegps_read_pes_header(AVFormatContext *s,
}
m->sofdec -= !m->sofdec;
}
- url_fskip(&s->pb, len);
+ url_fskip(s->pb, len);
goto redo;
}
if (startcode == PROGRAM_STREAM_MAP) {
- mpegps_psm_parse(m, &s->pb);
+ mpegps_psm_parse(m, s->pb);
goto redo;
}
@@ -302,16 +302,16 @@ static int mpegps_read_pes_header(AVFormatContext *s,
(startcode == 0x1bd) || (startcode == 0x1fd)))
goto redo;
if (ppos) {
- *ppos = url_ftell(&s->pb) - 4;
+ *ppos = url_ftell(s->pb) - 4;
}
- len = get_be16(&s->pb);
+ len = get_be16(s->pb);
pts =
dts = AV_NOPTS_VALUE;
/* stuffing */
for(;;) {
if (len < 1)
goto error_redo;
- c = get_byte(&s->pb);
+ c = get_byte(s->pb);
len--;
/* XXX: for mpeg1, should test only bit 7 */
if (c != 0xff)
@@ -319,15 +319,15 @@ static int mpegps_read_pes_header(AVFormatContext *s,
}
if ((c & 0xc0) == 0x40) {
/* buffer scale & size */
- get_byte(&s->pb);
- c = get_byte(&s->pb);
+ get_byte(s->pb);
+ c = get_byte(s->pb);
len -= 2;
}
if ((c & 0xe0) == 0x20) {
- dts = pts = get_pts(&s->pb, c);
+ dts = pts = get_pts(s->pb, c);
len -= 4;
if (c & 0x10){
- dts = get_pts(&s->pb, -1);
+ dts = get_pts(s->pb, -1);
len -= 5;
}
} else if ((c & 0xc0) == 0x80) {
@@ -338,22 +338,22 @@ static int mpegps_read_pes_header(AVFormatContext *s,
goto redo;
}
#endif
- flags = get_byte(&s->pb);
- header_len = get_byte(&s->pb);
+ flags = get_byte(s->pb);
+ header_len = get_byte(s->pb);
len -= 2;
if (header_len > len)
goto error_redo;
len -= header_len;
if (flags & 0x80) {
- dts = pts = get_pts(&s->pb, -1);
+ dts = pts = get_pts(s->pb, -1);
header_len -= 5;
if (flags & 0x40) {
- dts = get_pts(&s->pb, -1);
+ dts = get_pts(s->pb, -1);
header_len -= 5;
}
}
if (flags & 0x01) { /* PES extension */
- pes_ext = get_byte(&s->pb);
+ pes_ext = get_byte(s->pb);
header_len--;
if (pes_ext & 0x40) { /* pack header - should be zero in PS */
goto error_redo;
@@ -361,14 +361,14 @@ static int mpegps_read_pes_header(AVFormatContext *s,
/* Skip PES private data, program packet sequence counter and P-STD buffer */
skip = (pes_ext >> 4) & 0xb;
skip += skip & 0x9;
- url_fskip(&s->pb, skip);
+ url_fskip(s->pb, skip);
header_len -= skip;
if (pes_ext & 0x01) { /* PES extension 2 */
- ext2_len = get_byte(&s->pb);
+ ext2_len = get_byte(s->pb);
header_len--;
if ((ext2_len & 0x7f) > 0) {
- id_ext = get_byte(&s->pb);
+ id_ext = get_byte(s->pb);
if ((id_ext & 0x80) == 0)
startcode = ((startcode & 0xff) << 8) | id_ext;
header_len--;
@@ -377,23 +377,23 @@ static int mpegps_read_pes_header(AVFormatContext *s,
}
if(header_len < 0)
goto error_redo;
- url_fskip(&s->pb, header_len);
+ url_fskip(s->pb, header_len);
}
else if( c!= 0xf )
goto redo;
if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) {
- startcode = get_byte(&s->pb);
+ startcode = get_byte(s->pb);
len--;
if (startcode >= 0x80 && startcode <= 0xcf) {
/* audio: skip header */
- get_byte(&s->pb);
- get_byte(&s->pb);
- get_byte(&s->pb);
+ get_byte(s->pb);
+ get_byte(s->pb);
+ get_byte(s->pb);
len -= 3;
if (startcode >= 0xb0 && startcode <= 0xbf) {
/* MLP/TrueHD audio has a 4-byte header */
- get_byte(&s->pb);
+ get_byte(s->pb);
len--;
}
}
@@ -465,8 +465,8 @@ static int mpegps_read_packet(AVFormatContext *s,
} else if (startcode >= 0x1e0 && startcode <= 0x1ef) {
static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
unsigned char buf[8];
- get_buffer(&s->pb, buf, 8);
- url_fseek(&s->pb, -8, SEEK_CUR);
+ get_buffer(s->pb, buf, 8);
+ url_fseek(s->pb, -8, SEEK_CUR);
if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
codec_id = CODEC_ID_CAVS;
else
@@ -502,7 +502,7 @@ static int mpegps_read_packet(AVFormatContext *s,
} else {
skip:
/* skip packet */
- url_fskip(&s->pb, len);
+ url_fskip(s->pb, len);
goto redo;
}
/* no stream found: add a new stream */
@@ -523,9 +523,9 @@ static int mpegps_read_packet(AVFormatContext *s,
audio data */
if (len <= 3)
goto skip;
- get_byte(&s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
- b1 = get_byte(&s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
- get_byte(&s->pb); /* dynamic range control (0x80 = off) */
+ get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
+ b1 = get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
+ get_byte(s->pb); /* dynamic range control (0x80 = off) */
len -= 3;
freq = (b1 >> 4) & 3;
st->codec->sample_rate = lpcm_freq_tab[freq];
@@ -533,7 +533,7 @@ static int mpegps_read_packet(AVFormatContext *s,
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * 2;
}
av_new_packet(pkt, len);
- get_buffer(&s->pb, pkt->data, pkt->size);
+ get_buffer(s->pb, pkt->data, pkt->size);
pkt->pts = pts;
pkt->dts = dts;
pkt->stream_index = st->index;
@@ -560,7 +560,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
#ifdef DEBUG_SEEK
printf("read_dts: pos=0x%"PRIx64" next=%d -> ", pos, find_next);
#endif
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
for(;;) {
len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts);
if (len < 0) {
@@ -573,7 +573,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
dts != AV_NOPTS_VALUE) {
break;
}
- url_fskip(&s->pb, len);
+ url_fskip(s->pb, len);
}
#ifdef DEBUG_SEEK
printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0);
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 36b4cf1676..ca9d481978 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -690,19 +690,19 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
size = put_system_header(ctx, buf_ptr, 0);
buf_ptr += size;
size = buf_ptr - buffer;
- put_buffer(&ctx->pb, buffer, size);
+ put_buffer(ctx->pb, buffer, size);
- put_be32(&ctx->pb, PRIVATE_STREAM_2);
- put_be16(&ctx->pb, 0x03d4); // length
- put_byte(&ctx->pb, 0x00); // substream ID, 00=PCI
+ put_be32(ctx->pb, PRIVATE_STREAM_2);
+ put_be16(ctx->pb, 0x03d4); // length
+ put_byte(ctx->pb, 0x00); // substream ID, 00=PCI
for (i = 0; i < 979; i++)
- put_byte(&ctx->pb, 0x00);
+ put_byte(ctx->pb, 0x00);
- put_be32(&ctx->pb, PRIVATE_STREAM_2);
- put_be16(&ctx->pb, 0x03fa); // length
- put_byte(&ctx->pb, 0x01); // substream ID, 01=DSI
+ put_be32(ctx->pb, PRIVATE_STREAM_2);
+ put_be16(ctx->pb, 0x03fa); // length
+ put_byte(ctx->pb, 0x01); // substream ID, 01=DSI
for (i = 0; i < 1017; i++)
- put_byte(&ctx->pb, 0x00);
+ put_byte(ctx->pb, 0x00);
memset(buffer, 0, 128);
buf_ptr = buffer;
@@ -725,7 +725,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
}
}
size = buf_ptr - buffer;
- put_buffer(&ctx->pb, buffer, size);
+ put_buffer(ctx->pb, buffer, size);
packet_size = s->packet_size - size;
@@ -830,16 +830,16 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
nb_frames= get_nb_frames(ctx, stream, payload_size - stuffing_size);
- put_be32(&ctx->pb, startcode);
+ put_be32(ctx->pb, startcode);
- put_be16(&ctx->pb, packet_size);
+ put_be16(ctx->pb, packet_size);
if (!s->is_mpeg2)
for(i=0;i<stuffing_size;i++)
- put_byte(&ctx->pb, 0xff);
+ put_byte(ctx->pb, 0xff);
if (s->is_mpeg2) {
- put_byte(&ctx->pb, 0x80); /* mpeg2 id */
+ put_byte(ctx->pb, 0x80); /* mpeg2 id */
pes_flags=0;
@@ -856,64 +856,64 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
if (stream->packet_number == 0)
pes_flags |= 0x01;
- put_byte(&ctx->pb, pes_flags); /* flags */
- put_byte(&ctx->pb, header_len - 3 + stuffing_size);
+ put_byte(ctx->pb, pes_flags); /* flags */
+ put_byte(ctx->pb, header_len - 3 + stuffing_size);
if (pes_flags & 0x80) /*write pts*/
- put_timestamp(&ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
+ put_timestamp(ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
if (pes_flags & 0x40) /*write dts*/
- put_timestamp(&ctx->pb, 0x01, dts);
+ put_timestamp(ctx->pb, 0x01, dts);
if (pes_flags & 0x01) { /*write pes extension*/
- put_byte(&ctx->pb, 0x10); /* flags */
+ put_byte(ctx->pb, 0x10); /* flags */
/* P-STD buffer info */
if (id == AUDIO_ID)
- put_be16(&ctx->pb, 0x4000 | stream->max_buffer_size/128);
+ put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/128);
else
- put_be16(&ctx->pb, 0x6000 | stream->max_buffer_size/1024);
+ put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024);
}
} else {
if (pts != AV_NOPTS_VALUE) {
if (dts != pts) {
- put_timestamp(&ctx->pb, 0x03, pts);
- put_timestamp(&ctx->pb, 0x01, dts);
+ put_timestamp(ctx->pb, 0x03, pts);
+ put_timestamp(ctx->pb, 0x01, dts);
} else {
- put_timestamp(&ctx->pb, 0x02, pts);
+ put_timestamp(ctx->pb, 0x02, pts);
}
} else {
- put_byte(&ctx->pb, 0x0f);
+ put_byte(ctx->pb, 0x0f);
}
}
if (s->is_mpeg2) {
/* special stuffing byte that is always written
to prevent accidental generation of start codes. */
- put_byte(&ctx->pb, 0xff);
+ put_byte(ctx->pb, 0xff);
for(i=0;i<stuffing_size;i++)
- put_byte(&ctx->pb, 0xff);
+ put_byte(ctx->pb, 0xff);
}
if (startcode == PRIVATE_STREAM_1) {
- put_byte(&ctx->pb, id);
+ put_byte(ctx->pb, id);
if (id >= 0xa0) {
/* LPCM (XXX: check nb_frames) */
- put_byte(&ctx->pb, 7);
- put_be16(&ctx->pb, 4); /* skip 3 header bytes */
- put_byte(&ctx->pb, stream->lpcm_header[0]);
- put_byte(&ctx->pb, stream->lpcm_header[1]);
- put_byte(&ctx->pb, stream->lpcm_header[2]);
+ put_byte(ctx->pb, 7);
+ put_be16(ctx->pb, 4); /* skip 3 header bytes */
+ put_byte(ctx->pb, stream->lpcm_header[0]);
+ put_byte(ctx->pb, stream->lpcm_header[1]);
+ put_byte(ctx->pb, stream->lpcm_header[2]);
} else if (id >= 0x40) {
/* AC3 */
- put_byte(&ctx->pb, nb_frames);
- put_be16(&ctx->pb, trailer_size+1);
+ put_byte(ctx->pb, nb_frames);
+ put_be16(ctx->pb, trailer_size+1);
}
}
/* output data */
- if(av_fifo_generic_read(&stream->fifo, payload_size - stuffing_size, &put_buffer, &ctx->pb) < 0)
+ if(av_fifo_generic_read(&stream->fifo, payload_size - stuffing_size, &put_buffer, ctx->pb) < 0)
return -1;
stream->bytes_to_iframe -= payload_size - stuffing_size;
}else{
@@ -922,12 +922,12 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
}
if (pad_packet_bytes > 0)
- put_padding_packet(ctx,&ctx->pb, pad_packet_bytes);
+ put_padding_packet(ctx,ctx->pb, pad_packet_bytes);
for(i=0;i<zero_trail_bytes;i++)
- put_byte(&ctx->pb, 0x00);
+ put_byte(ctx->pb, 0x00);
- put_flush_packet(&ctx->pb);
+ put_flush_packet(ctx->pb);
s->packet_number++;
@@ -952,11 +952,11 @@ static void put_vcd_padding_sector(AVFormatContext *ctx)
int i;
for(i=0;i<s->packet_size;i++)
- put_byte(&ctx->pb, 0);
+ put_byte(ctx->pb, 0);
s->vcd_padding_bytes_written += s->packet_size;
- put_flush_packet(&ctx->pb);
+ put_flush_packet(ctx->pb);
/* increasing the packet number is correct. The SCR of the following packs
is calculated from the packet_number and it has to include the padding
@@ -1206,8 +1206,8 @@ static int mpeg_mux_end(AVFormatContext *ctx)
/* End header according to MPEG1 systems standard. We do not write
it as it is usually not needed by decoders and because it
complicates MPEG stream concatenation. */
- //put_be32(&ctx->pb, ISO_11172_END_CODE);
- //put_flush_packet(&ctx->pb);
+ //put_be32(ctx->pb, ISO_11172_END_CODE);
+ //put_flush_packet(ctx->pb);
for(i=0;i<ctx->nb_streams;i++) {
stream = ctx->streams[i]->priv_data;
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 9c60081301..b89bb4421f 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1098,7 +1098,7 @@ static int read_packet(ByteIOContext *pb, uint8_t *buf, int raw_packet_size)
static int handle_packets(MpegTSContext *ts, int nb_packets)
{
AVFormatContext *s = ts->stream;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint8_t packet[TS_PACKET_SIZE];
int packet_num, ret;
@@ -1180,7 +1180,7 @@ static int mpegts_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
MpegTSContext *ts = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint8_t buf[1024];
int len;
int64_t pos;
@@ -1243,7 +1243,7 @@ static int mpegts_read_header(AVFormatContext *s,
nb_pcrs = 0;
nb_packets = 0;
for(;;) {
- ret = read_packet(&s->pb, packet, ts->raw_packet_size);
+ ret = read_packet(s->pb, packet, ts->raw_packet_size);
if (ret < 0)
return -1;
pid = AV_RB16(packet + 1) & 0x1fff;
@@ -1291,8 +1291,8 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
return AVERROR(ENOMEM);
- pkt->pos= url_ftell(&s->pb);
- ret = read_packet(&s->pb, pkt->data, ts->raw_packet_size);
+ pkt->pos= url_ftell(s->pb);
+ ret = read_packet(s->pb, pkt->data, ts->raw_packet_size);
if (ret < 0) {
av_free_packet(pkt);
return ret;
@@ -1301,10 +1301,10 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
/* compute exact PCR for each packet */
if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
/* we read the next PCR (XXX: optimize it by using a bigger buffer */
- pos = url_ftell(&s->pb);
+ pos = url_ftell(s->pb);
for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
- url_fseek(&s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
- get_buffer(&s->pb, pcr_buf, 12);
+ url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
+ get_buffer(s->pb, pcr_buf, 12);
if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) {
/* XXX: not precise enough */
ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) /
@@ -1312,7 +1312,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
break;
}
}
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
/* no next PCR found: we use previous increment */
ts->cur_pcr = pcr_h * 300 + pcr_l;
}
@@ -1354,8 +1354,8 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
pos = ((*ppos + ts->raw_packet_size - 1) / ts->raw_packet_size) * ts->raw_packet_size;
if (find_next) {
for(;;) {
- url_fseek(&s->pb, pos, SEEK_SET);
- if (get_buffer(&s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+ url_fseek(s->pb, pos, SEEK_SET);
+ if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
return AV_NOPTS_VALUE;
if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
parse_pcr(&timestamp, &pcr_l, buf) == 0) {
@@ -1368,8 +1368,8 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
pos -= ts->raw_packet_size;
if (pos < 0)
return AV_NOPTS_VALUE;
- url_fseek(&s->pb, pos, SEEK_SET);
- if (get_buffer(&s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+ url_fseek(s->pb, pos, SEEK_SET);
+ if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
return AV_NOPTS_VALUE;
if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
parse_pcr(&timestamp, &pcr_l, buf) == 0) {
@@ -1390,17 +1390,17 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0)
return -1;
- pos= url_ftell(&s->pb);
+ pos= url_ftell(s->pb);
for(;;) {
- url_fseek(&s->pb, pos, SEEK_SET);
- if (get_buffer(&s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+ url_fseek(s->pb, pos, SEEK_SET);
+ if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
return -1;
// pid = AV_RB16(buf + 1) & 0x1fff;
if(buf[1] & 0x40) break;
pos += ts->raw_packet_size;
}
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
return 0;
}
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index c521b68b87..b5a63e87ed 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -353,7 +353,7 @@ static MpegTSService *mpegts_add_service(MpegTSWrite *ts,
static void section_write_packet(MpegTSSection *s, const uint8_t *packet)
{
AVFormatContext *ctx = s->opaque;
- put_buffer(&ctx->pb, packet, TS_PACKET_SIZE);
+ put_buffer(ctx->pb, packet, TS_PACKET_SIZE);
}
static int mpegts_write_header(AVFormatContext *s)
@@ -431,7 +431,7 @@ static int mpegts_write_header(AVFormatContext *s)
for(i = 0; i < ts->nb_services; i++) {
mpegts_write_pmt(s, ts->services[i]);
}
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
return 0;
@@ -608,9 +608,9 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
memcpy(buf + TS_PACKET_SIZE - len, payload, len);
payload += len;
payload_size -= len;
- put_buffer(&s->pb, buf, TS_PACKET_SIZE);
+ put_buffer(s->pb, buf, TS_PACKET_SIZE);
}
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
}
static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
@@ -668,7 +668,7 @@ static int mpegts_write_end(AVFormatContext *s)
ts_st->payload_pts, ts_st->payload_dts);
}
}
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
for(i = 0; i < ts->nb_services; i++) {
service = ts->services[i];
diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c
index 937917313b..2e745721bf 100644
--- a/libavformat/mpjpeg.c
+++ b/libavformat/mpjpeg.c
@@ -29,8 +29,8 @@ static int mpjpeg_write_header(AVFormatContext *s)
uint8_t buf1[256];
snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG);
- put_buffer(&s->pb, buf1, strlen(buf1));
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, buf1, strlen(buf1));
+ put_flush_packet(s->pb);
return 0;
}
@@ -39,12 +39,12 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
uint8_t buf1[256];
snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n");
- put_buffer(&s->pb, buf1, strlen(buf1));
- put_buffer(&s->pb, pkt->data, pkt->size);
+ put_buffer(s->pb, buf1, strlen(buf1));
+ put_buffer(s->pb, pkt->data, pkt->size);
snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG);
- put_buffer(&s->pb, buf1, strlen(buf1));
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, buf1, strlen(buf1));
+ put_flush_packet(s->pb);
return 0;
}
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index ce70db0db3..32057e6236 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -65,7 +65,7 @@ static int mtv_probe(AVProbeData *p)
static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
MTVDemuxContext *mtv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
@@ -131,7 +131,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
{
MTVDemuxContext *mtv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ret;
#ifndef WORDS_BIGENDIAN
int i;
diff --git a/libavformat/mxf.c b/libavformat/mxf.c
index cb227ac244..d334c800d4 100644
--- a/libavformat/mxf.c
+++ b/libavformat/mxf.c
@@ -269,7 +269,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};
MXFContext *mxf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
offset_t end = url_ftell(pb) + klv->length;
uint64_t size;
uint64_t orig_size;
@@ -326,8 +326,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
{
KLVPacket klv;
- while (!url_feof(&s->pb)) {
- if (klv_read_packet(&klv, &s->pb) < 0)
+ while (!url_feof(s->pb)) {
+ if (klv_read_packet(&klv, s->pb) < 0)
return -1;
#ifdef DEBUG
PRINT_KEY(s, "read packet", klv.key);
@@ -344,22 +344,22 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
int index = mxf_get_stream_index(s, &klv);
if (index < 0) {
av_log(s, AV_LOG_ERROR, "error getting stream index\n");
- url_fskip(&s->pb, klv.length);
+ url_fskip(s->pb, klv.length);
return -1;
}
/* check for 8 channels AES3 element */
if (klv.key[12] == 0x06 && klv.key[13] == 0x01 && klv.key[14] == 0x10) {
- if (mxf_get_d10_aes3_packet(&s->pb, s->streams[index], pkt, klv.length) < 0) {
+ if (mxf_get_d10_aes3_packet(s->pb, s->streams[index], pkt, klv.length) < 0) {
av_log(s, AV_LOG_ERROR, "error reading D-10 aes3 frame\n");
return -1;
}
} else
- av_get_packet(&s->pb, pkt, klv.length);
+ av_get_packet(s->pb, pkt, klv.length);
pkt->stream_index = index;
pkt->pos = klv.offset;
return 0;
} else
- url_fskip(&s->pb, klv.length);
+ url_fskip(s->pb, klv.length);
}
return AVERROR(EIO);
}
@@ -897,7 +897,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, int (*read_child)(), int ctx_size, enum MXFMetadataSetType type)
{
- ByteIOContext *pb = &mxf->fc->pb;
+ ByteIOContext *pb = mxf->fc->pb;
MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf;
uint64_t klv_end= url_ftell(pb) + klv->length;
@@ -926,16 +926,16 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
MXFContext *mxf = s->priv_data;
KLVPacket klv;
- if (!mxf_read_sync(&s->pb, mxf_header_partition_pack_key, 14)) {
+ if (!mxf_read_sync(s->pb, mxf_header_partition_pack_key, 14)) {
av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n");
return -1;
}
- url_fseek(&s->pb, -14, SEEK_CUR);
+ url_fseek(s->pb, -14, SEEK_CUR);
mxf->fc = s;
- while (!url_feof(&s->pb)) {
+ while (!url_feof(s->pb)) {
const MXFMetadataReadTableEntry *metadata;
- if (klv_read_packet(&klv, &s->pb) < 0)
+ if (klv_read_packet(&klv, s->pb) < 0)
return -1;
#ifdef DEBUG
PRINT_KEY(s, "read header", klv.key);
@@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) ||
IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
/* FIXME avoid seek */
- url_fseek(&s->pb, klv.offset, SEEK_SET);
+ url_fseek(s->pb, klv.offset, SEEK_SET);
break;
}
@@ -957,7 +957,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
if (!metadata->read)
- url_fskip(&s->pb, klv.length);
+ url_fskip(s->pb, klv.length);
}
return mxf_parse_structural_metadata(mxf);
}
@@ -1018,7 +1018,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
if (sample_time < 0)
sample_time = 0;
seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
- url_fseek(&s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
+ url_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
av_update_cur_dts(s, st, sample_time);
return 0;
}
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 30b3f5fa42..a115fe5710 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -228,7 +228,7 @@ static void print_tag(const char *str, unsigned int tag, int size)
static int nsv_resync(AVFormatContext *s)
{
NSVContext *nsv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint32_t v = 0;
int i;
@@ -275,7 +275,7 @@ static int nsv_resync(AVFormatContext *s)
static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
{
NSVContext *nsv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int file_size, size;
int64_t duration;
int strings_size;
@@ -394,7 +394,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
{
NSVContext *nsv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint32_t vtag, atag;
uint16_t vwidth, vheight;
AVRational framerate;
@@ -533,7 +533,7 @@ static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int nsv_read_chunk(AVFormatContext *s, int fill_header)
{
NSVContext *nsv = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st[2] = {NULL, NULL};
NSVStream *nst;
AVPacket *pkt;
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 233d867a7b..c4cdb14dd3 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -181,7 +181,7 @@ static int skip_reserved(ByteIOContext *bc, int64_t pos){
static int decode_main_header(NUTContext *nut){
AVFormatContext *s= nut->avf;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
uint64_t tmp, end;
unsigned int stream_count;
int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res;
@@ -268,7 +268,7 @@ static int decode_main_header(NUTContext *nut){
static int decode_stream_header(NUTContext *nut){
AVFormatContext *s= nut->avf;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
StreamContext *stc;
int class, stream_id;
uint64_t tmp, end;
@@ -354,7 +354,7 @@ static int decode_stream_header(NUTContext *nut){
static int decode_info_header(NUTContext *nut){
AVFormatContext *s= nut->avf;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
uint64_t tmp;
unsigned int stream_id_plus1, chapter_start, chapter_len, count;
int chapter_id, i;
@@ -412,7 +412,7 @@ static int decode_info_header(NUTContext *nut){
static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
AVFormatContext *s= nut->avf;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
int64_t end, tmp;
nut->last_syncpoint_pos= url_ftell(bc)-8;
@@ -440,7 +440,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
static int find_and_decode_index(NUTContext *nut){
AVFormatContext *s= nut->avf;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
uint64_t tmp, end;
int i, j, syncpoint_count;
int64_t filesize= url_fsize(bc);
@@ -531,7 +531,7 @@ static int find_and_decode_index(NUTContext *nut){
static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
NUTContext *nut = s->priv_data;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
int64_t pos;
int inited_stream_count;
@@ -592,7 +592,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, int frame_code){
AVFormatContext *s= nut->avf;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
StreamContext *stc;
int size, flags, size_mul, pts_delta, i, reserved_count;
uint64_t tmp;
@@ -648,7 +648,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, in
static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
AVFormatContext *s= nut->avf;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
int size, stream_id, discard;
int64_t pts, last_IP_pts;
StreamContext *stc;
@@ -684,7 +684,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
{
NUTContext *nut = s->priv_data;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
int i, frame_code=0, ret, skip;
int64_t ts, back_ptr;
@@ -740,7 +740,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){
NUTContext *nut = s->priv_data;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
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);
@@ -803,8 +803,8 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag
pos2= sp->back_ptr - 15;
}
av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2);
- pos= find_startcode(&s->pb, SYNCPOINT_STARTCODE, pos2);
- url_fseek(&s->pb, pos, SEEK_SET);
+ pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2);
+ url_fseek(s->pb, pos, SEEK_SET);
av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos);
if(pos2 > pos || pos2 + 15 < pos){
av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index f0ae12a2f8..a6be630767 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -324,19 +324,20 @@ static int add_info(ByteIOContext *bc, char *type, char *value){
return 1;
}
-static void write_globalinfo(NUTContext *nut, ByteIOContext *bc){
+static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){
AVFormatContext *s= nut->avf;
- ByteIOContext dyn_bc;
+ ByteIOContext *dyn_bc;
uint8_t *dyn_buf=NULL;
int count=0, dyn_size;
+ int ret = url_open_dyn_buf(&dyn_bc);
+ if(ret < 0)
+ return ret;
- url_open_dyn_buf(&dyn_bc);
-
- if(s->title [0]) count+= add_info(&dyn_bc, "Title" , s->title);
- if(s->author [0]) count+= add_info(&dyn_bc, "Author" , s->author);
- if(s->copyright[0]) count+= add_info(&dyn_bc, "Copyright", s->copyright);
+ if(s->title [0]) count+= add_info(dyn_bc, "Title" , s->title);
+ if(s->author [0]) count+= add_info(dyn_bc, "Author" , s->author);
+ if(s->copyright[0]) count+= add_info(dyn_bc, "Copyright", s->copyright);
if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
- count+= add_info(&dyn_bc, "Encoder" , LIBAVFORMAT_IDENT);
+ count+= add_info(dyn_bc, "Encoder" , LIBAVFORMAT_IDENT);
put_v(bc, 0); //stream_if_plus1
put_v(bc, 0); //chapter_id
@@ -345,38 +346,46 @@ static void write_globalinfo(NUTContext *nut, ByteIOContext *bc){
put_v(bc, count);
- dyn_size= url_close_dyn_buf(&dyn_bc, &dyn_buf);
+ dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
put_buffer(bc, dyn_buf, dyn_size);
av_free(dyn_buf);
+ return 0;
}
-static void write_headers(NUTContext *nut, ByteIOContext *bc){
- ByteIOContext dyn_bc;
- int i;
+static int write_headers(NUTContext *nut, ByteIOContext *bc){
+ ByteIOContext *dyn_bc;
+ int i, ret;
- url_open_dyn_buf(&dyn_bc);
- write_mainheader(nut, &dyn_bc);
- put_packet(nut, bc, &dyn_bc, 1, MAIN_STARTCODE);
+ ret = url_open_dyn_buf(&dyn_bc);
+ if(ret < 0)
+ return ret;
+ write_mainheader(nut, dyn_bc);
+ put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE);
for (i=0; i < nut->avf->nb_streams; i++){
AVCodecContext *codec = nut->avf->streams[i]->codec;
- url_open_dyn_buf(&dyn_bc);
- write_streamheader(nut, &dyn_bc, codec, i);
- put_packet(nut, bc, &dyn_bc, 1, STREAM_STARTCODE);
+ ret = url_open_dyn_buf(&dyn_bc);
+ if(ret < 0)
+ return ret;
+ write_streamheader(nut, dyn_bc, codec, i);
+ put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE);
}
- url_open_dyn_buf(&dyn_bc);
- write_globalinfo(nut, &dyn_bc);
- put_packet(nut, bc, &dyn_bc, 1, INFO_STARTCODE);
+ ret = url_open_dyn_buf(&dyn_bc);
+ if(ret < 0)
+ return ret;
+ write_globalinfo(nut, dyn_bc);
+ put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
nut->last_syncpoint_pos= INT_MIN;
nut->header_count++;
+ return 0;
}
static int write_header(AVFormatContext *s){
NUTContext *nut = s->priv_data;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
int i, j;
nut->avf= s;
@@ -441,12 +450,13 @@ static int get_needed_flags(NUTContext *nut, StreamContext *nus, FrameCode *fc,
static int write_packet(AVFormatContext *s, AVPacket *pkt){
NUTContext *nut = s->priv_data;
StreamContext *nus= &nut->stream[pkt->stream_index];
- ByteIOContext *bc = &s->pb, dyn_bc;
+ ByteIOContext *bc = s->pb, *dyn_bc;
FrameCode *fc;
int64_t coded_pts;
int best_length, frame_code, flags, needed_flags, i;
int key_frame = !!(pkt->flags & PKT_FLAG_KEY);
int store_sp=0;
+ int ret;
if(1LL<<(20+3*nut->header_count) <= url_ftell(bc))
write_headers(nut, bc);
@@ -472,10 +482,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
sp= av_tree_find(nut->syncpoints, &dummy, ff_nut_sp_pos_cmp, NULL);
nut->last_syncpoint_pos= url_ftell(bc);
- url_open_dyn_buf(&dyn_bc);
- put_t(nut, nus, &dyn_bc, pkt->dts);
- put_v(&dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0);
- put_packet(nut, bc, &dyn_bc, 1, SYNCPOINT_STARTCODE);
+ ret = url_open_dyn_buf(&dyn_bc);
+ if(ret < 0)
+ return ret;
+ put_t(nut, nus, dyn_bc, pkt->dts);
+ put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0);
+ put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE);
ff_nut_add_sp(nut, nut->last_syncpoint_pos, 0/*unused*/, pkt->dts);
}
@@ -566,7 +578,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
static int write_trailer(AVFormatContext *s){
NUTContext *nut= s->priv_data;
- ByteIOContext *bc= &s->pb;
+ ByteIOContext *bc= s->pb;
while(nut->header_count<3)
write_headers(nut, bc);
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index fe637de6b2..f56d116ff1 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -120,7 +120,7 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst,
static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
NUVContext *ctx = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
char id_string[12], version_string[5];
double aspect, fps;
int is_mythtv, width, height, v_packs, a_packs;
@@ -183,7 +183,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
NUVContext *ctx = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
uint8_t hdr[HDRSIZE];
frametype_t frametype;
int ret, size;
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 211208dd25..69279339f4 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -56,7 +56,7 @@ ogg_save (AVFormatContext * s)
ogg_state_t *ost =
av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));
int i;
- ost->pos = url_ftell (&s->pb);;
+ ost->pos = url_ftell (s->pb);
ost->curidx = ogg->curidx;
ost->next = ogg->state;
ost->nstreams = ogg->nstreams;
@@ -78,7 +78,7 @@ static int
ogg_restore (AVFormatContext * s, int discard)
{
ogg_t *ogg = s->priv_data;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
ogg_state_t *ost = ogg->state;
int i;
@@ -196,7 +196,7 @@ ogg_new_buf(ogg_t *ogg, int idx)
static int
ogg_read_page (AVFormatContext * s, int *str)
{
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
ogg_t *ogg = s->priv_data;
ogg_stream_t *os;
int i = 0;
@@ -438,20 +438,20 @@ ogg_get_length (AVFormatContext * s)
int idx = -1, i;
offset_t size, end;
- if(s->pb.is_streamed)
+ if(s->pb->is_streamed)
return 0;
// already set
if (s->duration != AV_NOPTS_VALUE)
return 0;
- size = url_fsize(&s->pb);
+ size = url_fsize(s->pb);
if(size < 0)
return 0;
end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: size;
ogg_save (s);
- url_fseek (&s->pb, end, SEEK_SET);
+ url_fseek (s->pb, end, SEEK_SET);
while (!ogg_read_page (s, &i)){
if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
@@ -552,7 +552,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
int64_t pos_limit)
{
ogg_t *ogg = s->priv_data;
- ByteIOContext *bc = &s->pb;
+ ByteIOContext *bc = s->pb;
int64_t pts = AV_NOPTS_VALUE;
int i;
url_fseek(bc, *pos_arg, SEEK_SET);
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 06c978ece2..1c85073572 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -37,11 +37,11 @@ typedef struct {
static void ogg_update_checksum(AVFormatContext *s, offset_t crc_offset)
{
- offset_t pos = url_ftell(&s->pb);
- uint32_t checksum = get_checksum(&s->pb);
- url_fseek(&s->pb, crc_offset, SEEK_SET);
- put_be32(&s->pb, checksum);
- url_fseek(&s->pb, pos, SEEK_SET);
+ offset_t pos = url_ftell(s->pb);
+ uint32_t checksum = get_checksum(s->pb);
+ url_fseek(s->pb, crc_offset, SEEK_SET);
+ put_be32(s->pb, checksum);
+ url_fseek(s->pb, pos, SEEK_SET);
}
static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size,
@@ -54,24 +54,24 @@ static int ogg_write_page(AVFormatContext *s, const uint8_t *data, int size,
size = FFMIN(size, 255*255);
page_segments = FFMIN((size/255)+!!size, 255);
- init_checksum(&s->pb, ff_crc04C11DB7_update, 0);
- put_tag(&s->pb, "OggS");
- put_byte(&s->pb, 0);
- put_byte(&s->pb, flags);
- put_le64(&s->pb, granule);
- put_le32(&s->pb, stream_index);
- put_le32(&s->pb, oggstream->page_counter++);
- crc_offset = url_ftell(&s->pb);
- put_le32(&s->pb, 0); // crc
- put_byte(&s->pb, page_segments);
+ init_checksum(s->pb, ff_crc04C11DB7_update, 0);
+ put_tag(s->pb, "OggS");
+ put_byte(s->pb, 0);
+ put_byte(s->pb, flags);
+ put_le64(s->pb, granule);
+ put_le32(s->pb, stream_index);
+ put_le32(s->pb, oggstream->page_counter++);
+ crc_offset = url_ftell(s->pb);
+ put_le32(s->pb, 0); // crc
+ put_byte(s->pb, page_segments);
for (i = 0; i < page_segments-1; i++)
- put_byte(&s->pb, 255);
+ put_byte(s->pb, 255);
if (size) {
- put_byte(&s->pb, size - (page_segments-1)*255);
- put_buffer(&s->pb, data, size);
+ put_byte(s->pb, size - (page_segments-1)*255);
+ put_buffer(s->pb, data, size);
}
ogg_update_checksum(s, crc_offset);
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
return size;
}
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index 654155622d..3d4cac7f82 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -125,7 +125,7 @@ static void dump(unsigned char *buf,size_t len)
static int str_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
StrDemuxContext *str = s->priv_data;
AVStream *st;
unsigned char sector[RAW_CD_SECTOR_SIZE];
@@ -249,7 +249,7 @@ if (str->audio_channel != -1)
static int str_read_packet(AVFormatContext *s,
AVPacket *ret_pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
StrDemuxContext *str = s->priv_data;
unsigned char sector[RAW_CD_SECTOR_SIZE];
int channel;
diff --git a/libavformat/raw.c b/libavformat/raw.c
index bd9380315c..08e75c5f59 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -33,8 +33,8 @@ static int flac_write_header(struct AVFormatContext *s)
uint8_t *streaminfo = s->streams[0]->codec->extradata;
int len = s->streams[0]->codec->extradata_size;
if(streaminfo != NULL && len > 0) {
- put_buffer(&s->pb, header, 8);
- put_buffer(&s->pb, streaminfo, len);
+ put_buffer(s->pb, header, 8);
+ put_buffer(s->pb, streaminfo, len);
}
return 0;
}
@@ -46,16 +46,16 @@ static int roq_write_header(struct AVFormatContext *s)
0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00
};
- put_buffer(&s->pb, header, 8);
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, header, 8);
+ put_flush_packet(s->pb);
return 0;
}
static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
- put_buffer(&s->pb, pkt->data, pkt->size);
- put_flush_packet(&s->pb);
+ put_buffer(s->pb, pkt->data, pkt->size);
+ put_flush_packet(s->pb);
return 0;
}
#endif //CONFIG_MUXERS
@@ -107,7 +107,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
size= RAW_PACKET_SIZE;
- ret= av_get_packet(&s->pb, pkt, size);
+ ret= av_get_packet(s->pb, pkt, size);
pkt->stream_index = 0;
if (ret <= 0) {
@@ -128,9 +128,9 @@ static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
if (av_new_packet(pkt, size) < 0)
return AVERROR(EIO);
- pkt->pos= url_ftell(&s->pb);
+ pkt->pos= url_ftell(s->pb);
pkt->stream_index = 0;
- ret = get_partial_buffer(&s->pb, pkt->data, size);
+ ret = get_partial_buffer(s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
return AVERROR(EIO);
@@ -144,19 +144,19 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, size, w, h, unk1, unk2;
- if (get_le32(&s->pb) != MKTAG('M', 'J', 'P', 'G'))
+ if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
return AVERROR(EIO); // FIXME
- size = get_le32(&s->pb);
+ size = get_le32(s->pb);
- w = get_le16(&s->pb);
- h = get_le16(&s->pb);
+ w = get_le16(s->pb);
+ h = get_le16(s->pb);
- url_fskip(&s->pb, 8); // zero + size (padded?)
- url_fskip(&s->pb, 2);
- unk1 = get_le16(&s->pb);
- unk2 = get_le16(&s->pb);
- url_fskip(&s->pb, 22); // ascii timestamp
+ url_fskip(s->pb, 8); // zero + size (padded?)
+ url_fskip(s->pb, 2);
+ unk1 = get_le16(s->pb);
+ unk2 = get_le16(s->pb);
+ url_fskip(s->pb, 22); // ascii timestamp
av_log(NULL, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
size, w, h, unk1, unk2);
@@ -164,9 +164,9 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
if (av_new_packet(pkt, size) < 0)
return AVERROR(EIO);
- pkt->pos = url_ftell(&s->pb);
+ pkt->pos = url_ftell(s->pb);
pkt->stream_index = 0;
- ret = get_buffer(&s->pb, pkt->data, size);
+ ret = get_buffer(s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
return AVERROR(EIO);
@@ -206,7 +206,7 @@ int pcm_read_seek(AVFormatContext *s,
/* recompute exact position */
st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
- url_fseek(&s->pb, pos + s->data_offset, SEEK_SET);
+ url_fseek(s->pb, pos + s->data_offset, SEEK_SET);
return 0;
}
@@ -843,7 +843,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
if (packet_size < 0)
return -1;
- ret= av_get_packet(&s->pb, pkt, packet_size);
+ ret= av_get_packet(s->pb, pkt, packet_size);
pkt->stream_index = 0;
if (ret != packet_size) {
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 79623094d6..aa4297af69 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -50,7 +50,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
int read_all)
{
RMContext *rm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
char buf[256];
uint32_t version;
int i;
@@ -191,7 +191,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
static int
ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVStream *st)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int v;
int codec_data_size, size;
int64_t codec_pos;
@@ -272,7 +272,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
RMContext *rm = s->priv_data;
AVStream *st;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int tag;
int tag_size, i;
unsigned int start_time, duration;
@@ -395,7 +395,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){
RMContext *rm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int len, num, res, i;
AVStream *st;
uint32_t state=0xFFFFFFFF;
@@ -451,7 +451,7 @@ skip:
static int rm_assemble_video_frame(AVFormatContext *s, RMContext *rm, AVPacket *pkt, int len)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int hdr, seq, pic_num, len2, pos;
int type;
@@ -550,7 +550,7 @@ static int
ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt,
int *seq, int *flags, int64_t *timestamp)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
RMContext *rm = s->priv_data;
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
@@ -647,7 +647,7 @@ ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt,
static void
ff_rm_retrieve_cache (AVFormatContext *s, AVStream *st, AVPacket *pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
RMContext *rm = s->priv_data;
assert (rm->audio_pkt_cnt > 0);
@@ -668,7 +668,7 @@ ff_rm_retrieve_cache (AVFormatContext *s, AVStream *st, AVPacket *pkt)
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
{
RMContext *rm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
int i, len;
int64_t timestamp, pos;
@@ -759,7 +759,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
if(rm->old_format)
return AV_NOPTS_VALUE;
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
rm->remaining_len=0;
for(;;){
int seq=1;
@@ -771,9 +771,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
st = s->streams[stream_index2];
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
- h= get_byte(&s->pb); len--;
+ h= get_byte(s->pb); len--;
if(!(h & 0x40)){
- seq = get_byte(&s->pb); len--;
+ seq = get_byte(s->pb); len--;
}
}
@@ -784,7 +784,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
break;
}
- url_fskip(&s->pb, len);
+ url_fskip(s->pb, len);
}
*ppos = pos;
return dts;
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index 74f944317c..57a4e757de 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -45,7 +45,7 @@ static void rv10_write_header(AVFormatContext *ctx,
int data_size, int index_pos)
{
RMContext *rm = ctx->priv_data;
- ByteIOContext *s = &ctx->pb;
+ ByteIOContext *s = ctx->pb;
StreamInfo *stream;
unsigned char *data_offset_ptr, *start_ptr;
const char *desc, *mimetype;
@@ -253,7 +253,7 @@ static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream,
int length, int key_frame)
{
int timestamp;
- ByteIOContext *s = &ctx->pb;
+ ByteIOContext *s = ctx->pb;
stream->nb_packets++;
stream->packet_total_size += length;
@@ -308,7 +308,7 @@ static int rm_write_header(AVFormatContext *s)
}
rv10_write_header(s, 0, 0);
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
return 0;
}
@@ -316,7 +316,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
{
uint8_t *buf1;
RMContext *rm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
StreamInfo *stream = rm->audio_stream;
int i;
@@ -340,7 +340,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)
{
RMContext *rm = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
StreamInfo *stream = rm->video_stream;
int key_frame = !!(flags & PKT_FLAG_KEY);
@@ -390,9 +390,9 @@ static int rm_write_trailer(AVFormatContext *s)
{
RMContext *rm = s->priv_data;
int data_size, index_pos, i;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
- if (!url_is_streamed(&s->pb)) {
+ if (!url_is_streamed(s->pb)) {
/* end of file: finish to write header */
index_pos = url_fseek(pb, 0, SEEK_CUR);
data_size = index_pos - rm->data_pos;
diff --git a/libavformat/rtp.c b/libavformat/rtp.c
index 27085793be..a9979520c2 100644
--- a/libavformat/rtp.c
+++ b/libavformat/rtp.c
@@ -360,7 +360,7 @@ static void rtcp_update_jitter(RTPStatistics *s, uint32_t sent_timestamp, uint32
int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
{
- ByteIOContext pb;
+ ByteIOContext *pb;
uint8_t *buf;
int len;
int rtcp_bytes;
@@ -391,11 +391,11 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
return -1;
// Receiver Report
- put_byte(&pb, (RTP_VERSION << 6) + 1); /* 1 report block */
- put_byte(&pb, 201);
- put_be16(&pb, 7); /* length in words - 1 */
- put_be32(&pb, s->ssrc); // our own SSRC
- put_be32(&pb, s->ssrc); // XXX: should be the server's here!
+ put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
+ put_byte(pb, 201);
+ put_be16(pb, 7); /* length in words - 1 */
+ put_be32(pb, s->ssrc); // our own SSRC
+ put_be32(pb, s->ssrc); // XXX: should be the server's here!
// some placeholders we should really fill...
// RFC 1889/p64
extended_max= stats->cycles + stats->max_seq;
@@ -412,38 +412,38 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
fraction= (fraction<<24) | lost;
- put_be32(&pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
- put_be32(&pb, extended_max); /* max sequence received */
- put_be32(&pb, stats->jitter>>4); /* jitter */
+ put_be32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
+ put_be32(pb, extended_max); /* max sequence received */
+ put_be32(pb, stats->jitter>>4); /* jitter */
if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE)
{
- put_be32(&pb, 0); /* last SR timestamp */
- put_be32(&pb, 0); /* delay since last SR */
+ put_be32(pb, 0); /* last SR timestamp */
+ put_be32(pb, 0); /* delay since last SR */
} else {
uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special?
uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time;
- put_be32(&pb, middle_32_bits); /* last SR timestamp */
- put_be32(&pb, delay_since_last); /* delay since last SR */
+ put_be32(pb, middle_32_bits); /* last SR timestamp */
+ put_be32(pb, delay_since_last); /* delay since last SR */
}
// CNAME
- put_byte(&pb, (RTP_VERSION << 6) + 1); /* 1 report block */
- put_byte(&pb, 202);
+ put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
+ put_byte(pb, 202);
len = strlen(s->hostname);
- put_be16(&pb, (6 + len + 3) / 4); /* length in words - 1 */
- put_be32(&pb, s->ssrc);
- put_byte(&pb, 0x01);
- put_byte(&pb, len);
- put_buffer(&pb, s->hostname, len);
+ put_be16(pb, (6 + len + 3) / 4); /* length in words - 1 */
+ put_be32(pb, s->ssrc);
+ put_byte(pb, 0x01);
+ put_byte(pb, len);
+ put_buffer(pb, s->hostname, len);
// padding
for (len = (6 + len) % 4; len % 4; len++) {
- put_byte(&pb, 0);
+ put_byte(pb, 0);
}
- put_flush_packet(&pb);
- len = url_close_dyn_buf(&pb, &buf);
+ put_flush_packet(pb);
+ len = url_close_dyn_buf(pb, &buf);
if ((len > 0) && buf) {
int result;
#if defined(DEBUG)
@@ -775,7 +775,7 @@ static int rtp_write_header(AVFormatContext *s1)
s->first_packet = 1;
s->first_rtcp_ntp_time = AV_NOPTS_VALUE;
- max_packet_size = url_fget_max_packet_size(&s1->pb);
+ max_packet_size = url_fget_max_packet_size(s1->pb);
if (max_packet_size <= 12)
return AVERROR(EIO);
s->max_payload_size = max_packet_size - 12;
@@ -838,16 +838,16 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
s->last_rtcp_ntp_time = ntp_time;
rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, AV_TIME_BASE_Q,
s1->streams[0]->time_base) + s->base_timestamp;
- put_byte(&s1->pb, (RTP_VERSION << 6));
- put_byte(&s1->pb, 200);
- put_be16(&s1->pb, 6); /* length in words - 1 */
- put_be32(&s1->pb, s->ssrc);
- put_be32(&s1->pb, ntp_time / 1000000);
- put_be32(&s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
- put_be32(&s1->pb, rtp_ts);
- put_be32(&s1->pb, s->packet_count);
- put_be32(&s1->pb, s->octet_count);
- put_flush_packet(&s1->pb);
+ put_byte(s1->pb, (RTP_VERSION << 6));
+ put_byte(s1->pb, 200);
+ put_be16(s1->pb, 6); /* length in words - 1 */
+ put_be32(s1->pb, s->ssrc);
+ put_be32(s1->pb, ntp_time / 1000000);
+ put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
+ put_be32(s1->pb, rtp_ts);
+ put_be32(s1->pb, s->packet_count);
+ put_be32(s1->pb, s->octet_count);
+ put_flush_packet(s1->pb);
}
/* send an rtp packet. sequence number is incremented, but the caller
@@ -861,14 +861,14 @@ void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
#endif
/* build the RTP header */
- put_byte(&s1->pb, (RTP_VERSION << 6));
- put_byte(&s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
- put_be16(&s1->pb, s->seq);
- put_be32(&s1->pb, s->timestamp);
- put_be32(&s1->pb, s->ssrc);
-
- put_buffer(&s1->pb, buf1, len);
- put_flush_packet(&s1->pb);
+ put_byte(s1->pb, (RTP_VERSION << 6));
+ put_byte(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
+ put_be16(s1->pb, s->seq);
+ put_be32(s1->pb, s->timestamp);
+ put_be32(s1->pb, s->ssrc);
+
+ put_buffer(s1->pb, buf1, len);
+ put_flush_packet(s1->pb);
s->seq++;
s->octet_count += len;
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c494ebd3d8..d71479c358 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1351,7 +1351,7 @@ static int sdp_read_header(AVFormatContext *s,
/* read the whole sdp file */
/* XXX: better loading */
content = av_malloc(SDP_MAX_SIZE);
- size = get_buffer(&s->pb, content, SDP_MAX_SIZE - 1);
+ size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
if (size <= 0) {
av_free(content);
return AVERROR_INVALIDDATA;
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index a06db71360..3cea07fef9 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -76,7 +76,7 @@ static int film_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
FilmDemuxContext *film = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
unsigned char scratch[256];
int i;
@@ -204,7 +204,7 @@ static int film_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
FilmDemuxContext *film = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
film_sample_t *sample;
int ret = 0;
int i;
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index 1f8e434a21..0f5063471c 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -72,7 +72,7 @@ static int vmd_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
VmdDemuxContext *vmd = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st, *vst;
unsigned int toc_offset;
unsigned char *raw_frame_table;
@@ -245,7 +245,7 @@ static int vmd_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
VmdDemuxContext *vmd = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ret = 0;
vmd_frame_t *frame;
diff --git a/libavformat/siff.c b/libavformat/siff.c
index 7adccb2eba..00b4eaa9dd 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -153,7 +153,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb
static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
SIFFContext *c = s->priv_data;
uint32_t tag;
@@ -189,12 +189,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
if (c->cur_frame >= c->frames)
return AVERROR(EIO);
if (c->curstrm == -1){
- c->pktsize = get_le32(&s->pb) - 4;
- c->flags = get_le16(&s->pb);
+ c->pktsize = get_le32(s->pb) - 4;
+ c->flags = get_le16(s->pb);
c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0;
if (c->gmcsize)
- get_buffer(&s->pb, c->gmc, c->gmcsize);
- c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(&s->pb): 0;
+ get_buffer(s->pb, c->gmc, c->gmcsize);
+ c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0;
c->curstrm = !!(c->flags & VB_HAS_AUDIO);
}
@@ -205,11 +205,11 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
AV_WL16(pkt->data, c->flags);
if (c->gmcsize)
memcpy(pkt->data + 2, c->gmc, c->gmcsize);
- get_buffer(&s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
+ get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
pkt->stream_index = 0;
c->curstrm = -1;
}else{
- if (av_get_packet(&s->pb, pkt, c->sndsize - 4) < 0)
+ if (av_get_packet(s->pb, pkt, c->sndsize - 4) < 0)
return AVERROR(EIO);
pkt->stream_index = 1;
c->curstrm = 0;
@@ -219,7 +219,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
if (c->curstrm == -1)
c->cur_frame++;
}else{
- size = av_get_packet(&s->pb, pkt, c->block_align);
+ size = av_get_packet(s->pb, pkt, c->block_align);
if(size <= 0)
return AVERROR(EIO);
}
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 655e7fb69f..562a416164 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -98,7 +98,7 @@ static int smacker_probe(AVProbeData *p)
static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
SmackerContext *smk = s->priv_data;
AVStream *st, *ast[7];
int i, ret;
@@ -226,35 +226,35 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
int palchange = 0;
int pos;
- if (url_feof(&s->pb) || smk->cur_frame >= smk->frames)
+ if (url_feof(s->pb) || smk->cur_frame >= smk->frames)
return AVERROR(EIO);
/* if we demuxed all streams, pass another frame */
if(smk->curstream < 0) {
- url_fseek(&s->pb, smk->nextpos, 0);
+ url_fseek(s->pb, smk->nextpos, 0);
frame_size = smk->frm_size[smk->cur_frame] & (~3);
flags = smk->frm_flags[smk->cur_frame];
/* handle palette change event */
- pos = url_ftell(&s->pb);
+ pos = url_ftell(s->pb);
if(flags & SMACKER_PAL){
int size, sz, t, off, j, pos;
uint8_t *pal = smk->pal;
uint8_t oldpal[768];
memcpy(oldpal, pal, 768);
- size = get_byte(&s->pb);
+ size = get_byte(s->pb);
size = size * 4 - 1;
frame_size -= size;
frame_size--;
sz = 0;
- pos = url_ftell(&s->pb) + size;
+ pos = url_ftell(s->pb) + size;
while(sz < 256){
- t = get_byte(&s->pb);
+ t = get_byte(s->pb);
if(t & 0x80){ /* skip palette entries */
sz += (t & 0x7F) + 1;
pal += ((t & 0x7F) + 1) * 3;
} else if(t & 0x40){ /* copy with offset */
- off = get_byte(&s->pb) * 3;
+ off = get_byte(s->pb) * 3;
j = (t & 0x3F) + 1;
while(j-- && sz < 256) {
*pal++ = oldpal[off + 0];
@@ -265,12 +265,12 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
}
} else { /* new entries */
*pal++ = smk_pal[t];
- *pal++ = smk_pal[get_byte(&s->pb) & 0x3F];
- *pal++ = smk_pal[get_byte(&s->pb) & 0x3F];
+ *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
+ *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
sz++;
}
}
- url_fseek(&s->pb, pos, 0);
+ url_fseek(s->pb, pos, 0);
palchange |= 1;
}
flags >>= 1;
@@ -279,13 +279,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
for(i = 0; i < 7; i++) {
if(flags & 1) {
int size;
- size = get_le32(&s->pb) - 4;
+ size = get_le32(s->pb) - 4;
frame_size -= size;
frame_size -= 4;
smk->curstream++;
smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
smk->buf_sizes[smk->curstream] = size;
- ret = get_buffer(&s->pb, smk->bufs[smk->curstream], size);
+ ret = get_buffer(s->pb, smk->bufs[smk->curstream], size);
if(ret != size)
return AVERROR(EIO);
smk->stream_id[smk->curstream] = smk->indexes[i];
@@ -298,13 +298,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
palchange |= 2;
pkt->data[0] = palchange;
memcpy(pkt->data + 1, smk->pal, 768);
- ret = get_buffer(&s->pb, pkt->data + 769, frame_size);
+ ret = get_buffer(s->pb, pkt->data + 769, frame_size);
if(ret != frame_size)
return AVERROR(EIO);
pkt->stream_index = smk->videoindex;
pkt->size = ret + 769;
smk->cur_frame++;
- smk->nextpos = url_ftell(&s->pb);
+ smk->nextpos = url_ftell(s->pb);
} else {
if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
return AVERROR(ENOMEM);
diff --git a/libavformat/sol.c b/libavformat/sol.c
index 3d2456d663..97ebfdb5eb 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -88,7 +88,7 @@ static int sol_read_header(AVFormatContext *s,
{
int size;
unsigned int magic,tag;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int id, codec, channels, rate, type;
AVStream *st;
@@ -130,9 +130,9 @@ static int sol_read_packet(AVFormatContext *s,
{
int ret;
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
- ret= av_get_packet(&s->pb, pkt, MAX_SIZE);
+ ret= av_get_packet(s->pb, pkt, MAX_SIZE);
pkt->stream_index = 0;
/* note: we need to modify the packet size here to handle the last
diff --git a/libavformat/swf.c b/libavformat/swf.c
index 1916d4a74c..56ba34f423 100644
--- a/libavformat/swf.c
+++ b/libavformat/swf.c
@@ -96,7 +96,7 @@ static const AVCodecTag swf_audio_codec_tags[] = {
static void put_swf_tag(AVFormatContext *s, int tag)
{
SWFContext *swf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
swf->tag_pos = url_ftell(pb);
swf->tag = tag;
@@ -112,7 +112,7 @@ static void put_swf_tag(AVFormatContext *s, int tag)
static void put_swf_end_tag(AVFormatContext *s)
{
SWFContext *swf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
offset_t pos;
int tag_len, tag;
@@ -244,7 +244,7 @@ static void put_swf_matrix(ByteIOContext *pb,
static int swf_write_header(AVFormatContext *s)
{
SWFContext *swf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *enc, *audio_enc, *video_enc;
PutBitContext p;
uint8_t buf1[256];
@@ -392,16 +392,16 @@ static int swf_write_header(AVFormatContext *s)
v |= 0x02; /* 16 bit playback */
if (audio_enc->channels == 2)
v |= 0x01; /* stereo playback */
- put_byte(&s->pb, v);
+ put_byte(s->pb, v);
v |= 0x20; /* mp3 compressed */
- put_byte(&s->pb, v);
- put_le16(&s->pb, swf->samples_per_frame); /* avg samples per frame */
- put_le16(&s->pb, 0);
+ put_byte(s->pb, v);
+ put_le16(s->pb, swf->samples_per_frame); /* avg samples per frame */
+ put_le16(s->pb, 0);
put_swf_end_tag(s);
}
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
return 0;
}
@@ -409,7 +409,7 @@ static int swf_write_video(AVFormatContext *s,
AVCodecContext *enc, const uint8_t *buf, int size)
{
SWFContext *swf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
/* Flash Player limit */
if (swf->swf_frame_number == 16000) {
@@ -516,7 +516,7 @@ static int swf_write_video(AVFormatContext *s,
put_swf_tag(s, TAG_SHOWFRAME);
put_swf_end_tag(s);
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
return 0;
}
@@ -560,7 +560,7 @@ static int swf_write_packet(AVFormatContext *s, AVPacket *pkt)
static int swf_write_trailer(AVFormatContext *s)
{
SWFContext *swf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVCodecContext *enc, *video_enc;
int file_size, i;
@@ -574,10 +574,10 @@ static int swf_write_trailer(AVFormatContext *s)
put_swf_tag(s, TAG_END);
put_swf_end_tag(s);
- put_flush_packet(&s->pb);
+ put_flush_packet(s->pb);
/* patch file size and number of frames if not streamed */
- if (!url_is_streamed(&s->pb) && video_enc) {
+ if (!url_is_streamed(s->pb) && video_enc) {
file_size = url_ftell(pb);
url_fseek(pb, 4, SEEK_SET);
put_le32(pb, file_size);
@@ -628,7 +628,7 @@ static int swf_probe(AVProbeData *p)
static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
SWFContext *swf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int nbits, len, tag;
tag = get_be32(pb) & 0xffffff00;
@@ -655,7 +655,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
{
SWFContext *swf = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *vst = NULL, *ast = NULL, *st = 0;
int tag, len, i, frame, v;
diff --git a/libavformat/thp.c b/libavformat/thp.c
index f1cc8ae26b..a0747ecad8 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -57,7 +57,7 @@ static int thp_read_header(AVFormatContext *s,
{
ThpDemuxContext *thp = s->priv_data;
AVStream *st;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int i;
/* Read the file header. */
@@ -140,7 +140,7 @@ static int thp_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
ThpDemuxContext *thp = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int size;
int ret;
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
index d6808a043f..457185b63d 100644
--- a/libavformat/tiertexseq.c
+++ b/libavformat/tiertexseq.c
@@ -184,7 +184,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
int i, rc;
SeqDemuxContext *seq = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
/* init internal buffers */
@@ -241,7 +241,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int rc;
SeqDemuxContext *seq = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
if (!seq->audio_buffer_full) {
rc = seq_parse_frame_data(seq, pb);
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 4b9be6cf30..2cd0101f15 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -40,25 +40,25 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
int i, channels, bps, samplerate, datalen, framelen;
uint64_t framepos;
- if (get_le32(&s->pb) != ff_get_fourcc("TTA1"))
+ if (get_le32(s->pb) != ff_get_fourcc("TTA1"))
return -1; // not tta file
- url_fskip(&s->pb, 2); // FIXME: flags
- channels = get_le16(&s->pb);
- bps = get_le16(&s->pb);
- samplerate = get_le32(&s->pb);
+ url_fskip(s->pb, 2); // FIXME: flags
+ channels = get_le16(s->pb);
+ bps = get_le16(s->pb);
+ samplerate = get_le32(s->pb);
if(samplerate <= 0 || samplerate > 1000000){
av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
return -1;
}
- datalen = get_le32(&s->pb);
+ datalen = get_le32(s->pb);
if(datalen < 0){
av_log(s, AV_LOG_ERROR, "nonsense datalen\n");
return -1;
}
- url_fskip(&s->pb, 4); // header crc
+ url_fskip(s->pb, 4); // header crc
framelen = samplerate*256/245;
c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0);
@@ -77,14 +77,14 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->start_time = 0;
st->duration = datalen;
- framepos = url_ftell(&s->pb) + 4*c->totalframes + 4;
+ framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
for (i = 0; i < c->totalframes; i++) {
- uint32_t size = get_le32(&s->pb);
+ uint32_t size = get_le32(s->pb);
av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
framepos += size;
}
- url_fskip(&s->pb, 4); // seektable crc
+ url_fskip(s->pb, 4); // seektable crc
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_TTA;
@@ -92,15 +92,15 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->sample_rate = samplerate;
st->codec->bits_per_sample = bps;
- st->codec->extradata_size = url_ftell(&s->pb);
+ st->codec->extradata_size = url_ftell(s->pb);
if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
//this check is redundant as get_buffer should fail
av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
return -1;
}
st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
- url_fseek(&s->pb, 0, SEEK_SET);
- get_buffer(&s->pb, st->codec->extradata, st->codec->extradata_size);
+ url_fseek(s->pb, 0, SEEK_SET);
+ get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
return 0;
}
@@ -117,7 +117,7 @@ static int tta_read_packet(AVFormatContext *s, AVPacket *pkt)
size = st->index_entries[c->currentframe].size;
- ret = av_get_packet(&s->pb, pkt, size);
+ ret = av_get_packet(s->pb, pkt, size);
pkt->dts = st->index_entries[c->currentframe++].timestamp;
return ret;
}
@@ -131,7 +131,7 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
return -1;
c->currentframe = index;
- url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
+ url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
return 0;
}
diff --git a/libavformat/txd.c b/libavformat/txd.c
index 6c17dff55a..8092a41a48 100644
--- a/libavformat/txd.c
+++ b/libavformat/txd.c
@@ -51,7 +51,7 @@ static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
}
static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) {
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int id, chunk_size, marker;
int ret;
@@ -60,7 +60,7 @@ next_chunk:
chunk_size = get_le32(pb);
marker = get_le32(pb);
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
if (marker != TXD_MARKER && marker != TXD_MARKER2) {
av_log(NULL, AV_LOG_ERROR, "marker does not match\n");
@@ -72,7 +72,7 @@ next_chunk:
if (chunk_size > 100)
break;
case TXD_EXTRA:
- url_fskip(&s->pb, chunk_size);
+ url_fskip(s->pb, chunk_size);
case TXD_FILE:
case TXD_TEXTURE:
goto next_chunk;
@@ -81,7 +81,7 @@ next_chunk:
return AVERROR(EIO);
}
- ret = av_get_packet(&s->pb, pkt, chunk_size);
+ ret = av_get_packet(s->pb, pkt, chunk_size);
pkt->stream_index = 0;
return ret <= 0 ? AVERROR(EIO) : ret;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 98018e5d46..d40a5f3f41 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -361,8 +361,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
goto fail;
}
ic->iformat = fmt;
- if (pb)
- ic->pb = *pb;
+ ic->pb = pb;
ic->duration = AV_NOPTS_VALUE;
ic->start_time = AV_NOPTS_VALUE;
av_strlcpy(ic->filename, filename, sizeof(ic->filename));
@@ -383,7 +382,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
goto fail;
if (pb && !ic->data_offset)
- ic->data_offset = url_ftell(&ic->pb);
+ ic->data_offset = url_ftell(ic->pb);
*ic_ptr = ic;
return 0;
@@ -407,7 +406,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
{
int err, must_open_file, file_opened, probe_size;
AVProbeData probe_data, *pd = &probe_data;
- ByteIOContext pb1, *pb = &pb1;
+ ByteIOContext *pb;
file_opened = 0;
pd->filename = "";
@@ -431,7 +430,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
if (!fmt || must_open_file) {
/* if no file needed do not try to open one */
- if ((err=url_fopen(pb, filename, URL_RDONLY)) < 0) {
+ if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
goto fail;
}
file_opened = 1;
@@ -447,7 +446,7 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
if (url_fseek(pb, 0, SEEK_SET) < 0) {
url_fclose(pb);
- if (url_fopen(pb, filename, URL_RDONLY) < 0) {
+ if (url_fopen(&pb, filename, URL_RDONLY) < 0) {
file_opened = 0;
err = AVERROR(EIO);
goto fail;
@@ -1130,7 +1129,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
return -1;
/* do the seek */
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
av_update_cur_dts(s, st, ts);
@@ -1155,7 +1154,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
if(ts_max == AV_NOPTS_VALUE){
int step= 1024;
- filesize = url_fsize(&s->pb);
+ filesize = url_fsize(s->pb);
pos_max = filesize - 1;
do{
pos_max -= step;
@@ -1261,12 +1260,12 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos,
#endif
pos_min = s->data_offset;
- pos_max = url_fsize(&s->pb) - 1;
+ pos_max = url_fsize(s->pb) - 1;
if (pos < pos_min) pos= pos_min;
else if(pos > pos_max) pos= pos_max;
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
#if 0
av_update_cur_dts(s, st, ts);
@@ -1291,10 +1290,10 @@ static int av_seek_frame_generic(AVFormatContext *s,
if(st->index_entries && st->nb_index_entries){
ie= &st->index_entries[st->nb_index_entries-1];
- url_fseek(&s->pb, ie->pos, SEEK_SET);
+ url_fseek(s->pb, ie->pos, SEEK_SET);
av_update_cur_dts(s, st, ie->timestamp);
}else
- url_fseek(&s->pb, 0, SEEK_SET);
+ url_fseek(s->pb, 0, SEEK_SET);
for(i=0;; i++) {
int ret = av_read_frame(s, &pkt);
@@ -1317,7 +1316,7 @@ static int av_seek_frame_generic(AVFormatContext *s,
return 0;
}
ie = &st->index_entries[index];
- url_fseek(&s->pb, ie->pos, SEEK_SET);
+ url_fseek(s->pb, ie->pos, SEEK_SET);
av_update_cur_dts(s, st, ie->timestamp);
@@ -1509,7 +1508,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
/* we read the first packets to get the first PTS (not fully
accurate, but it is enough now) */
- url_fseek(&ic->pb, 0, SEEK_SET);
+ url_fseek(ic->pb, 0, SEEK_SET);
read_size = 0;
for(;;) {
if (read_size >= DURATION_MAX_READ_SIZE)
@@ -1542,7 +1541,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
if (offset < 0)
offset = 0;
- url_fseek(&ic->pb, offset, SEEK_SET);
+ url_fseek(ic->pb, offset, SEEK_SET);
read_size = 0;
for(;;) {
if (read_size >= DURATION_MAX_READ_SIZE)
@@ -1568,7 +1567,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, offset_t old_offse
fill_all_stream_timings(ic);
- url_fseek(&ic->pb, old_offset, SEEK_SET);
+ url_fseek(ic->pb, old_offset, SEEK_SET);
for(i=0; i<ic->nb_streams; i++){
st= ic->streams[i];
st->cur_dts= st->first_dts;
@@ -1584,7 +1583,7 @@ static void av_estimate_timings(AVFormatContext *ic, offset_t old_offset)
if (ic->iformat->flags & AVFMT_NOFILE) {
file_size = 0;
} else {
- file_size = url_fsize(&ic->pb);
+ file_size = url_fsize(ic->pb);
if (file_size < 0)
file_size = 0;
}
@@ -1592,7 +1591,7 @@ static void av_estimate_timings(AVFormatContext *ic, offset_t old_offset)
if ((!strcmp(ic->iformat->name, "mpeg") ||
!strcmp(ic->iformat->name, "mpegts")) &&
- file_size && !ic->pb.is_streamed) {
+ file_size && !ic->pb->is_streamed) {
/* get accurate estimate from the PTSes */
av_estimate_timings_from_pts(ic, old_offset);
} else if (av_has_duration(ic)) {
@@ -1757,7 +1756,7 @@ int av_find_stream_info(AVFormatContext *ic)
int64_t last_dts[MAX_STREAMS];
int duration_count[MAX_STREAMS]={0};
double (*duration_error)[MAX_STD_TIMEBASES];
- offset_t old_offset = url_ftell(&ic->pb);
+ offset_t old_offset = url_ftell(ic->pb);
int64_t codec_info_duration[MAX_STREAMS]={0};
int codec_info_nb_frames[MAX_STREAMS]={0};
AVProbeData probe_data[MAX_STREAMS];
@@ -1989,7 +1988,7 @@ int av_find_stream_info(AVFormatContext *ic)
}
st->cur_dts= st->first_dts;
}
- url_fseek(&ic->pb, ic->data_offset, SEEK_SET);
+ url_fseek(ic->pb, ic->data_offset, SEEK_SET);
}
#if 0
@@ -2075,7 +2074,7 @@ void av_close_input_file(AVFormatContext *s)
must_open_file = 0;
}
if (must_open_file) {
- url_fclose(&s->pb);
+ url_fclose(s->pb);
}
av_freep(&s->priv_data);
av_free(s);
@@ -2343,7 +2342,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
ret= s->oformat->write_packet(s, pkt);
if(!ret)
- ret= url_ferror(&s->pb);
+ ret= url_ferror(s->pb);
return ret;
}
@@ -2444,8 +2443,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
if(ret<0)
return ret;
- if(url_ferror(&s->pb))
- return url_ferror(&s->pb);
+ if(url_ferror(s->pb))
+ return url_ferror(s->pb);
}
}
@@ -2468,7 +2467,7 @@ int av_write_trailer(AVFormatContext *s)
if(ret<0)
goto fail;
- if(url_ferror(&s->pb))
+ if(url_ferror(s->pb))
goto fail;
}
@@ -2476,7 +2475,7 @@ int av_write_trailer(AVFormatContext *s)
ret = s->oformat->write_trailer(s);
fail:
if(ret == 0)
- ret=url_ferror(&s->pb);
+ ret=url_ferror(s->pb);
for(i=0;i<s->nb_streams;i++)
av_freep(&s->streams[i]->priv_data);
av_freep(&s->priv_data);
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index 590a9173bc..7c50fa588c 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -39,7 +39,7 @@ static int voc_probe(AVProbeData *p)
static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
voc_dec_context_t *voc = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int header_size;
AVStream *st;
@@ -64,7 +64,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
{
voc_dec_context_t *voc = s->priv_data;
AVCodecContext *dec = st->codec;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
voc_type_t type;
int size;
int sample_rate = 0;
diff --git a/libavformat/vocenc.c b/libavformat/vocenc.c
index ae1ef90ed8..d967fae095 100644
--- a/libavformat/vocenc.c
+++ b/libavformat/vocenc.c
@@ -28,7 +28,7 @@ typedef struct voc_enc_context {
static int voc_write_header(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
const int header_size = 26;
const int version = 0x0114;
@@ -48,7 +48,7 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
{
voc_enc_context_t *voc = s->priv_data;
AVCodecContext *enc = s->streams[0]->codec;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
if (!voc->param_written) {
if (enc->codec_tag > 0xFF) {
@@ -84,7 +84,7 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
static int voc_write_trailer(AVFormatContext *s)
{
- put_byte(&s->pb, 0);
+ put_byte(s->pb, 0);
return 0;
}
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 9fccf64295..5053d15006 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -34,7 +34,7 @@ typedef struct {
static int wav_write_header(AVFormatContext *s)
{
WAVContext *wav = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
offset_t fmt, fact;
put_tag(pb, "RIFF");
@@ -50,7 +50,7 @@ static int wav_write_header(AVFormatContext *s)
end_tag(pb, fmt);
if(s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */
- && !url_is_streamed(&s->pb)) {
+ && !url_is_streamed(s->pb)) {
fact = start_tag(pb, "fact");
put_le32(pb, 0);
end_tag(pb, fact);
@@ -70,7 +70,7 @@ static int wav_write_header(AVFormatContext *s)
static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
WAVContext *wav = s->priv_data;
put_buffer(pb, pkt->data, pkt->size);
if(pkt->pts != AV_NOPTS_VALUE) {
@@ -84,11 +84,11 @@ static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
static int wav_write_trailer(AVFormatContext *s)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
WAVContext *wav = s->priv_data;
offset_t file_size;
- if (!url_is_streamed(&s->pb)) {
+ if (!url_is_streamed(s->pb)) {
end_tag(pb, wav->data);
/* update file size */
@@ -156,7 +156,7 @@ static int wav_read_header(AVFormatContext *s,
{
int size;
unsigned int tag;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
WAVContext *wav = s->priv_data;
@@ -199,17 +199,17 @@ static int wav_read_packet(AVFormatContext *s,
AVStream *st;
WAVContext *wav = s->priv_data;
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
st = s->streams[0];
- left= wav->data_end - url_ftell(&s->pb);
+ left= wav->data_end - url_ftell(s->pb);
if(left <= 0){
- left = find_tag(&(s->pb), MKTAG('d', 'a', 't', 'a'));
+ left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
if (left < 0) {
return AVERROR(EIO);
}
- wav->data_end= url_ftell(&s->pb) + left;
+ wav->data_end= url_ftell(s->pb) + left;
}
size = MAX_SIZE;
@@ -219,7 +219,7 @@ static int wav_read_packet(AVFormatContext *s,
size = (size / st->codec->block_align) * st->codec->block_align;
}
size= FFMIN(size, left);
- ret= av_get_packet(&s->pb, pkt, size);
+ ret= av_get_packet(s->pb, pkt, size);
if (ret <= 0)
return AVERROR(EIO);
pkt->stream_index = 0;
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 84b67005d8..dae4cec50a 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -126,7 +126,7 @@ static int wc3_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
Wc3DemuxContext *wc3 = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int fourcc_tag;
unsigned int size;
AVStream *st;
@@ -272,7 +272,7 @@ static int wc3_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
Wc3DemuxContext *wc3 = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned int fourcc_tag;
unsigned int size;
int packet_read = 0;
diff --git a/libavformat/westwood.c b/libavformat/westwood.c
index b553073970..268f2e71ee 100644
--- a/libavformat/westwood.c
+++ b/libavformat/westwood.c
@@ -118,7 +118,7 @@ static int wsaud_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
WsAudDemuxContext *wsaud = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
unsigned char header[AUD_HEADER_SIZE];
@@ -160,7 +160,7 @@ static int wsaud_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
WsAudDemuxContext *wsaud = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE];
unsigned int chunk_size;
int ret = 0;
@@ -213,7 +213,7 @@ static int wsvqa_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
WsVqaDemuxContext *wsvqa = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVStream *st;
unsigned char *header;
unsigned char scratch[VQA_PREAMBLE_SIZE];
@@ -315,7 +315,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
WsVqaDemuxContext *wsvqa = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int ret = -1;
unsigned char preamble[VQA_PREAMBLE_SIZE];
unsigned int chunk_type;
diff --git a/libavformat/wv.c b/libavformat/wv.c
index c8e4a40f24..2240dfde2d 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -135,7 +135,7 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb)
static int wv_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
WVContext *wc = s->priv_data;
AVStream *st;
@@ -164,17 +164,17 @@ static int wv_read_packet(AVFormatContext *s,
WVContext *wc = s->priv_data;
int ret;
- if (url_feof(&s->pb))
+ if (url_feof(s->pb))
return AVERROR(EIO);
if(wc->block_parsed){
- if(wv_read_block_header(s, &s->pb) < 0)
+ if(wv_read_block_header(s, s->pb) < 0)
return -1;
}
if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE);
- ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize);
+ ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize);
if(ret != wc->blksize){
av_free_packet(pkt);
return AVERROR(EIO);
@@ -204,18 +204,18 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
/* if found, seek there */
if (index >= 0){
wc->block_parsed = 1;
- url_fseek(&s->pb, st->index_entries[index].pos, SEEK_SET);
+ url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
return 0;
}
/* if timestamp is out of bounds, return error */
if(timestamp < 0 || timestamp >= s->duration)
return -1;
- pos = url_ftell(&s->pb);
+ pos = url_ftell(s->pb);
do{
ret = av_read_frame(s, pkt);
if (ret < 0){
- url_fseek(&s->pb, pos, SEEK_SET);
+ url_fseek(s->pb, pos, SEEK_SET);
return -1;
}
pts = pkt->pts;
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index 9614894caf..7913e417a7 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -87,7 +87,7 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVStream *st = s->streams[pkt->stream_index];
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
AVPicture *picture;
int* first_pkt = s->priv_data;
int width, height, h_chroma_shift, v_chroma_shift;
@@ -190,7 +190,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
char header[MAX_YUV4_HEADER+10]; // Include headroom for the longest option
char *tokstart,*tokend,*header_end;
int i;
- ByteIOContext *pb = &s->pb;
+ ByteIOContext *pb = s->pb;
int width=-1, height=-1, raten=0, rated=0, aspectn=0, aspectd=0;
enum PixelFormat pix_fmt=PIX_FMT_NONE,alt_pix_fmt=PIX_FMT_NONE;
AVStream *st;
@@ -344,7 +344,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
struct frame_attributes *s1 = s->priv_data;
for (i=0; i<MAX_FRAME_HEADER; i++) {
- header[i] = get_byte(&s->pb);
+ header[i] = get_byte(s->pb);
if (header[i] == '\n') {
header[i+1] = 0;
break;
@@ -360,7 +360,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
if (packet_size < 0)
return -1;
- if (av_get_packet(&s->pb, pkt, packet_size) != packet_size)
+ if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
return AVERROR(EIO);
if (s->streams[0]->codec->coded_frame) {