mirror of https://github.com/mpv-player/mpv
vo: change vo_platform_init to bool
There's several functions that are used for initializing mpv on a certain platform (x11, wayland, etc.). These currently are all int, but they actually return 1 and 0 like a boolean. This gets a bit confusing because actual vo preinit functions return 0 and -1 instead. Just make these all bool instead and return true/false to make it clearer.
This commit is contained in:
parent
e43393c4da
commit
e4e0e7dfcf
|
@ -29,7 +29,7 @@ struct vo_android_state {
|
|||
ANativeWindow *native_window;
|
||||
};
|
||||
|
||||
int vo_android_init(struct vo *vo)
|
||||
bool vo_android_init(struct vo *vo)
|
||||
{
|
||||
vo->android = talloc_zero(vo, struct vo_android_state);
|
||||
struct vo_android_state *ctx = vo->android;
|
||||
|
@ -51,11 +51,11 @@ int vo_android_init(struct vo *vo)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
fail:
|
||||
talloc_free(ctx);
|
||||
vo->android = NULL;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
void vo_android_uninit(struct vo *vo)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
struct vo;
|
||||
|
||||
int vo_android_init(struct vo *vo);
|
||||
bool vo_android_init(struct vo *vo);
|
||||
void vo_android_uninit(struct vo *vo);
|
||||
ANativeWindow *vo_android_native_window(struct vo *vo);
|
||||
bool vo_android_surface_size(struct vo *vo, int *w, int *h);
|
||||
|
|
|
@ -1618,8 +1618,7 @@ done:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Returns: 1 = Success, 0 = Failure
|
||||
int vo_w32_init(struct vo *vo)
|
||||
bool vo_w32_init(struct vo *vo)
|
||||
{
|
||||
assert(!vo->w32);
|
||||
|
||||
|
@ -1651,11 +1650,11 @@ int vo_w32_init(struct vo *vo)
|
|||
talloc_free(profile);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
fail:
|
||||
talloc_free(w32);
|
||||
vo->w32 = NULL;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
struct disp_names_data {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
struct vo;
|
||||
|
||||
int vo_w32_init(struct vo *vo);
|
||||
bool vo_w32_init(struct vo *vo);
|
||||
void vo_w32_uninit(struct vo *vo);
|
||||
int vo_w32_control(struct vo *vo, int *events, int request, void *arg);
|
||||
void vo_w32_config(struct vo *vo);
|
||||
|
|
|
@ -1929,7 +1929,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg)
|
|||
return VO_NOTIMPL;
|
||||
}
|
||||
|
||||
int vo_wayland_init(struct vo *vo)
|
||||
bool vo_wayland_init(struct vo *vo)
|
||||
{
|
||||
vo->wl = talloc_zero(NULL, struct vo_wayland_state);
|
||||
struct vo_wayland_state *wl = vo->wl;
|
||||
|
|
|
@ -153,11 +153,11 @@ struct vo_wayland_state {
|
|||
};
|
||||
|
||||
bool vo_wayland_check_visible(struct vo *vo);
|
||||
bool vo_wayland_init(struct vo *vo);
|
||||
bool vo_wayland_supported_format(struct vo *vo, uint32_t format, uint64_t modifier);
|
||||
|
||||
int vo_wayland_allocate_memfd(struct vo *vo, size_t size);
|
||||
int vo_wayland_control(struct vo *vo, int *events, int request, void *arg);
|
||||
int vo_wayland_init(struct vo *vo);
|
||||
int vo_wayland_reconfig(struct vo *vo);
|
||||
|
||||
void vo_wayland_set_opaque_region(struct vo_wayland_state *wl, int alpha);
|
||||
|
|
|
@ -596,7 +596,7 @@ static void vo_x11_get_bounding_monitors(struct vo_x11_state *x11, long b[4])
|
|||
XFree(screens);
|
||||
}
|
||||
|
||||
int vo_x11_init(struct vo *vo)
|
||||
bool vo_x11_init(struct vo *vo)
|
||||
{
|
||||
char *dispName;
|
||||
|
||||
|
@ -685,11 +685,11 @@ int vo_x11_init(struct vo *vo)
|
|||
|
||||
vo_x11_update_geometry(vo);
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
|
||||
error:
|
||||
vo_x11_uninit(vo);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
static const struct mp_keymap keymap[] = {
|
||||
|
|
|
@ -142,7 +142,7 @@ struct vo_x11_state {
|
|||
Atom icc_profile_property;
|
||||
};
|
||||
|
||||
int vo_x11_init(struct vo *vo);
|
||||
bool vo_x11_init(struct vo *vo);
|
||||
void vo_x11_uninit(struct vo *vo);
|
||||
void vo_x11_check_events(struct vo *vo);
|
||||
bool vo_x11_screen_is_composited(struct vo *vo);
|
||||
|
|
Loading…
Reference in New Issue