[vlc-devel] [PATCH] Support for rotated MP4 Movies (bug #2882)
Rémi Denis-Courmont
remi at remlab.net
Fri Feb 7 12:49:06 CET 2014
On Thu, 6 Feb 2014 23:19:34 +0100, Matthias Keiser
<matthias at tristan-inc.com> wrote:
> From 9e4ee31b951fe425a2de217ab9d84c106ceb22d4 Mon Sep 17 00:00:00 2001
> From: Matthias Keiser <matthias at tristan-inc.com>
> Date: Thu, 6 Feb 2014 16:17:02 +0100
> Subject: [PATCH 07/13] Add function which applies the rotation to a
> video_format_t.
>
> ---
> include/vlc_es.h | 6 ++++++
> src/misc/es_format.c | 20 ++++++++++++++++++++
> 2 files changed, 26 insertions(+)
>
> diff --git a/include/vlc_es.h b/include/vlc_es.h
> index 3040c38..950f2f3 100644
> --- a/include/vlc_es.h
> +++ b/include/vlc_es.h
> @@ -263,6 +263,12 @@ VLC_API void video_format_CopyCrop( video_format_t
*,
> const video_format_t * );
> VLC_API void video_format_ScaleCropAr( video_format_t *, const
> video_format_t * );
>
> /**
> + * If the formats orientation indicates a rotation, this function
> switches the a/r according to the orientation, producing a format whose
> orientation is ORIENT_NORMAL. It makes a shallow copy (pallette is not
> alloc'ed).
> + */
> +
> +void video_format_ApplyRotation(const video_format_t *in,
video_format_t
> *out);
> +
> +/**
> * This function will check if the first video format is similar
> * to the second one.
> */
> diff --git a/src/misc/es_format.c b/src/misc/es_format.c
> index 87b6ada..566203f 100644
> --- a/src/misc/es_format.c
> +++ b/src/misc/es_format.c
> @@ -243,6 +243,26 @@ void video_format_ScaleCropAr( video_format_t
*p_dst,
> const video_format_t *p_sr
> p_dst->i_sar_num, p_dst->i_sar_den, 65536);
> }
>
> +void video_format_ApplyRotation(const video_format_t *in,
video_format_t
> *out) {
The restrict qualifier is missing.
> +
> + *out = *in;
> +
> + if(in->orientation == ORIENT_ROTATED_90 || in->orientation ==
> ORIENT_ROTATED_270) {
The transpose and antitranspose cases appear to be missing.
> +
> + out->i_visible_width = in->i_visible_height;
> + out->i_visible_height = in->i_visible_width;
> + out->i_height = in->i_width;
> + out->i_width = in->i_height;
> + out->i_sar_num = in->i_sar_den;
> + out->i_sar_den = in->i_sar_num;
> + out->orientation = ORIENT_NORMAL;
> + }
> + if(in->orientation == ORIENT_ROTATED_180) {
I think you should use 'else'; the mirror cases seem to be missing
otherwise.
> + out->orientation = ORIENT_NORMAL;
> + }
> +}
> +
> +
> bool video_format_IsSimilar( const video_format_t *p_fmt1, const
> video_format_t *p_fmt2 )
> {
> video_format_t v1 = *p_fmt1;
--
Rémi Denis-Courmont
Sent from my collocated server
More information about the vlc-devel
mailing list