# HG changeset patch # User michaelni # Date 1038996243 0 # Node ID 39c4c4336486ab3fc0f1b427ce5528ecfe621056 # Parent dcc03a32d1bbc610362fade0e3efb7c43a819abc cleanup adding AVVideoFrame moving quality, pict_type, key_frame, qscale_table, ... to AVVideoFrame removing obsolete variables in AVCodecContext skiping of MBs in b frames correctly initalizing AVCodecContext picture buffer cleanup diff -r dcc03a32d1bb -r 39c4c4336486 asf.c --- a/asf.c Sat Nov 30 17:16:32 2002 +0000 +++ b/asf.c Wed Dec 04 10:04:03 2002 +0000 @@ -556,7 +556,7 @@ int val; val = stream->num; - if (s->streams[val - 1]->codec.key_frame /* && frag_offset == 0 */) + if (s->streams[val - 1]->codec.coded_picture->key_frame /* && frag_offset == 0 */) val |= 0x80; put_byte(pb, val); put_byte(pb, stream->seq); @@ -793,6 +793,7 @@ st = av_mallocz(sizeof(AVStream)); if (!st) goto fail; + avcodec_get_context_defaults(&st->codec); s->streams[s->nb_streams] = st; asf_st = av_mallocz(sizeof(ASFStream)); if (!asf_st) diff -r dcc03a32d1bb -r 39c4c4336486 au.c --- a/au.c Sat Nov 30 17:16:32 2002 +0000 +++ b/au.c Wed Dec 04 10:04:03 2002 +0000 @@ -143,6 +143,8 @@ st = av_malloc(sizeof(AVStream)); if (!st) return -1; + avcodec_get_context_defaults(&st->codec); + s->nb_streams = 1; s->streams[0] = st; diff -r dcc03a32d1bb -r 39c4c4336486 avformat.h --- a/avformat.h Sat Nov 30 17:16:32 2002 +0000 +++ b/avformat.h Wed Dec 04 10:04:03 2002 +0000 @@ -144,6 +144,9 @@ AVFrac pts; /* ffmpeg.c private use */ int stream_copy; /* if TRUE, just copy stream */ + /* quality, as it has been removed from AVCodecContext and put in AVVideoFrame + * MN:dunno if thats the right place, for it */ + float quality; } AVStream; #define MAX_STREAMS 20 diff -r dcc03a32d1bb -r 39c4c4336486 avidec.c --- a/avidec.c Sat Nov 30 17:16:32 2002 +0000 +++ b/avidec.c Wed Dec 04 10:04:03 2002 +0000 @@ -103,6 +103,8 @@ AVStream *st = av_mallocz(sizeof(AVStream)); if (!st) goto fail; + avcodec_get_context_defaults(&st->codec); + s->streams[i] = st; } url_fskip(pb, size - 7 * 4); diff -r dcc03a32d1bb -r 39c4c4336486 avienc.c --- a/avienc.c Sat Nov 30 17:16:32 2002 +0000 +++ b/avienc.c Wed Dec 04 10:04:03 2002 +0000 @@ -320,7 +320,7 @@ if (enc->codec_type == CODEC_TYPE_VIDEO) { tag[2] = 'd'; tag[3] = 'c'; - flags = enc->key_frame ? 0x10 : 0x00; + flags = enc->coded_picture->key_frame ? 0x10 : 0x00; } else { tag[2] = 'w'; tag[3] = 'b'; diff -r dcc03a32d1bb -r 39c4c4336486 ffm.c --- a/ffm.c Sat Nov 30 17:16:32 2002 +0000 +++ b/ffm.c Wed Dec 04 10:04:03 2002 +0000 @@ -151,7 +151,7 @@ put_be32(pb, codec->codec_id); put_byte(pb, codec->codec_type); put_be32(pb, codec->bit_rate); - put_be32(pb, codec->quality); + put_be32(pb, st->quality); put_be32(pb, codec->flags); /* specific info */ switch(codec->codec_type) { @@ -232,7 +232,7 @@ /* packet size & key_frame */ header[0] = stream_index; header[1] = 0; - if (st->codec.key_frame) + if (st->codec.coded_picture->key_frame) header[1] |= FLAG_KEY_FRAME; header[2] = (size >> 16) & 0xff; header[3] = (size >> 8) & 0xff; @@ -394,6 +394,7 @@ st = av_mallocz(sizeof(AVStream)); if (!st) goto fail; + avcodec_get_context_defaults(&st->codec); s->streams[i] = st; fst = av_mallocz(sizeof(FFMStream)); if (!fst) @@ -405,7 +406,7 @@ st->codec.codec_id = get_be32(pb); st->codec.codec_type = get_byte(pb); /* codec_type */ codec->bit_rate = get_be32(pb); - codec->quality = get_be32(pb); + st->quality = get_be32(pb); codec->flags = get_be32(pb); /* specific info */ switch(codec->codec_type) { diff -r dcc03a32d1bb -r 39c4c4336486 jpeg.c --- a/jpeg.c Sat Nov 30 17:16:32 2002 +0000 +++ b/jpeg.c Wed Dec 04 10:04:03 2002 +0000 @@ -170,6 +170,8 @@ av_free(s); return -ENOMEM; } + avcodec_get_context_defaults(&st->codec); + s1->streams[0] = st; s->img_number = 0; diff -r dcc03a32d1bb -r 39c4c4336486 rm.c --- a/rm.c Sat Nov 30 17:16:32 2002 +0000 +++ b/rm.c Wed Dec 04 10:04:03 2002 +0000 @@ -352,7 +352,7 @@ RMContext *rm = s->priv_data; ByteIOContext *pb = &s->pb; StreamInfo *stream = rm->video_stream; - int key_frame = stream->enc->key_frame; + int key_frame = stream->enc->coded_picture->key_frame; /* XXX: this is incorrect: should be a parameter */ @@ -527,6 +527,7 @@ st = av_mallocz(sizeof(AVStream)); if (!st) goto fail; + avcodec_get_context_defaults(&st->codec); s->streams[s->nb_streams++] = st; st->id = get_be16(pb); get_be32(pb); /* max bit rate */ diff -r dcc03a32d1bb -r 39c4c4336486 swf.c --- a/swf.c Sat Nov 30 17:16:32 2002 +0000 +++ b/swf.c Wed Dec 04 10:04:03 2002 +0000 @@ -482,6 +482,8 @@ st = av_mallocz(sizeof(AVStream)); if (!st) return -ENOMEM; + avcodec_get_context_defaults(&st->codec); + if (v & 0x01) st->codec.channels = 2; else diff -r dcc03a32d1bb -r 39c4c4336486 utils.c --- a/utils.c Sat Nov 30 17:16:32 2002 +0000 +++ b/utils.c Wed Dec 04 10:04:03 2002 +0000 @@ -458,7 +458,7 @@ AVCodec *codec; AVStream *st; AVPacket *pkt; - AVPicture picture; + AVVideoFrame picture; AVPacketList *pktl=NULL, **ppktl; short samples[AVCODEC_MAX_AUDIO_FRAME_SIZE / 2]; UINT8 *ptr; @@ -694,6 +694,8 @@ st = av_mallocz(sizeof(AVStream)); if (!st) return NULL; + avcodec_get_context_defaults(&st->codec); + st->index = s->nb_streams; st->id = id; s->streams[s->nb_streams++] = st;