aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-01-09 11:24:22 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-01-14 17:17:23 +0100
commitcf70ba37ba74089a18295b29e77dead0a3222c9e (patch)
treeb3d19bd0e53f921f157cfb7e45d7c59a4f56ee1f
parent1e763454322f7fbc7799f6009bf2e11d7a3b9821 (diff)
downloadffmpeg-cf70ba37ba74089a18295b29e77dead0a3222c9e.tar.gz
mov: Check angle rather than full matrix when updating SAR
When the display matrix is not the identity one, but the rotation angle is zero, there is no need to update the sample aspect ratio. Otherwise, it is possible to obtain negative values which interferes with transcoding in later stages. This kind of behaviour is reproducible on mov files with "major_brand: MSNV". CC: libav-stable@libav.org Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
-rw-r--r--libavformat/mov.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index aa81661c9a..86b2de0a96 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -35,6 +35,7 @@
#include "libavutil/time_internal.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
+#include "libavutil/display.h"
#include "libavutil/opt.h"
#include "libavcodec/ac3tab.h"
#include "avformat.h"
@@ -2578,15 +2579,10 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
// 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
+ // skip this if the rotation angle is 0 degrees
// to keep the same scale, use [width height 1<<16]
- if (width && height &&
- ((display_matrix[0][0] != 65536 ||
- display_matrix[1][1] != 65536) &&
- !display_matrix[0][1] &&
- !display_matrix[1][0] &&
- !display_matrix[2][0] && !display_matrix[2][1])) {
+ if (width && height && sc->display_matrix &&
+ av_display_rotation_get(sc->display_matrix) != 0.0f) {
for (i = 0; i < 2; i++)
disp_transform[i] =
(int64_t) width * display_matrix[0][i] +