Introduce "vout display" module API to replaced "vout" one.

This commit is contained in:
Laurent Aimar 2009-08-03 19:52:34 +02:00
parent 98c4602866
commit 3e30c539c6
9 changed files with 2230 additions and 0 deletions

407
include/vlc_vout_display.h Normal file
View File

@ -0,0 +1,407 @@
/*****************************************************************************
* vlc_vout_display.h: vout_display_t definitions
*****************************************************************************
* Copyright (C) 2009 Laurent Aimar
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_VOUT_DISPLAY_H
#define VLC_VOUT_DISPLAY_H 1
/**
* \file
* This file defines vout display structures and functions in vlc
*/
#include <vlc_es.h>
#include <vlc_picture.h>
#include <vlc_subpicture.h>
#include <vlc_keys.h>
#include <vlc_mouse.h>
#include <vlc_vout_window.h>
/* XXX
* Do NOT use video_format_t::i_aspect but i_sar_num/den everywhere. i_aspect
* will be removed as soon as possible.
*
*/
typedef struct vout_display_t vout_display_t;
typedef struct vout_display_sys_t vout_display_sys_t;
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.
*/
typedef enum
{
VOUT_DISPLAY_ALIGN_CENTER,
/* */
VOUT_DISPLAY_ALIGN_LEFT,
VOUT_DISPLAY_ALIGN_RIGHT,
/* */
VOUT_DISPLAY_ALIGN_TOP,
VOUT_DISPLAY_ALIGN_BOTTOM,
} vout_display_align_t;
/**
* Initial/Current configuration for a vout_display_t
*/
typedef struct {
bool is_fullscreen; /* Is the display fullscreen */
/* Display properties */
struct {
/* Window title (may be NULL) */
const char *title;
/* Display size */
int width;
int height;
/* Display SAR */
struct {
int num;
int den;
} sar;
} display;
/* Alignment of the picture inside the display */
struct {
int horizontal;
int vertical;
} align;
/* Do we fill up the display with the video */
bool is_display_filled;
/* Zoom to use
* It will be applied to the whole display if b_display_filled is set, otherwise
* only on the video source */
struct {
int num;
int den;
} zoom;
} vout_display_cfg_t;
/**
* Informations from a vout_display_t to configure
* the core behaviour.
*
* By default they are all false.
*
*/
typedef struct {
bool is_slow; /* The picture memory has slow read/write */
bool has_double_click; /* Is double-click generated */
bool has_hide_mouse; /* Is mouse automatically hidden */
bool has_pictures_invalid;/* Will VOUT_DISPLAY_EVENT_PICTURES_INVALID be used */
} vout_display_info_t;
/**
* Control query for vout_display_t
*/
enum {
/* Hide the mouse. It will be send when
* vout_display_t::info.b_hide_mouse is false */
VOUT_DISPLAY_HIDE_MOUSE,
/* Ask to reset the internal buffers after a VOUT_DISPLAY_EVENT_PICTURES_INVALID
* request.
*/
VOUT_DISPLAY_RESET_PICTURES,
/* Ask the module to acknowledge/refuse the fullscreen state change after
* being requested (externaly 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 display size change requested
* (externaly or by VOUT_DISPLAY_EVENT_DISPLAY_SIZE) */
VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, /* const vout_display_cfg_t *p_cfg */
/* Ask the module to acknowledge/refuse fill display state change after
* being requested externaly */
VOUT_DISPLAY_CHANGE_DISPLAY_FILLED, /* const vout_display_cfg_t *p_cfg */
/* Ask the module to acknowledge/refuse zoom change after being requested
* externaly */
VOUT_DISPLAY_CHANGE_ZOOM, /* const vout_display_cfg_t *p_cfg */
/* Ask the module to acknowledge/refuse source aspect ratio after being
* requested externaly */
VOUT_DISPLAY_CHANGE_SOURCE_ASPECT, /* const video_format_t *p_source */
/* Ask the module to acknowledge/refuse source crop change after being
* requested externaly.
* 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 */
};
/**
* 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.
*/
enum {
/* TODO:
* ZOOM ? DISPLAY_FILLED ? ON_TOP ?
*/
/* */
VOUT_DISPLAY_EVENT_PICTURES_INVALID, /* The buffer are now invalid and need to be changed */
VOUT_DISPLAY_EVENT_FULLSCREEN,
VOUT_DISPLAY_EVENT_DISPLAY_SIZE, /* The display size need to change : int i_width, int i_height */
/* */
VOUT_DISPLAY_EVENT_CLOSE,
VOUT_DISPLAY_EVENT_KEY,
/* Full mouse state.
* You can use it OR use the other mouse events. The core will do
* the conversion.
*/
VOUT_DISPLAY_EVENT_MOUSE_STATE,
/* Mouse event */
VOUT_DISPLAY_EVENT_MOUSE_MOVED,
VOUT_DISPLAY_EVENT_MOUSE_PRESSED,
VOUT_DISPLAY_EVENT_MOUSE_RELEASED,
VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK,
};
/**
* Vout owner structures
*/
struct vout_display_owner_t {
/* Private place holder for the vout_display_t creator
*/
vout_display_owner_sys_t *sys;
/* Event comming 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).
*/
void (*event)(vout_display_t *, int, va_list);
/* Window management
*
* These functions are set prior to the module instantiation and must not
* be overwritten nor used directly (use the vout_display_*Window
* wrapper */
vout_window_t *(*window_new)(vout_display_t *, const vout_window_cfg_t *);
void (*window_del)(vout_display_t *, vout_window_t *);
};
struct vout_display_t {
VLC_COMMON_MEMBERS
/* Module */
module_t *module;
/* Initial and current configuration.
* You cannot modify it directly, you must use the appropriate event.
*
* It reflects the current in use value ie 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.
* You cannot change it.
*/
video_format_t source;
/* 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.
*
* By default, it is equal to ::source except for the aspect ratio
* which is undefined(0) and is ignored.
*/
video_format_t fmt;
/* Informations
*
* You can only set then in the open function.
*/
vout_display_info_t info;
/* Return a new picture_t (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.
*/
picture_t *(*get)(vout_display_t *);
/* Prepare a picture for display (optional).
*
* It is called before the next pf_display call to provide as much
* time as possible to prepare the given picture for display.
* You are guaranted that pf_display will always be called and using
* the exact same picture_t.
* You cannot change the pixel content of the picture_t.
*/
void (*prepare)(vout_display_t *, picture_t *);
/* Display a picture (mandatory).
*
* The picture must be displayed as soon as possible.
* You cannot change the pixel content of the picture_t.
*
* This function gives away the ownership of the picture, so you must
* release it as soon as possible.
*/
void (*display)(vout_display_t *, picture_t *);
/* Control on the module (mandatory) */
int (*control)(vout_display_t *, int, va_list);
/* Manage pending event (mandatory for now) */
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.
*/
vout_display_sys_t *sys;
/* Reserved for the vout_display_t owner.
*
* It must not be overwritten nor used directly by a module.
*/
vout_display_owner_t owner;
};
static inline void vout_display_SendEvent(vout_display_t *vd, int query, ...)
{
va_list args;
va_start(args, query);
vd->owner.event(vd, query, args);
va_end(args);
}
static inline void vout_display_SendEventDisplaySize(vout_display_t *vd, int width, int height)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_DISPLAY_SIZE, width, height);
}
static inline void vout_display_SendEventPicturesInvalid(vout_display_t *vd)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_PICTURES_INVALID);
}
static inline void vout_display_SendEventClose(vout_display_t *vd)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_CLOSE);
}
static inline void vout_display_SendEventKey(vout_display_t *vd, int key)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_KEY, key);
}
static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_fullscreen)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_FULLSCREEN, is_fullscreen);
}
/* 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)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_STATE, x, y, button_mask);
}
static inline void vout_display_SendEventMouseMoved(vout_display_t *vd, int x, int y)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_MOVED, x, y);
}
static inline void vout_display_SendEventMousePressed(vout_display_t *vd, int button)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_PRESSED, button);
}
static inline void vout_display_SendEventMouseReleased(vout_display_t *vd, int button)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_RELEASED, button);
}
static inline void vout_display_SendEventMouseDoubleClick(vout_display_t *vd)
{
vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK);
}
/**
* Ask for a new window with the given configuration as hint.
*
* b_standalone/i_x/i_y may be overwritten by the core
*/
static inline vout_window_t *vout_display_NewWindow(vout_display_t *vd, const vout_window_cfg_t *cfg)
{
return vd->owner.window_new(vd, cfg);
}
static inline void vout_display_DeleteWindow(vout_display_t *vd,
vout_window_t *window)
{
vd->owner.window_del(vd, window);
}
/**
* It computes the default display size given the source and
* the display configuration.
*
* It supposes that the picture will already be cropped.
*/
VLC_EXPORT( void, vout_display_GetDefaultDisplaySize, (int *width, int *height, const video_format_t *source, const vout_display_cfg_t *) );
/**
* Structure used to store the result of a vout_display_PlacePicture.
*/
typedef struct {
int x;
int y;
int width;
int height;
} vout_display_place_t;
/**
* It 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.
*
* \param p_place Place inside the window (window pixel unit)
* \param p_source Video source format
* \param p_cfg Display configuration
* \param b_clip If true, prevent the video to go outside the display (break zoom).
*/
VLC_EXPORT( void, vout_display_PlacePicture, (vout_display_place_t *place, const video_format_t *source, const vout_display_cfg_t *cfg, bool do_clipping) );
#endif /* VLC_VOUT_DISPLAY_H */

View File

@ -0,0 +1,92 @@
/*****************************************************************************
* vlc_vout_wrapper.h: definitions for vout wrappers (temporary)
*****************************************************************************
* Copyright (C) 2009 Laurent Aimar
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_VOUT_WRAPPER_H
#define VLC_VOUT_WRAPPER_H 1
#include <vlc_vout_display.h>
/* XXX DO NOT use it ouside the vout module wrapper XXX */
/**
* It retreive a picture from the display
*/
static inline picture_t *vout_display_Get(vout_display_t *vd)
{
return vd->get(vd);
}
/**
* It preparse a picture for display.
*/
static inline void vout_display_Prepare(vout_display_t *vd, picture_t *picture)
{
if (vd->prepare )
vd->prepare(vd, picture);
}
/**
* It display a picture.
*/
static inline void vout_display_Display(vout_display_t *vd, picture_t *picture)
{
vd->display(vd, picture);
}
/**
* It holds a state for a vout display.
*/
typedef struct {
vout_display_cfg_t cfg;
bool is_on_top;
struct {
int num;
int den;
} sar;
} vout_display_state_t;
/**
* It creates a vout managed display.
*/
VLC_EXPORT(vout_display_t *, vout_NewDisplay, ( vout_thread_t *, const video_format_t *, const vout_display_state_t *, const char *psz_module, mtime_t i_double_click_timeout, mtime_t i_hide_timeout ));
/**
* It destroy a vout managed display.
*/
VLC_EXPORT(void, vout_DeleteDisplay, (vout_display_t *, vout_display_state_t *));
VLC_EXPORT(bool, vout_IsDisplayFiltered, (vout_display_t *));
VLC_EXPORT(picture_t *, vout_FilterDisplay, (vout_display_t *, picture_t *));
VLC_EXPORT(bool, vout_AreDisplayPicturesInvalid, (vout_display_t *));
VLC_EXPORT(void, vout_ManageDisplay, (vout_display_t *));
VLC_EXPORT(void, vout_SetDisplayFullscreen, (vout_display_t *, bool is_fullscreen));
VLC_EXPORT(void, vout_SetDisplayFilled, (vout_display_t *, bool is_filled));
VLC_EXPORT(void, vout_SetDisplayZoom, (vout_display_t *, int num, int den));
VLC_EXPORT(void, vout_SetDisplayOnTop, (vout_display_t *, bool is_on_top));
VLC_EXPORT(void, vout_SetDisplayAspect, (vout_display_t *, unsigned sar_num, unsigned sar_den));
VLC_EXPORT(void, vout_SetDisplayCrop, (vout_display_t *, unsigned crop_num, unsigned crop_den, unsigned x, unsigned y, unsigned width, unsigned height));
#endif /* VLC_VOUT_WRAPPER_H */

View File

@ -95,6 +95,7 @@ pluginsinclude_HEADERS = \
../include/vlc_vlm.h \
../include/vlc_video_splitter.h \
../include/vlc_vout.h \
../include/vlc_vout_display.h \
../include/vlc_vout_window.h \
../include/vlc_xml.h \
$(NULL)
@ -344,6 +345,8 @@ SOURCES_libvlc_common = \
input/stream_memory.c \
input/subtitles.c \
input/var.c \
video_output/display.c \
video_output/display.h \
video_output/snapshot.c \
video_output/snapshot.h \
video_output/statistic.h \

View File

@ -575,6 +575,20 @@ vout_UnlinkPicture
vout_window_New
vout_window_Control
vout_window_Delete
vout_NewDisplay
vout_DeleteDisplay
vout_AreDisplayPicturesInvalid
vout_IsDisplayFiltered
vout_FilterDisplay
vout_ManageDisplay
vout_SetDisplayFullscreen
vout_SetDisplayFilled
vout_SetDisplayZoom
vout_SetDisplayOnTop
vout_SetDisplayAspect
vout_SetDisplayCrop
vout_display_GetDefaultDisplaySize
vout_display_PlacePicture
__xml_Create
text_style_Copy
text_style_Delete

1330
src/video_output/display.c Normal file

File diff suppressed because it is too large Load Diff

116
src/video_output/display.h Normal file
View File

@ -0,0 +1,116 @@
/*****************************************************************************
* display.h: "vout display" managment
*****************************************************************************
* Copyright (C) 2009 Laurent Aimar
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
# error This header file can only be included from LibVLC.
#endif
#include <vlc_vout_wrapper.h>
#if 0
#include <vlc_vout_display.h>
#include <vlc_filter.h>
/**
* It retreive a picture from the display
*/
static inline picture_t *vout_display_Get(vout_display_t *vd)
{
return vd->get(vd);
}
/**
* It preparse a picture for display.
*/
static inline void vout_display_Prepare(vout_display_t *vd, picture_t *picture)
{
if (vd->prepare )
vd->prepare(vd, picture);
}
/**
* It display a picture.
*/
static inline void vout_display_Display(vout_display_t *vd, picture_t *picture)
{
vd->display(vd, picture);
}
/**
* It holds a state for a vout display.
*/
typedef struct {
vout_display_cfg_t cfg;
bool is_on_top;
struct {
int num;
int den;
} sar;
} vout_display_state_t;
/**
* It creates a vout managed display.
*/
vout_display_t *vout_NewDisplay( vout_thread_t *,
const video_format_t *,
const vout_display_state_t *,
const char *psz_module,
mtime_t i_double_click_timeout,
mtime_t i_hide_timeout );
/**
* It creates a vout managed display wrapping a video splitter.
*/
vout_display_t *vout_NewSplitter(vout_thread_t *,
const video_format_t *source,
const vout_display_state_t *state,
const char *module,
const char *splitter,
mtime_t double_click_timeout,
mtime_t hide_timeout );
/**
* It destroy a vout managed display.
*/
void vout_DeleteDisplay(vout_display_t *, vout_display_state_t *);
picture_t *vout_FilterDisplay(vout_display_t *, picture_t *);
void vout_ManageDisplay(vout_display_t *);
void vout_SetDisplayFullscreen(vout_display_t *, bool is_fullscreen);
void vout_SetDisplayFilled(vout_display_t *, bool is_filled);
void vout_SetDisplayZoom(vout_display_t *, int num, int den);
void vout_SetDisplayOnTop(vout_display_t *, bool is_on_top);
void vout_SetDisplayAspect(vout_display_t *, unsigned sar_num, unsigned sar_den);
void vout_SetDisplayCrop(vout_display_t *,
unsigned crop_num, unsigned crop_den,
unsigned x, unsigned y, unsigned width, unsigned height);
#endif
/* FIXME should not be there */
void vout_SendDisplayEventMouse(vout_thread_t *, const vlc_mouse_t *);
vout_window_t *vout_NewDisplayWindow(vout_thread_t *, vout_display_t *, const vout_window_cfg_t *);
void vout_DeleteDisplayWindow(vout_thread_t *, vout_display_t *, vout_window_t *);

263
src/video_output/event.h Normal file
View File

@ -0,0 +1,263 @@
/*****************************************************************************
* event.h: vout event
*****************************************************************************
* Copyright (C) 2009 Laurent Aimar
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
# error This header file can only be included from LibVLC.
#endif
#include <vlc_common.h>
#include <vlc_playlist.h>
#include <math.h>
#include "vout_control.h"
/* TODO/FIXME
*
* It should be converted to something like input_thread_t:
* one intf-event can be grabbed by a callback, all others
* variable only var_Change
*
* Maybe a intf-mouse can be used too (don't like it).
*
* (Some case may infinite loop otherwise here)
*/
static inline void vout_SendEventClose(vout_thread_t *vout)
{
/* Ask to stop
* FIXME works only for input handled by the playlist
*/
playlist_t *playlist = pl_Hold(vout);
if (playlist) {
playlist_Stop(playlist);
pl_Release(vout);
}
}
static inline void vout_SendEventKey(vout_thread_t *vout, int key)
{
var_SetInteger(vout->p_libvlc, "key-pressed", key);
}
static inline void vout_SendEventMouseMoved(vout_thread_t *vout, int x, int y)
{
var_SetInteger(vout, "mouse-x", x);
var_SetInteger(vout, "mouse-y", y);
var_SetBool(vout, "mouse-moved", true);
}
static inline void vout_SendEventMousePressed(vout_thread_t *vout, int button)
{
int current = var_GetInteger(vout, "mouse-button-down");
current |= 1 << button;
var_SetInteger(vout, "mouse-button-down", current);
switch (button)
{
case MOUSE_BUTTON_LEFT:
var_SetBool(vout, "mouse-clicked", true);
var_SetBool(vout->p_libvlc, "intf-popupmenu", false);
break;
case MOUSE_BUTTON_CENTER:
var_SetBool(vout->p_libvlc, "intf-show",
!var_GetBool(vout->p_libvlc, "intf-show"));
break;
case MOUSE_BUTTON_RIGHT:
var_SetBool(vout->p_libvlc, "intf-popupmenu", true);
break;
}
}
static inline void vout_SendEventMouseReleased(vout_thread_t *vout, int button)
{
int current = var_GetInteger(vout, "mouse-button-down");
current &= ~(1 << button);
var_SetInteger(vout, "mouse-button-down", current);
}
static inline void vout_SendEventMouseDoubleClick(vout_thread_t *vout)
{
//vout_ControlSetFullscreen(vout, !var_GetBool(vout, "fullscreen"));
var_ToggleBool(vout, "fullscreen");
}
static inline void vout_SendEventMouseVisible(vout_thread_t *vout)
{
/* TODO */
VLC_UNUSED(vout);
}
static inline void vout_SendEventMouseHidden(vout_thread_t *vout)
{
/* TODO */
VLC_UNUSED(vout);
}
static inline void vout_SendEventFullscreen(vout_thread_t *vout, bool is_fullscreen)
{
if (!var_GetBool(vout, "fullscreen") != !is_fullscreen)
var_SetBool(vout, "fullscreen", is_fullscreen);
}
static inline void vout_SendEventDisplayFilled(vout_thread_t *vout, bool is_display_filled)
{
if (!var_GetBool(vout, "autoscale") != !is_display_filled)
var_SetBool(vout, "autoscale", is_display_filled);
}
static inline void vout_SendEventZoom(vout_thread_t *vout, int num, int den)
{
/* FIXME deadlock problems with current vout */
#if 0
const float zoom = (float)num / (float)den;
/* XXX 0.1% is arbitrary */
if (fabs(zoom - var_GetFloat(vout, "scale")) > 0.001)
var_SetFloat(vout, "scale", zoom);
#endif
}
static inline void vout_SendEventOnTop(vout_thread_t *vout, bool is_on_top)
{
/* FIXME deadlock problems with current vout */
#if 0
if (!var_GetBool(vout, "video-on-top") != !is_on_top)
var_SetBool(vout, "video-on-top", is_on_top);
#endif
}
/**
* It must be called on source aspect ratio changes, with the new DAR (Display
* Aspect Ratio) value.
*/
static inline void vout_SendEventSourceAspect(vout_thread_t *vout,
unsigned num, unsigned den)
{
/* FIXME the value stored in "aspect-ratio" are not reduced
* creating a lot of problems here */
#if 0
char *ar;
if (num > 0 && den > 0) {
if (asprintf(&ar, "%u:%u", num, den) < 0)
return;
} else {
ar = strdup("");
}
char *current = var_GetString(vout, "aspect-ratio");
msg_Err(vout, "vout_SendEventSourceAspect %s -> %s", current, ar);
if (ar && current && strcmp(ar, current))
var_SetString(vout, "aspect-ratio", ar);
free(current);
free(ar);
#endif
}
static inline void vout_SendEventSourceCrop(vout_thread_t *vout,
unsigned num, unsigned den,
unsigned left, unsigned top,
unsigned right, unsigned bottom)
{
vlc_value_t val;
/* I cannot use var_Set here, infinite loop otherwise */
/* */
val.i_int = left;
var_Change(vout, "crop-left", VLC_VAR_SETVALUE, &val, NULL);
val.i_int = top;
var_Change(vout, "crop-top", VLC_VAR_SETVALUE, &val, NULL);
val.i_int = right;
var_Change(vout, "crop-right", VLC_VAR_SETVALUE, &val, NULL);
val.i_int = bottom;
var_Change(vout, "crop-bottom", VLC_VAR_SETVALUE, &val, NULL);
/* FIXME the value stored in "crop" are not reduced
* creating a lot of problems here */
#if 0
char *crop;
if (num > 0 && den > 0) {
if (asprintf(&crop, "%u:%u", num, den) < 0)
crop = NULL;
} else if (left > 0 || top > 0 || right > 0 || bottom > 0) {
if (asprintf(&crop, "%u+%u+%u+%u", left, top, right, bottom) < 0)
crop = NULL;
} else {
crop = strdup("");
}
if (crop) {
val.psz_string = crop;
var_Change(vout, "crop", VLC_VAR_SETVALUE, &val, NULL);
free(crop);
}
#endif
}
#if 0
static inline void vout_SendEventSnapshot(vout_thread_t *vout, const char *filename)
{
/* Generate a media player event - Right now just trigger a global libvlc var
CHECK: Could not find a more local object. The goal is to communicate
vout_thread with libvlc_media_player or its input_thread */
var_SetString(vout->p_libvlc, "vout-snapshottaken", filename);
}
#warning "FIXME clean up postproc event"
extern void vout_InstallDeprecatedPostProcessing(vout_thread_t *);
extern void vout_UninstallDeprecatedPostProcessing(vout_thread_t *);
static inline void vout_SendEventPostProcessing(vout_thread_t *vout, bool is_available)
{
if (is_available)
vout_InstallDeprecatedPostProcessing(vout);
else
vout_UninstallDeprecatedPostProcessing(vout);
}
static inline void vout_SendEventFilters(vout_thread_t *vout)
{
vout_filter_t **filter;
int filter_count;
vout_ControlGetFilters(vout, &filter, &filter_count);
char *list = strdup("");
for (int i = 0; i < filter_count; i++) {
char *psz;
if (asprintf(&psz, "%s%s%s",
list, i > 0 ? ":" : "", filter[i]->name) < 0) {
free(list);
list = NULL;
break;
}
free(list);
list = psz;
}
if (list) {
vlc_value_t val;
val.psz_string = list;
var_Change(vout, "video-filter", VLC_VAR_SETVALUE, &val, NULL);
free(list);
}
for (int i = 0; i < filter_count; i++)
vout_filter_Delete(filter[i]);
free(filter);
}
#endif

View File

@ -397,6 +397,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
p_vout->p->b_picture_empty = false;
p_vout->p->i_picture_qtype = QTYPE_NONE;
vlc_mouse_Init( &p_vout->p->mouse );
vout_snapshot_Init( &p_vout->p->snapshot );
/* Initialize locks */

View File

@ -97,6 +97,9 @@ struct vout_thread_sys_t
int i_title_position;
char *psz_title;
/* */
vlc_mouse_t mouse;
};
/* DO NOT use vout_RenderPicture unless you are in src/video_ouput */