summaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-01-22 19:10:27 +0000
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-01-23 14:54:59 +0000
commit4c5fa628da099dbb598c93bc4555b8733d2c3035 (patch)
treef6a7d86036ff9dd321c244a9a30969240e289c6a /libavformat/mov.c
parent2a06c2a03e1205aaeede5af850b9271752ddd4cf (diff)
downloadffmpeg-streaming-4c5fa628da099dbb598c93bc4555b8733d2c3035.zip
ffmpeg-streaming-4c5fa628da099dbb598c93bc4555b8733d2c3035.tar.gz
mov: Do not compute negative SAR values
This partially reverts cf70ba37ba74089a18295b29e77dead0a3222c9e, since it didn't take into account when rotation is 0, but there is another valid operation (eg. translation) in the matrix. Found-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 86b2de0..75bd5e9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -35,7 +35,6 @@
#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"
@@ -2579,10 +2578,9 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
}
// transform the display width/height according to the matrix
- // skip this if the rotation angle is 0 degrees
+ // skip this when the display matrix is the identity one
// to keep the same scale, use [width height 1<<16]
- if (width && height && sc->display_matrix &&
- av_display_rotation_get(sc->display_matrix) != 0.0f) {
+ if (width && height && sc->display_matrix) {
for (i = 0; i < 2; i++)
disp_transform[i] =
(int64_t) width * display_matrix[0][i] +
@@ -2590,9 +2588,10 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
((int64_t) display_matrix[2][i] << 16);
//sample aspect ratio is new width/height divided by old width/height
- st->sample_aspect_ratio = av_d2q(
- ((double) disp_transform[0] * height) /
- ((double) disp_transform[1] * width), INT_MAX);
+ if (disp_transform[0] > 0 && disp_transform[1] > 0)
+ st->sample_aspect_ratio = av_d2q(
+ ((double) disp_transform[0] * height) /
+ ((double) disp_transform[1] * width), INT_MAX);
}
return 0;
}
OpenPOWER on IntegriCloud