On Fri, May 23, 2014 at 12:52:42AM -0400, Don Moir wrote:
----- Original Message ----- From: "Don Moir" <donmoir@comcast.net> To: "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org> Sent: Friday, May 23, 2014 12:40 AM Subject: Re: [FFmpeg-devel] [PATCH] ffplay: support rotated video.
On Thu, May 22, 2014 at 09:30:05PM +0200, Clément B?sch wrote:
On Wed, May 21, 2014 at 05:18:30AM +0200, Michael Niedermayer wrote:
On Tue, May 20, 2014 at 07:54:05PM +0200, Clément B?sch wrote:
On Fri, Apr 18, 2014 at 05:43:35PM -0400, Don Moir wrote: [...]
+ if (autorotate) { + AVDictionaryEntry *rotate_tag = av_dict_get(is->video_st->metadata, "rotate", NULL, 0); + if (rotate_tag) { + if (!strcmp(rotate_tag->value, "90")) { + INSERT_FILT("transpose", "1"); + } else if (!strcmp(rotate_tag->value, "180")) { + INSERT_FILT("hflip", NULL); + INSERT_FILT("vflip", NULL); + } else if (!strcmp(rotate_tag->value, "270")) { + INSERT_FILT("transpose", "2"); + } else { + INSERT_FILT("rotate", rotate_tag->value); + } + } + }
you might want to do this instead of stcmp. Catches values greater than 360 as well.
int rotate = atoi(rotate_tag->value) % 360;
No I can't, it can be a floating value.
fmod() could be used
Right, but I'm not sure it would be more reliable/simple that what i'm currently proposing.
Not sure if it matters if its floating or not.
atoi ("180.0") equates to 180 if that is what you are refering to.
With what you have a filter gets inserted for anything your logic does not understand including zero rotate. doing a mod on it catches zero easily and anything >= 360. Probably not a big deal except the inserting of filter for possible zero rotate value.
I guess what you are saying it might be something like "90.5" or something.
Yes. 90.999 would raise 90 too unless you round btw.
Could be one degree off. Not sure it would display where someone would notice a one degree difference.
There is no reason to drop that accuracy. The orientation matrix in MOV has a relatively high one, there is no reason to drop it just to save 3 strcmp on 2-3 characters called only once at the beginning of the program.
Can it be radians and how would you know that?
See the other thread where I sent the updated patchset. It should answer all your questions.
Do you have a video with an odd rotate value ?
Not yet, but it's almost free to deal with that. 90, 180, and 270 cases are just exception, and I don't want to catch them because of an inaccuracy. It's more complex to write a matrix leading to 90.1 degrees than 90 degrees, so there is no reason to rotate 90 instead of 90.1 in that situation. -- Clément B.