mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 20:27:23 +00:00
Create a struct for X11 state
Will be used for common data between X11 VOs. The main reasons for making it a separate struct rather than extra fields in the main VO struct are that some field definitions need X headers and that the code keeps basic X state such as the display connection over opening and closing of individual VOs.
This commit is contained in:
parent
d283d5236a
commit
acf319b3ed
@ -20,6 +20,9 @@
|
||||
#include "help_mp.h"
|
||||
|
||||
#include "osdep/shmem.h"
|
||||
#ifdef HAVE_X11
|
||||
#include "x11_common.h"
|
||||
#endif
|
||||
|
||||
//int vo_flags=0;
|
||||
|
||||
@ -298,7 +301,7 @@ void list_video_out(void)
|
||||
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
|
||||
}
|
||||
|
||||
struct vo *init_best_video_out(struct MPOpts *opts)
|
||||
struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11)
|
||||
{
|
||||
char **vo_list = opts->video_driver_list;
|
||||
int i;
|
||||
@ -321,7 +324,7 @@ struct vo *init_best_video_out(struct MPOpts *opts)
|
||||
const vo_info_t *info = video_driver->info;
|
||||
if (!strcmp(info->short_name, name)) {
|
||||
// name matches, try it
|
||||
*vo = (struct vo){.opts = opts};
|
||||
*vo = (struct vo){.opts = opts, .x11 = x11};
|
||||
vo->driver = video_driver;
|
||||
if (!vo_preinit(vo, vo_subdevice)) {
|
||||
free(name);
|
||||
@ -339,7 +342,7 @@ struct vo *init_best_video_out(struct MPOpts *opts)
|
||||
vo_subdevice = NULL;
|
||||
for (i = 0; video_out_drivers[i]; i++) {
|
||||
const struct vo_driver *video_driver = video_out_drivers[i];
|
||||
*vo = (struct vo){.opts = opts};
|
||||
*vo = (struct vo){.opts = opts, .x11 = x11};
|
||||
vo->driver = video_driver;
|
||||
if (!vo_preinit(vo, vo_subdevice))
|
||||
return vo; // success!
|
||||
|
@ -210,9 +210,10 @@ struct vo {
|
||||
const struct vo_driver *driver;
|
||||
void *priv;
|
||||
struct MPOpts *opts;
|
||||
struct vo_x11_state *x11;
|
||||
};
|
||||
|
||||
struct vo *init_best_video_out(struct MPOpts *opts);
|
||||
struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11);
|
||||
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
|
||||
uint32_t d_width, uint32_t d_height, uint32_t flags,
|
||||
char *title, uint32_t format);
|
||||
|
@ -122,6 +122,10 @@ static int vo_x11_get_fs_type(int supported);
|
||||
static void saver_off(Display *);
|
||||
static void saver_on(Display *);
|
||||
|
||||
void vo_x11_init_state(struct vo_x11_state *s)
|
||||
{
|
||||
*s = (struct vo_x11_state){};
|
||||
}
|
||||
|
||||
/*
|
||||
* Sends the EWMH fullscreen state event.
|
||||
|
@ -6,6 +6,10 @@
|
||||
|
||||
struct vo;
|
||||
|
||||
struct vo_x11_state {
|
||||
int unused; // placeholder to avoid empty struct
|
||||
};
|
||||
|
||||
#ifdef X11_FULLSCREEN
|
||||
|
||||
#define vo_wm_LAYER 1
|
||||
@ -36,6 +40,7 @@ extern int mLocalDisplay;
|
||||
|
||||
extern int vo_mouse_autohide;
|
||||
|
||||
void vo_x11_init_state(struct vo_x11_state *s);
|
||||
extern int vo_init( void );
|
||||
extern void vo_uninit( void );
|
||||
extern void vo_x11_decoration( Display * vo_Display,Window w,int d );
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
typedef struct MPContext {
|
||||
struct MPOpts opts;
|
||||
struct vo_x11_state *x11_state;
|
||||
int osd_show_percentage;
|
||||
int osd_function;
|
||||
const ao_functions_t *audio_out;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
#include "talloc.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define _UWIN 1 /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/
|
||||
@ -2143,7 +2144,7 @@ int reinit_video_chain(void) {
|
||||
//shouldn't we set dvideo->id=-2 when we fail?
|
||||
vo_config_count=0;
|
||||
//if((mpctx->video_out->preinit(vo_subdevice))!=0){
|
||||
if(!(mpctx->video_out=init_best_video_out(opts))){
|
||||
if(!(mpctx->video_out=init_best_video_out(opts, mpctx->x11_state))){
|
||||
mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorInitializingVODevice);
|
||||
goto err_out;
|
||||
}
|
||||
@ -2562,6 +2563,10 @@ int gui_no_filename=0;
|
||||
|
||||
mp_msg_init();
|
||||
|
||||
#ifdef HAVE_X11
|
||||
mpctx->x11_state = talloc_ptrtype(NULL, mpctx->x11_state);
|
||||
vo_x11_init_state(mpctx->x11_state);
|
||||
#endif
|
||||
struct MPOpts *opts = &mpctx->opts;
|
||||
set_default_mplayer_options(opts);
|
||||
// Create the config context and register the options
|
||||
|
Loading…
Reference in New Issue
Block a user