[vlc-devel] [PATCH] avcodec: simplify the code logic

Steve Lhomme robux4 at videolabs.io
Mon Mar 30 15:10:05 CEST 2015


the line forcing I420 had no effect
---
 modules/codec/avcodec/video.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 381fe62..b37ecd1 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -152,13 +152,8 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
         p_dec->fmt_out.video.i_visible_height = height;
     }
 
-    if( !p_sys->p_va && GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) )
-    {
-        /* we are doomed, but not really, because most codecs set their pix_fmt
-         * much later
-         * FIXME does it make sense here ? */
-        p_dec->fmt_out.video.i_chroma = VLC_CODEC_I420;
-    }
+    if( !p_sys->p_va )
+        GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt );
     p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma;
 
     /* If an aspect-ratio was specified in the input format then force it */
@@ -424,11 +419,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
-    if( GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) != VLC_SUCCESS )
-    {
-        /* we are doomed. but not really, because most codecs set their pix_fmt later on */
-        p_dec->fmt_out.i_codec = VLC_CODEC_I420;
-    }
+    GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt );
     p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma;
 
     p_dec->fmt_out.video.orientation = p_dec->fmt_in.video.orientation;
-- 
2.3.0




More information about the vlc-devel mailing list