diff options
author | Alexander Preisinger <alexander.preisinger@gmail.com> | 2013-03-04 17:40:21 +0100 |
---|---|---|
committer | Alexander Preisinger <alexander.preisinger@gmail.com> | 2013-03-04 17:40:21 +0100 |
commit | 7686cd7f043ef5b42ade64db21ec01c8c8d6281e (patch) | |
tree | b8f2f3b73e2a7e19e6e999aa6ece03b381c87d14 /video | |
parent | dc226bb846f037e992ae4a9fa12aa2196e804e6d (diff) | |
download | mpv-7686cd7f043ef5b42ade64db21ec01c8c8d6281e.tar.bz2 mpv-7686cd7f043ef5b42ade64db21ec01c8c8d6281e.tar.xz |
vo: remove and cleanup globals
Removes almost every global variabel in vo.h and puts them in a special struct
in MPOpts for video output related options.
Also we completly remove the options/globals pts and refresh rate because
they were unused.
Diffstat (limited to 'video')
-rw-r--r-- | video/decode/vd.c | 20 | ||||
-rw-r--r-- | video/out/aspect.c | 18 | ||||
-rw-r--r-- | video/out/cocoa_common.m | 51 | ||||
-rw-r--r-- | video/out/vo.c | 40 | ||||
-rw-r--r-- | video/out/vo.h | 27 | ||||
-rw-r--r-- | video/out/vo_caca.c | 4 | ||||
-rw-r--r-- | video/out/vo_corevideo.m | 4 | ||||
-rw-r--r-- | video/out/vo_opengl.c | 2 | ||||
-rw-r--r-- | video/out/vo_opengl_old.c | 8 | ||||
-rw-r--r-- | video/out/vo_sdl.c | 28 | ||||
-rw-r--r-- | video/out/vo_vdpau.c | 5 | ||||
-rw-r--r-- | video/out/vo_x11.c | 10 | ||||
-rw-r--r-- | video/out/vo_xv.c | 8 | ||||
-rw-r--r-- | video/out/w32_common.c | 91 | ||||
-rw-r--r-- | video/out/wayland_common.c | 26 | ||||
-rw-r--r-- | video/out/x11_common.c | 168 |
16 files changed, 243 insertions, 267 deletions
diff --git a/video/decode/vd.c b/video/decode/vd.c index b43570f0ad..0ca685e2bb 100644 --- a/video/decode/vd.c +++ b/video/decode/vd.c @@ -169,16 +169,16 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int out_fmt) set_video_colorspace(sh); - if (opts->vo_gamma_gamma != 1000) - set_video_colors(sh, "gamma", opts->vo_gamma_gamma); - if (opts->vo_gamma_brightness != 1000) - set_video_colors(sh, "brightness", opts->vo_gamma_brightness); - if (opts->vo_gamma_contrast != 1000) - set_video_colors(sh, "contrast", opts->vo_gamma_contrast); - if (opts->vo_gamma_saturation != 1000) - set_video_colors(sh, "saturation", opts->vo_gamma_saturation); - if (opts->vo_gamma_hue != 1000) - set_video_colors(sh, "hue", opts->vo_gamma_hue); + if (opts->gamma_gamma != 1000) + set_video_colors(sh, "gamma", opts->gamma_gamma); + if (opts->gamma_brightness != 1000) + set_video_colors(sh, "brightness", opts->gamma_brightness); + if (opts->gamma_contrast != 1000) + set_video_colors(sh, "contrast", opts->gamma_contrast); + if (opts->gamma_saturation != 1000) + set_video_colors(sh, "saturation", opts->gamma_saturation); + if (opts->gamma_hue != 1000) + set_video_colors(sh, "hue", opts->gamma_hue); return 1; } diff --git a/video/out/aspect.c b/video/out/aspect.c index 05e40a73e9..e7ca37a82d 100644 --- a/video/out/aspect.c +++ b/video/out/aspect.c @@ -45,10 +45,10 @@ void aspect_save_screenres(struct vo *vo, int scrw, int scrh) scrw = (scrh * 4 + 2) / 3; vo->aspdat.scrw = scrw; vo->aspdat.scrh = scrh; - if (opts->force_monitor_aspect) - vo->monitor_par = opts->force_monitor_aspect * scrh / scrw; + if (opts->vo.force_monitor_aspect) + vo->monitor_par = opts->vo.force_monitor_aspect * scrh / scrw; else - vo->monitor_par = 1.0 / opts->monitor_pixel_aspect; + vo->monitor_par = 1.0 / opts->vo.monitor_pixel_aspect; } /* aspect is called with the source resolution and the @@ -88,7 +88,7 @@ static void get_max_dims(struct vo *vo, int *w, int *h, int zoom) struct aspect_data *aspdat = &vo->aspdat; *w = zoom ? aspdat->scrw : aspdat->prew; *h = zoom ? aspdat->scrh : aspdat->preh; - if (zoom && WinID >= 0) + if (zoom && vo->opts->vo.WinID >= 0) zoom = A_WINZOOM; if (zoom == A_WINZOOM) { *w = vo->dwidth; @@ -101,7 +101,7 @@ void aspect(struct vo *vo, int *srcw, int *srch, int zoom) int fitw; int fith; get_max_dims(vo, &fitw, &fith, zoom); - if (!zoom && vo->opts->vo_geometry.wh_valid) { + if (!zoom && vo->opts->vo.geometry.wh_valid) { mp_msg(MSGT_VO, MSGL_DBG2, "aspect(0) no aspect forced!\n"); return; // the user doesn't want to fix aspect } @@ -123,16 +123,16 @@ static void panscan_calc_internal(struct vo *vo, int zoom) get_max_dims(vo, &max_w, &max_h, zoom); struct MPOpts *opts = vo->opts; - if (opts->vo_panscanrange > 0) { + if (opts->vo.panscanrange > 0) { aspect(vo, &fwidth, &fheight, zoom); vo_panscan_area = max_h - fheight; if (!vo_panscan_area) vo_panscan_area = max_w - fwidth; - vo_panscan_area *= opts->vo_panscanrange; + vo_panscan_area *= opts->vo.panscanrange; } else - vo_panscan_area = -opts->vo_panscanrange * max_h; + vo_panscan_area = -opts->vo.panscanrange * max_h; - vo->panscan_amount = vo_fs || zoom == A_WINZOOM ? vo_panscan : 0; + vo->panscan_amount = opts->vo.fs || zoom == A_WINZOOM ? opts->vo.panscan : 0; vo->panscan_x = vo_panscan_area * vo->panscan_amount * vo->aspdat.asp; vo->panscan_y = vo_panscan_area * vo->panscan_amount; } diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index add42de953..b376e392c0 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -122,7 +122,7 @@ struct vo_cocoa_state { int display_cursor; int cursor_timer; - int cursor_autohide_delay; + int vo.cursor_autohide_delay; bool did_resize; bool out_fs_resize; @@ -150,7 +150,7 @@ static struct vo_cocoa_state *vo_cocoa_init_state(struct vo *vo) .windowed_frame = {{0,0},{0,0}}, .out_fs_resize = NO, .display_cursor = 1, - .cursor_autohide_delay = vo->opts->cursor_autohide_delay, + .vo.cursor_autohide_delay = vo->opts->vo.cursor_autohide_delay, .power_mgmt_assertion = kIOPMNullAssertionID, .accumulated_scroll = 0, }; @@ -281,10 +281,10 @@ static void update_screen_info(struct vo *vo) struct MPOpts *opts = vo->opts; NSScreen *ws, *fss; - get_screen_handle(opts->vo_screen_id, s->window, &ws); + get_screen_handle(opts->vo.screen_id, s->window, &ws); s->screen_frame = [ws frame]; - get_screen_handle(opts->vo_fsscreen_id, s->window, &fss); + get_screen_handle(opts->vo.fsscreen_id, s->window, &fss); s->fsscreen_frame = [fss frame]; } @@ -296,10 +296,10 @@ void vo_cocoa_update_xinerama_info(struct vo *vo) update_screen_info(vo); aspect_save_screenres(vo, s->screen_frame.size.width, s->screen_frame.size.height); - opts->vo_screenwidth = s->screen_frame.size.width; - opts->vo_screenheight = s->screen_frame.size.height; - xinerama_x = s->screen_frame.origin.x; - xinerama_y = s->screen_frame.origin.y; + opts->vo.screenwidth = s->screen_frame.size.width; + opts->vo.screenheight = s->screen_frame.size.height; + vo->xinerama_x = s->screen_frame.origin.x; + vo->xinerama_y = s->screen_frame.origin.y; } int vo_cocoa_change_attributes(struct vo *vo) @@ -339,8 +339,8 @@ static void vo_set_level(struct vo *vo, int ontop) void vo_cocoa_ontop(struct vo *vo) { struct MPOpts *opts = vo->opts; - opts->vo_ontop = !opts->vo_ontop; - vo_set_level(vo, opts->vo_ontop); + opts->vo.ontop = !opts->vo.ontop; + vo_set_level(vo, opts->vo.ontop); } static void update_state_sizes(struct vo_cocoa_state *s, @@ -355,7 +355,7 @@ static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height, uint32_t flags, int gl3profile) { struct vo_cocoa_state *s = vo->cocoa; - const NSRect window_rect = NSMakeRect(xinerama_x, xinerama_y, + const NSRect window_rect = NSMakeRect(vo->xinerama_x, vo->xinerama_y, d_width, d_height); const NSRect glview_rect = NSMakeRect(0, 0, 100, 100); @@ -418,7 +418,7 @@ static void update_window(struct vo *vo) if (s->current_video_size.width != s->previous_video_size.width || s->current_video_size.height != s->previous_video_size.height) { - if (vo_fs) { + if (vo->opts->vo.fs) { // we will resize as soon as we get out of fullscreen s->out_fs_resize = YES; } else { @@ -463,7 +463,7 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width, if (flags & VOFLAG_FULLSCREEN) vo_cocoa_fullscreen(vo); - vo_set_level(vo, opts->vo_ontop); + vo_set_level(vo, opts->vo.ontop); [s->window setContentSize:s->current_video_size]; [s->window setContentAspectRatio:s->current_video_size]; @@ -491,12 +491,12 @@ static void vo_cocoa_display_cursor(struct vo *vo, int requested_state) { struct vo_cocoa_state *s = vo->cocoa; if (requested_state) { - if (!vo_fs || s->cursor_autohide_delay > -2) { + if (!vo->opts->vo.fs || s->vo.cursor_autohide_delay > -2) { s->display_cursor = requested_state; CGDisplayShowCursor(kCGDirectMainDisplay); } } else { - if (s->cursor_autohide_delay != -1) { + if (s->vo.cursor_autohide_delay != -1) { s->display_cursor = requested_state; CGDisplayHideCursor(kCGDirectMainDisplay); } @@ -510,8 +510,8 @@ int vo_cocoa_check_events(struct vo *vo) int ms_time = (int) ([[NSProcessInfo processInfo] systemUptime] * 1000); // automatically hide mouse cursor - if (vo_fs && s->display_cursor && - (ms_time - s->cursor_timer >= s->cursor_autohide_delay)) { + if (vo->opts->vo.fs && s->display_cursor && + (ms_time - s->cursor_timer >= s->vo.cursor_autohide_delay)) { vo_cocoa_display_cursor(vo, 0); s->cursor_timer = ms_time; } @@ -648,7 +648,8 @@ void create_menu() - (void)fullscreen { struct vo_cocoa_state *s = _vo->cocoa; - if (!vo_fs) { + struct MPOpts *opts = _vo->opts; + if (!opts->vo.fs) { update_screen_info(_vo); if (current_screen_has_dock_or_menubar(_vo)) [NSApp setPresentationOptions:NSApplicationPresentationHideDock| @@ -657,7 +658,7 @@ void create_menu() [self setHasShadow:NO]; [self setStyleMask:s->fullscreen_mask]; [self setFrame:s->fsscreen_frame display:YES animate:NO]; - vo_fs = VO_TRUE; + opts->vo.fs = true; vo_cocoa_display_cursor(_vo, 0); [self setMovableByWindowBackground: NO]; } else { @@ -671,7 +672,7 @@ void create_menu() s->out_fs_resize = NO; } [self setContentAspectRatio:s->current_video_size]; - vo_fs = VO_FALSE; + opts->vo.fs = false; vo_cocoa_display_cursor(_vo, 1); [self setMovableByWindowBackground: YES]; } @@ -695,7 +696,7 @@ void create_menu() { // this is only valid as a starting value. it will be rewritten in the // -fullscreen method. - return !vo_fs; + return !_vo->opts->o_fs; } - (void)handleQuitEvent:(NSAppleEventDescriptor*)e @@ -730,7 +731,7 @@ void create_menu() - (void)mouseMoved: (NSEvent *) theEvent { - if (vo_fs) + if (_vo->opts->vo.fs) vo_cocoa_display_cursor(_vo, 1); } @@ -851,7 +852,7 @@ void create_menu() - (void)applicationWillBecomeActive:(NSNotification *)aNotification { - if (vo_fs && current_screen_has_dock_or_menubar(_vo)) { + if (_vo->opts->vo.fs && current_screen_has_dock_or_menubar(_vo)) { struct vo_cocoa_state *s = _vo->cocoa; [self setLevel:s->window_level]; [NSApp setPresentationOptions:NSApplicationPresentationHideDock| @@ -861,7 +862,7 @@ void create_menu() - (void)applicationWillResignActive:(NSNotification *)aNotification { - if (vo_fs) { + if (_vo->opts->vo.fs) { [self setLevel:NSNormalWindowLevel]; [NSApp setPresentationOptions:NSApplicationPresentationDefault]; } @@ -888,7 +889,7 @@ void create_menu() - (void)mulSize:(float)multiplier { - if (!vo_fs) { + if (!_vo->opts->vo.fs) { NSSize size = { .width = _vo->aspdat.prew * multiplier, .height = _vo->aspdat.preh * multiplier diff --git a/video/out/vo.c b/video/out/vo.c index 52ed04d3b5..5841d6fd52 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -42,25 +42,8 @@ #include "video/vfcap.h" #include "sub/sub.h" -int xinerama_x; -int xinerama_y; - -int vo_nomouse_input = 0; -int vo_vsync = 1; -int vo_fs = 0; -int vo_fsmode = 0; -float vo_panscan = 0.0f; -int vo_refresh_rate=0; -int vo_keepaspect=1; -int vo_border=1; -int64_t WinID = -1; - -int vo_pts=0; // for hw decoding float vo_fps=0; -int vo_colorkey = 0x0000ff00; // default colorkey is green - // (0xff000000 means that colorkey has been disabled) - // // Externally visible list of all vo drivers // @@ -407,22 +390,22 @@ static void determine_window_geometry(struct vo *vo, int d_w, int d_h) { struct MPOpts *opts = vo->opts; - int scr_w = opts->vo_screenwidth; - int scr_h = opts->vo_screenheight; + int scr_w = opts->vo.screenwidth; + int scr_h = opts->vo.screenheight; // This is only for applying monitor pixel aspect aspect(vo, &d_w, &d_h, A_NOZOOM); - apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo_autofit, true); - apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo_autofit_larger, false); + apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo.autofit, true); + apply_autofit(&d_w, &d_h, scr_w, scr_h, &opts->vo.autofit_larger, false); - vo->dx = (int)(opts->vo_screenwidth - d_w) / 2; - vo->dy = (int)(opts->vo_screenheight - d_h) / 2; + vo->dx = (int)(opts->vo.screenwidth - d_w) / 2; + vo->dy = (int)(opts->vo.screenheight - d_h) / 2; m_geometry_apply(&vo->dx, &vo->dy, &d_w, &d_h, scr_w, scr_h, - &opts->vo_geometry); + &opts->vo.geometry); - vo->dx += xinerama_x; - vo->dy += xinerama_y; + vo->dx += vo->xinerama_x; + vo->dy += vo->xinerama_y; vo->dwidth = d_w; vo->dheight = d_h; } @@ -536,7 +519,7 @@ void vo_get_src_dst_rects(struct vo *vo, struct mp_rect *out_src, .display_par = vo->monitor_par, .video_par = vo->aspdat.par, }; - if (aspect_scaling()) { + if (aspect_scaling(vo)) { int scaled_width = 0, scaled_height = 0; aspect(vo, &scaled_width, &scaled_height, A_WINZOOM); panscan_calc_windowed(vo); @@ -581,8 +564,9 @@ const char *vo_get_window_title(struct vo *vo) void vo_mouse_movement(struct vo *vo, int posx, int posy) { char cmd_str[40]; - if (!enable_mouse_movements) + if (!vo->opts->vo.enable_mouse_movements) return; snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i", posx, posy); mp_input_queue_cmd(vo->input_ctx, mp_input_parse_cmd(bstr0(cmd_str), "")); } + diff --git a/video/out/vo.h b/video/out/vo.h index ca252337b1..ed3be652bd 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -28,6 +28,7 @@ #include "video/img_format.h" #include "core/mp_common.h" +#include "core/options.h" #define VO_EVENT_EXPOSE 1 #define VO_EVENT_RESIZE 2 @@ -260,6 +261,9 @@ struct vo { int dwidth; int dheight; + int xinerama_x; + int xinerama_y; + int panscan_x; int panscan_y; float panscan_amount; @@ -306,27 +310,8 @@ const char *vo_get_window_title(struct vo *vo); // NULL terminated array of all drivers extern const struct vo_driver *video_out_drivers[]; -extern int xinerama_x; -extern int xinerama_y; - -extern int vo_vsync; -extern int vo_fs; -extern int vo_fsmode; -extern float vo_panscan; -extern int vo_refresh_rate; -extern int vo_keepaspect; -extern int vo_border; - -extern int vo_nomouse_input; -extern int enable_mouse_movements; - -extern int vo_pts; extern float vo_fps; -extern int vo_colorkey; - -extern int64_t WinID; - struct mp_keymap { int from; int to; @@ -339,9 +324,9 @@ struct mp_osd_res; void vo_get_src_dst_rects(struct vo *vo, struct mp_rect *out_src, struct mp_rect *out_dst, struct mp_osd_res *out_osd); -static inline int aspect_scaling(void) +static inline int aspect_scaling(struct vo *vo) { - return vo_keepaspect || vo_fs; + return vo->opts->vo.keepaspect || vo->opts->vo.fs; } #endif /* MPLAYER_VIDEO_OUT_H */ diff --git a/video/out/vo_caca.c b/video/out/vo_caca.c index 3a07f57152..885a6c6e9a 100644 --- a/video/out/vo_caca.c +++ b/video/out/vo_caca.c @@ -175,12 +175,12 @@ static void check_events(struct vo *vo) vo_mouse_movement(vo, cev.data.mouse.x, cev.data.mouse.y); break; case CACA_EVENT_MOUSE_PRESS: - if (!vo_nomouse_input) + if (!vo->opts->vo.nomouse_input) mplayer_put_key(vo->key_fifo, (MP_MOUSE_BTN0 + cev.data.mouse.button - 1) | MP_KEY_STATE_DOWN); break; case CACA_EVENT_MOUSE_RELEASE: - if (!vo_nomouse_input) + if (!vo->opts->vo.nomouse_input) mplayer_put_key(vo->key_fifo, MP_MOUSE_BTN0 + cev.data.mouse.button - 1); break; diff --git a/video/out/vo_corevideo.m b/video/out/vo_corevideo.m index a1b5036dbf..08dd8e8a25 100644 --- a/video/out/vo_corevideo.m +++ b/video/out/vo_corevideo.m @@ -70,7 +70,7 @@ static void resize(struct vo *vo, int width, int height) gl->MatrixMode(GL_PROJECTION); gl->LoadIdentity(); p->ass_border_x = p->ass_border_y = 0; - if (aspect_scaling()) { + if (aspect_scaling(vo)) { int new_w, new_h; GLdouble scale_x, scale_y; @@ -307,7 +307,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd) .video_par = vo->aspdat.par, }; - if (aspect_scaling()) { + if (aspect_scaling(vo)) { res.ml = res.mr = p->ass_border_x; res.mt = res.mb = p->ass_border_y; } diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index 98406ecad4..6170852132 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -2085,7 +2085,7 @@ static int preinit(struct vo *vo, const char *arg) .colorspace = MP_CSP_DETAILS_DEFAULTS, .use_npot = 1, .use_pbo = hq, - .swap_interval = vo_vsync, + .swap_interval = vo->opts->vo.vsync, .dither_depth = hq ? 0 : -1, .fbo_format = hq ? GL_RGB16 : GL_RGB, .use_scale_sep = 1, diff --git a/video/out/vo_opengl_old.c b/video/out/vo_opengl_old.c index 30a0467d46..d41a547847 100644 --- a/video/out/vo_opengl_old.c +++ b/video/out/vo_opengl_old.c @@ -1361,7 +1361,7 @@ static void resize(struct vo *vo, int x, int y) gl->MatrixMode(GL_PROJECTION); gl->LoadIdentity(); p->ass_border_x = p->ass_border_y = 0; - if (aspect_scaling()) { + if (aspect_scaling(vo)) { int new_w, new_h; GLdouble scale_x, scale_y; aspect(vo, &new_w, &new_h, A_WINZOOM); @@ -1490,7 +1490,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd) if (p->scaled_osd) { res.w = p->image_width; res.h = p->image_height; - } else if (aspect_scaling()) { + } else if (aspect_scaling(vo)) { res.ml = res.mr = p->ass_border_x; res.mt = res.mb = p->ass_border_y; } @@ -1821,7 +1821,7 @@ static void flip_page(struct vo *vo) if (p->use_glFinish) gl->Finish(); p->glctx->swapGlBuffers(p->glctx); - if (aspect_scaling()) + if (aspect_scaling(vo)) gl->Clear(GL_COLOR_BUFFER_BIT); } @@ -2113,7 +2113,7 @@ static int preinit(struct vo *vo, const char *arg) .use_rectangle = -1, .ati_hack = -1, .force_pbo = -1, - .swap_interval = vo_vsync, + .swap_interval = vo->opts->vo.vsync, .custom_prog = NULL, .custom_tex = NULL, .custom_tlin = 1, diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c index 5f1e4317ed..b10a237b19 100644 --- a/video/out/vo_sdl.c +++ b/video/out/vo_sdl.c @@ -271,7 +271,7 @@ static bool try_create_renderer(struct vo *vo, int i, const char *driver, if (!is_good_renderer(&ri, driver, vc->allow_sw, NULL)) return false; - bool xy_valid = vo->opts->vo_geometry.xy_valid; + bool xy_valid = vo->opts->vo.geometry.xy_valid; // then actually try vc->window = SDL_CreateWindow("MPV", @@ -387,7 +387,7 @@ static void set_fullscreen(struct vo *vo, int fs) // toggling fullscreen might recreate the window, so better guard for this SDL_DisableScreenSaver(); - vo_fs = fs; + vo->opts->vo.fs = fs; force_resize(vo); } @@ -473,18 +473,18 @@ static void check_events(struct vo *vo) struct MPOpts *opts = vo->opts; SDL_Event ev; - if (opts->cursor_autohide_delay >= 0) { + if (opts->vo.cursor_autohide_delay >= 0) { if (!vc->mouse_hidden && - (GetTimerMS() - vc->mouse_timer >= opts->cursor_autohide_delay)) { + (GetTimerMS() - vc->mouse_timer >= opts->vo.cursor_autohide_delay)) { SDL_ShowCursor(0); vc->mouse_hidden = 1; } - } else if (opts->cursor_autohide_delay == -1) { + } else if (opts->vo.cursor_autohide_delay == -1) { if (vc->mouse_hidden) { SDL_ShowCursor(1); vc->mouse_hidden = 0; } - } else if (opts->cursor_autohide_delay == -2) { + } else if (opts->vo.cursor_autohide_delay == -2) { if (!vc->mouse_hidden) { SDL_ShowCursor(0); vc->mouse_hidden = 1; @@ -553,7 +553,7 @@ static void check_events(struct vo *vo) break; } case SDL_MOUSEMOTION: - if (opts->cursor_autohide_delay >= 0) { + if (opts->vo.cursor_autohide_delay >= 0) { SDL_ShowCursor(1); vc->mouse_hidden = 0; vc->mouse_timer = GetTimerMS(); @@ -561,7 +561,7 @@ static void check_events(struct vo *vo) vo_mouse_movement(vo, ev.motion.x, ev.motion.y); break; case SDL_MOUSEBUTTONDOWN: - if (opts->cursor_autohide_delay >= 0) { + if (opts->vo.cursor_autohide_delay >= 0) { SDL_ShowCursor(1); vc->mouse_hidden = 0; vc->mouse_timer = GetTimerMS(); @@ -570,7 +570,7 @@ static void check_events(struct vo *vo) (MP_MOUSE_BTN0 + ev.button.button - 1) | MP_KEY_STATE_DOWN); break; case SDL_MOUSEBUTTONUP: - if (opts->cursor_autohide_delay >= 0) { + if (opts->vo.cursor_autohide_delay >= 0) { SDL_ShowCursor(1); vc->mouse_hidden = 0; vc->mouse_timer = GetTimerMS(); @@ -771,7 +771,7 @@ static int preinit(struct vo *vo, const char *arg) SDL_HINT_DEFAULT); // predefine MPV options (SDL env vars shall be overridden) - if (vo_vsync) + if (vo->opts->vo.vsync) SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, "1", SDL_HINT_OVERRIDE); else @@ -922,9 +922,9 @@ static void update_screeninfo(struct vo *vo) return; } struct MPOpts *opts = vo->opts; - opts->vo_screenwidth = mode.w; - opts->vo_screenheight = mode.h; - aspect_save_screenres(vo, opts->vo_screenwidth, opts->vo_screenheight); + opts->vo.screenwidth = mode.w; + opts->vo.screenheight = mode.h; + aspect_save_screenres(vo, opts->vo.screenwidth, opts->vo.screenheight); } static struct mp_image *get_screenshot(struct vo *vo) @@ -981,7 +981,7 @@ static int control(struct vo *vo, uint32_t request, void *data) { switch (request) { case VOCTRL_FULLSCREEN: - set_fullscreen(vo, !vo_fs); + set_fullscreen(vo, !vo->opts->vo.fs); return 1; case VOCTRL_REDRAW_FRAME: draw_image(vo, NULL); diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 6b35176bfb..02163f70bf 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -377,7 +377,10 @@ static void resize(struct vo *vo) vc->src_rect_vid.y0 = vc->flip ? src_rect.y1 : src_rect.y0; vc->src_rect_vid.y1 = vc->flip ? src_rect.y0 : src_rect.y1; - int flip_offset_ms = vo_fs ? vc->flip_offset_fs : vc->flip_offset_window; + int flip_offset_ms = vo->opts->vo.fs ? + vc->flip_offset_fs : + vc->flip_offset_window; + vo->flip_queue_offset = flip_offset_ms / 1000.; if (vc->output_surface_width < vo->dwidth diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index 34c23523ef..9e5f4dc64d 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -49,6 +49,7 @@ #define MODE_BGR 0x2 #include "core/mp_msg.h" +#include "core/options.h" #include "osdep/timer.h" extern int sws_flags; @@ -348,7 +349,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, } if (!XMatchVisualInfo(vo->x11->display, vo->x11->screen, p->depth, DirectColor, &p->vinfo) - || (WinID > 0 + || (vo->opts->vo.WinID > 0 && p->vinfo.visualid != XVisualIDFromVisual(p->attribs.visual))) { XMatchVisualInfo(vo->x11->display, vo->x11->screen, p->depth, TrueColor, @@ -365,7 +366,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, vo_x11_config_vo_window(vo, &p->vinfo, vo->dx, vo->dy, vo->dwidth, vo->dheight, flags, "x11"); - if (WinID > 0) { + if (vo->opts->vo.WinID > 0) { unsigned depth, dummy_uint; int dummy_int; Window dummy_win; @@ -444,7 +445,7 @@ static void Display_Image(struct priv *p, XImage *myximage, uint8_t *ImageData) p->old_vo_dheight != vo->dheight) && p->zoomFlag) return; - if (WinID == 0) { + if (vo->opts->vo.WinID == 0) { x = vo->dx; y = vo->dy; } @@ -538,6 +539,7 @@ static void flip_page(struct vo *vo) static void draw_image(struct vo *vo, mp_image_t *mpi) { struct priv *p = vo->priv; + struct MPOpts *opts = vo->opts; uint8_t *dst[MP_MAX_PLANES] = {NULL}; int dstStride[MP_MAX_PLANES] = {0}; @@ -553,7 +555,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi) p->old_vo_dwidth = vo->dwidth; p->old_vo_dheight = vo->dheight; - if (vo_fs) + if (opts->vo.fs) aspect(vo, &newW, &newH, A_ZOOM); if (sws_flags == 0) newW &= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index bc0920c2eb..46079aaf5f 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -317,7 +317,7 @@ static void xv_print_ck_info(struct xvctx *xv) } } -/* NOTE: If vo_colorkey has bits set after the first 3 low order bytes +/* NOTE: If vo.colorkey has bits set after the first 3 low order bytes * we don't draw anything as this means it was forced to off. */ static int xv_init_colorkey(struct vo *vo) { @@ -328,7 +328,7 @@ static int xv_init_colorkey(struct vo *vo) /* check if colorkeying is needed */ xv_atom = xv_intern_atom_if_exists(vo, "XV_COLORKEY"); - if (xv_atom != None && !(vo_colorkey & 0xFF000000)) { + if (xv_atom != None && !(vo->opts->vo.colorkey & 0xFF000000)) { if (ctx->xv_ck_info.source == CK_SRC_CUR) { int colorkey_ret; @@ -342,14 +342,14 @@ static int xv_init_colorkey(struct vo *vo) return 0; // error getting colorkey } } else { - ctx->xv_colorkey = vo_colorkey; + ctx->xv_colorkey = vo->opts->vo.colorkey; /* check if we have to set the colorkey too */ if (ctx->xv_ck_info.source == CK_SRC_SET) { xv_atom = XInternAtom(display, "XV_COLORKEY", False); rez = XvSetPortAttribute(display, ctx->xv_port, xv_atom, - vo_colorkey); + vo->opts->vo.colorkey); if (rez != Success) { mp_msg(MSGT_VO, MSGL_FATAL, "[xv] Couldn't set colorkey!\n"); return 0; // error setting colorkey diff --git a/video/out/w32_common.c b/video/out/w32_common.c index ab467135cc..3c882de625 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -150,7 +150,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, break; } case WM_SIZING: - if (vo_keepaspect && !vo_fs && WinID < 0) { + if (vo_keepaspect && !vo->opts->vo.fs && vo->otps->vo.WinID < 0) { RECT *rc = (RECT*)lParam; // get client area of the windows if it had the rect rc // (subtracting the window borders) @@ -215,11 +215,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, break; } case WM_LBUTTONDOWN: - if (!vo_nomouse_input && (vo_fs || (wParam & MK_CONTROL))) { + if (!vo_nomouse_input && (vo->opts->vo.fs || (wParam & MK_CONTROL))) { mplayer_put_key(vo->key_fifo, MP_MOUSE_BTN0 | mod_state(vo)); break; } - if (!vo_fs) { + if (!vo->opts->vo.fs) { ReleaseCapture(); SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); return 0; @@ -281,7 +281,7 @@ int vo_w32_check_events(struct vo *vo) TranslateMessage(&msg); DispatchMessageW(&msg); } - if (WinID >= 0) { + if (vo->opts->vo.WinID >= 0) { BOOL res; RECT r; POINT p; @@ -295,10 +295,10 @@ int vo_w32_check_events(struct vo *vo) if (p.x != w32->window_x || p.y != w32->window_y) { w32->window_x = p.x; w32->window_y = p.y; } - res = GetClientRect(WIN_ID_TO_HWND(WinID), &r); + res = GetClientRect(WIN_ID_TO_HWND(vo->opts->vo.WinID), &r); if (res && (r.right != vo->dwidth || r.bottom != vo->dheight)) MoveWindow(w32->window, 0, 0, r.right, r.bottom, FALSE); - if (!IsWindow(WIN_ID_TO_HWND(WinID))) + if (!IsWindow(WIN_ID_TO_HWND(vo->otps->vo.WinID))) // Window has probably been closed, e.g. due to program crash mplayer_put_key(vo->key_fifo, MP_KEY_CLOSE_WIN); } @@ -311,10 +311,10 @@ static BOOL CALLBACK mon_enum(HMONITOR hmon, HDC hdc, LPRECT r, LPARAM p) struct vo *vo = (void*)p; struct vo_w32_state *w32 = vo->w32; // this defaults to the last screen if specified number does not exist - xinerama_x = r->left; - xinerama_y = r->top; - vo->opts->vo_screenwidth = r->right - r->left; - vo->opts->vo_screenheight = r->bottom - r->top; + vo->xinerama_x = r->left; + vo->xinerama_y = r->top; + vo->opts->vo.screenwidth = r->right - r->left; |