summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-01-08 13:16:47 -0600
committerDudemanguy <random342@airmail.cc>2023-01-08 20:42:42 +0000
commite4e0e7dfcf3a79f7bb510e11d059bcf8d1e93bd6 (patch)
tree8a26c42915f9d7f1a32a1162a4b96aaefcab4296 /video/out
parente43393c4da0c72dd974cc5ff08952f7614b3958f (diff)
downloadmpv-e4e0e7dfcf3a79f7bb510e11d059bcf8d1e93bd6.tar.bz2
mpv-e4e0e7dfcf3a79f7bb510e11d059bcf8d1e93bd6.tar.xz
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.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/android_common.c6
-rw-r--r--video/out/android_common.h2
-rw-r--r--video/out/w32_common.c7
-rw-r--r--video/out/w32_common.h2
-rw-r--r--video/out/wayland_common.c2
-rw-r--r--video/out/wayland_common.h2
-rw-r--r--video/out/x11_common.c6
-rw-r--r--video/out/x11_common.h2
8 files changed, 14 insertions, 15 deletions
diff --git a/video/out/android_common.c b/video/out/android_common.c
index e32f9c1706..7efed3caee 100644
--- a/video/out/android_common.c
+++ b/video/out/android_common.c
@@ -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)
diff --git a/video/out/android_common.h b/video/out/android_common.h
index 44f5aefe3a..7f075ea33a 100644
--- a/video/out/android_common.h
+++ b/video/out/android_common.h
@@ -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);
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index f228bc99b6..4ef57dc53d 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -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 {
diff --git a/video/out/w32_common.h b/video/out/w32_common.h
index 886e82d449..528b21662c 100644
--- a/video/out/w32_common.h
+++ b/video/out/w32_common.h
@@ -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);
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 183458cc29..ed7e68c9ad 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -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;
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index ef156f1fca..b7f2e4645d 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -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);
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 37149148b9..c61bab7497 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -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[] = {
diff --git a/video/out/x11_common.h b/video/out/x11_common.h
index 0134935daa..48516a77ad 100644
--- a/video/out/x11_common.h
+++ b/video/out/x11_common.h
@@ -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);