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

Rémi Denis-Courmont remi at remlab.net
Fri Feb 7 09:11:05 CET 2014


On Thu, 6 Feb 2014 23:18:15 +0100, Matthias Keiser
<matthias at tristan-inc.com> wrote:
> 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;
> +                    }

I would rather call atoi() and round to the nearest rectangular angle.
Also mind the indentation...

> +                }
>  #if LIBAVCODEC_VERSION_MAJOR < 54
>              if( cc->palctrl )
>              {

-- 
Rémi Denis-Courmont
Sent from my collocated server



More information about the vlc-devel mailing list