[vlc-commits] Avformat: Support rotation information
Matthias Keiser
git at videolan.org
Tue Feb 18 11:26:55 CET 2014
vlc | branch: master | Matthias Keiser <matthias at tristan-inc.com> | Mon Feb 17 01:32:20 2014 +0100| [aec33d68527544e1cc685e22e21856fc78792ce0] | committer: Jean-Baptiste Kempf
Avformat: Support rotation information
Notably for mp4
Ref #2882
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=aec33d68527544e1cc685e22e21856fc78792ce0
---
modules/demux/avformat/demux.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index b550ca9..92fcbc0 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -335,6 +335,28 @@ 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 )
+ {
+
+ long angle = strtol(rotation->value, NULL, 10);
+
+ if (angle > 45 && angle < 135)
+ fmt.video.orientation = ORIENT_ROTATED_270;
+
+ else if (angle > 135 && angle < 225)
+ fmt.video.orientation = ORIENT_ROTATED_180;
+
+ else if (angle > 225 && angle < 315)
+ fmt.video.orientation = ORIENT_ROTATED_90;
+
+ else
+ fmt.video.orientation = ORIENT_NORMAL;
+ }
+
#if LIBAVCODEC_VERSION_MAJOR < 54
if( cc->palctrl )
{
More information about the vlc-commits
mailing list