[FFmpeg-devel] [PATCH 2/2] ffplay: support snap to 90degree autorotation
Michael Niedermayer
michaelni at gmx.at
Sun May 3 20:27:01 CEST 2015
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
> (And
> why would you want to "snap" them, instead of rotating them freely.)
if you rotate a rectangle by a angle thats not a multiple of 90 then
it doesnt fit cleanly in a 90deg aligned rectangle anymore so you
either end up with black triangles, or some parts cut off
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150503/cf51966d/attachment.asc>
More information about the ffmpeg-devel
mailing list