From 899681cd1dbf4cd7c3b86af23bca25e20a54f4d0 Mon Sep 17 00:00:00 2001 From: Björn Axelsson Date: Wed, 21 Nov 2007 07:41:00 +0000 Subject: Use dynamically allocated ByteIOContext in AVFormatContext MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- libavformat/asf.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'libavformat/asf.c') 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;ipb); - 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; -- cgit v1.2.3