Mercurial > libavformat.hg
changeset 820:feca73904e67 libavformat
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
author | michael |
---|---|
date | Sun, 17 Jul 2005 22:24:36 +0000 |
parents | a6c035e7f429 |
children | 92dfb26763e4 |
files | 4xm.c amr.c asf-enc.c asf.c au.c audio.c avformat.h avidec.c avienc.c dv.c electronicarts.c ffm.c flic.c flvdec.c flvenc.c gif.c gifdec.c grab.c idcin.c idroq.c img.c img2.c ipmovie.c matroska.c mmf.c mov.c movenc.c mp3.c mpeg.c mpegts.c mpegtsenc.c nsvdec.c nut.c ogg.c ogg2.c oggparseflac.c oggparsetheora.c oggparsevorbis.c psxstr.c raw.c rm.c rtp.c rtsp.c segafilm.c sierravmd.c sol.c swf.c utils.c wav.c wc3movie.c westwood.c yuv4mpeg.c |
diffstat | 52 files changed, 849 insertions(+), 850 deletions(-) [+] |
line wrap: on
line diff
--- a/4xm.c Sun Jul 17 00:28:12 2005 +0000 +++ b/4xm.c Sun Jul 17 22:24:36 2005 +0000 @@ -166,11 +166,11 @@ fourxm->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_4XM; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = fourxm->width; - st->codec.height = fourxm->height; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_4XM; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = fourxm->width; + st->codec->height = fourxm->height; } else if (fourcc_tag == strk_TAG) { /* check that there is enough data */ @@ -205,20 +205,20 @@ fourxm->tracks[current_track].stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_tag = 1; - st->codec.channels = fourxm->tracks[current_track].channels; - st->codec.sample_rate = fourxm->tracks[current_track].sample_rate; - st->codec.bits_per_sample = fourxm->tracks[current_track].bits; - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * - st->codec.bits_per_sample; - st->codec.block_align = st->codec.channels * st->codec.bits_per_sample; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_tag = 1; + st->codec->channels = fourxm->tracks[current_track].channels; + st->codec->sample_rate = fourxm->tracks[current_track].sample_rate; + st->codec->bits_per_sample = fourxm->tracks[current_track].bits; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_sample; + st->codec->block_align = st->codec->channels * st->codec->bits_per_sample; if (fourxm->tracks[current_track].adpcm) - st->codec.codec_id = CODEC_ID_ADPCM_4XM; - else if (st->codec.bits_per_sample == 8) - st->codec.codec_id = CODEC_ID_PCM_U8; + st->codec->codec_id = CODEC_ID_ADPCM_4XM; + else if (st->codec->bits_per_sample == 8) + st->codec->codec_id = CODEC_ID_PCM_U8; else - st->codec.codec_id = CODEC_ID_PCM_S16LE; + st->codec->codec_id = CODEC_ID_PCM_S16LE; } }
--- a/amr.c Sun Jul 17 00:28:12 2005 +0000 +++ b/amr.c Sun Jul 17 22:24:36 2005 +0000 @@ -31,7 +31,7 @@ static int amr_write_header(AVFormatContext *s) { ByteIOContext *pb = &s->pb; - AVCodecContext *enc = &s->streams[0]->codec; + AVCodecContext *enc = s->streams[0]->codec; s->priv_data = NULL; @@ -100,11 +100,11 @@ return AVERROR_NOMEM; } - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_tag = MKTAG('s', 'a', 'w', 'b'); - st->codec.codec_id = CODEC_ID_AMR_WB; - st->codec.channels = 1; - st->codec.sample_rate = 16000; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b'); + st->codec->codec_id = CODEC_ID_AMR_WB; + st->codec->channels = 1; + st->codec->sample_rate = 16000; } else { @@ -114,11 +114,11 @@ return AVERROR_NOMEM; } - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_tag = MKTAG('s', 'a', 'm', 'r'); - st->codec.codec_id = CODEC_ID_AMR_NB; - st->codec.channels = 1; - st->codec.sample_rate = 8000; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r'); + st->codec->codec_id = CODEC_ID_AMR_NB; + st->codec->channels = 1; + st->codec->sample_rate = 8000; } return 0; @@ -129,7 +129,7 @@ static int amr_read_packet(AVFormatContext *s, AVPacket *pkt) { - AVCodecContext *enc = &s->streams[0]->codec; + AVCodecContext *enc = s->streams[0]->codec; if (enc->codec_id == CODEC_ID_AMR_NB) {
--- a/asf-enc.c Sun Jul 17 00:28:12 2005 +0000 +++ b/asf-enc.c Sun Jul 17 22:24:36 2005 +0000 @@ -289,7 +289,7 @@ bit_rate = 0; for(n=0;n<s->nb_streams;n++) { - enc = &s->streams[n]->codec; + enc = s->streams[n]->codec; av_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */ @@ -353,7 +353,7 @@ int er_spr_len = 0; // ASFStream *stream = &asf->streams[n]; - enc = &s->streams[n]->codec; + enc = s->streams[n]->codec; asf->streams[n].num = n + 1; asf->streams[n].seq = 0; @@ -437,7 +437,7 @@ for(n=0;n<s->nb_streams;n++) { AVCodec *p; - enc = &s->streams[n]->codec; + enc = s->streams[n]->codec; p = avcodec_find_encoder(enc->codec_id); put_le16(pb, asf->streams[n].num); @@ -730,7 +730,7 @@ int64_t packet_st,pts; int start_sec,i; - codec = &s->streams[pkt->stream_index]->codec; + codec = s->streams[pkt->stream_index]->codec; stream = &asf->streams[pkt->stream_index]; //XXX /FIXME use duration from AVPacket (quick hack by)
--- a/asf.c Sun Jul 17 00:28:12 2005 +0000 +++ b/asf.c Sun Jul 17 22:24:36 2005 +0000 @@ -216,9 +216,9 @@ asf->asfid2avid[st->id] = s->nb_streams - 1; get_le32(pb); - st->codec.codec_type = type; + st->codec->codec_type = type; if (type == CODEC_TYPE_AUDIO) { - get_wav_header(pb, &st->codec, type_specific_size); + get_wav_header(pb, st->codec, type_specific_size); st->need_parsing = 1; /* We have to init the frame size at some point .... */ pos2 = url_ftell(pb); @@ -237,9 +237,9 @@ || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)) asf_st->ds_span = 0; // disable descrambling } - switch (st->codec.codec_id) { + switch (st->codec->codec_id) { case CODEC_ID_MP3: - st->codec.frame_size = MPA_FRAME_SIZE; + st->codec->frame_size = MPA_FRAME_SIZE; break; case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: @@ -249,11 +249,11 @@ case CODEC_ID_PCM_U8: case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_MULAW: - st->codec.frame_size = 1; + st->codec->frame_size = 1; break; default: /* This is probably wrong, but it prevents a crash later */ - st->codec.frame_size = 1; + st->codec->frame_size = 1; break; } } else { @@ -262,38 +262,38 @@ get_byte(pb); size = get_le16(pb); /* size */ sizeX= 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); /* not available for asf */ 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); url_fskip(pb, 20); // av_log(NULL, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); size= sizeX; if (size > 40) { - st->codec.extradata_size = size - 40; - st->codec.extradata = av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec.extradata, st->codec.extradata_size); + st->codec->extradata_size = size - 40; + st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } /* 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; } - st->codec.codec_tag = tag1; - st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1); + st->codec->codec_tag = tag1; + st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1); if(tag1 == MKTAG('D', 'V', 'R', ' ')) st->need_parsing = 1; } @@ -398,7 +398,7 @@ AVStream *st = s->streams[i]; if (st) { av_free(st->priv_data); - av_free(st->codec.extradata); + av_free(st->codec->extradata); } av_free(st); } @@ -608,8 +608,8 @@ asf_st->packet_pos= asf->packet_pos; //printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", //asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & PKT_FLAG_KEY, -//s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO, asf->packet_obj_size); - if (s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO) +//s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO, asf->packet_obj_size); + if (s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO) asf->packet_key_frame = 1; if (asf->packet_key_frame) asf_st->pkt.flags |= PKT_FLAG_KEY; @@ -666,8 +666,8 @@ for(i=0;i<s->nb_streams;i++) { AVStream *st = s->streams[i]; av_free(st->priv_data); - av_free(st->codec.extradata); - av_free(st->codec.palctrl); + av_free(st->codec->extradata); + av_free(st->codec->palctrl); } return 0; }
--- a/au.c Sun Jul 17 00:28:12 2005 +0000 +++ b/au.c Sun Jul 17 22:24:36 2005 +0000 @@ -63,7 +63,7 @@ s->priv_data = NULL; /* format header */ - if (put_au_header(pb, &s->streams[0]->codec) < 0) { + if (put_au_header(pb, s->streams[0]->codec) < 0) { return -1; } @@ -143,11 +143,11 @@ st = av_new_stream(s, 0); if (!st) return -1; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_tag = id; - st->codec.codec_id = codec; - st->codec.channels = channels; - st->codec.sample_rate = rate; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_tag = id; + st->codec->codec_id = codec; + st->codec->channels = channels; + st->codec->sample_rate = rate; av_set_pts_info(st, 64, 1, rate); return 0; }
--- a/audio.c Sun Jul 17 00:28:12 2005 +0000 +++ b/audio.c Sun Jul 17 22:24:36 2005 +0000 @@ -162,8 +162,8 @@ int ret; st = s1->streams[0]; - s->sample_rate = st->codec.sample_rate; - s->channels = st->codec.channels; + s->sample_rate = st->codec->sample_rate; + s->channels = st->codec->channels; ret = audio_open(s, 1, NULL); if (ret < 0) { return AVERROR_IO; @@ -234,10 +234,10 @@ } /* take real parameters */ - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = s->codec_id; - st->codec.sample_rate = s->sample_rate; - st->codec.channels = s->channels; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = s->codec_id; + st->codec->sample_rate = s->sample_rate; + st->codec->channels = s->channels; av_set_pts_info(st, 48, 1, 1000000); /* 48 bits pts in us */ return 0;
--- a/avformat.h Sun Jul 17 00:28:12 2005 +0000 +++ b/avformat.h Sun Jul 17 22:24:36 2005 +0000 @@ -5,7 +5,7 @@ extern "C" { #endif -#define LIBAVFORMAT_BUILD 4628 +#define LIBAVFORMAT_BUILD 4629 #define LIBAVFORMAT_VERSION_INT FFMPEG_VERSION_INT #define LIBAVFORMAT_VERSION FFMPEG_VERSION @@ -216,7 +216,7 @@ typedef struct AVStream { int index; /* stream index in AVFormatContext */ int id; /* format specific stream id */ - AVCodecContext codec; /* codec context */ + AVCodecContext *codec; /* codec context */ /** * real base frame rate of the stream. * for example if the timebase is 1/90000 and all frames have either
--- a/avidec.c Sun Jul 17 00:28:12 2005 +0000 +++ b/avidec.c Sun Jul 17 22:24:36 2005 +0000 @@ -178,7 +178,7 @@ 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 @@ } 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 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ //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 @@ 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 @@ 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)
--- a/avienc.c Sun Jul 17 00:28:12 2005 +0000 +++ b/avienc.c Sun Jul 17 22:24:36 2005 +0000 @@ -338,7 +338,7 @@ video_enc = NULL; for(n=0;n<s->nb_streams;n++) { - stream = &s->streams[n]->codec; + stream = s->streams[n]->codec; bitrate += stream->bit_rate; if (stream->codec_type == CODEC_TYPE_VIDEO) video_enc = stream; @@ -376,7 +376,7 @@ list2 = start_tag(pb, "LIST"); put_tag(pb, "strl"); - stream = &s->streams[i]->codec; + stream = s->streams[i]->codec; /* FourCC should really be set by the codec itself */ if (! stream->codec_tag) { @@ -504,7 +504,7 @@ for (i=0;i<s->nb_streams;i++) { offset_t ix, pos; - avi_stream2fourcc(&tag[0], i, s->streams[i]->codec.codec_type); + avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type); ix_tag[3] = '0' + i; /* Writing AVI OpenDML leaf index chunk */ @@ -576,7 +576,7 @@ } if (!empty) { avi_stream2fourcc(&tag[0], stream_id, - s->streams[stream_id]->codec.codec_type); + s->streams[stream_id]->codec->codec_type); put_tag(pb, &tag[0]); put_le32(pb, ie->flags); put_le32(pb, ie->pos); @@ -591,7 +591,7 @@ nb_frames = 0; for(n=0;n<s->nb_streams;n++) { if (avi->frames_hdr_strm[n] != 0) { - stream = &s->streams[n]->codec; + stream = s->streams[n]->codec; url_fseek(pb, avi->frames_hdr_strm[n], SEEK_SET); ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); if (au_ssize == 0) { @@ -618,7 +618,7 @@ unsigned char tag[5]; unsigned int flags=0; const int stream_index= pkt->stream_index; - AVCodecContext *enc= &s->streams[stream_index]->codec; + AVCodecContext *enc= s->streams[stream_index]->codec; int size= pkt->size; // av_log(s, AV_LOG_DEBUG, "%lld %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index); @@ -705,7 +705,7 @@ url_fskip(pb, 16); for (n=nb_frames=0;n<s->nb_streams;n++) { - AVCodecContext *stream = &s->streams[n]->codec; + AVCodecContext *stream = s->streams[n]->codec; if (stream->codec_type == CODEC_TYPE_VIDEO) { if (nb_frames < stream->frame_number) nb_frames = stream->frame_number;
--- a/dv.c Sun Jul 17 00:28:12 2005 +0000 +++ b/dv.c Sun Jul 17 22:24:36 2005 +0000 @@ -560,8 +560,8 @@ if (!c->ast[i]) break; av_set_pts_info(c->ast[i], 64, 1, 30000); - c->ast[i]->codec.codec_type = CODEC_TYPE_AUDIO; - c->ast[i]->codec.codec_id = CODEC_ID_PCM_S16LE; + c->ast[i]->codec->codec_type = CODEC_TYPE_AUDIO; + c->ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE; av_init_packet(&c->audio_pkt[i]); c->audio_pkt[i].size = 0; @@ -569,9 +569,9 @@ c->audio_pkt[i].stream_index = c->ast[i]->index; c->audio_pkt[i].flags |= PKT_FLAG_KEY; } - c->ast[i]->codec.sample_rate = dv_audio_frequency[freq]; - c->ast[i]->codec.channels = 2; - c->ast[i]->codec.bit_rate = 2 * dv_audio_frequency[freq] * 16; + c->ast[i]->codec->sample_rate = dv_audio_frequency[freq]; + c->ast[i]->codec->channels = 2; + c->ast[i]->codec->bit_rate = 2 * dv_audio_frequency[freq] * 16; c->ast[i]->start_time = 0; } c->ach = i; @@ -589,7 +589,7 @@ sys = dv_frame_profile(frame); if (sys) { - avctx = &c->vst->codec; + avctx = c->vst->codec; av_set_pts_info(c->vst, 64, sys->frame_rate_base, sys->frame_rate); avctx->time_base= (AVRational){sys->frame_rate_base, sys->frame_rate}; @@ -628,10 +628,10 @@ c->has_video = 0; } - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { /* FIXME: we have to have more sensible approach than this one */ if (c->has_video) - av_log(&st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n", c->frames); + av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n", c->frames); dv_inject_video(c, data, *frame); c->has_video = 1; @@ -642,7 +642,7 @@ reqasize = 4 * dv_audio_frame_size(c->sys, c->frames); fsize = fifo_size(&c->audio_data, c->audio_data.rptr); - if (st->codec.codec_type == CODEC_TYPE_AUDIO || (c->has_video && fsize >= reqasize)) { + if (st->codec->codec_type == CODEC_TYPE_AUDIO || (c->has_video && fsize >= reqasize)) { if (fsize + data_size >= reqasize && !c->has_audio) { if (fsize >= reqasize) { fifo_read(&c->audio_data, &pcm[0], reqasize, &c->audio_data.rptr); @@ -658,7 +658,7 @@ /* FIXME: we have to have more sensible approach than this one */ if (fifo_size(&c->audio_data, c->audio_data.rptr) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) - av_log(&st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames); + av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames); fifo_write(&c->audio_data, (uint8_t *)data, data_size, &c->audio_data.wptr); } @@ -682,7 +682,7 @@ /* We have to sort out where audio and where video stream is */ for (i=0; i<s->nb_streams; i++) { - switch (s->streams[i]->codec.codec_type) { + switch (s->streams[i]->codec->codec_type) { case CODEC_TYPE_VIDEO: vst = s->streams[i]; break; @@ -695,13 +695,13 @@ } /* Some checks -- DV format is very picky about its incoming streams */ - if (!vst || vst->codec.codec_id != CODEC_ID_DVVIDEO) + if (!vst || vst->codec->codec_id != CODEC_ID_DVVIDEO) goto bail_out; - if (ast && (ast->codec.codec_id != CODEC_ID_PCM_S16LE || - ast->codec.sample_rate != 48000 || - ast->codec.channels != 2)) + if (ast && (ast->codec->codec_id != CODEC_ID_PCM_S16LE || + ast->codec->sample_rate != 48000 || + ast->codec->channels != 2)) goto bail_out; - c->sys = dv_codec_profile(&vst->codec); + c->sys = dv_codec_profile(vst->codec); if (!c->sys) goto bail_out; @@ -711,7 +711,7 @@ c->has_video = 0; c->start_time = (time_t)s->timestamp; c->aspect = 0; /* 4:3 is the default */ - if ((int)(av_q2d(vst->codec.sample_aspect_ratio) * vst->codec.width / vst->codec.height * 10) == 17) /* 16:9 */ + if ((int)(av_q2d(vst->codec->sample_aspect_ratio) * vst->codec->width / vst->codec->height * 10) == 17) /* 16:9 */ c->aspect = 0x07; if (ast && fifo_init(&c->audio_data, 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) < 0) @@ -751,9 +751,9 @@ c->frames = 0; c->abytes = 0; - c->vst->codec.codec_type = CODEC_TYPE_VIDEO; - c->vst->codec.codec_id = CODEC_ID_DVVIDEO; - c->vst->codec.bit_rate = 25000000; + c->vst->codec->codec_type = CODEC_TYPE_VIDEO; + c->vst->codec->codec_id = CODEC_ID_DVVIDEO; + c->vst->codec->bit_rate = 25000000; c->vst->start_time = 0; return c; @@ -790,7 +790,7 @@ size = dv_extract_audio_info(c, buf); for (i=0; i<c->ach; i++) { c->audio_pkt[i].size = size; - c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec.bit_rate; + c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate; } dv_extract_audio(buf, c->audio_buf[0], c->audio_buf[1]); c->abytes += size; @@ -813,7 +813,7 @@ int64_t timestamp, int flags) { // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk) - const DVprofile* sys = dv_codec_profile(&c->vst->codec); + const DVprofile* sys = dv_codec_profile(c->vst->codec); int64_t offset; int64_t size = url_fsize(&s->pb); int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size; @@ -886,12 +886,12 @@ RawDVContext *r = s->priv_data; DVDemuxContext *c = r->dv_demux; int64_t offset= dv_frame_offset(s, c, timestamp, flags); - const DVprofile* sys = dv_codec_profile(&c->vst->codec); + const DVprofile* sys = dv_codec_profile(c->vst->codec); c->frames= offset / sys->frame_size; if (c->ach) c->abytes= av_rescale(c->frames, - c->ast[0]->codec.bit_rate * (int64_t)sys->frame_rate_base, + c->ast[0]->codec->bit_rate * (int64_t)sys->frame_rate_base, 8*sys->frame_rate); dv_flush_audio_packets(c);
--- a/electronicarts.c Sun Jul 17 00:28:12 2005 +0000 +++ b/electronicarts.c Sun Jul 17 22:24:36 2005 +0000 @@ -188,9 +188,9 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); ea->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_EA_MJPEG; - st->codec.codec_tag = 0; /* no fourcc */ + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_EA_MJPEG; + st->codec->codec_tag = 0; /* no fourcc */ #endif /* initialize the audio decoder stream */ @@ -198,15 +198,15 @@ if (!st) return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, EA_SAMPLE_RATE); - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_ADPCM_EA; - st->codec.codec_tag = 0; /* no tag */ - st->codec.channels = ea->num_channels; - st->codec.sample_rate = EA_SAMPLE_RATE; - st->codec.bits_per_sample = EA_BITS_PER_SAMPLE; - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * - st->codec.bits_per_sample / 4; - st->codec.block_align = st->codec.channels * st->codec.bits_per_sample; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_ADPCM_EA; + st->codec->codec_tag = 0; /* no tag */ + st->codec->channels = ea->num_channels; + st->codec->sample_rate = EA_SAMPLE_RATE; + st->codec->bits_per_sample = EA_BITS_PER_SAMPLE; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_sample / 4; + st->codec->block_align = st->codec->channels * st->codec->bits_per_sample; ea->audio_stream_index = st->index; ea->audio_frame_counter = 0;
--- a/ffm.c Sun Jul 17 00:28:12 2005 +0000 +++ b/ffm.c Sun Jul 17 22:24:36 2005 +0000 @@ -141,7 +141,7 @@ bit_rate = 0; for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; - bit_rate += st->codec.bit_rate; + bit_rate += st->codec->bit_rate; } put_be32(pb, bit_rate); @@ -154,7 +154,7 @@ av_set_pts_info(st, 64, 1, 1000000); st->priv_data = fst; - codec = &st->codec; + codec = st->codec; /* generic info */ put_be32(pb, codec->codec_id); put_byte(pb, codec->codec_type); @@ -247,10 +247,10 @@ int size= pkt->size; //XXX/FIXME use duration from pkt - if (st->codec.codec_type == CODEC_TYPE_AUDIO) { - duration = ((float)st->codec.frame_size / st->codec.sample_rate * 1000000.0); + if (st->codec->codec_type == CODEC_TYPE_AUDIO) { + duration = ((float)st->codec->frame_size / st->codec->sample_rate * 1000000.0); } else { - duration = (1000000.0 * st->codec.time_base.num / (float)st->codec.time_base.den); + duration = (1000000.0 * st->codec->time_base.num / (float)st->codec->time_base.den); } pts = fst->pts; @@ -485,10 +485,10 @@ st->priv_data = fst; - codec = &st->codec; + codec = st->codec; /* generic info */ - st->codec.codec_id = get_be32(pb); - st->codec.codec_type = get_byte(pb); /* codec_type */ + st->codec->codec_id = get_be32(pb); + st->codec->codec_type = get_byte(pb); /* codec_type */ codec->bit_rate = get_be32(pb); st->quality = get_be32(pb); codec->flags = get_be32(pb);
--- a/flic.c Sun Jul 17 00:28:12 2005 +0000 +++ b/flic.c Sun Jul 17 22:24:36 2005 +0000 @@ -86,19 +86,19 @@ if (!st) return AVERROR_NOMEM; flic->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_FLIC; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = LE_16(&header[0x08]); - st->codec.height = LE_16(&header[0x0A]); + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_FLIC; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = LE_16(&header[0x08]); + st->codec->height = LE_16(&header[0x0A]); - if (!st->codec.width || !st->codec.height) + if (!st->codec->width || !st->codec->height) return AVERROR_INVALIDDATA; /* send over the whole 128-byte FLIC header */ - st->codec.extradata_size = FLIC_HEADER_SIZE; - st->codec.extradata = av_malloc(FLIC_HEADER_SIZE); - memcpy(st->codec.extradata, header, FLIC_HEADER_SIZE); + st->codec->extradata_size = FLIC_HEADER_SIZE; + st->codec->extradata = av_malloc(FLIC_HEADER_SIZE); + memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE); av_set_pts_info(st, 33, 1, 90000); @@ -113,10 +113,10 @@ url_fseek(pb, 12, SEEK_SET); /* send over abbreviated FLIC header chunk */ - av_free(st->codec.extradata); - st->codec.extradata_size = 12; - st->codec.extradata = av_malloc(12); - memcpy(st->codec.extradata, header, 12); + av_free(st->codec->extradata); + st->codec->extradata_size = 12; + st->codec->extradata = av_malloc(12); + memcpy(st->codec->extradata, header, 12); } else if (magic_number == FLIC_FILE_MAGIC_1) { /*
--- a/flvdec.c Sun Jul 17 00:28:12 2005 +0000 +++ b/flvdec.c Sun Jul 17 22:24:36 2005 +0000 @@ -102,7 +102,7 @@ return AVERROR_NOMEM; av_set_pts_info(st, 24, 1, 1000); /* 24 bit pts in ms */ - st->codec.time_base= (AVRational){1,1000}; + st->codec->time_base= (AVRational){1,1000}; } // av_log(NULL, AV_LOG_DEBUG, "%d %X %d \n", is_audio, flags, st->discard); if( (st->discard >= AVDISCARD_NONKEY && !((flags >> 4)==1 || is_audio)) @@ -116,34 +116,34 @@ } if(is_audio){ - if(st->codec.sample_rate == 0){ - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.channels = (flags&1)+1; + if(st->codec->sample_rate == 0){ + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->channels = (flags&1)+1; if((flags >> 4) == 5) - st->codec.sample_rate= 8000; + st->codec->sample_rate= 8000; else - st->codec.sample_rate = (44100<<((flags>>2)&3))>>3; + st->codec->sample_rate = (44100<<((flags>>2)&3))>>3; switch(flags >> 4){/* 0: uncompressed 1: ADPCM 2: mp3 5: Nellymoser 8kHz mono 6: Nellymoser*/ - case 0: if (flags&2) st->codec.codec_id = CODEC_ID_PCM_S16BE; - else st->codec.codec_id = CODEC_ID_PCM_S8; break; - case 1: st->codec.codec_id = CODEC_ID_ADPCM_SWF; break; - case 2: st->codec.codec_id = CODEC_ID_MP3; break; + case 0: if (flags&2) st->codec->codec_id = CODEC_ID_PCM_S16BE; + else st->codec->codec_id = CODEC_ID_PCM_S8; break; + case 1: st->codec->codec_id = CODEC_ID_ADPCM_SWF; break; + case 2: st->codec->codec_id = CODEC_ID_MP3; break; // this is not listed at FLV but at SWF, strange... - case 3: if (flags&2) st->codec.codec_id = CODEC_ID_PCM_S16LE; - else st->codec.codec_id = CODEC_ID_PCM_S8; break; + case 3: if (flags&2) st->codec->codec_id = CODEC_ID_PCM_S16LE; + else st->codec->codec_id = CODEC_ID_PCM_S8; break; default: av_log(s, AV_LOG_INFO, "Unsupported audio codec (%x)\n", flags >> 4); - st->codec.codec_tag= (flags >> 4); + st->codec->codec_tag= (flags >> 4); } - st->codec.bits_per_sample = (flags & 2) ? 16 : 8; + st->codec->bits_per_sample = (flags & 2) ? 16 : 8; } }else{ - st->codec.codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_type = CODEC_TYPE_VIDEO; switch(flags & 0xF){ - case 2: st->codec.codec_id = CODEC_ID_FLV1; break; + case 2: st->codec->codec_id = CODEC_ID_FLV1; break; default: av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flags & 0xf); - st->codec.codec_tag= flags & 0xF; + st->codec->codec_tag= flags & 0xF; } }
--- a/flvenc.c Sun Jul 17 00:28:12 2005 +0000 +++ b/flvenc.c Sun Jul 17 22:24:36 2005 +0000 @@ -97,7 +97,7 @@ put_be32(pb,0); for(i=0; i<s->nb_streams; i++){ - AVCodecContext *enc = &s->streams[i]->codec; + AVCodecContext *enc = s->streams[i]->codec; av_set_pts_info(s->streams[i], 24, 1, 1000); /* 24 bit pts in ms */ if(enc->codec_tag == 5){ put_byte(pb,8); // message type @@ -134,7 +134,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) { ByteIOContext *pb = &s->pb; - AVCodecContext *enc = &s->streams[pkt->stream_index]->codec; + AVCodecContext *enc = s->streams[pkt->stream_index]->codec; FLVContext *flv = s->priv_data; int size= pkt->size; int flags;
--- a/gif.c Sun Jul 17 00:28:12 2005 +0000 +++ b/gif.c Sun Jul 17 22:24:36 2005 +0000 @@ -327,7 +327,7 @@ video_enc = NULL; for(i=0;i<s->nb_streams;i++) { - enc = &s->streams[i]->codec; + enc = s->streams[i]->codec; if (enc->codec_type != CODEC_TYPE_AUDIO) video_enc = enc; } @@ -388,7 +388,7 @@ static int gif_write_packet(AVFormatContext *s, AVPacket *pkt) { - AVCodecContext *codec = &s->streams[pkt->stream_index]->codec; + AVCodecContext *codec = s->streams[pkt->stream_index]->codec; if (codec->codec_type == CODEC_TYPE_AUDIO) return 0; /* just ignore audio */ else
--- a/gifdec.c Sun Jul 17 00:28:12 2005 +0000 +++ b/gifdec.c Sun Jul 17 22:24:36 2005 +0000 @@ -555,14 +555,14 @@ if (!st) return -1; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_RAWVIDEO; - st->codec.time_base.den = 5; - st->codec.time_base.num = 1; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_RAWVIDEO; + st->codec->time_base.den = 5; + st->codec->time_base.num = 1; /* XXX: check if screen size is always valid */ - st->codec.width = s->screen_width; - st->codec.height = s->screen_height; - st->codec.pix_fmt = PIX_FMT_RGB24; + st->codec->width = s->screen_width; + st->codec->height = s->screen_height; + st->codec->pix_fmt = PIX_FMT_RGB24; return 0; }
--- a/grab.c Sun Jul 17 00:28:12 2005 +0000 +++ b/grab.c Sun Jul 17 22:24:36 2005 +0000 @@ -109,11 +109,11 @@ } desired_palette = -1; - if (st->codec.pix_fmt == PIX_FMT_YUV420P) { + if (st->codec->pix_fmt == PIX_FMT_YUV420P) { desired_palette = VIDEO_PALETTE_YUV420P; - } else if (st->codec.pix_fmt == PIX_FMT_YUV422) { + } else if (st->codec->pix_fmt == PIX_FMT_YUV422) { desired_palette = VIDEO_PALETTE_YUV422; - } else if (st->codec.pix_fmt == PIX_FMT_BGR24) { + } else if (st->codec->pix_fmt == PIX_FMT_BGR24) { desired_palette = VIDEO_PALETTE_RGB24; } @@ -245,15 +245,15 @@ switch(s->frame_format) { case VIDEO_PALETTE_YUV420P: frame_size = (width * height * 3) / 2; - st->codec.pix_fmt = PIX_FMT_YUV420P; + st->codec->pix_fmt = PIX_FMT_YUV420P; break; case VIDEO_PALETTE_YUV422: frame_size = width * height * 2; - st->codec.pix_fmt = PIX_FMT_YUV422; + st->codec->pix_fmt = PIX_FMT_YUV422; break; case VIDEO_PALETTE_RGB24: frame_size = width * height * 3; - st->codec.pix_fmt = PIX_FMT_BGR24; /* NOTE: v4l uses BGR24, not RGB24 ! */ + st->codec->pix_fmt = PIX_FMT_BGR24; /* NOTE: v4l uses BGR24, not RGB24 ! */ break; default: goto fail; @@ -261,12 +261,12 @@ s->fd = video_fd; s->frame_size = frame_size; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_RAWVIDEO; - st->codec.width = width; - st->codec.height = height; - st->codec.time_base.den = frame_rate; - st->codec.time_base.num = frame_rate_base; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_RAWVIDEO; + st->codec->width = width; + st->codec->height = height; + st->codec->time_base.den = frame_rate; + st->codec->time_base.num = frame_rate_base; return 0; fail:
--- a/idcin.c Sun Jul 17 00:28:12 2005 +0000 +++ b/idcin.c Sun Jul 17 22:24:36 2005 +0000 @@ -156,20 +156,20 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); idcin->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_IDCIN; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = width; - st->codec.height = height; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_IDCIN; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = width; + st->codec->height = height; /* load up the Huffman tables into extradata */ - st->codec.extradata_size = HUFFMAN_TABLE_SIZE; - st->codec.extradata = av_malloc(HUFFMAN_TABLE_SIZE); - if (get_buffer(pb, st->codec.extradata, HUFFMAN_TABLE_SIZE) != + st->codec->extradata_size = HUFFMAN_TABLE_SIZE; + st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE); + if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) return AVERROR_IO; /* save a reference in order to transport the palette */ - st->codec.palctrl = &idcin->palctrl; + st->codec->palctrl = &idcin->palctrl; /* if sample rate is 0, assume no audio */ if (sample_rate) { @@ -179,17 +179,17 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); idcin->audio_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_tag = 1; - st->codec.channels = channels; - st->codec.sample_rate = sample_rate; - st->codec.bits_per_sample = bytes_per_sample * 8; - st->codec.bit_rate = sample_rate * bytes_per_sample * 8 * channels; - st->codec.block_align = bytes_per_sample * channels; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_tag = 1; + st->codec->channels = channels; + st->codec->sample_rate = sample_rate; + st->codec->bits_per_sample = bytes_per_sample * 8; + st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels; + st->codec->block_align = bytes_per_sample * channels; if (bytes_per_sample == 1) - st->codec.codec_id = CODEC_ID_PCM_U8; + st->codec->codec_id = CODEC_ID_PCM_U8; else - st->codec.codec_id = CODEC_ID_PCM_S16LE; + st->codec->codec_id = CODEC_ID_PCM_S16LE; if (sample_rate % 14 != 0) { idcin->audio_chunk_size1 = (sample_rate / 14) *
--- a/idroq.c Sun Jul 17 00:28:12 2005 +0000 +++ b/idroq.c Sun Jul 17 22:24:36 2005 +0000 @@ -145,11 +145,11 @@ /* set the pts reference (1 pts = 1/90000) */ av_set_pts_info(st, 33, 1, 90000); roq->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_ROQ; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = roq->width; - st->codec.height = roq->height; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_ROQ; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = roq->width; + st->codec->height = roq->height; if (roq->audio_channels) { st = av_new_stream(s, 0); @@ -157,15 +157,15 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); roq->audio_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_ROQ_DPCM; - st->codec.codec_tag = 0; /* no tag */ - st->codec.channels = roq->audio_channels; - st->codec.sample_rate = RoQ_AUDIO_SAMPLE_RATE; - st->codec.bits_per_sample = 16; - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * - st->codec.bits_per_sample; - st->codec.block_align = st->codec.channels * st->codec.bits_per_sample; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_ROQ_DPCM; + st->codec->codec_tag = 0; /* no tag */ + st->codec->channels = roq->audio_channels; + st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE; + st->codec->bits_per_sample = 16; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_sample; + st->codec->block_align = st->codec->channels * st->codec->bits_per_sample; } return 0;
--- a/img.c Sun Jul 17 00:28:12 2005 +0000 +++ b/img.c Sun Jul 17 22:24:36 2005 +0000 @@ -134,9 +134,9 @@ s->is_pipe = 1; if (!ap || !ap->time_base.num) { - st->codec.time_base= (AVRational){1,25}; + st->codec->time_base= (AVRational){1,25}; } else { - st->codec.time_base= ap->time_base; + st->codec->time_base= ap->time_base; } if (!s->is_pipe) { @@ -166,11 +166,11 @@ url_fseek(f, 0, SEEK_SET); } - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_RAWVIDEO; - st->codec.width = s->width; - st->codec.height = s->height; - st->codec.pix_fmt = s->pix_fmt; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_RAWVIDEO; + st->codec->width = s->width; + st->codec->height = s->height; + st->codec->pix_fmt = s->pix_fmt; s->img_size = avpicture_get_size(s->pix_fmt, (s->width+15)&(~15), (s->height+15)&(~15)); return 0; @@ -232,7 +232,7 @@ } else { /* XXX: computing this pts is not necessary as it is done in the generic code too */ - pkt->pts = av_rescale((int64_t)s->img_count * s1->streams[0]->codec.time_base.num, s1->streams[0]->time_base.den, s1->streams[0]->codec.time_base.den) / s1->streams[0]->time_base.num; + pkt->pts = av_rescale((int64_t)s->img_count * s1->streams[0]->codec->time_base.num, s1->streams[0]->time_base.den, s1->streams[0]->codec->time_base.den) / s1->streams[0]->time_base.num; s->img_count++; s->img_number++; return 0; @@ -276,7 +276,7 @@ return -1; img->img_fmt = img_fmt; img->pix_fmt = i; - st->codec.pix_fmt = img->pix_fmt; + st->codec->pix_fmt = img->pix_fmt; return 0; } @@ -306,8 +306,8 @@ char filename[1024]; AVImageInfo info; - width = st->codec.width; - height = st->codec.height; + width = st->codec->width; + height = st->codec->height; picture = (AVPicture *)pkt->data; @@ -323,7 +323,7 @@ } info.width = width; info.height = height; - info.pix_fmt = st->codec.pix_fmt; + info.pix_fmt = st->codec->pix_fmt; info.interleaved = 0; /* FIXME: there should be a way to set it right */ info.pict = *picture; ret = av_write_image(pb, img->img_fmt, &info);
--- a/img2.c Sun Jul 17 00:28:12 2005 +0000 +++ b/img2.c Sun Jul 17 22:24:36 2005 +0000 @@ -193,8 +193,8 @@ } if(ap && ap->width && ap->height){ - st->codec.width = ap->width; - st->codec.height= ap->height; + st->codec->width = ap->width; + st->codec->height= ap->height; } if (!s->is_pipe) { @@ -209,17 +209,17 @@ } if(ap->video_codec_id){ - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = ap->video_codec_id; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = ap->video_codec_id; }else if(ap->audio_codec_id){ - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = ap->audio_codec_id; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = ap->audio_codec_id; }else{ - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = av_str2id(img_tags, s->path); + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = av_str2id(img_tags, s->path); } - if(st->codec.codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE) - st->codec.pix_fmt = ap->pix_fmt; + if(st->codec->codec_type == CODEC_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE) + st->codec->pix_fmt = ap->pix_fmt; return 0; } @@ -231,7 +231,7 @@ int i; int size[3]={0}, ret[3]={0}; ByteIOContext f1[3], *f[3]= {&f1[0], &f1[1], &f1[2]}; - AVCodecContext *codec= &s1->streams[0]->codec; + AVCodecContext *codec= s1->streams[0]->codec; if (!s->is_pipe) { /* loop over input */ @@ -314,7 +314,7 @@ VideoData *img = s->priv_data; ByteIOContext pb1[3], *pb[3]= {&pb1[0], &pb1[1], &pb1[2]}; char filename[1024]; - AVCodecContext *codec= &s->streams[ pkt->stream_index ]->codec; + AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec; int i; if (!img->is_pipe) {
--- a/ipmovie.c Sun Jul 17 00:28:12 2005 +0000 +++ b/ipmovie.c Sun Jul 17 22:24:36 2005 +0000 @@ -554,14 +554,14 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); ipmovie->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_INTERPLAY_VIDEO; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = ipmovie->video_width; - st->codec.height = ipmovie->video_height; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_INTERPLAY_VIDEO; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = ipmovie->video_width; + st->codec->height = ipmovie->video_height; /* palette considerations */ - st->codec.palctrl = &ipmovie->palette_control; + st->codec->palctrl = &ipmovie->palette_control; if (ipmovie->audio_type) { st = av_new_stream(s, 0); @@ -569,17 +569,17 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); ipmovie->audio_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = ipmovie->audio_type; - st->codec.codec_tag = 0; /* no tag */ - st->codec.channels = ipmovie->audio_channels; - st->codec.sample_rate = ipmovie->audio_sample_rate; - st->codec.bits_per_sample = ipmovie->audio_bits; - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * - st->codec.bits_per_sample; - if (st->codec.codec_id == CODEC_ID_INTERPLAY_DPCM) - st->codec.bit_rate /= 2; - st->codec.block_align = st->codec.channels * st->codec.bits_per_sample; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = ipmovie->audio_type; + st->codec->codec_tag = 0; /* no tag */ + st->codec->channels = ipmovie->audio_channels; + st->codec->sample_rate = ipmovie->audio_sample_rate; + st->codec->bits_per_sample = ipmovie->audio_bits; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_sample; + if (st->codec->codec_id == CODEC_ID_INTERPLAY_DPCM) + st->codec->bit_rate /= 2; + st->codec->block_align = st->codec->channels * st->codec->bits_per_sample; } return 0;
--- a/matroska.c Sun Jul 17 00:28:12 2005 +0000 +++ b/matroska.c Sun Jul 17 22:24:36 2005 +0000 @@ -2273,46 +2273,46 @@ return AVERROR_NOMEM; av_set_pts_info(st, 24, 1, 1000); /* 24 bit pts in ms */ - st->codec.codec_id = codec_id; + st->codec->codec_id = codec_id; if(extradata){ - st->codec.extradata = extradata; - st->codec.extradata_size = extradata_size; + st->codec->extradata = extradata; + st->codec->extradata_size = extradata_size; } else if(track->codec_priv && track->codec_priv_size > 0){ - st->codec.extradata = av_malloc(track->codec_priv_size); - if(st->codec.extradata == NULL) + st->codec->extradata = av_malloc(track->codec_priv_size); + if(st->codec->extradata == NULL) return AVERROR_NOMEM; - st->codec.extradata_size = track->codec_priv_size; - memcpy(st->codec.extradata, track->codec_priv, + st->codec->extradata_size = track->codec_priv_size; + memcpy(st->codec->extradata, track->codec_priv, track->codec_priv_size); } if (track->type == MATROSKA_TRACK_TYPE_VIDEO) { MatroskaVideoTrack *videotrack = (MatroskaVideoTrack *)track; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_tag = videotrack->fourcc; - st->codec.width = videotrack->pixel_width; - st->codec.height = videotrack->pixel_height; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_tag = videotrack->fourcc; + st->codec->width = videotrack->pixel_width; + st->codec->height = videotrack->pixel_height; if (videotrack->display_width == 0) - st->codec.sample_aspect_ratio.num = + st->codec->sample_aspect_ratio.num = videotrack->pixel_width; else - st->codec.sample_aspect_ratio.num = + st->codec->sample_aspect_ratio.num = videotrack->display_width; if (videotrack->display_height == 0) - st->codec.sample_aspect_ratio.num = + st->codec->sample_aspect_ratio.num = videotrack->pixel_height; else - st->codec.sample_aspect_ratio.num = + st->codec->sample_aspect_ratio.num = videotrack->display_height; } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) { MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *)track; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.sample_rate = audiotrack->samplerate; - st->codec.channels = audiotrack->channels; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->sample_rate = audiotrack->samplerate; + st->codec->channels = audiotrack->channels; } /* What do we do with private data? E.g. for Vorbis. */ @@ -2700,7 +2700,7 @@ } for (n = 0; n < s->nb_streams; n++) { - av_free(s->streams[n]->codec.extradata); + av_free(s->streams[n]->codec->extradata); } memset(matroska, 0, sizeof(MatroskaDemuxContext));
--- a/mmf.c Sun Jul 17 00:28:12 2005 +0000 +++ b/mmf.c Sun Jul 17 22:24:36 2005 +0000 @@ -61,9 +61,9 @@ offset_t pos; int rate; - rate = mmf_rate_code(s->streams[0]->codec.sample_rate); + rate = mmf_rate_code(s->streams[0]->codec->sample_rate); if(rate < 0) { - av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec.sample_rate); + av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec->sample_rate); return -1; } @@ -96,7 +96,7 @@ mmf->awapos = start_tag(pb, "Awa\x01"); - av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec.sample_rate); + av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); put_flush_packet(pb); @@ -144,7 +144,7 @@ /* "play wav" */ put_byte(pb, 0); /* start time */ put_byte(pb, 1); /* (channel << 6) | wavenum */ - gatetime = size * 500 / s->streams[0]->codec.sample_rate; + gatetime = size * 500 / s->streams[0]->codec->sample_rate; put_varlength(pb, gatetime); /* duration */ /* "nop" */ @@ -239,14 +239,14 @@ if (!st) return AVERROR_NOMEM; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_ADPCM_YAMAHA; - st->codec.sample_rate = rate; - st->codec.channels = 1; - st->codec.bits_per_sample = 4; - st->codec.bit_rate = st->codec.sample_rate * st->codec.bits_per_sample; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_ADPCM_YAMAHA; + st->codec->sample_rate = rate; + st->codec->channels = 1; + st->codec->bits_per_sample = 4; + st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_sample; - av_set_pts_info(st, 64, 1, st->codec.sample_rate); + av_set_pts_info(st, 64, 1, st->codec->sample_rate); return 0; }
--- a/mov.c Sun Jul 17 00:28:12 2005 +0000 +++ b/mov.c Sun Jul 17 22:24:36 2005 +0000 @@ -481,16 +481,16 @@ /* helps parsing the string hereafter... */ c->mp4 = 0; if(type == MKTAG('v', 'i', 'd', 'e')) - st->codec.codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_type = CODEC_TYPE_VIDEO; else if(type == MKTAG('s', 'o', 'u', 'n')) - st->codec.codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_type = CODEC_TYPE_AUDIO; } else if(ctype == 0) { /* MP4 */ /* helps parsing the string hereafter... */ c->mp4 = 1; if(type == MKTAG('v', 'i', 'd', 'e')) - st->codec.codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_type = CODEC_TYPE_VIDEO; else if(type == MKTAG('s', 'o', 'u', 'n')) - st->codec.codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_type = CODEC_TYPE_AUDIO; } get_be32(pb); /* component manufacture */ get_be32(pb); /* component flags */ @@ -591,10 +591,10 @@ #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "Specific MPEG4 header len=%d\n", len); #endif - st->codec.extradata = (uint8_t*) av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); - if (st->codec.extradata) { - get_buffer(pb, st->codec.extradata, len); - st->codec.extradata_size = len; + st->codec->extradata = (uint8_t*) av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); + if (st->codec->extradata) { + get_buffer(pb, st->codec->extradata, len); + st->codec->extradata_size = len; } } } @@ -703,14 +703,14 @@ // currently SVQ3 decoder expect full STSD header - so let's fake it // this should be fixed and just SMI header should be passed - av_free(st->codec.extradata); - st->codec.extradata_size = 0x5a + atom.size; - st->codec.extradata = (uint8_t*) av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + av_free(st->codec->extradata); + st->codec->extradata_size = 0x5a + atom.size; + st->codec->extradata = (uint8_t*) av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (st->codec.extradata) { - strcpy(st->codec.extradata, "SVQ3"); // fake - get_buffer(pb, st->codec.extradata + 0x5a, atom.size); - //av_log(NULL, AV_LOG_DEBUG, "Reading SMI %Ld %s\n", atom.size, (char*)st->codec.extradata + 0x5a); + if (st->codec->extradata) { + strcpy(st->codec->extradata, "SVQ3"); // fake + get_buffer(pb, st->codec->extradata + 0x5a, atom.size); + //av_log(NULL, AV_LOG_DEBUG, "Reading SMI %Ld %s\n", atom.size, (char*)st->codec->extradata + 0x5a); } else url_fskip(pb, atom.size); @@ -724,13 +724,13 @@ if((uint64_t)atom.size > (1<<30)) return -1; - av_free(st->codec.extradata); + av_free(st->codec->extradata); - st->codec.extradata_size = atom.size; - st->codec.extradata = (uint8_t*) av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata_size = atom.size; + st->codec->extradata = (uint8_t*) av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (st->codec.extradata) { - get_buffer(pb, st->codec.extradata, atom.size); + if (st->codec->extradata) { + get_buffer(pb, st->codec->extradata, atom.size); } else url_fskip(pb, atom.size); @@ -829,7 +829,7 @@ AVCodec *codec; codec = avcodec_find_decoder(id); if (codec) - st->codec.codec_type = codec->type; + st->codec->codec_type = codec->type; } #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "size=%d 4CC= %c%c%c%c codec_type=%d\n", @@ -838,23 +838,23 @@ (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff, - st->codec.codec_type); + st->codec->codec_type); #endif - st->codec.codec_tag = format; - if(st->codec.codec_type==CODEC_TYPE_VIDEO) { + st->codec->codec_tag = format; + if(st->codec->codec_type==CODEC_TYPE_VIDEO) { MOV_atom_t a = { 0, 0, 0 }; - st->codec.codec_id = id; + st->codec->codec_id = id; get_be16(pb); /* version */ get_be16(pb); /* revision level */ get_be32(pb); /* vendor */ get_be32(pb); /* temporal quality */ get_be32(pb); /* spacial quality */ - if(st->codec.codec_id == CODEC_ID_MPEG4){ //FIXME this is silly + if(st->codec->codec_id == CODEC_ID_MPEG4){ //FIXME this is silly get_be16(pb); get_be16(pb); }else{ - st->codec.width = get_be16(pb); /* width */ - st->codec.height = get_be16(pb); /* height */ + st->codec->width = get_be16(pb); /* width */ + st->codec->height = get_be16(pb); /* height */ } get_be32(pb); /* horiz resolution */ get_be32(pb); /* vert resolution */ @@ -865,16 +865,16 @@ #endif get_buffer(pb, codec_name, 32); /* codec name, pascal string (FIXME: true for mp4?) */ if (codec_name[0] <= 31) { - memcpy(st->codec.codec_name, &codec_name[1],codec_name[0]); - st->codec.codec_name[codec_name[0]] = 0; + memcpy(st->codec->codec_name, &codec_name[1],codec_name[0]); + st->codec->codec_name[codec_name[0]] = 0; } - st->codec.bits_per_sample = get_be16(pb); /* depth */ - st->codec.color_table_id = get_be16(pb); /* colortable id */ + st->codec->bits_per_sample = get_be16(pb); /* depth */ + st->codec->color_table_id = get_be16(pb); /* colortable id */ /* These are set in mov_read_stts and might already be set! - st->codec.time_base.den = 25; - st->codec.time_base.num = 1; + st->codec->time_base.den = 25; + st->codec->time_base.num = 1; */ size -= (16+8*4+2+32+2*2); #if 0 @@ -948,8 +948,8 @@ #else /* figure out the palette situation */ - color_depth = st->codec.bits_per_sample & 0x1F; - color_greyscale = st->codec.bits_per_sample & 0x20; + color_depth = st->codec->bits_per_sample & 0x1F; + color_greyscale = st->codec->bits_per_sample & 0x20; /* if the depth is 2, 4, or 8 bpp, file is palettized */ if ((color_depth == 2) || (color_depth == 4) || @@ -970,7 +970,7 @@ color_index = 0; } - } else if (st->codec.color_table_id & 0x08) { + } else if (st->codec->color_table_id & 0x08) { /* if flag bit 3 is set, use the default palette */ color_count = 1 << color_depth; @@ -1012,17 +1012,17 @@ } } - st->codec.palctrl = &c->palette_control; - st->codec.palctrl->palette_changed = 1; + st->codec->palctrl = &c->palette_control; + st->codec->palctrl->palette_changed = 1; } else - st->codec.palctrl = NULL; + st->codec->palctrl = NULL; a.size = size; mov_read_default(c, pb, a); #endif } else { - st->codec.codec_id = codec_get_id(mov_audio_tags, format); - if(st->codec.codec_id==CODEC_ID_AMR_NB || st->codec.codec_id==CODEC_ID_AMR_WB) //from TS26.244 + st->codec->codec_id = codec_get_id(mov_audio_tags, format); + if(st->codec->codec_id==CODEC_ID_AMR_NB || st->codec->codec_id==CODEC_ID_AMR_WB) //from TS26.244 { #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "AMR-NB or AMR-WB audio identified!!\n"); @@ -1045,21 +1045,21 @@ get_byte(pb); //frames_per_sample st->duration = AV_NOPTS_VALUE;//Not possible to get from this info, must count number of AMR frames - if(st->codec.codec_id==CODEC_ID_AMR_NB) + if(st->codec->codec_id==CODEC_ID_AMR_NB) { - st->codec.sample_rate=8000; - st->codec.channels=1; + st->codec->sample_rate=8000; + st->codec->channels=1; } else //AMR-WB { - st->codec.sample_rate=16000; - st->codec.channels=1; + st->codec->sample_rate=16000; + st->codec->channels=1; } - st->codec.bits_per_sample=16; - st->codec.bit_rate=0; /*It is not possible to tell this before we have + st->codec->bits_per_sample=16; + st->codec->bit_rate=0; /*It is not possible to tell this before we have an audio frame and even then every frame can be different*/ } - else if( st->codec.codec_tag == MKTAG( 'm', 'p', '4', 's' )) + else if( st->codec->codec_tag == MKTAG( 'm', 'p', '4', 's' )) { //This is some stuff for the hint track, lets ignore it! //Do some mp4 auto detect. @@ -1067,7 +1067,7 @@ size-=(16); url_fskip(pb, size); /* The mp4s atom also contians a esds atom that we can skip*/ } - else if( st->codec.codec_tag == MKTAG( 'm', 'p', '4', 'a' )) + else if( st->codec->codec_tag == MKTAG( 'm', 'p', '4', 'a' )) { MOV_atom_t a; int mp4_version; @@ -1076,10 +1076,10 @@ mp4_version=get_be16(pb);/*version*/ get_be16(pb); /*revesion*/ get_be32(pb); - st->codec.channels = get_be16(pb); /* channels */ - st->codec.bits_per_sample = get_be16(pb); /* bits per sample */ + st->codec->channels = get_be16(pb); /* channels */ + st->codec->bits_per_sample = get_be16(pb); /* bits per sample */ get_be32(pb); - st->codec.sample_rate = get_be16(pb); /* sample rate, not always correct */ + st->codec->sample_rate = get_be16(pb); /* sample rate, not always correct */ get_be16(pb); c->mp4=1; @@ -1096,35 +1096,35 @@ mov_read_default(c, pb, a); /* Get correct sample rate from extradata */ - if(st->codec.extradata_size) { + if(st->codec->extradata_size) { const int samplerate_table[] = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, 0, 0, 0 }; - unsigned char *px = st->codec.extradata; + unsigned char *px = st->codec->extradata; // 5 bits objectTypeIndex, 4 bits sampleRateIndex, 4 bits channels int samplerate_index = ((px[0] & 7) << 1) + ((px[1] >> 7) & 1); - st->codec.sample_rate = samplerate_table[samplerate_index]; - st->codec.channels = (px[1] >> 3) & 15; + st->codec->sample_rate = samplerate_table[samplerate_index]; + st->codec->channels = (px[1] >> 3) & 15; } } - else if( st->codec.codec_tag == MKTAG( 'a', 'l', 'a', 'c' )) + else if( st->codec->codec_tag == MKTAG( 'a', 'l', 'a', 'c' )) { /* Handle alac audio tag + special extradata */ get_be32(pb); /* version */ get_be32(pb); - st->codec.channels = get_be16(pb); /* channels */ - st->codec.bits_per_sample = get_be16(pb); /* bits per sample */ + st->codec->channels = get_be16(pb); /* channels */ + st->codec->bits_per_sample = get_be16(pb); /* bits per sample */ get_be32(pb); - st->codec.sample_rate = get_be16(pb); + st->codec->sample_rate = get_be16(pb); get_be16(pb); /* fetch the 36-byte extradata needed for alac decoding */ - st->codec.extradata_size = 36; - st->codec.extradata = (uint8_t*) - av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(pb, st->codec.extradata, st->codec.extradata_size); + st->codec->extradata_size = 36; + st->codec->extradata = (uint8_t*) + av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } else if(size>=(16+20)) {//16 bytes read, reading atleast 20 more @@ -1136,23 +1136,23 @@ get_be16(pb); /* revision level */ get_be32(pb); /* vendor */ - st->codec.channels = get_be16(pb); /* channel count */ - st->codec.bits_per_sample = get_be16(pb); /* sample size */ + st->codec->channels = get_be16(pb); /* channel count */ + st->codec->bits_per_sample = get_be16(pb); /* sample size */ /* handle specific s8 codec */ get_be16(pb); /* compression id = 0*/ get_be16(pb); /* packet size = 0 */ - st->codec.sample_rate = ((get_be32(pb) >> 16)); - //av_log(NULL, AV_LOG_DEBUG, "CODECID %d %d %.4s\n", st->codec.codec_id, CODEC_ID_PCM_S16BE, (char*)&format); + st->codec->sample_rate = ((get_be32(pb) >> 16)); + //av_log(NULL, AV_LOG_DEBUG, "CODECID %d %d %.4s\n", st->codec->codec_id, CODEC_ID_PCM_S16BE, (char*)&format); - switch (st->codec.codec_id) { + switch (st->codec->codec_id) { case CODEC_ID_PCM_S16BE: - if (st->codec.bits_per_sample == 8) - st->codec.codec_id = CODEC_ID_PCM_S8; + if (st->codec->bits_per_sample == 8) + st->codec->codec_id = CODEC_ID_PCM_S8; /* fall */ case CODEC_ID_PCM_U8: - st->codec.bit_rate = st->codec.sample_rate * 8; + st->codec->bit_rate = st->codec->sample_rate * 8; break; default: ; @@ -1348,8 +1348,8 @@ } av_set_pts_info(st, 64, 1, c->streams[c->fc->nb_streams-1]->time_scale); -// st->codec.time_base.num = 1; -// st->codec.time_base.den = c->streams[c->fc->nb_streams-1]->time_scale; +// st->codec->time_base.num = 1; +// st->codec->time_base.den = c->streams[c->fc->nb_streams-1]->time_scale; st->nb_frames= total_sample_count; if(duration) st->duration= duration; @@ -1400,7 +1400,7 @@ sc->sample_to_chunk_index = -1; st->priv_data = sc; - st->codec.codec_type = CODEC_TYPE_MOV_OTHER; + st->codec->codec_type = CODEC_TYPE_MOV_OTHER; st->start_time = 0; /* XXX: check */ c->streams[c->fc->nb_streams-1] = sc; @@ -1443,8 +1443,8 @@ url_fskip(pb, 36); /* display matrix */ /* those are fixed-point */ - /*st->codec.width =*/ get_be32(pb) >> 16; /* track width */ - /*st->codec.height =*/ get_be32(pb) >> 16; /* track height */ + /*st->codec->width =*/ get_be32(pb) >> 16; /* track width */ + /*st->codec->height =*/ get_be32(pb) >> 16; /* track height */ return 0; } @@ -1755,7 +1755,7 @@ #if 1 for(i=0; i<s->nb_streams;) { - if(s->streams[i]->codec.codec_type == CODEC_TYPE_MOV_OTHER) {/* not audio, not video, delete */ + if(s->streams[i]->codec->codec_type == CODEC_TYPE_MOV_OTHER) {/* not audio, not video, delete */ av_free(s->streams[i]); for(j=i+1; j<s->nb_streams; j++) s->streams[j-1] = s->streams[j]; @@ -1894,7 +1894,7 @@ { // I can't figure out why for PCM audio sample_size is always 1 // (it should actually be channels*bits_per_second/8) but it is. - AVCodecContext* cod = &s->streams[sc->ffindex]->codec; + AVCodecContext* cod = s->streams[sc->ffindex]->codec; if (sc->sample_size == 1 && (cod->codec_id == CODEC_ID_PCM_S16BE || cod->codec_id == CODEC_ID_PCM_S16LE)) foundsize=(sc->sample_to_chunk[i].count*cod->channels*cod->bits_per_sample)/8; else
--- a/movenc.c Sun Jul 17 00:28:12 2005 +0000 +++ b/movenc.c Sun Jul 17 22:24:36 2005 +0000 @@ -1256,11 +1256,11 @@ static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s) { - int AudioRate = s->streams[1]->codec.sample_rate; - int FrameRate = ((s->streams[0]->codec.time_base.den) * (0x10000))/ (s->streams[0]->codec.time_base.num); + int AudioRate = s->streams[1]->codec->sample_rate; + int FrameRate = ((s->streams[0]->codec->time_base.den) * (0x10000))/ (s->streams[0]->codec->time_base.num); //printf("audiorate = %d\n",AudioRate); - //printf("framerate = %d / %d = 0x%x\n",s->streams[0]->codec.time_base.den,s->streams[0]->codec.time_base.num,FrameRate); + //printf("framerate = %d / %d = 0x%x\n",s->streams[0]->codec->time_base.den,s->streams[0]->codec->time_base.num,FrameRate); put_be32(pb, 0x94 ); /* size */ put_tag(pb, "uuid"); @@ -1302,8 +1302,8 @@ put_be32(pb, 0xc0 ); put_be32(pb, FrameRate); // was 0xefc29 put_be32(pb, FrameRate ); // was 0xefc29 - put_be16(pb, s->streams[0]->codec.width); - put_be16(pb, s->streams[0]->codec.height); + put_be16(pb, s->streams[0]->codec->width); + put_be16(pb, s->streams[0]->codec->height); put_be32(pb, 0x010001 ); } @@ -1314,7 +1314,7 @@ int i; for(i=0; i<s->nb_streams; i++){ - AVCodecContext *c= &s->streams[i]->codec; + AVCodecContext *c= s->streams[i]->codec; if (c->codec_type == CODEC_TYPE_VIDEO){ if (!codec_get_tag(codec_movvideo_tags, c->codec_id)){ @@ -1367,7 +1367,7 @@ { MOVContext *mov = s->priv_data; ByteIOContext *pb = &s->pb; - AVCodecContext *enc = &s->streams[pkt->stream_index]->codec; + AVCodecContext *enc = s->streams[pkt->stream_index]->codec; MOVTrack* trk = &mov->tracks[pkt->stream_index]; int cl, id; unsigned int samplesInChunk = 0;
--- a/mp3.c Sun Jul 17 00:28:12 2005 +0000 +++ b/mp3.c Sun Jul 17 22:24:36 2005 +0000 @@ -251,8 +251,8 @@ if (!st) return AVERROR_NOMEM; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_MP3; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_MP3; st->need_parsing = 1; /* try to get the TAG */
--- a/mpeg.c Sun Jul 17 00:28:12 2005 +0000 +++ b/mpeg.c Sun Jul 17 22:24:36 2005 +0000 @@ -360,26 +360,26 @@ av_set_pts_info(st, 64, 1, 90000); - switch(st->codec.codec_type) { + switch(st->codec->codec_type) { case CODEC_TYPE_AUDIO: - if (st->codec.codec_id == CODEC_ID_AC3) { + if (st->codec->codec_id == CODEC_ID_AC3) { stream->id = ac3_id++; - } else if (st->codec.codec_id == CODEC_ID_DTS) { + } else if (st->codec->codec_id == CODEC_ID_DTS) { stream->id = dts_id++; - } else if (st->codec.codec_id == CODEC_ID_PCM_S16BE) { + } else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) { stream->id = lpcm_id++; for(j = 0; j < 4; j++) { - if (lpcm_freq_tab[j] == st->codec.sample_rate) + if (lpcm_freq_tab[j] == st->codec->sample_rate) break; } if (j == 4) goto fail; - if (st->codec.channels > 8) + if (st->codec->channels > 8) return -1; stream->lpcm_header[0] = 0x0c; - stream->lpcm_header[1] = (st->codec.channels - 1) | (j << 4); + stream->lpcm_header[1] = (st->codec->channels - 1) | (j << 4); stream->lpcm_header[2] = 0x80; - stream->lpcm_align = st->codec.channels * 2; + stream->lpcm_align = st->codec->channels * 2; } else { stream->id = mpa_id++; } @@ -391,8 +391,8 @@ break; case CODEC_TYPE_VIDEO: stream->id = mpv_id++; - if (st->codec.rc_buffer_size) - stream->max_buffer_size = 6*1024 + st->codec.rc_buffer_size/8; + if (st->codec->rc_buffer_size) + stream->max_buffer_size = 6*1024 + st->codec->rc_buffer_size/8; else stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default #if 0 @@ -422,10 +422,10 @@ st = ctx->streams[i]; stream = (StreamInfo*) st->priv_data; - if(st->codec.rc_max_rate || stream->id==VIDEO_ID) - codec_rate= st->codec.rc_max_rate; + if(st->codec->rc_max_rate || stream->id==VIDEO_ID) + codec_rate= st->codec->rc_max_rate; else - codec_rate= st->codec.bit_rate; + codec_rate= st->codec->bit_rate; if(!codec_rate) codec_rate= (1<<21)*8*50/ctx->nb_streams; @@ -1073,7 +1073,7 @@ /* for subtitle, a single PES packet must be generated, so we flush after every single subtitle packet */ if(s->packet_size > avail_data && !flush - && st->codec.codec_type != CODEC_TYPE_SUBTITLE) + && st->codec->codec_type != CODEC_TYPE_SUBTITLE) return 0; if(avail_data==0) continue; @@ -1183,7 +1183,7 @@ int64_t pts, dts; PacketDesc *pkt_desc; const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE); - const int is_iframe = st->codec.codec_type == CODEC_TYPE_VIDEO && (pkt->flags & PKT_FLAG_KEY); + const int is_iframe = st->codec->codec_type == CODEC_TYPE_VIDEO && (pkt->flags & PKT_FLAG_KEY); pts= pkt->pts; dts= pkt->dts; @@ -1634,8 +1634,8 @@ st = av_new_stream(s, startcode); if (!st) goto skip; - st->codec.codec_type = type; - st->codec.codec_id = codec_id; + st->codec->codec_type = type; + st->codec->codec_id = codec_id; if (codec_id != CODEC_ID_PCM_S16BE) st->need_parsing = 1; found: @@ -1653,9 +1653,9 @@ get_byte(&s->pb); /* dynamic range control (0x80 = off) */ len -= 3; freq = (b1 >> 4) & 3; - st->codec.sample_rate = lpcm_freq_tab[freq]; - st->codec.channels = 1 + (b1 & 7); - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * 2; + st->codec->sample_rate = lpcm_freq_tab[freq]; + st->codec->channels = 1 + (b1 & 7); + 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);
--- a/mpegts.c Sun Jul 17 00:28:12 2005 +0000 +++ b/mpegts.c Sun Jul 17 22:24:36 2005 +0000 @@ -493,7 +493,7 @@ } if (stream_type == STREAM_TYPE_SUBTITLE_DVB) { - st->codec.sub_id = (anc_page << 16) | comp_page; + st->codec->sub_id = (anc_page << 16) | comp_page; } } } @@ -921,8 +921,8 @@ if (st) { av_set_pts_info(st, 33, 1, 90000); st->priv_data = pes; - st->codec.codec_type = codec_type; - st->codec.codec_id = codec_id; + st->codec->codec_type = codec_type; + st->codec->codec_id = codec_id; st->need_parsing = 1; pes->st = st; } @@ -1253,8 +1253,8 @@ if (!st) goto fail; av_set_pts_info(st, 60, 1, 27000000); - st->codec.codec_type = CODEC_TYPE_DATA; - st->codec.codec_id = CODEC_ID_MPEG2TS; + st->codec->codec_type = CODEC_TYPE_DATA; + st->codec->codec_id = CODEC_ID_MPEG2TS; /* we iterate until we find two PCRs to estimate the bitrate */ pcr_pid = -1; @@ -1283,7 +1283,7 @@ ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]); ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0]; s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; - st->codec.bit_rate = s->bit_rate; + st->codec->bit_rate = s->bit_rate; st->start_time = ts->cur_pcr; #if 0 printf("start=%0.3f pcr=%0.3f incr=%d\n",
--- a/mpegtsenc.c Sun Jul 17 00:28:12 2005 +0000 +++ b/mpegtsenc.c Sun Jul 17 22:24:36 2005 +0000 @@ -262,7 +262,7 @@ for(i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MpegTSWriteStream *ts_st = st->priv_data; - switch(st->codec.codec_id) { + switch(st->codec->codec_id) { case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: stream_type = STREAM_TYPE_VIDEO_MPEG2; @@ -293,7 +293,7 @@ q += 2; /* patched after */ /* write optional descriptors here */ - switch(st->codec.codec_type) { + switch(st->codec->codec_type) { case CODEC_TYPE_AUDIO: if (strlen(st->language) == 3) { *q++ = 0x0a; /* ISO 639 language descriptor */ @@ -452,10 +452,10 @@ ts_st->pid = DEFAULT_START_PID + i; ts_st->payload_pts = AV_NOPTS_VALUE; /* update PCR pid by using the first video stream */ - if (st->codec.codec_type == CODEC_TYPE_VIDEO && + if (st->codec->codec_type == CODEC_TYPE_VIDEO && service->pcr_pid == 0x1fff) service->pcr_pid = ts_st->pid; - total_bit_rate += st->codec.bit_rate; + total_bit_rate += st->codec->bit_rate; } /* if no video stream, use the first stream as PCR */ @@ -570,15 +570,15 @@ *q++ = 0x00; *q++ = 0x01; private_code = 0; - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { *q++ = 0xe0; - } else if (st->codec.codec_type == CODEC_TYPE_AUDIO && - (st->codec.codec_id == CODEC_ID_MP2 || - st->codec.codec_id == CODEC_ID_MP3)) { + } else if (st->codec->codec_type == CODEC_TYPE_AUDIO && + (st->codec->codec_id == CODEC_ID_MP2 || + st->codec->codec_id == CODEC_ID_MP3)) { *q++ = 0xc0; } else { *q++ = 0xbd; - if (st->codec.codec_type == CODEC_TYPE_SUBTITLE) { + if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) { private_code = 0x20; } } @@ -593,7 +593,7 @@ *q++ = len; val = 0x80; /* data alignment indicator is required for subtitle data */ - if (st->codec.codec_type == CODEC_TYPE_SUBTITLE) + if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) val |= 0x04; *q++ = val; if (pts != AV_NOPTS_VALUE) { @@ -660,7 +660,7 @@ MpegTSWriteStream *ts_st = st->priv_data; int len, max_payload_size; - if (st->codec.codec_type == CODEC_TYPE_SUBTITLE) { + if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) { /* for subtitle, a single PES packet must be generated */ mpegts_write_pes(s, st, buf, size, pkt->pts); return 0;
--- a/nsvdec.c Sun Jul 17 00:28:12 2005 +0000 +++ b/nsvdec.c Sun Jul 17 22:24:36 2005 +0000 @@ -439,12 +439,12 @@ if (!nst) goto fail; st->priv_data = nst; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_tag = vtag; - st->codec.codec_id = codec_get_id(nsv_codec_video_tags, vtag); - st->codec.width = vwidth; - st->codec.height = vheight; - st->codec.bits_per_sample = 24; /* depth XXX */ + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_tag = vtag; + st->codec->codec_id = codec_get_id(nsv_codec_video_tags, vtag); + st->codec->width = vwidth; + st->codec->height = vheight; + st->codec->bits_per_sample = 24; /* depth XXX */ av_set_pts_info(st, 64, framerate.den, framerate.num); st->start_time = 0; @@ -460,17 +460,17 @@ if (!nst) goto fail; st->priv_data = nst; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_tag = atag; - st->codec.codec_id = codec_get_id(nsv_codec_audio_tags, atag); + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_tag = atag; + st->codec->codec_id = codec_get_id(nsv_codec_audio_tags, atag); st->start_time = 0; // st->duration = nsv->duration; //FIXME st->need_parsing = 1; /* for PCM we will read a chunk later and put correct info */ /* XXX:FIXME */ - //st->codec.channels = 2; //XXX:channels; - //st->codec.sample_rate = 1000; - //av_set_pts_info(st, 64, 1, st->codec.sample_rate); + //st->codec->channels = 2; //XXX:channels; + //st->codec->sample_rate = 1000; + //av_set_pts_info(st, 64, 1, st->codec->sample_rate); #endif } @@ -606,7 +606,7 @@ pkt = &nsv->ahead[NSV_ST_AUDIO]; /* read raw audio specific header on the first audio chunk... */ /* on ALL audio chunks ?? seems so! */ - if (asize && st[NSV_ST_AUDIO]->codec.codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) { + if (asize && st[NSV_ST_AUDIO]->codec->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) { uint8_t bps; uint8_t channels; uint16_t samplerate; @@ -622,13 +622,13 @@ } bps /= channels; // ??? if (bps == 8) - st[NSV_ST_AUDIO]->codec.codec_id = CODEC_ID_PCM_U8; + st[NSV_ST_AUDIO]->codec->codec_id = CODEC_ID_PCM_U8; samplerate /= 4;/* UGH ??? XXX */ channels = 1; - st[NSV_ST_AUDIO]->codec.channels = channels; - st[NSV_ST_AUDIO]->codec.sample_rate = samplerate; + st[NSV_ST_AUDIO]->codec->channels = channels; + st[NSV_ST_AUDIO]->codec->sample_rate = samplerate; av_set_pts_info(st[NSV_ST_AUDIO], 64, 1, - st[NSV_ST_AUDIO]->codec.sample_rate); + st[NSV_ST_AUDIO]->codec->sample_rate); PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %ld\n", bps, channels, samplerate)); } } @@ -704,8 +704,8 @@ av_free(ast->index_entries); av_free(ast); } - av_free(st->codec.extradata); - av_free(st->codec.palctrl); + av_free(st->codec->extradata); + av_free(st->codec->palctrl); } #endif
--- a/nut.c Sun Jul 17 00:28:12 2005 +0000 +++ b/nut.c Sun Jul 17 22:24:36 2005 +0000 @@ -155,7 +155,7 @@ for(stream_id= 0; stream_id<s->nb_streams; stream_id++){ int start2= start + (end-start)*stream_id / s->nb_streams; int end2 = start + (end-start)*(stream_id+1) / s->nb_streams; - AVCodecContext *codec = &s->streams[stream_id]->codec; + AVCodecContext *codec = s->streams[stream_id]->codec; int is_audio= codec->codec_type == CODEC_TYPE_AUDIO; int intra_only= /*codec->intra_only || */is_audio; int pred_count; @@ -579,7 +579,7 @@ { int nom, denom, ssize; - codec = &s->streams[i]->codec; + codec = s->streams[i]->codec; put_be64(bc, STREAM_STARTCODE); put_packetheader(nut, bc, 120 + codec->extradata_size, 1); @@ -674,7 +674,7 @@ put_str(bc, s->copyright); } /* encoder */ - if(!(s->streams[0]->codec.flags & CODEC_FLAG_BITEXACT)){ + if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)){ put_v(bc, 13); /* type */ put_str(bc, LIBAVFORMAT_IDENT); } @@ -707,7 +707,7 @@ int size= pkt->size; int stream_index= pkt->stream_index; - enc = &s->streams[stream_index]->codec; + enc = s->streams[stream_index]->codec; key_frame = !!(pkt->flags & PKT_FLAG_KEY); frame_type=0; @@ -949,27 +949,27 @@ class = get_v(bc); tmp = get_vb(bc); - st->codec.codec_tag= tmp; + st->codec->codec_tag= tmp; switch(class) { case 0: - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = codec_get_bmp_id(tmp); - if (st->codec.codec_id == CODEC_ID_NONE) + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = codec_get_bmp_id(tmp); + if (st->codec->codec_id == CODEC_ID_NONE) av_log(s, AV_LOG_ERROR, "Unknown codec?!\n"); break; case 1: case 32: //compatibility - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = codec_get_wav_id(tmp); - if (st->codec.codec_id == CODEC_ID_NONE) + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = codec_get_wav_id(tmp); + if (st->codec->codec_id == CODEC_ID_NONE) av_log(s, AV_LOG_ERROR, "Unknown codec?!\n"); break; case 2: -// st->codec.codec_type = CODEC_TYPE_TEXT; +// st->codec->codec_type = CODEC_TYPE_TEXT; // break; case 3: - st->codec.codec_type = CODEC_TYPE_DATA; + st->codec->codec_type = CODEC_TYPE_DATA; break; default: av_log(s, AV_LOG_ERROR, "Unknown stream class (%d)\n", class); @@ -980,33 +980,33 @@ nom = get_v(bc); denom = get_v(bc); nut->stream[stream_id].msb_timestamp_shift = get_v(bc); - st->codec.has_b_frames= + st->codec->has_b_frames= nut->stream[stream_id].decode_delay= get_v(bc); get_byte(bc); /* flags */ /* codec specific data headers */ while(get_v(bc) != 0){ - st->codec.extradata_size= get_v(bc); - if((unsigned)st->codec.extradata_size > (1<<30)) + st->codec->extradata_size= get_v(bc); + if((unsigned)st->codec->extradata_size > (1<<30)) return -1; - st->codec.extradata= av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - get_buffer(bc, st->codec.extradata, st->codec.extradata_size); + st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + get_buffer(bc, st->codec->extradata, st->codec->extradata_size); // url_fskip(bc, get_v(bc)); } - if (st->codec.codec_type == CODEC_TYPE_VIDEO) /* VIDEO */ + if (st->codec->codec_type == CODEC_TYPE_VIDEO) /* VIDEO */ { - st->codec.width = get_v(bc); - st->codec.height = get_v(bc); - st->codec.sample_aspect_ratio.num= get_v(bc); - st->codec.sample_aspect_ratio.den= get_v(bc); + st->codec->width = get_v(bc); + st->codec->height = get_v(bc); + st->codec->sample_aspect_ratio.num= get_v(bc); + st->codec->sample_aspect_ratio.den= get_v(bc); get_v(bc); /* csp type */ } - if (st->codec.codec_type == CODEC_TYPE_AUDIO) /* AUDIO */ + if (st->codec->codec_type == CODEC_TYPE_AUDIO) /* AUDIO */ { - st->codec.sample_rate = get_v(bc); + st->codec->sample_rate = get_v(bc); get_v(bc); // samplerate_den - st->codec.channels = get_v(bc); + st->codec->channels = get_v(bc); } if(check_checksum(bc)){ av_log(s, AV_LOG_ERROR, "Stream header %d checksum mismatch\n", stream_id); @@ -1407,7 +1407,7 @@ int i; for(i=0;i<s->nb_streams;i++) { - av_freep(&s->streams[i]->codec.extradata); + av_freep(&s->streams[i]->codec->extradata); } av_freep(&nut->stream);
--- a/ogg.c Sun Jul 17 00:28:12 2005 +0000 +++ b/ogg.c Sun Jul 17 22:24:36 2005 +0000 @@ -39,7 +39,7 @@ ogg_stream_init(&context->os, 31415); for(n = 0 ; n < avfcontext->nb_streams ; n++) { - AVCodecContext *codec = &avfcontext->streams[n]->codec; + AVCodecContext *codec = avfcontext->streams[n]->codec; uint8_t *p= codec->extradata; av_set_pts_info(avfcontext->streams[n], 60, 1, AV_TIME_BASE); @@ -65,7 +65,7 @@ static int ogg_write_packet(AVFormatContext *avfcontext, AVPacket *pkt) { OggContext *context = avfcontext->priv_data ; - AVCodecContext *avctx= &avfcontext->streams[pkt->stream_index]->codec; + AVCodecContext *avctx= avfcontext->streams[pkt->stream_index]->codec; ogg_packet *op= &context->op; ogg_page og ; int64_t pts;
--- a/ogg2.c Sun Jul 17 00:28:12 2005 +0000 +++ b/ogg2.c Sun Jul 17 22:24:36 2005 +0000 @@ -430,7 +430,7 @@ ogg_t *ogg = s->priv_data; ogg_stream_t *os = ogg->streams + i; AVStream *st = s->streams[i]; - AVCodecContext *codec = &st->codec; + AVCodecContext *codec = st->codec; uint64_t pts = AV_NOPTS_VALUE; if(os->codec->gptopts){ @@ -537,7 +537,7 @@ for (i = 0; i < ogg->nstreams; i++){ av_free (ogg->streams[i].buf); av_free (ogg->streams[i].private); - av_freep (&s->streams[i]->codec.extradata); + av_freep (&s->streams[i]->codec->extradata); } av_free (ogg->streams); return 0;
--- a/oggparseflac.c Sun Jul 17 00:28:12 2005 +0000 +++ b/oggparseflac.c Sun Jul 17 22:24:36 2005 +0000 @@ -52,17 +52,17 @@ skip_bits(&gb, 16*2+24*2); - st->codec.sample_rate = get_bits_long(&gb, 20); - st->codec.channels = get_bits(&gb, 3) + 1; + st->codec->sample_rate = get_bits_long(&gb, 20); + st->codec->channels = get_bits(&gb, 3) + 1; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_FLAC; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_FLAC; - st->codec.extradata = + st->codec->extradata = av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); - memcpy (st->codec.extradata, os->buf + os->pstart + 5 + 4 + 4 + 4, + memcpy (st->codec->extradata, os->buf + os->pstart + 5 + 4 + 4 + 4, FLAC_STREAMINFO_SIZE); - st->codec.extradata_size = FLAC_STREAMINFO_SIZE; + st->codec->extradata_size = FLAC_STREAMINFO_SIZE; } else if (mdt == 4) { vorbis_comment (s, os->buf + os->pstart + 4, os->psize - 4); }
--- a/oggparsetheora.c Sun Jul 17 00:28:12 2005 +0000 +++ b/oggparsetheora.c Sun Jul 17 22:24:36 2005 +0000 @@ -40,7 +40,7 @@ ogg_stream_t *os = ogg->streams + idx; AVStream *st = s->streams[idx]; theora_params_t *thp = os->private; - int cds = st->codec.extradata_size + os->psize + 2; + int cds = st->codec->extradata_size + os->psize + 2; uint8_t *cdp; if(!(os->buf[os->pstart] & 0x80)) @@ -62,33 +62,33 @@ return -1; skip_bits(&gb, 8); /* revision */ - st->codec.width = get_bits(&gb, 16) << 4; - st->codec.height = get_bits(&gb, 16) << 4; + st->codec->width = get_bits(&gb, 16) << 4; + st->codec->height = get_bits(&gb, 16) << 4; skip_bits(&gb, 64); - st->codec.time_base.den = get_bits(&gb, 32); - st->codec.time_base.num = get_bits(&gb, 32); + st->codec->time_base.den = get_bits(&gb, 32); + st->codec->time_base.num = get_bits(&gb, 32); - st->codec.sample_aspect_ratio.num = get_bits(&gb, 24); - st->codec.sample_aspect_ratio.den = get_bits(&gb, 24); + st->codec->sample_aspect_ratio.num = get_bits(&gb, 24); + st->codec->sample_aspect_ratio.den = get_bits(&gb, 24); skip_bits(&gb, 38); thp->gpshift = get_bits(&gb, 5); thp->gpmask = (1 << thp->gpshift) - 1; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_THEORA; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_THEORA; } else if (os->buf[os->pstart] == 0x83) { vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8); } - st->codec.extradata = av_realloc (st->codec.extradata, cds); - cdp = st->codec.extradata + st->codec.extradata_size; + st->codec->extradata = av_realloc (st->codec->extradata, cds); + cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; *cdp++ = os->psize & 0xff; memcpy (cdp, os->buf + os->pstart, os->psize); - st->codec.extradata_size = cds; + st->codec->extradata_size = cds; return 1; } @@ -103,8 +103,8 @@ uint64_t iframe = gp >> thp->gpshift; uint64_t pframe = gp & thp->gpmask; - return (iframe + pframe) * AV_TIME_BASE * st->codec.time_base.num / - st->codec.time_base.den; + return (iframe + pframe) * AV_TIME_BASE * st->codec->time_base.num / + st->codec->time_base.den; } ogg_codec_t theora_codec = {
--- a/oggparsevorbis.c Sun Jul 17 00:28:12 2005 +0000 +++ b/oggparsevorbis.c Sun Jul 17 22:24:36 2005 +0000 @@ -178,19 +178,19 @@ memcpy(priv->packet[os->seq], os->buf + os->pstart, os->psize); if (os->buf[os->pstart] == 1) { uint8_t *p = os->buf + os->pstart + 11; //skip up to the audio channels - st->codec.channels = *p++; - st->codec.sample_rate = le2me_32 (unaligned32 (p)); + st->codec->channels = *p++; + st->codec->sample_rate = le2me_32 (unaligned32 (p)); p += 8; //skip maximum and and nominal bitrate - st->codec.bit_rate = le2me_32 (unaligned32 (p)); //Minimum bitrate + st->codec->bit_rate = le2me_32 (unaligned32 (p)); //Minimum bitrate - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_VORBIS; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_VORBIS; } else if (os->buf[os->pstart] == 3) { vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8); } else { - st->codec.extradata_size = - fixup_vorbis_headers(s, priv, &st->codec.extradata); + st->codec->extradata_size = + fixup_vorbis_headers(s, priv, &st->codec->extradata); } return os->seq < 3;
--- a/psxstr.c Sun Jul 17 00:28:12 2005 +0000 +++ b/psxstr.c Sun Jul 17 22:24:36 2005 +0000 @@ -182,11 +182,11 @@ str->channels[channel].video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_MDEC; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = str->channels[channel].width; - st->codec.height = str->channels[channel].height; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_MDEC; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = str->channels[channel].width; + st->codec->height = str->channels[channel].height; } break; @@ -212,13 +212,13 @@ str->channels[channel].audio_stream_index = st->index; fmt = sector[0x13]; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_ADPCM_XA; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.channels = (fmt&1)?2:1; - st->codec.sample_rate = (fmt&4)?18900:37800; - // st->codec.bit_rate = 0; //FIXME; - st->codec.block_align = 128; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_ADPCM_XA; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->channels = (fmt&1)?2:1; + st->codec->sample_rate = (fmt&4)?18900:37800; + // st->codec->bit_rate = 0; //FIXME; + st->codec->block_align = 128; } break;
--- a/raw.c Sun Jul 17 00:28:12 2005 +0000 +++ b/raw.c Sun Jul 17 22:24:36 2005 +0000 @@ -50,25 +50,25 @@ if (ap) { id = s->iformat->value; if (id == CODEC_ID_RAWVIDEO) { - st->codec.codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_type = CODEC_TYPE_VIDEO; } else { - st->codec.codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_type = CODEC_TYPE_AUDIO; } - st->codec.codec_id = id; + st->codec->codec_id = id; - switch(st->codec.codec_type) { + switch(st->codec->codec_type) { case CODEC_TYPE_AUDIO: - st->codec.sample_rate = ap->sample_rate; - st->codec.channels = ap->channels; - av_set_pts_info(st, 64, 1, st->codec.sample_rate); + st->codec->sample_rate = ap->sample_rate; + st->codec->channels = ap->channels; + av_set_pts_info(st, 64, 1, st->codec->sample_rate); break; case CODEC_TYPE_VIDEO: av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den); - st->codec.width = ap->width; - st->codec.height = ap->height; - st->codec.pix_fmt = ap->pix_fmt; - if(st->codec.pix_fmt == PIX_FMT_NONE) - st->codec.pix_fmt= PIX_FMT_YUV420P; + st->codec->width = ap->width; + st->codec->height = ap->height; + st->codec->pix_fmt = ap->pix_fmt; + if(st->codec->pix_fmt == PIX_FMT_NONE) + st->codec->pix_fmt= PIX_FMT_YUV420P; break; default: return -1; @@ -133,24 +133,24 @@ int64_t pos; st = s->streams[0]; - switch(st->codec.codec_id) { + switch(st->codec->codec_id) { case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S16BE: case CODEC_ID_PCM_U16LE: case CODEC_ID_PCM_U16BE: - block_align = 2 * st->codec.channels; - byte_rate = block_align * st->codec.sample_rate; + block_align = 2 * st->codec->channels; + byte_rate = block_align * st->codec->sample_rate; break; case CODEC_ID_PCM_S8: case CODEC_ID_PCM_U8: case CODEC_ID_PCM_MULAW: case CODEC_ID_PCM_ALAW: - block_align = st->codec.channels; - byte_rate = block_align * st->codec.sample_rate; + block_align = st->codec->channels; + byte_rate = block_align * st->codec->sample_rate; break; default: - block_align = st->codec.block_align; - byte_rate = st->codec.bit_rate / 8; + block_align = st->codec->block_align; + byte_rate = st->codec->bit_rate / 8; break; } @@ -180,8 +180,8 @@ if (!st) return AVERROR_NOMEM; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_AC3; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_AC3; st->need_parsing = 1; /* the parameters will be extracted from the compressed bitstream */ return 0; @@ -195,8 +195,8 @@ st = av_new_stream(s, 0); if (!st) return AVERROR_NOMEM; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_SHORTEN; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_SHORTEN; st->need_parsing = 1; /* the parameters will be extracted from the compressed bitstream */ return 0; @@ -212,8 +212,8 @@ if (!st) return AVERROR_NOMEM; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_DTS; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_DTS; st->need_parsing = 1; /* the parameters will be extracted from the compressed bitstream */ return 0; @@ -229,17 +229,17 @@ if (!st) return AVERROR_NOMEM; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = s->iformat->value; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = s->iformat->value; st->need_parsing = 1; /* for mjpeg, specify frame rate */ /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/ if (ap && ap->time_base.num) { av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den); - } else if ( st->codec.codec_id == CODEC_ID_MJPEG || - st->codec.codec_id == CODEC_ID_MPEG4 || - st->codec.codec_id == CODEC_ID_H264) { + } else if ( st->codec->codec_id == CODEC_ID_MJPEG || + st->codec->codec_id == CODEC_ID_MPEG4 || + st->codec->codec_id == CODEC_ID_H264) { av_set_pts_info(st, 64, 1, 25); } @@ -609,10 +609,10 @@ int packet_size, ret, width, height; AVStream *st = s->streams[0]; - width = st->codec.width; - height = st->codec.height; + width = st->codec->width; + height = st->codec->height; - packet_size = avpicture_get_size(st->codec.pix_fmt, width, height); + packet_size = avpicture_get_size(st->codec->pix_fmt, width, height); if (packet_size < 0) return -1;
--- a/rm.c Sun Jul 17 00:28:12 2005 +0000 +++ b/rm.c Sun Jul 17 22:24:36 2005 +0000 @@ -298,7 +298,7 @@ for(n=0;n<s->nb_streams;n++) { s->streams[n]->id = n; - codec = &s->streams[n]->codec; + codec = s->streams[n]->codec; stream = &rm->streams[n]; memset(stream, 0, sizeof(StreamInfo)); stream->num = n; @@ -399,7 +399,7 @@ static int rm_write_packet(AVFormatContext *s, AVPacket *pkt) { - if (s->streams[pkt->stream_index]->codec.codec_type == + if (s->streams[pkt->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO) return rm_write_audio(s, pkt->data, pkt->size, pkt->flags); else @@ -495,10 +495,10 @@ get_str8(pb, s->comment, sizeof(s->comment)); get_byte(pb); get_str8(pb, buf, sizeof(buf)); - st->codec.sample_rate = 8000; - st->codec.channels = 1; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_RA_144; + st->codec->sample_rate = 8000; + st->codec->channels = 1; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_RA_144; } else { int flavor, sub_packet_h, coded_framesize; /* old version (4) */ @@ -512,30 +512,30 @@ get_be32(pb); /* ??? */ get_be32(pb); /* ??? */ sub_packet_h= get_be16(pb); /* 1 */ - st->codec.block_align= get_be16(pb); /* frame size */ + st->codec->block_align= get_be16(pb); /* frame size */ get_be16(pb); /* sub packet size */ get_be16(pb); /* ??? */ - st->codec.sample_rate = get_be16(pb); + st->codec->sample_rate = get_be16(pb); get_be32(pb); - st->codec.channels = get_be16(pb); + st->codec->channels = get_be16(pb); get_str8(pb, buf, sizeof(buf)); /* desc */ get_str8(pb, buf, sizeof(buf)); /* desc */ - st->codec.codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_type = CODEC_TYPE_AUDIO; if (!strcmp(buf, "dnet")) { - st->codec.codec_id = CODEC_ID_AC3; + st->codec->codec_id = CODEC_ID_AC3; } else if (!strcmp(buf, "28_8")) { - st->codec.codec_id = CODEC_ID_RA_288; - st->codec.extradata_size= 10; - st->codec.extradata= av_mallocz(st->codec.extradata_size); + st->codec->codec_id = CODEC_ID_RA_288; + st->codec->extradata_size= 10; + st->codec->extradata= av_mallocz(st->codec->extradata_size); /* this is completly braindead and broken, the idiot who added this codec and endianness specific reordering to mplayer and libavcodec/ra288.c should be drowned in a see of cola */ //FIXME pass the unpermutated extradata - ((uint16_t*)st->codec.extradata)[1]= sub_packet_h; - ((uint16_t*)st->codec.extradata)[2]= flavor; - ((uint16_t*)st->codec.extradata)[3]= coded_framesize; + ((uint16_t*)st->codec->extradata)[1]= sub_packet_h; + ((uint16_t*)st->codec->extradata)[2]= flavor; + ((uint16_t*)st->codec->extradata)[3]= coded_framesize; } else { - st->codec.codec_id = CODEC_ID_NONE; - pstrcpy(st->codec.codec_name, sizeof(st->codec.codec_name), + st->codec->codec_id = CODEC_ID_NONE; + pstrcpy(st->codec->codec_name, sizeof(st->codec->codec_name), buf); } if (read_all) { @@ -635,7 +635,7 @@ goto fail; st->id = get_be16(pb); get_be32(pb); /* max bit rate */ - st->codec.bit_rate = get_be32(pb); /* bit rate */ + st->codec->bit_rate = get_be32(pb); /* bit rate */ get_be32(pb); /* max packet size */ get_be32(pb); /* avg packet size */ start_time = get_be32(pb); /* start time */ @@ -647,7 +647,7 @@ get_str8(pb, buf, sizeof(buf)); /* mimetype */ codec_data_size = get_be32(pb); codec_pos = url_ftell(pb); - st->codec.codec_type = CODEC_TYPE_DATA; + st->codec->codec_type = CODEC_TYPE_DATA; av_set_pts_info(st, 64, 1, 1000); v = get_be32(pb); @@ -658,43 +658,43 @@ int fps, fps2; if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) { fail1: - av_log(&st->codec, AV_LOG_ERROR, "Unsupported video codec\n"); + av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n"); goto skip; } - st->codec.codec_tag = get_le32(pb); -// av_log(NULL, AV_LOG_DEBUG, "%X %X\n", st->codec.codec_tag, MKTAG('R', 'V', '2', '0')); - if ( st->codec.codec_tag != MKTAG('R', 'V', '1', '0') - && st->codec.codec_tag != MKTAG('R', 'V', '2', '0') - && st->codec.codec_tag != MKTAG('R', 'V', '3', '0') - && st->codec.codec_tag != MKTAG('R', 'V', '4', '0')) + st->codec->codec_tag = get_le32(pb); +// av_log(NULL, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); + if ( st->codec->codec_tag != MKTAG('R', 'V', '1', '0') + && st->codec->codec_tag != MKTAG('R', 'V', '2', '0') + && st->codec->codec_tag != MKTAG('R', 'V', '3', '0') + && st->codec->codec_tag != MKTAG('R', 'V', '4', '0')) goto fail1; - st->codec.width = get_be16(pb); - st->codec.height = get_be16(pb); - st->codec.time_base.num= 1; + st->codec->width = get_be16(pb); + st->codec->height = get_be16(pb); + st->codec->time_base.num= 1; fps= get_be16(pb); - st->codec.codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_type = CODEC_TYPE_VIDEO; get_be32(pb); fps2= get_be16(pb); get_be16(pb); - st->codec.extradata_size= codec_data_size - (url_ftell(pb) - codec_pos); - st->codec.extradata= av_malloc(st->codec.extradata_size); - get_buffer(pb, st->codec.extradata, st->codec.extradata_size); + st->codec->extradata_size= codec_data_size - (url_ftell(pb) - codec_pos); + st->codec->extradata= av_malloc(st->codec->extradata_size); + get_buffer(pb, st->codec->extradata, st->codec->extradata_size); // av_log(NULL, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2); - st->codec.time_base.den = fps * st->codec.time_base.num; + st->codec->time_base.den = fps * st->codec->time_base.num; /* modification of h263 codec version (!) */ #ifdef WORDS_BIGENDIAN - h263_hack_version = ((uint32_t*)st->codec.extradata)[1]; + h263_hack_version = ((uint32_t*)st->codec->extradata)[1]; #else - h263_hack_version = bswap_32(((uint32_t*)st->codec.extradata)[1]); + h263_hack_version = bswap_32(((uint32_t*)st->codec->extradata)[1]); #endif - st->codec.sub_id = h263_hack_version; + st->codec->sub_id = h263_hack_version; switch((h263_hack_version>>28)){ - case 1: st->codec.codec_id = CODEC_ID_RV10; break; - case 2: st->codec.codec_id = CODEC_ID_RV20; break; - case 3: st->codec.codec_id = CODEC_ID_RV30; break; - case 4: st->codec.codec_id = CODEC_ID_RV40; break; + case 1: st->codec->codec_id = CODEC_ID_RV10; break; + case 2: st->codec->codec_id = CODEC_ID_RV20; break; + case 3: st->codec->codec_id = CODEC_ID_RV30; break; + case 4: st->codec->codec_id = CODEC_ID_RV40; break; default: goto fail1; } } @@ -827,7 +827,7 @@ return AVERROR_IO; st = s->streams[i]; - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { int h, pic_num, len2, pos; h= get_byte(pb); len--; @@ -862,8 +862,8 @@ pkt->stream_index = i; #if 0 - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { - if(st->codec.codec_id == CODEC_ID_RV20){ + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { + if(st->codec->codec_id == CODEC_ID_RV20){ int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1); av_log(NULL, AV_LOG_DEBUG, "%d %Ld %d\n", timestamp, timestamp*512LL/25, seq); @@ -882,7 +882,7 @@ } /* for AC3, needs to swap bytes */ - if (st->codec.codec_id == CODEC_ID_AC3) { + if (st->codec->codec_id == CODEC_ID_AC3) { ptr = pkt->data; for(j=0;j<len;j+=2) { tmp = ptr[0]; @@ -937,7 +937,7 @@ return AV_NOPTS_VALUE; st = s->streams[stream_index2]; - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { h= get_byte(&s->pb); len--; if(!(h & 0x40)){ seq = get_byte(&s->pb); len--;
--- a/rtp.c Sun Jul 17 00:28:12 2005 +0000 +++ b/rtp.c Sun Jul 17 22:24:36 2005 +0000 @@ -290,7 +290,7 @@ return NULL; } } else { - switch(st->codec.codec_id) { + switch(st->codec->codec_id) { case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: case CODEC_ID_MP2: @@ -307,7 +307,6 @@ static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf) { - AVCodecContext codec; int au_headers_length, au_header_size, i; GetBitContext getbitcontext; rtp_payload_data_t *infos; @@ -317,8 +316,6 @@ if (infos == NULL) return -1; - codec = s->st->codec; - /* decode the first 2 bytes where are stored the AUHeader sections length in bits */ au_headers_length = BE_16(buf); @@ -407,7 +404,7 @@ return -1; #if defined(DEBUG) || 1 if (seq != ((s->seq + 1) & 0xffff)) { - av_log(&s->st->codec, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", + av_log(s->st->codec, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", payload_type, seq, ((s->seq + 1) & 0xffff)); } #endif @@ -428,7 +425,7 @@ return 1; } } else { - switch(st->codec.codec_id) { + switch(st->codec->codec_id) { case CODEC_ID_MP2: /* better than nothing: skip mpeg audio RTP header */ if (len <= 4) @@ -462,7 +459,7 @@ break; } - switch(st->codec.codec_id) { + switch(st->codec->codec_id) { case CODEC_ID_MP2: case CODEC_ID_MPEG1VIDEO: if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) { @@ -529,7 +526,7 @@ return -1; st = s1->streams[0]; - payload_type = rtp_get_payload_type(&st->codec); + payload_type = rtp_get_payload_type(st->codec); if (payload_type < 0) payload_type = RTP_PT_PRIVATE; /* private payload type */ s->payload_type = payload_type; @@ -544,7 +541,7 @@ return AVERROR_IO; s->max_payload_size = max_packet_size - 12; - switch(st->codec.codec_id) { + switch(st->codec->codec_id) { case CODEC_ID_MP2: case CODEC_ID_MP3: s->buf_ptr = s->buf + 4; @@ -663,7 +660,7 @@ s->buf_ptr = s->buf + 4; /* 90 KHz time stamp */ s->timestamp = s->base_timestamp + - (s->cur_timestamp * 90000LL) / st->codec.sample_rate; + (s->cur_timestamp * 90000LL) / st->codec->sample_rate; } } @@ -697,7 +694,7 @@ memcpy(s->buf_ptr, buf1, size); s->buf_ptr += size; } - s->cur_timestamp += st->codec.frame_size; + s->cur_timestamp += st->codec->frame_size; } /* NOTE: a single frame must be passed with sequence header if @@ -715,7 +712,7 @@ while (size > 0) { /* XXX: more correct headers */ h = 0; - if (st->codec.sub_id == 2) + if (st->codec->sub_id == 2) h |= 1 << 26; /* mpeg 2 indicator */ q = s->buf; *q++ = h >> 24; @@ -723,7 +720,7 @@ *q++ = h >> 8; *q++ = h; - if (st->codec.sub_id == 2) { + if (st->codec->sub_id == 2) { h = 0; *q++ = h >> 24; *q++ = h >> 16; @@ -740,7 +737,7 @@ /* 90 KHz time stamp */ s->timestamp = s->base_timestamp + - av_rescale((int64_t)s->cur_timestamp * st->codec.time_base.num, 90000, st->codec.time_base.den); //FIXME pass timestamps + av_rescale((int64_t)s->cur_timestamp * st->codec->time_base.num, 90000, st->codec->time_base.den); //FIXME pass timestamps rtp_send_data(s1, s->buf, q - s->buf); buf1 += len; @@ -765,7 +762,7 @@ /* 90 KHz time stamp */ s->timestamp = s->base_timestamp + - av_rescale((int64_t)s->cur_timestamp * st->codec.time_base.num, 90000, st->codec.time_base.den); //FIXME pass timestamps + av_rescale((int64_t)s->cur_timestamp * st->codec->time_base.num, 90000, st->codec->time_base.den); //FIXME pass timestamps rtp_send_data(s1, buf1, len); buf1 += len; @@ -824,18 +821,18 @@ s->first_packet = 0; } - switch(st->codec.codec_id) { + switch(st->codec->codec_id) { case CODEC_ID_PCM_MULAW: case CODEC_ID_PCM_ALAW: case CODEC_ID_PCM_U8: case CODEC_ID_PCM_S8: - rtp_send_samples(s1, buf1, size, 1 * st->codec.channels); + rtp_send_samples(s1, buf1, size, 1 * st->codec->channels); break; case CODEC_ID_PCM_U16BE: case CODEC_ID_PCM_U16LE: case CODEC_ID_PCM_S16BE: case CODEC_ID_PCM_S16LE: - rtp_send_samples(s1, buf1, size, 2 * st->codec.channels); + rtp_send_samples(s1, buf1, size, 2 * st->codec->channels); break; case CODEC_ID_MP2: case CODEC_ID_MP3:
--- a/rtsp.c Sun Jul 17 00:28:12 2005 +0000 +++ b/rtsp.c Sun Jul 17 22:24:36 2005 +0000 @@ -282,7 +282,7 @@ int i; RTSPStream *rtsp_st = st->priv_data; - AVCodecContext *codec = &st->codec; + AVCodecContext *codec = st->codec; rtp_payload_data_t *rtp_payload_data = &rtsp_st->rtp_payload_data; /* loop on each attribute */ @@ -405,10 +405,10 @@ return; st->priv_data = rtsp_st; rtsp_st->stream_index = st->index; - st->codec.codec_type = codec_type; + st->codec->codec_type = codec_type; if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { /* if standard payload type, we can find the codec right now */ - rtp_get_codec_info(&st->codec, rtsp_st->sdp_payload_type); + rtp_get_codec_info(st->codec, rtsp_st->sdp_payload_type); } } /* put a default control url */ @@ -438,7 +438,7 @@ st = s->streams[i]; rtsp_st = st->priv_data; if (rtsp_st->sdp_payload_type == payload_type) { - sdp_parse_rtpmap(&st->codec, payload_type, p); + sdp_parse_rtpmap(st->codec, payload_type, p); } } } else if (strstart(p, "fmtp:", &p)) {
--- a/segafilm.c Sun Jul 17 00:28:12 2005 +0000 +++ b/segafilm.c Sun Jul 17 22:24:36 2005 +0000 @@ -140,11 +140,11 @@ if (!st) return AVERROR_NOMEM; film->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = film->video_type; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = BE_32(&scratch[16]); - st->codec.height = BE_32(&scratch[12]); + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = film->video_type; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = BE_32(&scratch[16]); + st->codec->height = BE_32(&scratch[12]); } if (film->audio_type) { @@ -152,16 +152,16 @@ if (!st) return AVERROR_NOMEM; film->audio_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = film->audio_type; - st->codec.codec_tag = 1; - st->codec.channels = film->audio_channels; - st->codec.bits_per_sample = film->audio_bits; - st->codec.sample_rate = film->audio_samplerate; - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * - st->codec.bits_per_sample; - st->codec.block_align = st->codec.channels * - st->codec.bits_per_sample / 8; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = film->audio_type; + st->codec->codec_tag = 1; + st->codec->channels = film->audio_channels; + st->codec->bits_per_sample = film->audio_bits; + st->codec->sample_rate = film->audio_samplerate; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_sample; + st->codec->block_align = st->codec->channels * + st->codec->bits_per_sample / 8; } /* load the sample table */
--- a/sierravmd.c Sun Jul 17 00:28:12 2005 +0000 +++ b/sierravmd.c Sun Jul 17 22:24:36 2005 +0000 @@ -131,14 +131,14 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); vmd->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_VMDVIDEO; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = LE_16(&vmd->vmd_header[12]); - st->codec.height = LE_16(&vmd->vmd_header[14]); - st->codec.extradata_size = VMD_HEADER_SIZE; - st->codec.extradata = av_malloc(VMD_HEADER_SIZE); - memcpy(st->codec.extradata, vmd->vmd_header, VMD_HEADER_SIZE); + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_VMDVIDEO; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = LE_16(&vmd->vmd_header[12]); + st->codec->height = LE_16(&vmd->vmd_header[14]); + st->codec->extradata_size = VMD_HEADER_SIZE; + st->codec->extradata = av_malloc(VMD_HEADER_SIZE); + memcpy(st->codec->extradata, vmd->vmd_header, VMD_HEADER_SIZE); /* if sample rate is 0, assume no audio */ vmd->sample_rate = LE_16(&vmd->vmd_header[804]); @@ -148,29 +148,29 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); vmd->audio_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_VMDAUDIO; - st->codec.codec_tag = 0; /* no codec tag */ - st->codec.channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1; - st->codec.sample_rate = vmd->sample_rate; - st->codec.block_align = vmd->audio_block_align = + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_VMDAUDIO; + st->codec->codec_tag = 0; /* no codec tag */ + st->codec->channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1; + st->codec->sample_rate = vmd->sample_rate; + st->codec->block_align = vmd->audio_block_align = LE_16(&vmd->vmd_header[806]); - if (st->codec.block_align & 0x8000) { - st->codec.bits_per_sample = 16; - st->codec.block_align = -(st->codec.block_align - 0x10000); + if (st->codec->block_align & 0x8000) { + st->codec->bits_per_sample = 16; + st->codec->block_align = -(st->codec->block_align - 0x10000); } else - st->codec.bits_per_sample = 16; -// st->codec.bits_per_sample = 8; - st->codec.bit_rate = st->codec.sample_rate * - st->codec.bits_per_sample * st->codec.channels; + st->codec->bits_per_sample = 16; +// st->codec->bits_per_sample = 8; + st->codec->bit_rate = st->codec->sample_rate * + st->codec->bits_per_sample * st->codec->channels; /* for calculating pts */ - vmd->audio_frame_divisor = st->codec.bits_per_sample / 8 / - st->codec.channels; + vmd->audio_frame_divisor = st->codec->bits_per_sample / 8 / + st->codec->channels; video_pts_inc = 90000; - video_pts_inc *= st->codec.block_align; - video_pts_inc /= st->codec.sample_rate; + video_pts_inc *= st->codec->block_align; + video_pts_inc /= st->codec->sample_rate; } else { /* if no audio, assume 10 frames/second */ video_pts_inc = 90000 / 10;
--- a/sol.c Sun Jul 17 00:28:12 2005 +0000 +++ b/sol.c Sun Jul 17 22:24:36 2005 +0000 @@ -113,11 +113,11 @@ st = av_new_stream(s, 0); if (!st) return -1; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_tag = id; - st->codec.codec_id = codec; - st->codec.channels = channels; - st->codec.sample_rate = rate; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_tag = id; + st->codec->codec_id = codec; + st->codec->channels = channels; + st->codec->sample_rate = rate; av_set_pts_info(st, 64, 1, rate); return 0; }
--- a/swf.c Sun Jul 17 00:28:12 2005 +0000 +++ b/swf.c Sun Jul 17 22:24:36 2005 +0000 @@ -324,7 +324,7 @@ video_enc = NULL; audio_enc = NULL; for(i=0;i<s->nb_streams;i++) { - enc = &s->streams[i]->codec; + enc = s->streams[i]->codec; if (enc->codec_type == CODEC_TYPE_AUDIO) audio_enc = enc; else { @@ -652,7 +652,7 @@ static int swf_write_packet(AVFormatContext *s, AVPacket *pkt) { - AVCodecContext *codec = &s->streams[pkt->stream_index]->codec; + AVCodecContext *codec = s->streams[pkt->stream_index]->codec; if (codec->codec_type == CODEC_TYPE_AUDIO) return swf_write_audio(s, codec, pkt->data, pkt->size); else @@ -668,7 +668,7 @@ video_enc = NULL; for(i=0;i<s->nb_streams;i++) { - enc = &s->streams[i]->codec; + enc = s->streams[i]->codec; if (enc->codec_type == CODEC_TYPE_VIDEO) video_enc = enc; } @@ -775,8 +775,8 @@ if (tag < 0) { if ( ast || vst ) { if ( vst && ast ) { - vst->codec.time_base.den = ast->codec.sample_rate / swf->samples_per_frame; - vst->codec.time_base.num = 1; + vst->codec->time_base.den = ast->codec->sample_rate / swf->samples_per_frame; + vst->codec->time_base.num = 1; } break; } @@ -794,11 +794,11 @@ vst = av_new_stream(s, 0); av_set_pts_info(vst, 24, 1, 1000); /* 24 bit pts in ms */ - vst->codec.codec_type = CODEC_TYPE_VIDEO; - vst->codec.codec_id = CODEC_ID_FLV1; + vst->codec->codec_type = CODEC_TYPE_VIDEO; + vst->codec->codec_id = CODEC_ID_FLV1; if ( swf->samples_per_frame ) { - vst->codec.time_base.den = 1000. / swf->ms_per_frame; - vst->codec.time_base.num = 1; + vst->codec->time_base.den = 1000. / swf->ms_per_frame; + vst->codec->time_base.num = 1; } } } else if ( ( tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2 ) && !ast) { @@ -819,26 +819,26 @@ return -ENOMEM; if (v & 0x01) - ast->codec.channels = 2; + ast->codec->channels = 2; else - ast->codec.channels = 1; + ast->codec->channels = 1; switch((v>> 2) & 0x03) { case 1: - ast->codec.sample_rate = 11025; + ast->codec->sample_rate = 11025; break; case 2: - ast->codec.sample_rate = 22050; + ast->codec->sample_rate = 22050; break; case 3: - ast->codec.sample_rate = 44100; + ast->codec->sample_rate = 44100; break; default: av_free(ast); return AVERROR_IO; } - ast->codec.codec_type = CODEC_TYPE_AUDIO; - ast->codec.codec_id = CODEC_ID_MP3; + ast->codec->codec_type = CODEC_TYPE_AUDIO; + ast->codec->codec_id = CODEC_ID_MP3; } } else { url_fskip(pb, len);
--- a/utils.c Sun Jul 17 00:28:12 2005 +0000 +++ b/utils.c Sun Jul 17 22:24:36 2005 +0000 @@ -683,14 +683,14 @@ *pnum = 0; *pden = 0; - switch(st->codec.codec_type) { + switch(st->codec->codec_type) { case CODEC_TYPE_VIDEO: if(st->time_base.num*1000LL > st->time_base.den){ *pnum = st->time_base.num; *pden = st->time_base.den; - }else if(st->codec.time_base.num*1000LL > st->codec.time_base.den){ - *pnum = st->codec.time_base.num; - *pden = st->codec.time_base.den; + }else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){ + *pnum = st->codec->time_base.num; + *pden = st->codec->time_base.den; if (pc && pc->repeat_pict) { *pden *= 2; *pnum = (*pnum) * (2 + pc->repeat_pict); @@ -698,11 +698,11 @@ } break; case CODEC_TYPE_AUDIO: - frame_size = get_audio_frame_size(&st->codec, pkt->size); + frame_size = get_audio_frame_size(st->codec, pkt->size); if (frame_size < 0) break; *pnum = frame_size; - *pden = st->codec.sample_rate; + *pden = st->codec->sample_rate; break; default: break; @@ -756,16 +756,16 @@ } } - if(is_intra_only(&st->codec)) + if(is_intra_only(st->codec)) pkt->flags |= PKT_FLAG_KEY; /* do we have a video B frame ? */ presentation_delayed = 0; - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { /* XXX: need has_b_frame, but cannot get it if the codec is not initialized */ - if (( st->codec.codec_id == CODEC_ID_H264 - || st->codec.has_b_frames) && + if (( st->codec->codec_id == CODEC_ID_H264 + || st->codec->has_b_frames) && pc && pc->pict_type != FF_B_TYPE) presentation_delayed = 1; /* this may be redundant, but it shouldnt hurt */ @@ -834,7 +834,7 @@ if (pc) { pkt->flags = 0; /* key frame computation */ - switch(st->codec.codec_type) { + switch(st->codec->codec_type) { case CODEC_TYPE_VIDEO: if (pc->pict_type == FF_I_TYPE) pkt->flags |= PKT_FLAG_KEY; @@ -870,7 +870,7 @@ s->cur_st = NULL; return 0; } else if (s->cur_len > 0 && st->discard < AVDISCARD_ALL) { - len = av_parser_parse(st->parser, &st->codec, &pkt->data, &pkt->size, + len = av_parser_parse(st->parser, st->codec, &pkt->data, &pkt->size, s->cur_ptr, s->cur_len, s->cur_pkt.pts, s->cur_pkt.dts); s->cur_pkt.pts = AV_NOPTS_VALUE; @@ -905,7 +905,7 @@ for(i = 0; i < s->nb_streams; i++) { st = s->streams[i]; if (st->parser && st->need_parsing) { - av_parser_parse(st->parser, &st->codec, + av_parser_parse(st->parser, st->codec, &pkt->data, &pkt->size, NULL, 0, AV_NOPTS_VALUE, AV_NOPTS_VALUE); @@ -923,7 +923,7 @@ s->cur_ptr = s->cur_pkt.data; s->cur_len = s->cur_pkt.size; if (st->need_parsing && !st->parser) { - st->parser = av_parser_init(st->codec.codec_id); + st->parser = av_parser_init(st->codec->codec_id); if (!st->parser) { /* no parser available : just output the raw packets */ st->need_parsing = 0; @@ -995,7 +995,7 @@ return -1; for(i = 0; i < s->nb_streams; i++) { st = s->streams[i]; - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { return i; } } @@ -1537,7 +1537,7 @@ bit_rate = 0; for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; - bit_rate += st->codec.bit_rate; + bit_rate += st->codec->bit_rate; } ic->bit_rate = bit_rate; } @@ -1728,26 +1728,26 @@ int got_picture, ret=0; AVFrame picture; - if(!st->codec.codec){ - codec = avcodec_find_decoder(st->codec.codec_id); + if(!st->codec->codec){ + codec = avcodec_find_decoder(st->codec->codec_id); if (!codec) return -1; - ret = avcodec_open(&st->codec, codec); + ret = avcodec_open(st->codec, codec); if (ret < 0) return ret; } - if(!has_codec_parameters(&st->codec)){ - switch(st->codec.codec_type) { + if(!has_codec_parameters(st->codec)){ + switch(st->codec->codec_type) { case CODEC_TYPE_VIDEO: - ret = avcodec_decode_video(&st->codec, &picture, + ret = avcodec_decode_video(st->codec, &picture, &got_picture, (uint8_t *)data, size); break; case CODEC_TYPE_AUDIO: samples = av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE); if (!samples) goto fail; - ret = avcodec_decode_audio(&st->codec, samples, + ret = avcodec_decode_audio(st->codec, samples, &got_picture, (uint8_t *)data, size); av_free(samples); break; @@ -1787,15 +1787,15 @@ for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; - if(st->codec.codec_type == CODEC_TYPE_VIDEO){ + if(st->codec->codec_type == CODEC_TYPE_VIDEO){ /* if(!st->time_base.num) st->time_base= */ - if(!st->codec.time_base.num) - st->codec.time_base= st->time_base; + if(!st->codec->time_base.num) + st->codec->time_base= st->time_base; } //only for the split stuff if (!st->parser) { - st->parser = av_parser_init(st->codec.codec_id); + st->parser = av_parser_init(st->codec->codec_id); } } @@ -1811,13 +1811,13 @@ /* check if one codec still needs to be handled */ for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; - if (!has_codec_parameters(&st->codec)) + if (!has_codec_parameters(st->codec)) break; /* variable fps and no guess at the real fps */ - if( st->codec.time_base.den >= 1000LL*st->codec.time_base.num - && duration_count[i]<20 && st->codec.codec_type == CODEC_TYPE_VIDEO) + if( st->codec->time_base.den >= 1000LL*st->codec->time_base.num + && duration_count[i]<20 && st->codec->codec_type == CODEC_TYPE_VIDEO) break; - if(st->parser && st->parser->parser->split && !st->codec.extradata) + if(st->parser && st->parser->parser->split && !st->codec->extradata) break; } if (i == ic->nb_streams) { @@ -1845,7 +1845,7 @@ ret = -1; /* we could not have all the codec parameters before EOF */ for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; - if (!has_codec_parameters(&st->codec)) + if (!has_codec_parameters(st->codec)) break; } if (i == ic->nb_streams) @@ -1898,12 +1898,12 @@ } last_dts[pkt->stream_index]= pkt->dts; } - if(st->parser && st->parser->parser->split && !st->codec.extradata){ - int i= st->parser->parser->split(&st->codec, pkt->data, pkt->size); + if(st->parser && st->parser->parser->split && !st->codec->extradata){ + int i= st->parser->parser->split(st->codec, pkt->data, pkt->size); if(i){ - st->codec.extradata_size= i; - st->codec.extradata= av_malloc(st->codec.extradata_size); - memcpy(st->codec.extradata, pkt->data, st->codec.extradata_size); + st->codec->extradata_size= i; + st->codec->extradata= av_malloc(st->codec->extradata_size); + memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size); } } @@ -1911,21 +1911,21 @@ decompress the frame. We try to avoid that in most cases as it takes longer and uses more memory. For MPEG4, we need to decompress for Quicktime. */ - if (!has_codec_parameters(&st->codec) /*&& - (st->codec.codec_id == CODEC_ID_FLV1 || - st->codec.codec_id == CODEC_ID_H264 || - st->codec.codec_id == CODEC_ID_H263 || - st->codec.codec_id == CODEC_ID_H261 || - st->codec.codec_id == CODEC_ID_VORBIS || - st->codec.codec_id == CODEC_ID_MJPEG || - st->codec.codec_id == CODEC_ID_PNG || - st->codec.codec_id == CODEC_ID_PAM || - st->codec.codec_id == CODEC_ID_PGM || - st->codec.codec_id == CODEC_ID_PGMYUV || - st->codec.codec_id == CODEC_ID_PBM || - st->codec.codec_id == CODEC_ID_PPM || - st->codec.codec_id == CODEC_ID_SHORTEN || - (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/) + if (!has_codec_parameters(st->codec) /*&& + (st->codec->codec_id == CODEC_ID_FLV1 || + st->codec->codec_id == CODEC_ID_H264 || + st->codec->codec_id == CODEC_ID_H263 || + st->codec->codec_id == CODEC_ID_H261 || + st->codec->codec_id == CODEC_ID_VORBIS || + st->codec->codec_id == CODEC_ID_MJPEG || + st->codec->codec_id == CODEC_ID_PNG || + st->codec->codec_id == CODEC_ID_PAM || + st->codec->codec_id == CODEC_ID_PGM || + st->codec->codec_id == CODEC_ID_PGMYUV || + st->codec->codec_id == CODEC_ID_PBM || + st->codec->codec_id == CODEC_ID_PPM || + st->codec->codec_id == CODEC_ID_SHORTEN || + (st->codec->codec_id == CODEC_ID_MPEG4 && !st->need_parsing))*/) try_decode_frame(st, pkt->data, pkt->size); if (av_rescale_q(st->codec_info_duration, st->time_base, AV_TIME_BASE_Q) >= MAX_STREAM_DURATION) { @@ -1937,16 +1937,16 @@ // close codecs which where opened in try_decode_frame() for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; - if(st->codec.codec) - avcodec_close(&st->codec); + if(st->codec->codec) + avcodec_close(st->codec); } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { - if(st->codec.codec_id == CODEC_ID_RAWVIDEO && !st->codec.codec_tag && !st->codec.bits_per_sample) - st->codec.codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec.pix_fmt); + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { + if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_sample) + st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); - if(duration_count[i] && st->codec.time_base.num*1000LL <= st->codec.time_base.den && + if(duration_count[i] && st->codec->time_base.num*1000LL <= st->codec->time_base.den && st->time_base.num*duration_sum[i]/duration_count[i]*1000LL > st->time_base.den){ AVRational fps1; int64_t num, den; @@ -1964,14 +1964,14 @@ /* set real frame rate info */ /* compute the real frame rate for telecine */ - if ((st->codec.codec_id == CODEC_ID_MPEG1VIDEO || - st->codec.codec_id == CODEC_ID_MPEG2VIDEO) && - st->codec.sub_id == 2) { + if ((st->codec->codec_id == CODEC_ID_MPEG1VIDEO || + st->codec->codec_id == CODEC_ID_MPEG2VIDEO) && + st->codec->sub_id == 2) { if (st->codec_info_nb_frames >= 20) { float coded_frame_rate, est_frame_rate; est_frame_rate = ((double)st->codec_info_nb_frames * AV_TIME_BASE) / (double)st->codec_info_duration ; - coded_frame_rate = 1.0/av_q2d(st->codec.time_base); + coded_frame_rate = 1.0/av_q2d(st->codec->time_base); #if 0 printf("telecine: coded_frame_rate=%0.3f est_frame_rate=%0.3f\n", coded_frame_rate, est_frame_rate); @@ -1987,8 +1987,8 @@ } /* if no real frame rate, use the codec one */ if (!st->r_frame_rate.num){ - st->r_frame_rate.num = st->codec.time_base.den; - st->r_frame_rate.den = st->codec.time_base.num; + st->r_frame_rate.num = st->codec->time_base.den; + st->r_frame_rate.den = st->codec->time_base.num; } } } @@ -1998,7 +1998,7 @@ /* correct DTS for b frame streams with no timestamps */ for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; - if (st->codec.codec_type == CODEC_TYPE_VIDEO) { + if (st->codec->codec_type == CODEC_TYPE_VIDEO) { if(b-frames){ ppktl = &ic->packet_buffer; while(ppkt1){ @@ -2069,6 +2069,7 @@ av_parser_close(st->parser); } av_free(st->index_entries); + av_free(st->codec); av_free(st); } flush_packet_queue(s); @@ -2103,10 +2104,11 @@ st = av_mallocz(sizeof(AVStream)); if (!st) return NULL; - avcodec_get_context_defaults(&st->codec); + + st->codec= avcodec_alloc_context(); if (s->iformat) { /* no default bitrate if decoding */ - st->codec.bit_rate = 0; + st->codec->bit_rate = 0; } st->index = s->nb_streams; st->id = id; @@ -2164,14 +2166,14 @@ for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; - switch (st->codec.codec_type) { + switch (st->codec->codec_type) { case CODEC_TYPE_AUDIO: av_frac_init(&st->pts, 0, 0, - (int64_t)st->time_base.num * st->codec.sample_rate); + (int64_t)st->time_base.num * st->codec->sample_rate); break; case CODEC_TYPE_VIDEO: av_frac_init(&st->pts, 0, 0, - (int64_t)st->time_base.num * st->codec.time_base.den); + (int64_t)st->time_base.num * st->codec->time_base.den); break; default: break; @@ -2182,7 +2184,7 @@ //FIXME merge with compute_pkt_fields static int compute_pkt_fields2(AVStream *st, AVPacket *pkt){ - int b_frames = FFMAX(st->codec.has_b_frames, st->codec.max_b_frames); + int b_frames = FFMAX(st->codec->has_b_frames, st->codec->max_b_frames); int num, den, frame_size; // av_log(NULL, AV_LOG_DEBUG, "av_write_frame: pts:%lld dts:%lld cur_dts:%lld b:%d size:%d st:%d\n", pkt->pts, pkt->dts, st->cur_dts, b_frames, pkt->size, pkt->stream_index); @@ -2234,9 +2236,9 @@ st->pts.val= pkt->dts; /* update pts */ - switch (st->codec.codec_type) { + switch (st->codec->codec_type) { case CODEC_TYPE_AUDIO: - frame_size = get_audio_frame_size(&st->codec, pkt->size); + frame_size = get_audio_frame_size(st->codec, pkt->size); /* HACK/FIXME, we skip the initial 0-size packets as they are most likely equal to the encoder delay, but it would be better if we had the real timestamps from the encoder */ @@ -2245,7 +2247,7 @@ } break; case CODEC_TYPE_VIDEO: - av_frac_add(&st->pts, (int64_t)st->time_base.den * st->codec.time_base.num); + av_frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num); break; default: break; @@ -2380,7 +2382,7 @@ AVStream *st= s->streams[ pkt->stream_index]; //FIXME/XXX/HACK drop zero sized packets - if(st->codec.codec_type == CODEC_TYPE_AUDIO && pkt->size==0) + if(st->codec->codec_type == CODEC_TYPE_AUDIO && pkt->size==0) return 0; //av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %Ld %Ld\n", pkt->size, pkt->dts, pkt->pts); @@ -2497,7 +2499,7 @@ } for(i=0;i<ic->nb_streams;i++) { AVStream *st = ic->streams[i]; - avcodec_string(buf, sizeof(buf), &st->codec, is_output); + avcodec_string(buf, sizeof(buf), st->codec, is_output); av_log(NULL, AV_LOG_INFO, " Stream #%d.%d", index, i); /* the pid is an important information, so we display it */ /* XXX: add a generic system */
--- a/wav.c Sun Jul 17 00:28:12 2005 +0000 +++ b/wav.c Sun Jul 17 22:24:36 2005 +0000 @@ -199,13 +199,13 @@ /* format header */ fmt = start_tag(pb, "fmt "); - if (put_wav_header(pb, &s->streams[0]->codec) < 0) { + if (put_wav_header(pb, s->streams[0]->codec) < 0) { av_free(wav); return -1; } end_tag(pb, fmt); - av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec.sample_rate); + av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate); /* data header */ wav->data = start_tag(pb, "data"); @@ -305,10 +305,10 @@ if (!st) return AVERROR_NOMEM; - get_wav_header(pb, &st->codec, size); + get_wav_header(pb, st->codec, size); st->need_parsing = 1; - av_set_pts_info(st, 64, 1, st->codec.sample_rate); + av_set_pts_info(st, 64, 1, st->codec->sample_rate); size = find_tag(pb, MKTAG('d', 'a', 't', 'a')); if (size < 0) @@ -329,10 +329,10 @@ st = s->streams[0]; size = MAX_SIZE; - if (st->codec.block_align > 1) { - if (size < st->codec.block_align) - size = st->codec.block_align; - size = (size / st->codec.block_align) * st->codec.block_align; + if (st->codec->block_align > 1) { + if (size < st->codec->block_align) + size = st->codec->block_align; + size = (size / st->codec->block_align) * st->codec->block_align; } if (av_new_packet(pkt, size)) return AVERROR_IO; @@ -358,7 +358,7 @@ AVStream *st; st = s->streams[0]; - switch(st->codec.codec_id) { + switch(st->codec->codec_id) { case CODEC_ID_MP2: case CODEC_ID_MP3: case CODEC_ID_AC3:
--- a/wc3movie.c Sun Jul 17 00:28:12 2005 +0000 +++ b/wc3movie.c Sun Jul 17 22:24:36 2005 +0000 @@ -239,29 +239,29 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); wc3->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_XAN_WC3; - st->codec.codec_tag = 0; /* no fourcc */ - st->codec.width = wc3->width; - st->codec.height = wc3->height; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_XAN_WC3; + st->codec->codec_tag = 0; /* no fourcc */ + st->codec->width = wc3->width; + st->codec->height = wc3->height; /* palette considerations */ - st->codec.palctrl = &wc3->palette_control; + st->codec->palctrl = &wc3->palette_control; st = av_new_stream(s, 0); if (!st) return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); wc3->audio_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_PCM_S16LE; - st->codec.codec_tag = 1; - st->codec.channels = WC3_AUDIO_CHANNELS; - st->codec.bits_per_sample = WC3_AUDIO_BITS; - st->codec.sample_rate = WC3_SAMPLE_RATE; - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * - st->codec.bits_per_sample; - st->codec.block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_PCM_S16LE; + st->codec->codec_tag = 1; + st->codec->channels = WC3_AUDIO_CHANNELS; + st->codec->bits_per_sample = WC3_AUDIO_BITS; + st->codec->sample_rate = WC3_SAMPLE_RATE; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_sample; + st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS; return 0; }
--- a/westwood.c Sun Jul 17 00:28:12 2005 +0000 +++ b/westwood.c Sun Jul 17 22:24:36 2005 +0000 @@ -136,15 +136,15 @@ if (!st) return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, wsaud->audio_samplerate); - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = wsaud->audio_type; - st->codec.codec_tag = 0; /* no tag */ - st->codec.channels = wsaud->audio_channels; - st->codec.sample_rate = wsaud->audio_samplerate; - st->codec.bits_per_sample = wsaud->audio_bits; - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * - st->codec.bits_per_sample / 4; - st->codec.block_align = st->codec.channels * st->codec.bits_per_sample; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = wsaud->audio_type; + st->codec->codec_tag = 0; /* no tag */ + st->codec->channels = wsaud->audio_channels; + st->codec->sample_rate = wsaud->audio_samplerate; + st->codec->bits_per_sample = wsaud->audio_bits; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_sample / 4; + st->codec->block_align = st->codec->channels * st->codec->bits_per_sample; wsaud->audio_stream_index = st->index; wsaud->audio_frame_counter = 0; @@ -222,24 +222,24 @@ return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); wsvqa->video_stream_index = st->index; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_WS_VQA; - st->codec.codec_tag = 0; /* no fourcc */ + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_WS_VQA; + st->codec->codec_tag = 0; /* no fourcc */ /* skip to the start of the VQA header */ url_fseek(pb, 20, SEEK_SET); /* the VQA header needs to go to the decoder */ - st->codec.extradata_size = VQA_HEADER_SIZE; - st->codec.extradata = av_malloc(VQA_HEADER_SIZE); - header = (unsigned char *)st->codec.extradata; - if (get_buffer(pb, st->codec.extradata, VQA_HEADER_SIZE) != + st->codec->extradata_size = VQA_HEADER_SIZE; + st->codec->extradata = av_malloc(VQA_HEADER_SIZE); + header = (unsigned char *)st->codec->extradata; + if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) != VQA_HEADER_SIZE) { - av_free(st->codec.extradata); + av_free(st->codec->extradata); return AVERROR_IO; } - st->codec.width = LE_16(&header[6]); - st->codec.height = LE_16(&header[8]); + st->codec->width = LE_16(&header[6]); + st->codec->height = LE_16(&header[8]); /* initialize the audio decoder stream is sample rate is non-zero */ if (LE_16(&header[24])) { @@ -247,19 +247,19 @@ if (!st) return AVERROR_NOMEM; av_set_pts_info(st, 33, 1, 90000); - st->codec.codec_type = CODEC_TYPE_AUDIO; - st->codec.codec_id = CODEC_ID_ADPCM_IMA_WS; - st->codec.codec_tag = 0; /* no tag */ - st->codec.sample_rate = LE_16(&header[24]); - st->codec.channels = header[26]; - st->codec.bits_per_sample = 16; - st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * - st->codec.bits_per_sample / 4; - st->codec.block_align = st->codec.channels * st->codec.bits_per_sample; + st->codec->codec_type = CODEC_TYPE_AUDIO; + st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS; + st->codec->codec_tag = 0; /* no tag */ + st->codec->sample_rate = LE_16(&header[24]); + st->codec->channels = header[26]; + st->codec->bits_per_sample = 16; + st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * + st->codec->bits_per_sample / 4; + st->codec->block_align = st->codec->channels * st->codec->bits_per_sample; wsvqa->audio_stream_index = st->index; - wsvqa->audio_samplerate = st->codec.sample_rate; - wsvqa->audio_channels = st->codec.channels; + wsvqa->audio_samplerate = st->codec->sample_rate; + wsvqa->audio_channels = st->codec->channels; wsvqa->audio_frame_counter = 0; } @@ -267,7 +267,7 @@ * FINF has been skipped and the file will be ready to be demuxed */ do { if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) { - av_free(st->codec.extradata); + av_free(st->codec->extradata); return AVERROR_IO; } chunk_tag = BE_32(&scratch[0]);
--- a/yuv4mpeg.c Sun Jul 17 00:28:12 2005 +0000 +++ b/yuv4mpeg.c Sun Jul 17 22:24:36 2005 +0000 @@ -33,22 +33,22 @@ char *colorspace = ""; st = s->streams[0]; - width = st->codec.width; - height = st->codec.height; + width = st->codec->width; + height = st->codec->height; - av_reduce(&raten, &rated, st->codec.time_base.den, st->codec.time_base.num, (1UL<<31)-1); + av_reduce(&raten, &rated, st->codec->time_base.den, st->codec->time_base.num, (1UL<<31)-1); - aspectn = st->codec.sample_aspect_ratio.num; - aspectd = st->codec.sample_aspect_ratio.den; + aspectn = st->codec->sample_aspect_ratio.num; + aspectd = st->codec->sample_aspect_ratio.den; if ( aspectn == 0 && aspectd == 1 ) aspectd = 0; // 0:0 means unknown inter = 'p'; /* progressive is the default */ - if (st->codec.coded_frame && st->codec.coded_frame->interlaced_frame) { - inter = st->codec.coded_frame->top_field_first ? 't' : 'b'; + if (st->codec->coded_frame && st->codec->coded_frame->interlaced_frame) { + inter = st->codec->coded_frame->top_field_first ? 't' : 'b'; } - switch(st->codec.pix_fmt) { + switch(st->codec->pix_fmt) { case PIX_FMT_GRAY8: colorspace = " Cmono"; break; @@ -56,7 +56,7 @@ colorspace = " C411 XYSCSS=411"; break; case PIX_FMT_YUV420P: - colorspace = (st->codec.codec_id == CODEC_ID_DVVIDEO)?" C420paldv XYSCSS=420PALDV":" C420mpeg2 XYSCSS=420MPEG2"; + colorspace = (st->codec->codec_id == CODEC_ID_DVVIDEO)?" C420paldv XYSCSS=420PALDV":" C420mpeg2 XYSCSS=420MPEG2"; break; case PIX_FMT_YUV422P: colorspace = " C422 XYSCSS=422"; @@ -109,8 +109,8 @@ m = snprintf(buf1, sizeof(buf1), "%s\n", Y4M_FRAME_MAGIC); put_buffer(pb, buf1, strlen(buf1)); - width = st->codec.width; - height = st->codec.height; + width = st->codec->width; + height = st->codec->height; ptr = picture->data[0]; for(i=0;i<height;i++) { @@ -118,9 +118,9 @@ ptr += picture->linesize[0]; } - if (st->codec.pix_fmt != PIX_FMT_GRAY8){ + if (st->codec->pix_fmt != PIX_FMT_GRAY8){ // Adjust for smaller Cb and Cr planes - avcodec_get_chroma_sub_sample(st->codec.pix_fmt, &h_chroma_shift, &v_chroma_shift); + avcodec_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift, &v_chroma_shift); width >>= h_chroma_shift; height >>= v_chroma_shift; @@ -146,13 +146,13 @@ if (s->nb_streams != 1) return AVERROR_IO; - if (s->streams[0]->codec.pix_fmt == PIX_FMT_YUV411P) { + if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) { av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n"); } - else if ((s->streams[0]->codec.pix_fmt != PIX_FMT_YUV420P) && - (s->streams[0]->codec.pix_fmt != PIX_FMT_YUV422P) && - (s->streams[0]->codec.pix_fmt != PIX_FMT_GRAY8) && - (s->streams[0]->codec.pix_fmt != PIX_FMT_YUV444P)) { + else if ((s->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) && + (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) && + (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) && + (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) { av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n"); return AVERROR_IO; } @@ -320,14 +320,14 @@ st = av_new_stream(s, 0); st = s->streams[0]; - st->codec.width = width; - st->codec.height = height; + st->codec->width = width; + st->codec->height = height; av_reduce(&raten, &rated, raten, rated, (1UL<<31)-1); av_set_pts_info(st, 64, rated, raten); - st->codec.pix_fmt = pix_fmt; - st->codec.codec_type = CODEC_TYPE_VIDEO; - st->codec.codec_id = CODEC_ID_RAWVIDEO; - st->codec.sample_aspect_ratio= (AVRational){aspectn, aspectd}; + st->codec->pix_fmt = pix_fmt; + st->codec->codec_type = CODEC_TYPE_VIDEO; + st->codec->codec_id = CODEC_ID_RAWVIDEO; + st->codec->sample_aspect_ratio= (AVRational){aspectn, aspectd}; return 0; } @@ -349,10 +349,10 @@ if (i == MAX_FRAME_HEADER) return -1; if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC))) return -1; - width = st->codec.width; - height = st->codec.height; + width = st->codec->width; + height = st->codec->height; - packet_size = avpicture_get_size(st->codec.pix_fmt, width, height); + packet_size = avpicture_get_size(st->codec->pix_fmt, width, height); if (packet_size < 0) return -1;