Ticket #1322: 0001-ffplay-fix-odd-YUV-width.patch

File 0001-ffplay-fix-odd-YUV-width.patch, 2.1 KB (added by cus, 4 years ago)
  • ffplay.c

    From f2e7613cc5e8afeb437d13b37d89c8368105591d Mon Sep 17 00:00:00 2001
    From: Marton Balint <cus@passwd.hu>
    Date: Fri, 24 Aug 2012 01:02:04 +0200
    Subject: [PATCH] ffplay: fix odd YUV width
    
    Should fix issue #1322.
    
    Signed-off-by: Marton Balint <cus@passwd.hu>
    ---
     ffplay.c |   12 ++++++++++--
     1 files changed, 10 insertions(+), 2 deletions(-)
    
    diff --git a/ffplay.c b/ffplay.c
    index f81bd7c..f996b68 100644
    a b static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c 
    15861586    char buffersrc_args[256]; 
    15871587    int ret; 
    15881588    AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); 
    1589     AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format; 
     1589    AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format, *filt_scale; 
    15901590    AVCodecContext *codec = is->video_st->codec; 
    15911591 
    15921592    snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); 
    static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c 
    16121612    if (ret < 0) 
    16131613        return ret; 
    16141614 
     1615    /* SDL YUV code is not handling odd width/height for some driver 
     1616     * combinations, therefore we upscale the picture to an even width/height. */ 
     1617    if ((ret = avfilter_graph_create_filter(&filt_scale, 
     1618                                            avfilter_get_by_name("scale"), 
     1619                                            "ffplay_scale", "ceil(in_w/2)*2:ceil(in_h/2)*2", NULL, graph)) < 0) 
     1620        return ret; 
    16151621    if ((ret = avfilter_graph_create_filter(&filt_format, 
    16161622                                            avfilter_get_by_name("format"), 
    16171623                                            "format", "yuv420p", NULL, graph)) < 0) 
    16181624        return ret; 
     1625    if ((ret = avfilter_link(filt_scale, 0, filt_format, 0)) < 0) 
     1626        return ret; 
    16191627    if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0) 
    16201628        return ret; 
    16211629 
    1622     if ((ret = configure_filtergraph(graph, vfilters, filt_src, filt_format)) < 0) 
     1630    if ((ret = configure_filtergraph(graph, vfilters, filt_src, filt_scale)) < 0) 
    16231631        return ret; 
    16241632 
    16251633    is->in_video_filter  = filt_src;