[vlc-devel] [PATCH] Support for rotated MP4 Movies (bug #2882)

Matthias Keiser matthias at tristan-inc.com
Thu Feb 6 23:18:15 CET 2014


From f1ef96fc575693b7716f277012906758f0df83e4 Mon Sep 17 00:00:00 2001
From: Matthias Keiser <matthias at tristan-inc.com>
Date: Thu, 6 Feb 2014 16:06:14 +0100
Subject: [PATCH 05/13] Avformat: set video orientation according to the values
 passed by libavformat (currently FFmpeg only).

---
 modules/demux/avformat/demux.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 6e8086e..a931572 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -323,6 +323,25 @@ int OpenDemux( vlc_object_t *p_this )
 
             fmt.video.i_width = cc->width;
             fmt.video.i_height = cc->height;
+
+            char const *kRotateKey = "rotate";
+            AVDictionaryEntry *rotation = av_dict_get(s->metadata, kRotateKey, NULL, 0);
+
+                if( rotation )
+                {
+                    if ( !strncmp(rotation->value, "90", 2 ))
+                    {
+                        fmt.video.orientation = ORIENT_ROTATED_270;
+                    }
+                    else if ( !strncmp(rotation->value, "180", 3 ))
+                    {
+                        fmt.video.orientation = ORIENT_ROTATED_180;
+                    }
+                    else if ( !strncmp(rotation->value, "270", 3 ))
+                    {
+                        fmt.video.orientation = ORIENT_ROTATED_90;
+                    }
+                }
 #if LIBAVCODEC_VERSION_MAJOR < 54
             if( cc->palctrl )
             {
-- 
1.8.3.4 (Apple Git-47)





More information about the vlc-devel mailing list