[vlc-devel] [PATCH] libvlc: media: add orientation in libvlc_video_track_t

Thomas Guillem thomas at gllm.fr
Fri Nov 25 09:43:27 CET 2016



On Thu, Nov 24, 2016, at 18:59, Rémi Denis-Courmont wrote:
> Le torstaina 24. marraskuuta 2016, 17.54.23 EET Thomas Guillem a écrit :
> > ---
> >  include/vlc/libvlc_media.h | 13 +++++++++++++
> >  lib/media.c                | 18 ++++++++++++++++++
> >  2 files changed, 31 insertions(+)
> > 
> > diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
> > index 8fd13fe..547c7c0 100644
> > --- a/include/vlc/libvlc_media.h
> > +++ b/include/vlc/libvlc_media.h
> > @@ -172,6 +172,18 @@ typedef struct libvlc_audio_track_t
> >      unsigned    i_rate;
> >  } libvlc_audio_track_t;
> > 
> > +typedef enum libvlc_video_orient_t
> > +{
> > +    libvlc_video_orient_normal,         /**< or top_left */
> > +    libvlc_video_orient_transposed,     /**< or left_top */
> > +    libvlc_video_orient_antitransposed, /**< or right_bottom */
> > +    libvlc_video_orient_hflipped,       /**< or top_right */
> > +    libvlc_video_orient_vflipped,       /**< or bottom_left */
> > +    libvlc_video_orient_180,            /**< or bottom_right */
> > +    libvlc_video_orient_270,            /**< or left_bottom */
> > +    libvlc_video_orient_90,             /**< or right_top */
> > +} libvlc_video_orient_t;
> 
> Did you actually check how that looks in Doxygen. I somehow doubt it´s 
> understandable.

Yes, this looks understandable, see png attached.

> > +
> >  typedef struct libvlc_video_track_t
> >  {
> >      unsigned    i_height;
> > @@ -180,6 +192,7 @@ typedef struct libvlc_video_track_t
> >      unsigned    i_sar_den;
> >      unsigned    i_frame_rate_num;
> >      unsigned    i_frame_rate_den;
> > +    libvlc_video_orient_t i_orientation;
> 
> Not this again.

What again ?

> 
> >  } libvlc_video_track_t;
> > 
> >  typedef struct libvlc_subtitle_track_t
> > diff --git a/lib/media.c b/lib/media.c
> > index 8e07930..b30bbc4 100644
> > --- a/lib/media.c
> > +++ b/lib/media.c
> > @@ -106,6 +106,22 @@ static const libvlc_meta_t vlc_to_libvlc_meta[] =
> >      [vlc_meta_DiscTotal]    = libvlc_meta_DiscTotal
> >  };
> > 
> > +static libvlc_video_orient_t vlc_to_libvlc_orient(video_orientation_t
> > orient) +{
> > +    switch (orient)
> > +    {
> > +        case ORIENT_TOP_LEFT:       return libvlc_video_orient_normal;
> > +        case ORIENT_TOP_RIGHT:      return libvlc_video_orient_hflipped;
> > +        case ORIENT_BOTTOM_LEFT:    return libvlc_video_orient_vflipped;
> > +        case ORIENT_BOTTOM_RIGHT:   return libvlc_video_orient_180;
> > +        case ORIENT_LEFT_TOP:       return libvlc_video_orient_transposed;
> > +        case ORIENT_LEFT_BOTTOM:    return libvlc_video_orient_270;
> > +        case ORIENT_RIGHT_TOP:      return libvlc_video_orient_90;
> > +        case ORIENT_RIGHT_BOTTOM:   return
> > libvlc_video_orient_antitransposed;
> > +        default:                   
> > vlc_assert_unreachable();
> 
> Do you really need a switch for a 1:1 mapping of 8 values?

Enum values are different, except if I choose to use
top_left/top_right... in libvlc, then I could do a libvlc_orient =
vlc_orient.

Also, I already experienced enums mismatch between vlc and libvlc, I
don't want to loose time on that again. But I'm still not sure what's
the best way to do.

> 
> > +    }
> > +}
> > +
> >  static libvlc_media_list_t *media_get_subitems( libvlc_media_t * p_md,
> >                                                  bool b_create )
> >  {
> > @@ -994,6 +1010,8 @@ libvlc_media_tracks_get( libvlc_media_t *p_md,
> > libvlc_media_track_t *** pp_es ) p_mes->video->i_sar_den =
> > p_es->video.i_sar_den;
> >              p_mes->video->i_frame_rate_num = p_es->video.i_frame_rate;
> >              p_mes->video->i_frame_rate_den = p_es->video.i_frame_rate_base;
> > +            p_mes->video->i_orientation =
> > +                vlc_to_libvlc_orient(p_es->video.orientation);
> >              break;
> >          case AUDIO_ES:
> >              p_mes->i_type = libvlc_track_audio;
> 
> 
> -- 
> Rémi Denis-Courmont
> https://www.remlab.net/
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: docygen.png
Type: image/png
Size: 26769 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161125/2207ef1c/attachment.png>


More information about the vlc-devel mailing list