aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-09-12 00:27:08 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-09-12 00:27:08 +0000
commit208d3ddf961c745b20e19f1568dca3f631856d34 (patch)
tree94e45f99b567760af147b4cbaf76d6b31e8e84d3
parent89b3d7c9f1375d8f2009e9fd98e97ae0019eb6b6 (diff)
downloadffmpeg-208d3ddf961c745b20e19f1568dca3f631856d34.tar.gz
set pict_type & key_frame on decoding too
Originally committed as revision 918 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/avcodec.h2
-rw-r--r--libavcodec/mpegvideo.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 96db4d9031..123c58fd9c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -182,7 +182,7 @@ typedef struct AVCodecContext {
int key_frame; /* true if the previous compressed frame was
a key frame (intra, or seekable) */
int pict_type; /* picture type of the previous
- encoded frame */
+ en/decoded frame */
/* FIXME: these should have FF_ */
#define I_TYPE 1 // Intra
#define P_TYPE 2 // Predicted
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index e26024cb48..619cf509fe 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -720,7 +720,8 @@ void MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
/* generic function for encode/decode called after a frame has been coded/decoded */
void MPV_frame_end(MpegEncContext *s)
{
-// if((s->picture_number%100)==0 && s->encoding) printf("sads:%d //\n", sads);
+ s->avctx->key_frame = (s->pict_type == I_TYPE);
+ s->avctx->pict_type = s->pict_type;
/* draw edge for correct motion prediction if outside */
if (s->pict_type != B_TYPE && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
@@ -870,8 +871,7 @@ int MPV_encode_picture(AVCodecContext *avctx,
MPV_frame_start(s, avctx);
encode_picture(s, s->picture_number);
- avctx->key_frame = (s->pict_type == I_TYPE);
- avctx->pict_type = s->pict_type;
+
avctx->real_pict_num = s->picture_number;
avctx->header_bits = s->header_bits;
avctx->mv_bits = s->mv_bits;