[vlc-devel] [PATCH] lib: fix position enumeration values

Francois Cartegnie fcvlcdev at free.fr
Tue May 20 14:44:32 CEST 2014


Le 20/05/2014 14:27, Mark Lee a écrit :

> /* Subpicture region position flags */
> #define SUBPICTURE_ALIGN_LEFT 0x1
> #define SUBPICTURE_ALIGN_RIGHT 0x2
> #define SUBPICTURE_ALIGN_TOP 0x4
> #define SUBPICTURE_ALIGN_BOTTOM 0x8

Having defines & enums is bad for consistency.

Maybe a best way is to split and compose enums:

typedef enum libvlc_align_t {
    libvlc_align_left = 1 << 0,
    libvlc_align_right= 1 << 1,
    libvlc_align_bottom= 1 << 2,
    libvlc_align_top= 1 << 3,
}

and then compose our second enum based on those values


typedef enum libvlc_position_t ...
libvlc_position_left         =  libvlc_align_left,
libvlc_position_top_left     = ( libvlc_align_left|libvlc_align_top ),

then drop #define


Francois



More information about the vlc-devel mailing list