diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-07-17 22:24:36 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-07-17 22:24:36 +0000 |
commit | 01f4895c682a1752bf6d138ffb0628470e16b85a (patch) | |
tree | 56a3dfce270dad38b97c8f7ff288cc23cfac54da /libavformat/avidec.c | |
parent | 4c1a012e9ceb0840688c547625208e7c4b81624a (diff) | |
download | ffmpeg-01f4895c682a1752bf6d138ffb0628470e16b85a.tar.gz |
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
Originally committed as revision 4453 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r-- | libavformat/avidec.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 14fa2b5eff..f1a25899a6 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -178,7 +178,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) goto fail; ast = s->streams[0]->priv_data; - av_freep(&s->streams[0]->codec.extradata); + av_freep(&s->streams[0]->codec->extradata); av_freep(&s->streams[0]); s->nb_streams = 0; avi->dv_demux = dv_init_demux(s); @@ -199,7 +199,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } st = s->streams[stream_index]; ast = st->priv_data; - st->codec.stream_codec_tag= handler; + st->codec->stream_codec_tag= handler; get_le32(pb); /* flags */ get_le16(pb); /* priority */ @@ -259,10 +259,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) switch(codec_type) { case CODEC_TYPE_VIDEO: get_le32(pb); /* size */ - st->codec.width = get_le32(pb); - st->codec.height = get_le32(pb); + st->codec->width = get_le32(pb); + st->codec->height = get_le32(pb); get_le16(pb); /* panes */ - st->codec.bits_per_sample= get_le16(pb); /* depth */ + st->codec->bits_per_sample= get_le16(pb); /* depth */ tag1 = get_le32(pb); get_le32(pb); /* ImageSize */ get_le32(pb); /* XPelsPerMeter */ @@ -271,41 +271,41 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) get_le32(pb); /* ClrImportant */ if(size > 10*4 && size<(1<<30)){ - st->codec.extradata_size= size - 10*4; - st->codec.extradata= av_malloc(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec.extradata, st->codec.extradata_size); + st->codec->extradata_size= size - 10*4; + st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } - if(st->codec.extradata_size & 1) //FIXME check if the encoder really did this correctly + if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly get_byte(pb); /* Extract palette from extradata if bpp <= 8 */ /* This code assumes that extradata contains only palette */ /* This is true for all paletted codecs implemented in ffmpeg */ - if (st->codec.extradata_size && (st->codec.bits_per_sample <= 8)) { - st->codec.palctrl = av_mallocz(sizeof(AVPaletteControl)); + if (st->codec->extradata_size && (st->codec->bits_per_sample <= 8)) { + st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #ifdef WORDS_BIGENDIAN - for (i = 0; i < FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)/4; i++) - st->codec.palctrl->palette[i] = bswap_32(((uint32_t*)st->codec.extradata)[i]); + for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) + st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]); #else - memcpy(st->codec.palctrl->palette, st->codec.extradata, - FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)); + memcpy(st->codec->palctrl->palette, st->codec->extradata, + FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); #endif - st->codec.palctrl->palette_changed = 1; + st->codec->palctrl->palette_changed = 1; } #ifdef DEBUG print_tag("video", tag1, 0); #endif - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_tag = tag1; - st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1); - if (st->codec.codec_id == CODEC_ID_XAN_WC4) + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_tag = tag1; + st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1); + if (st->codec->codec_id == CODEC_ID_XAN_WC4) xan_video = 1; // url_fskip(pb, size - 5 * 4); break; case CODEC_TYPE_AUDIO: - get_wav_header(pb, &st->codec, size); + get_wav_header(pb, st->codec, size); if (size%2) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */ url_fskip(pb, 1); /* special case time: To support Xan DPCM, hardcode @@ -314,12 +314,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) /* force parsing as several audio frames can be in one packet */ if (xan_video) - st->codec.codec_id = CODEC_ID_XAN_DPCM; + st->codec->codec_id = CODEC_ID_XAN_DPCM; break; default: - st->codec.codec_type = CODEC_TYPE_DATA; - st->codec.codec_id= CODEC_ID_NONE; - st->codec.codec_tag= 0; + st->codec->codec_type = CODEC_TYPE_DATA; + st->codec->codec_id= CODEC_ID_NONE; + st->codec->codec_tag= 0; url_fskip(pb, size); break; } @@ -337,7 +337,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if (stream_index != s->nb_streams - 1) { fail: for(i=0;i<s->nb_streams;i++) { - av_freep(&s->streams[i]->codec.extradata); + av_freep(&s->streams[i]->codec->extradata); av_freep(&s->streams[i]); } return -1; @@ -440,7 +440,7 @@ resync: //av_log(NULL, AV_LOG_DEBUG, "dts:%Ld offset:%d %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, n, size); pkt->stream_index = avi->stream_index; - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { if(st->index_entries){ AVIndexEntry *e; int index; @@ -580,9 +580,9 @@ resync: g = get_byte(pb); b = get_byte(pb); get_byte(pb); - st->codec.palctrl->palette[k] = b + (g << 8) + (r << 16); + st->codec->palctrl->palette[k] = b + (g << 8) + (r << 16); } - st->codec.palctrl->palette_changed = 1; + st->codec->palctrl->palette_changed = 1; goto resync; } @@ -786,8 +786,8 @@ static int avi_read_close(AVFormatContext *s) AVStream *st = s->streams[i]; AVIStream *ast = st->priv_data; av_free(ast); - av_free(st->codec.extradata); - av_free(st->codec.palctrl); + av_free(st->codec->extradata); + av_free(st->codec->palctrl); } if (avi->dv_demux) |