diff options
author | Piotr Tomasik <piotr@tomasik.co> | 2012-01-24 02:16:41 -0800 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-24 17:01:10 +0100 |
commit | 62d2a75b024bf72e6f3648e33c5bb5baf9018358 (patch) | |
tree | 166ae77c8a604e6683ff30f07c182a8053ca6fd9 /libavformat/mov.c | |
parent | 6813450209bab97c30e8b25a018cdc4c936b224a (diff) | |
download | ffmpeg-62d2a75b024bf72e6f3648e33c5bb5baf9018358.tar.gz |
Added clockwise rotate values to metadata for 90 and 270 degrees
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 06b2f87b0d..133dd89509 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2156,10 +2156,21 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc->width = width >> 16; sc->height = height >> 16; + //Assign clockwise rotate values based on transform matrix so that + //we can compensate for iPhone orientation during capture. + + if (display_matrix[1][0] == -65536 && display_matrix[0][1] == 65536) { + av_dict_set(&st->metadata, "rotate", "90", 0); + } + if (display_matrix[0][0] == -65536 && display_matrix[1][1] == -65536) { av_dict_set(&st->metadata, "rotate", "180", 0); } + if (display_matrix[1][0] == 65536 && display_matrix[0][1] == -65536) { + av_dict_set(&st->metadata, "rotate", "270", 0); + } + // transform the display width/height according to the matrix // skip this if the display matrix is the default identity matrix // or if it is rotating the picture, ex iPhone 3GS |