diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6b60473466237728aef59f4fc77a7bb15793dc82..8306ad9ba6746d4fa36b66a4039105da87b2a81c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -69,6 +69,7 @@ extern int motion_estimation_method;
 #define CODEC_FLAG_B      0x0008 /* use B frames */
 #define CODEC_FLAG_QPEL   0x0010 /* use qpel MC */
 #define CODEC_FLAG_GMC    0x0020 /* use GMC */
+#define CODEC_FLAG_TYPE   0x0040 /* fixed I/P frame type, from avctx->key_frame */
 
 /* codec capabilities */
 
@@ -121,8 +122,6 @@ typedef struct AVCodecContext {
     int qmax;         /* max qscale */
     int max_qdiff;    /* max qscale difference between frames */
     
-    int force_type;   /* 0= no force, otherwise I_TYPE, P_TYPE, ... */
-
     struct AVCodec *codec;
     void *priv_data;
 
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 2a7aca21d2b81dd9480a1d21e1677ee21a40f33e..55159c68c623806052b83a8be31a737202f8d20b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -514,7 +514,8 @@ int MPV_encode_picture(AVCodecContext *avctx,
 
     init_put_bits(&s->pb, buf, buf_size, NULL, NULL);
 
-    s->force_type= avctx->force_type;
+    s->force_type= (avctx->flags&CODEC_FLAG_TYPE) ?
+	(avctx->key_frame ? I_TYPE : P_TYPE) : 0;
     if (!s->intra_only) {
         /* first picture of GOP is intra */
         if (s->picture_in_gop_number % s->gop_size==0 || s->force_type==I_TYPE){