[vlc-commits] mux/mp4: do not shift negative values left

Rémi Denis-Courmont git at videolan.org
Tue Apr 26 22:14:22 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Apr 26 23:13:00 2016 +0300| [53d5195cf233f8618a863c2fcb46bb368a0d9af9] | committer: Rémi Denis-Courmont

mux/mp4: do not shift negative values left

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=53d5195cf233f8618a863c2fcb46bb368a0d9af9
---

 modules/mux/mp4/libmp4mux.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/mux/mp4/libmp4mux.c b/modules/mux/mp4/libmp4mux.c
index 8b48b1f..0af383f 100644
--- a/modules/mux/mp4/libmp4mux.c
+++ b/modules/mux/mp4/libmp4mux.c
@@ -147,14 +147,16 @@ static void matrix_apply_rotation(es_format_t *fmt, uint32_t mvhd_matrix[9])
     if (fmt->i_cat == VIDEO_ES)
         orientation = fmt->video.orientation;
 
-#define ATAN(a, b) do { mvhd_matrix[1] = (a) << 16; \
-    mvhd_matrix[0] = (b) << 16; \
+#define ATAN(a, b) \
+    do { \
+        mvhd_matrix[1] = ((uint32_t)(a)) << 16; \
+        mvhd_matrix[0] = ((uint32_t)(b)) << 16; \
     } while(0)
 
     switch (orientation) {
     case ORIENT_ROTATED_90:  ATAN( 1,  0); break;
     case ORIENT_ROTATED_180: ATAN( 0, -1); break;
-    case ORIENT_ROTATED_270: ATAN( -1, 0); break;
+    case ORIENT_ROTATED_270: ATAN(-1,  0); break;
     default:                 ATAN( 0,  1); break;
     }
 



More information about the vlc-commits mailing list