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

Matthias Keiser matthias at tristan-inc.com
Mon Feb 17 01:38:03 CET 2014


Previous discussion was here:

https://mailman.videolan.org/pipermail/vlc-devel/2014-February/096708.html
---
 src/video_output/video_output.c | 58 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 64bef99..839023b 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -56,6 +56,7 @@
  *****************************************************************************/
 static void *Thread(void *);
 static void VoutDestructor(vlc_object_t *);
+static void ThreadChangeAspectRatio(vout_thread_t *vout, unsigned num, unsigned den);
 
 /* Maximum delay between 2 displayed pictures.
  * XXX it is needed for now but should be removed in the long term.
@@ -742,6 +743,63 @@ static void ThreadChangeFilters(vout_thread_t *vout,
 
     vlc_array_init(&array_static);
     vlc_array_init(&array_interactive);
+
+    if (vout->p->filter.format.orientation != ORIENT_TOP_LEFT) {
+
+        if (!vout_CanDisplayHandleOrientation(vout->p->display.vd)) {
+
+            const char *type;
+
+            switch (vout->p->filter.format.orientation) {
+
+                case ORIENT_ROTATED_90:
+                    type = "90";
+                    break;
+                case ORIENT_ROTATED_180:
+                    type = "180";
+                    break;
+                case ORIENT_ROTATED_270:
+                    type = "270";
+                    break;
+                case ORIENT_HFLIPPED:
+                    type = "hflip";
+                    break;
+                case ORIENT_VFLIPPED:
+                    type = "vflip";
+                    break;
+                case ORIENT_TRANSPOSED:
+                    type = "transpose";
+                    break;
+                case ORIENT_ANTI_TRANSPOSED:
+                    type = "antitranspose";
+                    break;
+                default:
+                    type = NULL;
+                    break;
+            }
+
+            if (type) {
+
+                config_chain_t *cfg;
+                char *name;
+                char config[30];
+                snprintf(config, 30, "transform{type=%s}", type);
+                char *next;
+                VLC_UNUSED(next);
+                next = config_ChainCreate(&name, &cfg, config);
+                vout_filter_t *e = xmalloc(sizeof(*e));
+                e->name = name;
+                e->cfg  = cfg;
+                vlc_array_insert(&array_interactive, e, 0);
+            }
+        }
+        else if (ORIENT_IS_SWAP(vout->p->filter.format.orientation)) {
+
+            //If we don't use a filter, we have to adjust the aspect ration manually.
+            ThreadChangeAspectRatio(vout, vout->p->filter.format.i_visible_height, vout->p->filter.format.i_visible_width);
+        }
+    }
+
     char *current = filters ? strdup(filters) : NULL;
     while (current) {
         config_chain_t *cfg;
-- 
1.8.3.4 (Apple Git-47)





More information about the vlc-devel mailing list