changeset 6739:8a680d5f3a17

10l (init flags after init ...)
author michael
date Tue, 16 Jul 2002 00:56:12 +0000
parents 77f2713ae7fd
children 913736867009
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 25 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Mon Jul 15 21:33:46 2002 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Tue Jul 16 00:56:12 2002 +0000
@@ -57,6 +57,8 @@
 
 #include "cfgparser.h"
 
+static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type);
+
 static int lavc_param_workaround_bugs=0;
 static int lavc_param_error_resilience=0;
 static int lavc_param_gray=0;
@@ -77,14 +79,24 @@
     vd_ffmpeg_ctx *ctx = sh->context;
     switch(cmd){
     case VDCTRL_QUERY_FORMAT:
-	if( (*((int*)arg)) == IMGFMT_YV12 ) return CONTROL_TRUE;
-	if( (*((int*)arg)) == IMGFMT_IYUV ) return CONTROL_TRUE;
-	if( (*((int*)arg)) == IMGFMT_I420 ) return CONTROL_TRUE;
-	if( (*((int*)arg)) == IMGFMT_YUY2 && ctx->yuy2_support ) return CONTROL_TRUE;
+        switch(*((int*)arg)){
+        case IMGFMT_YV12:
+        case IMGFMT_IYUV:
+        case IMGFMT_I420:
+            if(ctx->yuy2_support || ctx->yvu9_support) return CONTROL_FALSE;
+            else                                       return CONTROL_TRUE;
+        case IMGFMT_YUY2:
+            if(ctx->yuy2_support) return CONTROL_TRUE;
+                                  return CONTROL_FALSE;
 #if LIBAVCODEC_BUILD >= 4615
-	if( (*((int*)arg)) == IMGFMT_YVU9 && ctx->yvu9_support ) return CONTROL_TRUE;
+        case IMGFMT_YVU9:
+            if(ctx->yvu9_support) return CONTROL_TRUE;
+                                  return CONTROL_FALSE;
 #endif
-	return CONTROL_FALSE;
+        default:
+            return CONTROL_FALSE;
+                
+        }
     }
     return CONTROL_UNKNOWN;
 }
@@ -123,6 +135,13 @@
     ctx->avctx = malloc(sizeof(AVCodecContext));
     memset(ctx->avctx, 0, sizeof(AVCodecContext));
     avctx = ctx->avctx;
+
+#if LIBAVCODEC_BUILD > 4615
+    if(ctx->do_dr1){
+        avctx->flags|= CODEC_FLAG_EMU_EDGE | CODEC_FLAG_DR1; 
+        avctx->get_buffer_callback= get_buffer;
+    }
+#endif
     
     avctx->width = sh->disp_w;
     avctx->height= sh->disp_h;
@@ -326,13 +345,6 @@
 	}
     }
 
-#if LIBAVCODEC_BUILD > 4615
-    if(dr1){
-        avctx->flags|= CODEC_FLAG_EMU_EDGE | CODEC_FLAG_DR1;
-        avctx->get_buffer_callback= get_buffer;
-    }
-#endif
-
 #if LIBAVCODEC_BUILD > 4603
     avctx->hurry_up=(flags&3)?((flags&2)?2:1):0;
 #endif