From 796141765a2f47a5f8198de3003fdd6cabcf5619 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 by cropping the video
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..257d656 100644
|
a
|
b
|
static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
| 1586 | 1586 | char buffersrc_args[256]; |
| 1587 | 1587 | int ret; |
| 1588 | 1588 | 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_crop; |
| 1590 | 1590 | AVCodecContext *codec = is->video_st->codec; |
| 1591 | 1591 | |
| 1592 | 1592 | snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); |
| … |
… |
static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
| 1612 | 1612 | if (ret < 0) |
| 1613 | 1613 | return ret; |
| 1614 | 1614 | |
| | 1615 | /* SDL YUV code is not handling odd width/height for some driver |
| | 1616 | * combinations, therefore we crop the picture to an even width/height. */ |
| | 1617 | if ((ret = avfilter_graph_create_filter(&filt_crop, |
| | 1618 | avfilter_get_by_name("crop"), |
| | 1619 | "ffplay_crop", "floor(in_w/2)*2:floor(in_h/2)*2", NULL, graph)) < 0) |
| | 1620 | return ret; |
| 1615 | 1621 | if ((ret = avfilter_graph_create_filter(&filt_format, |
| 1616 | 1622 | avfilter_get_by_name("format"), |
| 1617 | 1623 | "format", "yuv420p", NULL, graph)) < 0) |
| 1618 | 1624 | return ret; |
| | 1625 | if ((ret = avfilter_link(filt_crop, 0, filt_format, 0)) < 0) |
| | 1626 | return ret; |
| 1619 | 1627 | if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0) |
| 1620 | 1628 | return ret; |
| 1621 | 1629 | |
| 1622 | | if ((ret = configure_filtergraph(graph, vfilters, filt_src, filt_format)) < 0) |
| | 1630 | if ((ret = configure_filtergraph(graph, vfilters, filt_src, filt_crop)) < 0) |
| 1623 | 1631 | return ret; |
| 1624 | 1632 | |
| 1625 | 1633 | is->in_video_filter = filt_src; |