summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-12-04 10:04:03 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-12-04 10:04:03 +0000
commit1e491e29c27cf6a6925666e4f4eac41b65e263d7 (patch)
tree99879470b8deeb55e7d88c62729b62ac27d249ee /libavformat
parent855ea723b0ea450137e54674179751c14e8fc6b5 (diff)
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 Originally committed as revision 1302 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asf.c3
-rw-r--r--libavformat/au.c2
-rw-r--r--libavformat/avformat.h3
-rw-r--r--libavformat/avidec.c2
-rw-r--r--libavformat/avienc.c2
-rw-r--r--libavformat/ffm.c7
-rw-r--r--libavformat/jpeg.c2
-rw-r--r--libavformat/rm.c3
-rw-r--r--libavformat/swf.c2
-rw-r--r--libavformat/utils.c4
10 files changed, 23 insertions, 7 deletions
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 2f1ce12dc3..3635913713 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -556,7 +556,7 @@ static void put_frame_header(AVFormatContext *s, ASFStream *stream, int timestam
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 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
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 --git a/libavformat/au.c b/libavformat/au.c
index 8c3d62a595..b584d8d4f5 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -143,6 +143,8 @@ static int au_read_header(AVFormatContext *s,
st = av_malloc(sizeof(AVStream));
if (!st)
return -1;
+ avcodec_get_context_defaults(&st->codec);
+
s->nb_streams = 1;
s->streams[0] = st;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 0ea10f7dfe..86ddee4b52 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -144,6 +144,9 @@ typedef struct AVStream {
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 --git a/libavformat/avidec.c b/libavformat/avidec.c
index 9646408cd1..fc719d3fff 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -103,6 +103,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
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 --git a/libavformat/avienc.c b/libavformat/avienc.c
index b4298b0b39..a9bf3a8d92 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -320,7 +320,7 @@ static int avi_write_packet(AVFormatContext *s, int stream_index,
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 --git a/libavformat/ffm.c b/libavformat/ffm.c
index c21599c69f..cd7a174d06 100644
--- a/libavformat/ffm.c
+++ b/libavformat/ffm.c
@@ -151,7 +151,7 @@ static int ffm_write_header(AVFormatContext *s)
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 @@ static int ffm_write_packet(AVFormatContext *s, int stream_index,
/* 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 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
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 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
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 --git a/libavformat/jpeg.c b/libavformat/jpeg.c
index 6a19db6d67..e86edfecde 100644
--- a/libavformat/jpeg.c
+++ b/libavformat/jpeg.c
@@ -170,6 +170,8 @@ static int jpeg_read_header(AVFormatContext *s1, AVFormatParameters *ap)
av_free(s);
return -ENOMEM;
}
+ avcodec_get_context_defaults(&st->codec);
+
s1->streams[0] = st;
s->img_number = 0;
diff --git a/libavformat/rm.c b/libavformat/rm.c
index be90a27c89..44e384559d 100644
--- a/libavformat/rm.c
+++ b/libavformat/rm.c
@@ -352,7 +352,7 @@ static int rm_write_video(AVFormatContext *s, UINT8 *buf, int size)
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 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
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 --git a/libavformat/swf.c b/libavformat/swf.c
index 14f8707f96..315219056e 100644
--- a/libavformat/swf.c
+++ b/libavformat/swf.c
@@ -482,6 +482,8 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
st = av_mallocz(sizeof(AVStream));
if (!st)
return -ENOMEM;
+ avcodec_get_context_defaults(&st->codec);
+
if (v & 0x01)
st->codec.channels = 2;
else
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5a9aa082f4..3388ddc9ef 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -458,7 +458,7 @@ int av_find_stream_info(AVFormatContext *ic)
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 @@ AVStream *av_new_stream(AVFormatContext *s, int id)
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;