qtdemux: does not detect orientation

Most files don't contain the values for transposing the coordinates
back to the positive quadrant so qtdemux was ignoring the rotation
tag. To be able to properly handle those files qtdemux will also ignore
the transposing values to only detect the rotation using the values
abde from the transformation matrix:

[a b c]
[d e f]
[g h i]

https://bugzilla.gnome.org/show_bug.cgi?id=738681
This commit is contained in:
Gilbok Lee 2015-06-23 20:15:13 +09:00 committed by Thiago Santos
parent 35bf449404
commit 0dcd76447a

View file

@ -7719,25 +7719,21 @@ qtdemux_inspect_transformation_matrix (GstQTDemux * qtdemux,
* This macro will only compare value abdegh, it expects cfi to have already * This macro will only compare value abdegh, it expects cfi to have already
* been checked * been checked
*/ */
#define QTCHECK_MATRIX(m,a,b,d,e,g,h) ((m)[0] == (a << 16) && (m)[1] == (b << 16) && \ #define QTCHECK_MATRIX(m,a,b,d,e) ((m)[0] == (a << 16) && (m)[1] == (b << 16) && \
(m)[3] == (d << 16) && (m)[4] == (e << 16) && \ (m)[3] == (d << 16) && (m)[4] == (e << 16))
(m)[6] == (g << 16) && (m)[7] == (h << 16))
/* only handle the cases where the last column has standard values */ /* only handle the cases where the last column has standard values */
if (matrix[2] == 0 && matrix[5] == 0 && matrix[8] == 1 << 30) { if (matrix[2] == 0 && matrix[5] == 0 && matrix[8] == 1 << 30) {
const gchar *rotation_tag = NULL; const gchar *rotation_tag = NULL;
/* no rotation needed */ /* no rotation needed */
if (QTCHECK_MATRIX (matrix, 1, 0, 0, 1, 0, 0)) { if (QTCHECK_MATRIX (matrix, 1, 0, 0, 1)) {
/* NOP */ /* NOP */
} else if (QTCHECK_MATRIX (matrix, 0, 1, G_MAXUINT16, 0, } else if (QTCHECK_MATRIX (matrix, 0, 1, G_MAXUINT16, 0)) {
stream->display_height, 0)) {
rotation_tag = "rotate-90"; rotation_tag = "rotate-90";
} else if (QTCHECK_MATRIX (matrix, G_MAXUINT16, 0, 0, G_MAXUINT16, } else if (QTCHECK_MATRIX (matrix, G_MAXUINT16, 0, 0, G_MAXUINT16)) {
stream->display_width, stream->display_height)) {
rotation_tag = "rotate-180"; rotation_tag = "rotate-180";
} else if (QTCHECK_MATRIX (matrix, 0, G_MAXUINT16, 1, 0, 0, } else if (QTCHECK_MATRIX (matrix, 0, G_MAXUINT16, 1, 0)) {
stream->display_width)) {
rotation_tag = "rotate-270"; rotation_tag = "rotate-270";
} else { } else {
GST_FIXME_OBJECT (qtdemux, "Unhandled transformation matrix values"); GST_FIXME_OBJECT (qtdemux, "Unhandled transformation matrix values");