# HG changeset patch # User reimar # Date 1263740324 0 # Node ID 54e9eb2664a785728c29ce999d1275da45560c41 # Parent 8a67140f5fc1ce8125421766f252137610ee19fc Reuse the fmt-conversion code instead of duplicating the functionality. diff -r 8a67140f5fc1 -r 54e9eb2664a7 libmpcodecs/ve_lavc.c --- 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 */