Mercurial > libavformat.hg
diff mpc8.c @ 2771:d52c718e83f9 libavformat
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
author | andoma |
---|---|
date | Wed, 21 Nov 2007 07:41:00 +0000 |
parents | 8f923b7f5462 |
children | 6f61c3b36632 |
line wrap: on
line diff
--- a/mpc8.c Mon Nov 19 20:28:11 2007 +0000 +++ b/mpc8.c Wed Nov 21 07:41:00 2007 +0000 @@ -90,15 +90,15 @@ 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_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 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 @@ 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 @@ 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; }