mirror of https://github.com/mpv-player/mpv
x11: use vo_x11_control() for all VOs
This commit is contained in:
parent
bf10a4fdfa
commit
d5de75b340
|
@ -867,20 +867,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_events(struct vo *vo)
|
|
||||||
{
|
|
||||||
if (handle_preemption(vo) < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int e = vo_x11_check_events(vo);
|
|
||||||
|
|
||||||
if (e & VO_EVENT_RESIZE)
|
|
||||||
resize(vo);
|
|
||||||
else if (e & VO_EVENT_EXPOSE) {
|
|
||||||
vo->want_redraw = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct bitmap_packer *make_packer(struct vo *vo, VdpRGBAFormat format)
|
static struct bitmap_packer *make_packer(struct vo *vo, VdpRGBAFormat format)
|
||||||
{
|
{
|
||||||
struct vdpctx *vc = vo->priv;
|
struct vdpctx *vc = vo->priv;
|
||||||
|
@ -1554,14 +1540,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
return true;
|
return true;
|
||||||
case VOCTRL_HWDEC_DECODER_RENDER:
|
case VOCTRL_HWDEC_DECODER_RENDER:
|
||||||
return decoder_render(vo, data);
|
return decoder_render(vo, data);
|
||||||
case VOCTRL_BORDER:
|
|
||||||
vo_x11_border(vo);
|
|
||||||
checked_resize(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_FULLSCREEN:
|
|
||||||
vo_x11_fullscreen(vo);
|
|
||||||
checked_resize(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_GET_PANSCAN:
|
case VOCTRL_GET_PANSCAN:
|
||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
case VOCTRL_SET_PANSCAN:
|
case VOCTRL_SET_PANSCAN:
|
||||||
|
@ -1585,12 +1563,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
case VOCTRL_GET_YUV_COLORSPACE:
|
case VOCTRL_GET_YUV_COLORSPACE:
|
||||||
*(struct mp_csp_details *)data = vc->colorspace;
|
*(struct mp_csp_details *)data = vc->colorspace;
|
||||||
return true;
|
return true;
|
||||||
case VOCTRL_ONTOP:
|
|
||||||
vo_x11_ontop(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_UPDATE_SCREENINFO:
|
|
||||||
vo_x11_update_screeninfo(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_NEWFRAME:
|
case VOCTRL_NEWFRAME:
|
||||||
vc->deint_queue_pos = next_deint_queue_pos(vo, true);
|
vc->deint_queue_pos = next_deint_queue_pos(vo, true);
|
||||||
if (status_ok(vo))
|
if (status_ok(vo))
|
||||||
|
@ -1617,7 +1589,17 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return VO_NOTIMPL;
|
|
||||||
|
int events = 0;
|
||||||
|
int r = vo_x11_control(vo, &events, request, data);
|
||||||
|
|
||||||
|
if (events & VO_EVENT_RESIZE) {
|
||||||
|
checked_resize(vo);
|
||||||
|
} else if (events & VO_EVENT_EXPOSE) {
|
||||||
|
vo->want_redraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OPT_BASE_STRUCT struct vdpctx
|
#define OPT_BASE_STRUCT struct vdpctx
|
||||||
|
@ -1638,7 +1620,6 @@ const struct vo_driver video_out_vdpau = {
|
||||||
.get_buffered_frame = set_next_frame_info,
|
.get_buffered_frame = set_next_frame_info,
|
||||||
.draw_osd = draw_osd,
|
.draw_osd = draw_osd,
|
||||||
.flip_page_timed = flip_page_timed,
|
.flip_page_timed = flip_page_timed,
|
||||||
.check_events = check_events,
|
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
.priv_size = sizeof(struct vdpctx),
|
.priv_size = sizeof(struct vdpctx),
|
||||||
.options = (const struct m_option []){
|
.options = (const struct m_option []){
|
||||||
|
|
|
@ -101,13 +101,6 @@ struct priv {
|
||||||
|
|
||||||
static bool resize(struct vo *vo);
|
static bool resize(struct vo *vo);
|
||||||
|
|
||||||
static void check_events(struct vo *vo)
|
|
||||||
{
|
|
||||||
int ret = vo_x11_check_events(vo);
|
|
||||||
if (ret & (VO_EVENT_EXPOSE | VO_EVENT_RESIZE))
|
|
||||||
resize(vo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scan the available visuals on this Display/Screen. Try to find
|
/* Scan the available visuals on this Display/Screen. Try to find
|
||||||
* the 'best' available TrueColor visual that has a decent color
|
* the 'best' available TrueColor visual that has a decent color
|
||||||
* depth (at least 15bit). If there are multiple visuals with depth
|
* depth (at least 15bit). If there are multiple visuals with depth
|
||||||
|
@ -483,7 +476,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
|
||||||
ctx->Shm_Warned_Slow = 1;
|
ctx->Shm_Warned_Slow = 1;
|
||||||
}
|
}
|
||||||
usec_sleep(1000);
|
usec_sleep(1000);
|
||||||
check_events(vo);
|
vo_x11_check_events(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -646,10 +639,6 @@ static int preinit(struct vo *vo, const char *arg)
|
||||||
static int control(struct vo *vo, uint32_t request, void *data)
|
static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
{
|
{
|
||||||
switch (request) {
|
switch (request) {
|
||||||
case VOCTRL_FULLSCREEN:
|
|
||||||
vo_x11_fullscreen(vo);
|
|
||||||
resize(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_SET_EQUALIZER:
|
case VOCTRL_SET_EQUALIZER:
|
||||||
{
|
{
|
||||||
struct voctrl_set_equalizer_args *args = data;
|
struct voctrl_set_equalizer_args *args = data;
|
||||||
|
@ -660,12 +649,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
struct voctrl_get_equalizer_args *args = data;
|
struct voctrl_get_equalizer_args *args = data;
|
||||||
return vo_x11_get_equalizer(vo, args->name, args->valueptr);
|
return vo_x11_get_equalizer(vo, args->name, args->valueptr);
|
||||||
}
|
}
|
||||||
case VOCTRL_ONTOP:
|
|
||||||
vo_x11_ontop(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_UPDATE_SCREENINFO:
|
|
||||||
vo_x11_update_screeninfo(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_GET_PANSCAN:
|
case VOCTRL_GET_PANSCAN:
|
||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
case VOCTRL_SET_PANSCAN:
|
case VOCTRL_SET_PANSCAN:
|
||||||
|
@ -679,7 +662,12 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return VO_NOTIMPL;
|
|
||||||
|
int events = 0;
|
||||||
|
int r = vo_x11_control(vo, &events, request, data);
|
||||||
|
if (events & (VO_EVENT_EXPOSE | VO_EVENT_RESIZE))
|
||||||
|
resize(vo);
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct vo_driver video_out_x11 = {
|
const struct vo_driver video_out_x11 = {
|
||||||
|
@ -698,6 +686,5 @@ const struct vo_driver video_out_x11 = {
|
||||||
.draw_image = draw_image,
|
.draw_image = draw_image,
|
||||||
.draw_osd = draw_osd,
|
.draw_osd = draw_osd,
|
||||||
.flip_page = flip_page,
|
.flip_page = flip_page,
|
||||||
.check_events = check_events,
|
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
};
|
};
|
||||||
|
|
|
@ -657,16 +657,6 @@ static struct mp_image get_xv_buffer(struct vo *vo, int buf_index)
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_events(struct vo *vo)
|
|
||||||
{
|
|
||||||
int e = vo_x11_check_events(vo);
|
|
||||||
|
|
||||||
if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) {
|
|
||||||
resize(vo);
|
|
||||||
vo->want_redraw = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void draw_osd(struct vo *vo, struct osd_state *osd)
|
static void draw_osd(struct vo *vo, struct osd_state *osd)
|
||||||
{
|
{
|
||||||
struct xvctx *ctx = vo->priv;
|
struct xvctx *ctx = vo->priv;
|
||||||
|
@ -696,7 +686,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
|
||||||
ctx->Shm_Warned_Slow = 1;
|
ctx->Shm_Warned_Slow = 1;
|
||||||
}
|
}
|
||||||
usec_sleep(1000);
|
usec_sleep(1000);
|
||||||
check_events(vo);
|
vo_x11_check_events(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -921,9 +911,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
switch (request) {
|
switch (request) {
|
||||||
case VOCTRL_GET_PANSCAN:
|
case VOCTRL_GET_PANSCAN:
|
||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
case VOCTRL_FULLSCREEN:
|
|
||||||
vo_x11_fullscreen(vo);
|
|
||||||
/* indended, fallthrough to update panscan on fullscreen/windowed switch */
|
|
||||||
case VOCTRL_SET_PANSCAN:
|
case VOCTRL_SET_PANSCAN:
|
||||||
resize(vo);
|
resize(vo);
|
||||||
return VO_TRUE;
|
return VO_TRUE;
|
||||||
|
@ -948,12 +935,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
read_xv_csp(vo);
|
read_xv_csp(vo);
|
||||||
*cspc = ctx->cached_csp;
|
*cspc = ctx->cached_csp;
|
||||||
return true;
|
return true;
|
||||||
case VOCTRL_ONTOP:
|
|
||||||
vo_x11_ontop(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_UPDATE_SCREENINFO:
|
|
||||||
vo_x11_update_screeninfo(vo);
|
|
||||||
return VO_TRUE;
|
|
||||||
case VOCTRL_REDRAW_FRAME:
|
case VOCTRL_REDRAW_FRAME:
|
||||||
return redraw_frame(vo);
|
return redraw_frame(vo);
|
||||||
case VOCTRL_SCREENSHOT: {
|
case VOCTRL_SCREENSHOT: {
|
||||||
|
@ -962,7 +943,13 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return VO_NOTIMPL;
|
int events = 0;
|
||||||
|
int r = vo_x11_control(vo, &events, request, data);
|
||||||
|
if (events & (VO_EVENT_EXPOSE | VO_EVENT_RESIZE)) {
|
||||||
|
resize(vo);
|
||||||
|
vo->want_redraw = true;
|
||||||
|
}
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct vo_driver video_out_xv = {
|
const struct vo_driver video_out_xv = {
|
||||||
|
@ -974,6 +961,5 @@ const struct vo_driver video_out_xv = {
|
||||||
.draw_image = draw_image,
|
.draw_image = draw_image,
|
||||||
.draw_osd = draw_osd,
|
.draw_osd = draw_osd,
|
||||||
.flip_page = flip_page,
|
.flip_page = flip_page,
|
||||||
.check_events = check_events,
|
|
||||||
.uninit = uninit
|
.uninit = uninit
|
||||||
};
|
};
|
||||||
|
|
|
@ -128,6 +128,7 @@ typedef struct
|
||||||
} MotifWmHints;
|
} MotifWmHints;
|
||||||
|
|
||||||
static void vo_x11_update_geometry(struct vo *vo);
|
static void vo_x11_update_geometry(struct vo *vo);
|
||||||
|
static void vo_x11_fullscreen(struct vo *vo);
|
||||||
static int vo_x11_get_fs_type(struct vo *vo);
|
static int vo_x11_get_fs_type(struct vo *vo);
|
||||||
static void xscreensaver_heartbeat(struct vo_x11_state *x11);
|
static void xscreensaver_heartbeat(struct vo_x11_state *x11);
|
||||||
static void saver_on(struct vo_x11_state *x11);
|
static void saver_on(struct vo_x11_state *x11);
|
||||||
|
@ -371,7 +372,7 @@ static void init_atoms(struct vo_x11_state *x11)
|
||||||
x11->XA_NET_WM_CM = XInternAtom(x11->display, buf, False);
|
x11->XA_NET_WM_CM = XInternAtom(x11->display, buf, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vo_x11_update_screeninfo(struct vo *vo)
|
static void vo_x11_update_screeninfo(struct vo *vo)
|
||||||
{
|
{
|
||||||
struct mp_vo_opts *opts = vo->opts;
|
struct mp_vo_opts *opts = vo->opts;
|
||||||
struct vo_x11_state *x11 = vo->x11;
|
struct vo_x11_state *x11 = vo->x11;
|
||||||
|
@ -1275,7 +1276,7 @@ static void vo_x11_update_geometry(struct vo *vo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vo_x11_fullscreen(struct vo *vo)
|
static void vo_x11_fullscreen(struct vo *vo)
|
||||||
{
|
{
|
||||||
struct mp_vo_opts *opts = vo->opts;
|
struct mp_vo_opts *opts = vo->opts;
|
||||||
struct vo_x11_state *x11 = vo->x11;
|
struct vo_x11_state *x11 = vo->x11;
|
||||||
|
@ -1371,7 +1372,7 @@ void vo_x11_fullscreen(struct vo *vo)
|
||||||
x11->pos_changed_during_fs = false;
|
x11->pos_changed_during_fs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vo_x11_ontop(struct vo *vo)
|
static void vo_x11_ontop(struct vo *vo)
|
||||||
{
|
{
|
||||||
struct mp_vo_opts *opts = vo->opts;
|
struct mp_vo_opts *opts = vo->opts;
|
||||||
opts->ontop = !opts->ontop;
|
opts->ontop = !opts->ontop;
|
||||||
|
@ -1379,7 +1380,7 @@ void vo_x11_ontop(struct vo *vo)
|
||||||
vo_x11_setlayer(vo, vo->x11->window, opts->ontop);
|
vo_x11_setlayer(vo, vo->x11->window, opts->ontop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vo_x11_border(struct vo *vo)
|
static void vo_x11_border(struct vo *vo)
|
||||||
{
|
{
|
||||||
vo->opts->border = !vo->opts->border;
|
vo->opts->border = !vo->opts->border;
|
||||||
vo_x11_decoration(vo, vo->opts->border && !vo->opts->fs);
|
vo_x11_decoration(vo, vo->opts->border && !vo->opts->fs);
|
||||||
|
|
|
@ -129,7 +129,6 @@ struct vo_x11_state {
|
||||||
int vo_x11_init(struct vo *vo);
|
int vo_x11_init(struct vo *vo);
|
||||||
void vo_x11_uninit(struct vo *vo);
|
void vo_x11_uninit(struct vo *vo);
|
||||||
int vo_x11_check_events(struct vo *vo);
|
int vo_x11_check_events(struct vo *vo);
|
||||||
void vo_x11_fullscreen(struct vo *vo);
|
|
||||||
uint32_t vo_x11_set_equalizer(struct vo *vo, const char *name, int value);
|
uint32_t vo_x11_set_equalizer(struct vo *vo, const char *name, int value);
|
||||||
uint32_t vo_x11_get_equalizer(struct vo *vo, const char *name, int *value);
|
uint32_t vo_x11_get_equalizer(struct vo *vo, const char *name, int *value);
|
||||||
bool vo_x11_screen_is_composited(struct vo *vo);
|
bool vo_x11_screen_is_composited(struct vo *vo);
|
||||||
|
@ -140,9 +139,6 @@ void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis,
|
||||||
const char *classname);
|
const char *classname);
|
||||||
void vo_x11_clear_background(struct vo *vo, const struct mp_rect *rc);
|
void vo_x11_clear_background(struct vo *vo, const struct mp_rect *rc);
|
||||||
void vo_x11_clearwindow(struct vo *vo, Window vo_window);
|
void vo_x11_clearwindow(struct vo *vo, Window vo_window);
|
||||||
void vo_x11_ontop(struct vo *vo);
|
|
||||||
void vo_x11_border(struct vo *vo);
|
|
||||||
void vo_x11_update_screeninfo(struct vo *vo);
|
|
||||||
int vo_x11_control(struct vo *vo, int *events, int request, void *arg);
|
int vo_x11_control(struct vo *vo, int *events, int request, void *arg);
|
||||||
|
|
||||||
double vo_x11_vm_get_fps(struct vo *vo);
|
double vo_x11_vm_get_fps(struct vo *vo);
|
||||||
|
|
Loading…
Reference in New Issue