[FFmpeg-devel] [PATCH 2/2] ffplay: support snap to 90degree autorotation
wm4
nfxjfg at googlemail.com
Sun May 3 20:04:52 CEST 2015
On Sun, 3 May 2015 03:10:05 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:
> do people prefer this to be enabled or disabled by default ?
>
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> ffplay.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/ffplay.c b/ffplay.c
> index eea00e6..48b09ee 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -343,6 +343,7 @@ static int nb_vfilters = 0;
> static char *afilters = NULL;
> #endif
> static int autorotate = 1;
> +static int snapto90 = 0;
>
> /* current context */
> static int is_full_screen;
> @@ -2032,6 +2033,9 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
> if (displaymatrix && !theta)
> theta = av_display_rotation_get((int32_t*) displaymatrix);
>
> + if (snapto90)
> + theta = 90 * round(theta/90);
> +
> theta -= 360*floor(theta/360 + 0.9/360);
>
> if (fabs(theta - 90) < 1.0) {
> @@ -3742,6 +3746,7 @@ static const OptionDef options[] = {
> { "scodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &subtitle_codec_name }, "force subtitle decoder", "decoder_name" },
> { "vcodec", HAS_ARG | OPT_STRING | OPT_EXPERT, { &video_codec_name }, "force video decoder", "decoder_name" },
> { "autorotate", OPT_BOOL, { &autorotate }, "automatically rotate video", "" },
> + { "snapto90", OPT_BOOL, { &snapto90 }, "automatically rotate to any angle or multiplies of 90°", "" },
> { NULL, },
> };
>
Is there an actual use-case for this? Do files like this exist? (And
why would you want to "snap" them, instead of rotating them freely.)
More information about the ffmpeg-devel
mailing list