changeset 30312:54e9eb2664a7

Reuse the fmt-conversion code instead of duplicating the functionality.
author reimar
date Sun, 17 Jan 2010 14:58:44 +0000
parents 8a67140f5fc1
children 7f7591482564
files libmpcodecs/ve_lavc.c
diffstat 1 files changed, 4 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ve_lavc.c	Sun Jan 17 14:54:38 2010 +0000
+++ b/libmpcodecs/ve_lavc.c	Sun Jan 17 14:58:44 2010 +0000
@@ -24,6 +24,7 @@
 #include "libmpdemux/muxer.h"
 
 #include "img_format.h"
+#include "fmt-conversion.h"
 #include "mp_image.h"
 #include "vf.h"
 
@@ -593,30 +594,9 @@
     }
 
     mux_v->imgfmt = lavc_param_format;
-    switch(lavc_param_format)
-    {
-	case IMGFMT_YV12:
-	    lavc_venc_context->pix_fmt = PIX_FMT_YUV420P;
-	    break;
-	case IMGFMT_422P:
-	    lavc_venc_context->pix_fmt = PIX_FMT_YUV422P;
-	    break;
-	case IMGFMT_444P:
-	    lavc_venc_context->pix_fmt = PIX_FMT_YUV444P;
-	    break;
-	case IMGFMT_411P:
-	    lavc_venc_context->pix_fmt = PIX_FMT_YUV411P;
-	    break;
-	case IMGFMT_YVU9:
-	    lavc_venc_context->pix_fmt = PIX_FMT_YUV410P;
-	    break;
-	case IMGFMT_BGR32:
-	    lavc_venc_context->pix_fmt = PIX_FMT_RGB32;
-	    break;
-	default:
-    	    mp_msg(MSGT_MENCODER,MSGL_ERR,"%s is not a supported format\n", vo_format_name(lavc_param_format));
-    	    return 0;
-    }
+    lavc_venc_context->pix_fmt = imgfmt2pixfmt(lavc_param_format);
+    if (lavc_venc_context->pix_fmt == PIX_FMT_NONE)
+        return 0;
 
     if(!stats_file) {
     /* lavc internal 2pass bitrate control */