[FFmpeg-devel] [PATCH 2/2] ffplay: support snap to 90degree autorotation

Marton Balint cus at passwd.hu
Sun May 3 22:21:51 CEST 2015



On Sun, 3 May 2015, Michael Niedermayer wrote:

> On Sun, May 03, 2015 at 08:04:52PM +0200, wm4 wrote:
>> 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?
>
> i dont know, i just want to fix and cleanup the code
> so it doesnt randomly apply snapto90 in some cases and not in others
>
> if someone does have a file that contains an angle which is not a
> multiple of 90, i would like to have that file
>
>

I would not add this option until we are aware of any real-world files 
where this option matters.

Regards
Marton

[...]


More information about the ffmpeg-devel mailing list