changeset 5:39c4c4336486 libavformat

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
author michaelni
date Wed, 04 Dec 2002 10:04:03 +0000
parents dcc03a32d1bb
children b681d968f227
files asf.c au.c avformat.h avidec.c avienc.c ffm.c jpeg.c rm.c swf.c utils.c
diffstat 10 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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;
 
--- 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
--- 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);
--- 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';
--- 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) {
--- 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;
 
--- 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 */
--- 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
--- 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;