Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Thomas Guillem
vlc-legacy
Commits
a225373d
Commit
a225373d
authored
Sep 11, 2020
by
Steve Lhomme
Browse files
display: use a vlc_display_operations to set the display module callbacks
parent
7b33f117
Changes
28
Hide whitespace changes
Inline
Side-by-side
include/vlc_vout_display.h
View file @
a225373d
...
...
@@ -262,48 +262,12 @@ typedef int (*vout_display_open_cb)(vout_display_t *vd,
} \
set_capability( "vout display", priority )
struct
vout_display_t
{
struct
vlc_object_t
obj
;
/**
* User configuration.
*
* This cannot be modified directly. It reflects the current values.
*/
const
vout_display_cfg_t
*
cfg
;
/**
* Source video format.
*
* This is the format of the video that is being displayed (after decoding
* and filtering). It cannot be modified.
*
* \note
* Cropping is not requested while in the open function.
*/
const
video_format_t
*
source
;
struct
vlc_display_operations
{
/**
* Picture format.
*
* This is the format of the pictures that are supplied to the
* \ref prepare and \ref display callbacks. Ideally, it should be identical
* or as close as possible as \ref source.
*
* This can only be changed from the display module activation callback,
* or within a VOUT_DISPLAY_RESET_PICTURES control request.
*
* By default, it is equal to ::source except for the aspect ratio
* which is undefined(0) and is ignored.
*/
const
video_format_t
*
fmt
;
/* Information
*
* You can only set them in the open function.
* Destroys the display.
*/
vo
ut_display_info_t
info
;
vo
id
(
*
close
)(
vout_display_t
*
)
;
/**
* Prepares a picture and an optional subpicture for display (optional).
...
...
@@ -361,25 +325,68 @@ struct vout_display_t {
*
* \param vp viewpoint to use on the next render
*/
int
(
*
set_viewpoint
)(
vout_display_t
*
,
const
vlc_viewpoint_t
*
vp
);
int
(
*
set_viewpoint
)(
vout_display_t
*
,
const
vlc_viewpoint_t
*
vp
);
};
struct
vout_display_t
{
struct
vlc_object_t
obj
;
/**
* User configuration.
*
* This cannot be modified directly. It reflects the current values.
*/
const
vout_display_cfg_t
*
cfg
;
/**
* Destroys the display.
* Source video format.
*
* This is the format of the video that is being displayed (after decoding
* and filtering). It cannot be modified.
*
* \note
* Cropping is not requested while in the open function.
*/
void
(
*
close
)(
vout_display_t
*
)
;
const
video_format_t
*
source
;
/**
* P
rivate data for the display module
.
* P
icture format
.
*
* A module is free to use it as it wishes.
* This is the format of the pictures that are supplied to the
* \ref prepare and \ref display callbacks. Ideally, it should be identical
* or as close as possible as \ref source.
*
* This can only be changed from the display module activation callback,
* or within a VOUT_DISPLAY_RESET_PICTURES control request.
*
* By default, it is equal to ::source except for the aspect ratio
* which is undefined(0) and is ignored.
*/
vout_display_sys_t
*
sys
;
const
video_format_t
*
fmt
;
/* Information
*
* You can only set them in the open function.
*/
vout_display_info_t
info
;
/* Reserved for the vout_display_t owner.
*
* It must not be overwritten nor used directly by a module.
*/
vout_display_owner_t
owner
;
/**
* Private data for the display module.
*
* A module is free to use it as it wishes.
*/
vout_display_sys_t
*
sys
;
/**
* Callbacks the display module must set on Open.
*/
const
struct
vlc_display_operations
*
ops
;
};
/**
...
...
@@ -426,8 +433,8 @@ VLC_API picture_t *vout_display_Prepare(vout_display_t *vd, picture_t *picture,
*/
static
inline
void
vout_display_Display
(
vout_display_t
*
vd
,
picture_t
*
picture
)
{
if
(
vd
->
display
!=
NULL
)
vd
->
display
(
vd
,
picture
);
if
(
vd
->
ops
->
display
!=
NULL
)
vd
->
ops
->
display
(
vd
,
picture
);
picture_Release
(
picture
);
}
...
...
modules/hw/mmal/vout.c
View file @
a225373d
...
...
@@ -1096,6 +1096,10 @@ static int find_display_num(const char * name)
return
display_name_to_num
[
i
].
num
;
}
static
const
struct
vlc_display_operations
ops
=
{
CloseMmalVout
,
vd_prepare
,
vd_display
,
vd_control
,
NULL
,
};
static
int
OpenMmalVout
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
vctx
)
{
...
...
@@ -1280,11 +1284,7 @@ static int OpenMmalVout(vout_display_t *vd, const vout_display_cfg_t *cfg,
.
subpicture_chromas
=
hw_mmal_vzc_subpicture_chromas
};
vd
->
prepare
=
vd_prepare
;
vd
->
display
=
vd_display
;
vd
->
control
=
vd_control
;
vd
->
close
=
CloseMmalVout
;
vd
->
ops
=
&
ops
;
return
VLC_SUCCESS
;
...
...
modules/hw/vdpau/display.c
View file @
a225373d
...
...
@@ -283,6 +283,10 @@ static int Control(vout_display_t *vd, int query, va_list ap)
return
VLC_SUCCESS
;
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
Queue
,
Wait
,
Control
,
NULL
,
};
static
int
Open
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
context
)
{
...
...
@@ -488,12 +492,8 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
vd
->
info
.
subpicture_chromas
=
spu_chromas
;
*
fmtp
=
fmt
;
vd
->
prepare
=
Queue
;
vd
->
display
=
Wait
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
(
void
)
context
;
return
VLC_SUCCESS
;
error:
...
...
modules/video_output/android/display.c
View file @
a225373d
...
...
@@ -476,6 +476,10 @@ static void SetRGBMask(video_format_t *p_fmt)
}
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
Prepare
,
Display
,
Control
,
NULL
,
};
static
int
Open
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
context
)
{
...
...
@@ -587,10 +591,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
UpdateVideoSize
(
sys
,
&
sys
->
p_window
->
fmt
);
}
vd
->
prepare
=
Prepare
;
vd
->
display
=
Display
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
*
fmtp
=
fmt
;
...
...
modules/video_output/caca.c
View file @
a225373d
...
...
@@ -372,6 +372,10 @@ static void Close(vout_display_t *vd)
free
(
sys
);
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
Prepare
,
PictureDisplay
,
Control
,
NULL
,
};
/**
* This function initializes libcaca vout method.
*/
...
...
@@ -488,10 +492,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
}
/* Setup vout_display now that everything is fine */
vd
->
prepare
=
Prepare
;
vd
->
display
=
PictureDisplay
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
/* Fix initial state */
caca_refresh_display
(
sys
->
dp
);
...
...
modules/video_output/caopengllayer.m
View file @
a225373d
...
...
@@ -118,6 +118,10 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
return
ret
;
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
PictureRender
,
PictureDisplay
,
Control
,
SetViewpoint
,
};
/*****************************************************************************
* Open: This function allocates and initializes the OpenGL vout method.
*****************************************************************************/
...
...
@@ -209,11 +213,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
/* setup vout display */
vd
->
info
.
subpicture_chromas
=
subpicture_chromas
;
vd
->
prepare
=
PictureRender
;
vd
->
display
=
PictureDisplay
;
vd
->
control
=
Control
;
vd
->
set_viewpoint
=
SetViewpoint
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
if
(
OSX_SIERRA_AND_HIGHER
)
{
/* request our screen's HDR mode (introduced in OS X 10.11, but correctly supported in 10.12 only) */
...
...
modules/video_output/decklink.cpp
View file @
a225373d
...
...
@@ -768,6 +768,10 @@ static int ControlVideo(vout_display_t *vd, int query, va_list args)
return
VLC_EGENERIC
;
}
static
const
struct
vlc_display_operations
ops
=
{
CloseVideo
,
PrepareVideo
,
NULL
,
ControlVideo
,
NULL
,
};
static
int
OpenVideo
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
context
)
{
...
...
@@ -805,10 +809,7 @@ static int OpenVideo(vout_display_t *vd, const vout_display_cfg_t *cfg,
}
}
vd
->
prepare
=
PrepareVideo
;
vd
->
display
=
NULL
;
vd
->
control
=
ControlVideo
;
vd
->
close
=
CloseVideo
;
vd
->
ops
=
&
ops
;
vd
->
sys
=
(
vout_display_sys_t
*
)
sys
;
...
...
modules/video_output/fb.c
View file @
a225373d
...
...
@@ -161,6 +161,10 @@ static void ClearScreen(vout_display_sys_t *sys)
}
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
NULL
,
Display
,
Control
,
NULL
,
};
/**
* This function allocates and initializes a FB vout method.
*/
...
...
@@ -292,10 +296,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
/* */
*
fmtp
=
fmt
;
vd
->
prepare
=
NULL
;
vd
->
display
=
Display
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
(
void
)
context
;
return
VLC_SUCCESS
;
...
...
modules/video_output/flaschen.c
View file @
a225373d
...
...
@@ -81,6 +81,10 @@ struct vout_display_sys_t {
static
void
Display
(
vout_display_t
*
,
picture_t
*
);
static
int
Control
(
vout_display_t
*
,
int
,
va_list
);
static
const
struct
vlc_display_operations
ops
=
{
Close
,
NULL
,
Display
,
Control
,
NULL
,
};
/*****************************************************************************
* Open: activates flaschen vout display method
*****************************************************************************/
...
...
@@ -138,10 +142,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
*
fmtp
=
fmt
;
vd
->
prepare
=
NULL
;
vd
->
display
=
Display
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
(
void
)
cfg
;
(
void
)
context
;
return
VLC_SUCCESS
;
...
...
modules/video_output/ios.m
View file @
a225373d
...
...
@@ -151,6 +151,10 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
return
vout_display_opengl_SetViewpoint
(
glsys
->
vgl
,
vp
);
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
PictureRender
,
PictureDisplay
,
Control
,
SetViewpoint
,
};
static
int
Open
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmt
,
vlc_video_context
*
context
)
{
...
...
@@ -216,11 +220,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
/* Setup vout_display_t once everything is fine */
vd
->
info
.
subpicture_chromas
=
subpicture_chromas
;
vd
->
prepare
=
PictureRender
;
vd
->
display
=
PictureDisplay
;
vd
->
control
=
Control
;
vd
->
set_viewpoint
=
SetViewpoint
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
return
VLC_SUCCESS
;
...
...
modules/video_output/kms.c
View file @
a225373d
...
...
@@ -662,6 +662,10 @@ static void Close(vout_display_t *vd)
drmDropMaster
(
sys
->
drm_fd
);
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
Prepare
,
Display
,
Control
,
NULL
,
};
/**
* This function allocates and initializes a KMS vout method.
*/
...
...
@@ -732,10 +736,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
fmt
.
i_chroma
=
sys
->
vlc_fourcc
;
*
fmtp
=
fmt
;
vd
->
prepare
=
Prepare
;
vd
->
display
=
Display
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
(
void
)
context
;
return
VLC_SUCCESS
;
...
...
modules/video_output/kva.c
View file @
a225373d
...
...
@@ -155,6 +155,10 @@ static void Prepare(vout_display_t *vd, picture_t *pic, subpicture_t *subpic, vl
}
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
Prepare
,
Display
,
Control
,
NULL
,
};
static
void
PMThread
(
void
*
arg
)
{
struct
open_init
*
init
=
(
struct
open_init
*
)
arg
;
...
...
@@ -271,10 +275,7 @@ static void PMThread( void *arg )
/* Setup vout_display now that everything is fine */
*
fmtp
=
fmt
;
vd
->
prepare
=
Prepare
;
vd
->
display
=
Display
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
/* Prevent SIG_FPE */
_control87
(
MCW_EM
,
MCW_EM
);
...
...
modules/video_output/macosx.m
View file @
a225373d
...
...
@@ -137,6 +137,10 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
return
vout_display_opengl_SetViewpoint
(
sys
->
vgl
,
vp
);
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
PictureRender
,
PictureDisplay
,
Control
,
SetViewpoint
,
};
static
int
Open
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmt
,
vlc_video_context
*
context
)
{
...
...
@@ -247,11 +251,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
/* Setup vout_display_t once everything is fine */
vd
->
info
.
subpicture_chromas
=
subpicture_chromas
;
vd
->
prepare
=
PictureRender
;
vd
->
display
=
PictureDisplay
;
vd
->
control
=
Control
;
vd
->
set_viewpoint
=
SetViewpoint
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
/* */
// FIXME: this call leads to a fatal mutex locking error in vout_ChangeDisplaySize()
...
...
modules/video_output/opengl/display.c
View file @
a225373d
...
...
@@ -93,6 +93,10 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
return
vout_display_opengl_SetViewpoint
(
sys
->
vgl
,
vp
);
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
PictureRender
,
PictureDisplay
,
Control
,
SetViewpoint
,
};
/**
* Allocates a surface and an OpenGL context for video output.
*/
...
...
@@ -155,11 +159,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
vd
->
sys
=
sys
;
vd
->
info
.
subpicture_chromas
=
spu_chromas
;
vd
->
prepare
=
PictureRender
;
vd
->
display
=
PictureDisplay
;
vd
->
control
=
Control
;
vd
->
set_viewpoint
=
SetViewpoint
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
return
VLC_SUCCESS
;
error:
...
...
modules/video_output/splitter.c
View file @
a225373d
...
...
@@ -219,6 +219,10 @@ static vout_window_t *video_splitter_CreateWindow(vlc_object_t *obj,
return
window
;
}
static
const
struct
vlc_display_operations
ops
=
{
vlc_vidsplit_Close
,
vlc_vidsplit_Prepare
,
vlc_vidsplit_Display
,
vlc_vidsplit_Control
,
NULL
,
};
static
int
vlc_vidsplit_Open
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
ctx
)
...
...
@@ -303,10 +307,7 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
vlc_sem_post
(
&
part
->
lock
);
}
vd
->
prepare
=
vlc_vidsplit_Prepare
;
vd
->
display
=
vlc_vidsplit_Display
;
vd
->
control
=
vlc_vidsplit_Control
;
vd
->
close
=
vlc_vidsplit_Close
;
vd
->
ops
=
&
ops
;
(
void
)
fmtp
;
return
VLC_SUCCESS
;
}
...
...
modules/video_output/vdummy.c
View file @
a225373d
...
...
@@ -69,8 +69,7 @@ static int Control(vout_display_t *, int, va_list);
/*****************************************************************************
* OpenVideo: activates dummy vout display method
*****************************************************************************/
static
int
Open
(
vout_display_t
*
vd
,
video_format_t
*
fmt
,
void
(
*
display
)(
vout_display_t
*
,
picture_t
*
))
static
void
Open
(
vout_display_t
*
vd
,
video_format_t
*
fmt
)
{
/* p_vd->info is not modified */
...
...
@@ -83,25 +82,32 @@ static int Open(vout_display_t *vd, video_format_t *fmt,
}
free
(
chroma
);
}
vd
->
prepare
=
NULL
;
vd
->
display
=
display
;
vd
->
control
=
Control
;
return
VLC_SUCCESS
;
}
static
const
struct
vlc_display_operations
ops_dummy
=
{
NULL
,
NULL
,
NULL
,
Control
,
NULL
,
};
static
int
OpenDummy
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
context
)
{
(
void
)
cfg
;
(
void
)
context
;
return
Open
(
vd
,
fmtp
,
NULL
);
Open
(
vd
,
fmtp
);
vd
->
ops
=
&
ops_dummy
;
return
VLC_SUCCESS
;
}
static
const
struct
vlc_display_operations
ops_stats
=
{
NULL
,
NULL
,
DisplayStat
,
Control
,
NULL
,
};
static
int
OpenStats
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
context
)
{
(
void
)
cfg
;
(
void
)
context
;
return
Open
(
vd
,
fmtp
,
DisplayStat
);
Open
(
vd
,
fmtp
);
vd
->
ops
=
&
ops_stats
;
return
VLC_SUCCESS
;
}
static
void
DisplayStat
(
vout_display_t
*
vd
,
picture_t
*
picture
)
...
...
modules/video_output/vmem.c
View file @
a225373d
...
...
@@ -105,6 +105,10 @@ static void Prepare(vout_display_t *, picture_t *, subpicture_t *, vlc
static
void
Display
(
vout_display_t
*
,
picture_t
*
);
static
int
Control
(
vout_display_t
*
,
int
,
va_list
);
static
const
struct
vlc_display_operations
ops
=
{
Close
,
Prepare
,
Display
,
Control
,
NULL
,
};
/*****************************************************************************
* Open: allocates video thread
*****************************************************************************
...
...
@@ -216,10 +220,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
*
fmtp
=
fmt
;
vd
->
sys
=
sys
;
vd
->
prepare
=
Prepare
;
vd
->
display
=
Display
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
(
void
)
cfg
;
(
void
)
context
;
return
VLC_SUCCESS
;
...
...
modules/video_output/vulkan/display.c
View file @
a225373d
...
...
@@ -77,6 +77,10 @@ static int Control(vout_display_t *, int, va_list);
static
void
Close
(
vout_display_t
*
);
static
void
UpdateParams
(
vout_display_t
*
);
static
const
struct
vlc_display_operations
ops
=
{
Close
,
PictureRender
,
PictureDisplay
,
Control
,
NULL
,
};
// Allocates a Vulkan surface and instance for video output.
static
int
Open
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmt
,
vlc_video_context
*
context
)
...
...
@@ -139,10 +143,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
vd
->
info
.
subpicture_chromas
=
subfmts
;
vd
->
prepare
=
PictureRender
;
vd
->
display
=
PictureDisplay
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
UpdateParams
(
vd
);
(
void
)
cfg
;
(
void
)
context
;
...
...
modules/video_output/wayland/shm.c
View file @
a225373d
...
...
@@ -262,6 +262,10 @@ static void Close(vout_display_t *vd)
free
(
sys
);
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
Prepare
,
Display
,
Control
,
NULL
,
};
static
int
Open
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
context
)
{
...
...
@@ -337,10 +341,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
fmtp
->
i_chroma
=
VLC_CODEC_RGB32
;
vd
->
prepare
=
Prepare
;
vd
->
display
=
Display
;
vd
->
control
=
Control
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
vlc_wl_registry_destroy
(
registry
);
(
void
)
context
;
...
...
modules/video_output/win32/direct3d11.c
View file @
a225373d
...
...
@@ -304,6 +304,10 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *viewpoint)
return
VLC_SUCCESS
;
}
static
const
struct
vlc_display_operations
ops
=
{
Close
,
Prepare
,
Display
,
Control
,
SetViewpoint
,
};
static
int
Open
(
vout_display_t
*
vd
,
const
vout_display_cfg_t
*
cfg
,
video_format_t
*
fmtp
,
vlc_video_context
*
context
)
{
...
...
@@ -390,11 +394,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
else
vd
->
info
.
subpicture_chromas
=
NULL
;
vd
->
prepare
=
Prepare
;
vd
->
display
=
Display
;
vd
->
control
=
Control
;
vd
->
set_viewpoint
=
SetViewpoint
;
vd
->
close
=
Close
;
vd
->
ops
=
&
ops
;
msg_Dbg
(
vd
,
"Direct3D11 Open Succeeded"
);
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%