X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_vout_display.h;h=8b32efceef1d5f64de9f0305eb475f48c31642c2;hb=37a27cc6447a51b5780adf0917ab7b22a4456a5b;hp=4625c284b380c61babd500e80dc8599bb1933771;hpb=3e30c539c6c88e936f09d23041f606608371bc9f;p=vlc diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h index 4625c284b3..8b32efceef 100644 --- a/include/vlc_vout_display.h +++ b/include/vlc_vout_display.h @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -47,7 +48,7 @@ typedef struct vout_display_owner_t vout_display_owner_t; typedef struct vout_display_owner_sys_t vout_display_owner_sys_t; /** - * It specifies the possible alignment used in vout_display. + * Possible alignments for vout_display. */ typedef enum { @@ -60,6 +61,16 @@ typedef enum VOUT_DISPLAY_ALIGN_BOTTOM, } vout_display_align_t; +/** + * Window management state. + */ +enum { + VOUT_WINDOW_STATE_NORMAL=0, + VOUT_WINDOW_STATE_ABOVE=1, + VOUT_WINDOW_STATE_BELOW=2, + VOUT_WINDOW_STACK_MASK=3, +}; + /** * Initial/Current configuration for a vout_display_t */ @@ -72,13 +83,13 @@ typedef struct { const char *title; /* Display size */ - int width; - int height; + unsigned width; + unsigned height; /* Display SAR */ struct { - int num; - int den; + unsigned num; + unsigned den; } sar; } display; @@ -119,7 +130,7 @@ typedef struct { * Control query for vout_display_t */ enum { - /* Hide the mouse. It will be send when + /* Hide the mouse. It will be sent when * vout_display_t::info.b_hide_mouse is false */ VOUT_DISPLAY_HIDE_MOUSE, @@ -129,41 +140,44 @@ enum { VOUT_DISPLAY_RESET_PICTURES, /* Ask the module to acknowledge/refuse the fullscreen state change after - * being requested (externaly or by VOUT_DISPLAY_EVENT_FULLSCREEN */ + * being requested (externally or by VOUT_DISPLAY_EVENT_FULLSCREEN */ VOUT_DISPLAY_CHANGE_FULLSCREEN, /* const vout_display_cfg_t *p_cfg */ - /* Ask the module to acknowledge/refuse the on top state change after - * being requested externaly */ - VOUT_DISPLAY_CHANGE_ON_TOP, /* int b_on_top */ + /* Ask the module to acknowledge/refuse the window management state change + * after being requested externally or by VOUT_DISPLAY_WINDOW_STATE */ + VOUT_DISPLAY_CHANGE_WINDOW_STATE, /* unsigned state */ /* Ask the module to acknowledge/refuse the display size change requested - * (externaly or by VOUT_DISPLAY_EVENT_DISPLAY_SIZE) */ - VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, /* const vout_display_cfg_t *p_cfg */ + * (externally or by VOUT_DISPLAY_EVENT_DISPLAY_SIZE) */ + VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, /* const vout_display_cfg_t *p_cfg, int is_forced */ /* Ask the module to acknowledge/refuse fill display state change after - * being requested externaly */ + * being requested externally */ VOUT_DISPLAY_CHANGE_DISPLAY_FILLED, /* const vout_display_cfg_t *p_cfg */ /* Ask the module to acknowledge/refuse zoom change after being requested - * externaly */ + * externally */ VOUT_DISPLAY_CHANGE_ZOOM, /* const vout_display_cfg_t *p_cfg */ /* Ask the module to acknowledge/refuse source aspect ratio after being - * requested externaly */ + * requested externally */ VOUT_DISPLAY_CHANGE_SOURCE_ASPECT, /* const video_format_t *p_source */ /* Ask the module to acknowledge/refuse source crop change after being - * requested externaly. + * requested externally. * The cropping requested is stored by video_format_t::i_x/y_offset and * video_format_t::i_visible_width/height */ VOUT_DISPLAY_CHANGE_SOURCE_CROP, /* const video_format_t *p_source */ + + /* Ask an opengl interface if available. */ + VOUT_DISPLAY_GET_OPENGL, /* vout_opengl_t ** */ }; /** * Event from vout_display_t * - * For event that modifiy the state, you may send them multiple of times, - * only the transition will be kept and act upon. + * Events modifiying the state may be sent multiple times. + * Only the transition will be retained and acted upon. */ enum { /* TODO: @@ -173,8 +187,9 @@ enum { VOUT_DISPLAY_EVENT_PICTURES_INVALID, /* The buffer are now invalid and need to be changed */ VOUT_DISPLAY_EVENT_FULLSCREEN, + VOUT_DISPLAY_EVENT_WINDOW_STATE, - VOUT_DISPLAY_EVENT_DISPLAY_SIZE, /* The display size need to change : int i_width, int i_height */ + VOUT_DISPLAY_EVENT_DISPLAY_SIZE, /* The display size need to change : int i_width, int i_height, bool is_fullscreen */ /* */ VOUT_DISPLAY_EVENT_CLOSE, @@ -201,14 +216,16 @@ struct vout_display_owner_t { */ vout_display_owner_sys_t *sys; - /* Event comming from the module + /* Event coming from the module * * This function is set prior to the module instantiation and must not * be overwritten nor used directly (use the vout_display_SendEvent* * wrapper. * - * You can send it at any time ie from any vout_display_t functions - * (TODO add support from a private thread). + * You can send it at any time i.e. from any vout_display_t functions or + * from another thread. + * Be careful, it does not ensure correct serialization if it is used + * from multiple threads. */ void (*event)(vout_display_t *, int, va_list); @@ -228,16 +245,16 @@ struct vout_display_t { module_t *module; /* Initial and current configuration. - * You cannot modify it directly, you must use the appropriate event. + * You cannot modify it directly, you must use the appropriate events. * - * It reflects the current in use value ie after the event has been accepted + * It reflects the current values, i.e. after the event has been accepted * and applied/configured if needed. */ const vout_display_cfg_t *cfg; /* video source format. * - * You are guaranted that in the open function, no cropping is asked. + * Cropping is not requested while in the open function. * You cannot change it. */ video_format_t source; @@ -245,8 +262,8 @@ struct vout_display_t { /* picture_t format. * * You can only change it inside the module open function to - * match what you want and when a VOUT_DISPLAY_RESET_PICTURES - * is called on your module and was successfull. + * match what you want, and when a VOUT_DISPLAY_RESET_PICTURES control + * request is made and succeeds. * * By default, it is equal to ::source except for the aspect ratio * which is undefined(0) and is ignored. @@ -255,18 +272,20 @@ struct vout_display_t { /* Informations * - * You can only set then in the open function. + * You can only set them in the open function. */ vout_display_info_t info; - /* Return a new picture_t (mandatory). + /* Return a pointer over the current picture_pool_t* (mandatory). * + * For performance reasons, it is best to provide at least count + * pictures but it is not mandatory. * You can return NULL when you cannot/do not want to allocate - * more pictures. - * If you want to create a pool of reusable pictures, you can - * use a picture_pool_t. + * pictures. + * The vout display module keeps the ownership of the pool and can + * destroy it only when closing or on invalid pictures control. */ - picture_t *(*get)(vout_display_t *); + picture_pool_t *(*pool)(vout_display_t *, unsigned count); /* Prepare a picture for display (optional). * @@ -291,12 +310,12 @@ struct vout_display_t { /* Control on the module (mandatory) */ int (*control)(vout_display_t *, int, va_list); - /* Manage pending event (mandatory for now) */ + /* Manage pending event (optional) */ void (*manage)(vout_display_t *); /* Private place holder for the vout_display_t module (optional) * - * A module is free to used it as it wishes. + * A module is free to use it as it wishes. */ vout_display_sys_t *sys; @@ -315,9 +334,9 @@ static inline void vout_display_SendEvent(vout_display_t *vd, int query, ...) va_end(args); } -static inline void vout_display_SendEventDisplaySize(vout_display_t *vd, int width, int height) +static inline void vout_display_SendEventDisplaySize(vout_display_t *vd, int width, int height, bool is_fullscreen) { - vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_DISPLAY_SIZE, width, height); + vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_DISPLAY_SIZE, width, height, is_fullscreen); } static inline void vout_display_SendEventPicturesInvalid(vout_display_t *vd) { @@ -335,6 +354,10 @@ static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_ { vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_FULLSCREEN, is_fullscreen); } +static inline void vout_display_SendWindowState(vout_display_t *vd, unsigned state) +{ + vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_WINDOW_STATE, state); +} /* The mouse position (State and Moved event) must be expressed against vout_display_t::source unit */ static inline void vout_display_SendEventMouseState(vout_display_t *vd, int x, int y, int button_mask) { @@ -358,7 +381,7 @@ static inline void vout_display_SendEventMouseDoubleClick(vout_display_t *vd) } /** - * Ask for a new window with the given configuration as hint. + * Asks for a new window with the given configuration as hint. * * b_standalone/i_x/i_y may be overwritten by the core */ @@ -366,6 +389,10 @@ static inline vout_window_t *vout_display_NewWindow(vout_display_t *vd, const vo { return vd->owner.window_new(vd, cfg); } +/** + * Deletes a window created by vout_display_NewWindow if window is non NULL + * or any unused windows otherwise. + */ static inline void vout_display_DeleteWindow(vout_display_t *vd, vout_window_t *window) { @@ -373,12 +400,12 @@ static inline void vout_display_DeleteWindow(vout_display_t *vd, } /** - * It computes the default display size given the source and + * Computes the default display size given the source and * the display configuration. * - * It supposes that the picture will already be cropped. + * This asssumes that the picture is already cropped. */ -VLC_EXPORT( void, vout_display_GetDefaultDisplaySize, (int *width, int *height, const video_format_t *source, const vout_display_cfg_t *) ); +VLC_EXPORT( void, vout_display_GetDefaultDisplaySize, (unsigned *width, unsigned *height, const video_format_t *source, const vout_display_cfg_t *) ); /** @@ -387,14 +414,14 @@ VLC_EXPORT( void, vout_display_GetDefaultDisplaySize, (int *width, int *height, typedef struct { int x; int y; - int width; - int height; + unsigned width; + unsigned height; } vout_display_place_t; /** - * It computes how to place a picture inside the display to respect + * Computes how to place a picture inside the display to respect * the given parameters. - * It supposes that the cropping is done by an external mean. + * This assumes that cropping is done by an external mean. * * \param p_place Place inside the window (window pixel unit) * \param p_source Video source format