diff --git a/inc/lektor/module/module_sdl2.h b/inc/lektor/module/module_sdl2.h index 18cdee5c44f7d59e3b6418be5db25b2dda9cfa3c..8caa155f641e8196519d9d3ff5c415778ab99cba 100644 --- a/inc/lektor/module/module_sdl2.h +++ b/inc/lektor/module/module_sdl2.h @@ -17,11 +17,10 @@ bool module_sdl2_new(struct lkt_win *const win); void module_sdl2_close(struct lkt_win *const win); void module_sdl2_free(struct lkt_win *const win); -bool module_sdl2_toggle_pause(struct lkt_win *const win, bool *new_paused); +bool module_sdl2_toggle_pause(struct lkt_win *const win); bool module_sdl2_load_file(struct lkt_win *const win, const char *filepath); bool module_sdl2_set_volume(struct lkt_win *const win, int vol); -bool module_sdl2_is_paused(struct lkt_win *const win, bool *ret); bool module_sdl2_get_duration(struct lkt_win *const win, int *dur_sec); bool module_sdl2_get_elapsed(struct lkt_win *const win, int *elapsed_sec); diff --git a/inc/lektor/module/module_x11.h b/inc/lektor/module/module_x11.h index 5325fe48611662cd7155efdc2da013e23d3ef712..29f943a99fdc43eec72ff7fa91e3468665124700 100644 --- a/inc/lektor/module/module_x11.h +++ b/inc/lektor/module/module_x11.h @@ -17,11 +17,10 @@ bool module_x11_new(struct lkt_win *const win); void module_x11_close(struct lkt_win *const win); void module_x11_free(struct lkt_win *const win); -bool module_x11_toggle_pause(struct lkt_win *const win, bool *new_paused); +bool module_x11_toggle_pause(struct lkt_win *const win); bool module_x11_load_file(struct lkt_win *const win, const char *filepath); bool module_x11_set_volume(struct lkt_win *const win, int vol); -bool module_x11_is_paused(struct lkt_win *const win, bool *ret); bool module_x11_get_duration(struct lkt_win *const win, int *dur_sec); bool module_x11_get_elapsed(struct lkt_win *const win, int *elapsed_sec); diff --git a/inc/lektor/module/mpv.h b/inc/lektor/module/mpv.h index d141455712658903bc5d0952795c382570192620..ce9c63e64d5ec03fc5fdb4ad9f00dcb3366b69de 100644 --- a/inc/lektor/module/mpv.h +++ b/inc/lektor/module/mpv.h @@ -9,9 +9,8 @@ mpv_handle *lmpv_new(unsigned long int wid); int lmpv_observe_properties(mpv_handle *ctx); mpv_handle *lmpv_prepare(void); -int lmpv_is_paused(mpv_handle *ctx, int *ret); int lmpv_set_volume(mpv_handle *ctx, int vol); int lmpv_load_file(mpv_handle *ctx, const char *file); -int lmpv_toggle_pause(mpv_handle *ctx, int *pause); +int lmpv_toggle_pause(mpv_handle *ctx); int lmpv_handle(struct lkt_win *win, mpv_handle *ctx, sqlite3 *db, enum mpd_idle_flag *mpd_idle_flag, int *time_pos, int *time_duration); diff --git a/inc/lektor/window.h b/inc/lektor/window.h index f0f86b505b1ac39ac7b885a9f13d8fd9abc06107..87644c98f139d81ce4c35d8b36dd21019926d467 100644 --- a/inc/lektor/window.h +++ b/inc/lektor/window.h @@ -20,12 +20,12 @@ struct lkt_win { void (*free)(struct lkt_win *win); /* Entirelly liberate all the resources */ /* Playback control */ - bool (*toggle_pause)(struct lkt_win *win, bool *new_paused); + bool (*toggle_pause)(struct lkt_win *win); bool (*load_file)(struct lkt_win *win, const char *filepath); bool (*set_volume)(struct lkt_win *win, int vol); /* Get playback properties */ - bool (*is_paused)(struct lkt_win *win, bool *ret); + // bool (*is_paused)(struct lkt_win *win, bool *ret); bool (*get_duration)(struct lkt_win *win, int *dur_sec); bool (*get_elapsed)(struct lkt_win *win, int *elapsed_sec); diff --git a/src/commands.c b/src/commands.c index 1c5254629204d094134de368286e49adac14bd12..b95059d9a6818a30078948c0723e046aa532271b 100644 --- a/src/commands.c +++ b/src/commands.c @@ -177,7 +177,7 @@ bool command_pause(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr) { *watch_mask_ptr |= MPD_IDLE_PLAYER; - return database_queue_toggle_pause(db) && win->toggle_pause(win, NULL); + return database_queue_toggle_pause(db) && win->toggle_pause(win); } bool diff --git a/src/module/module_sdl2.c b/src/module/module_sdl2.c index c0195c9cd547eaef9fe9dce2297dceb862a70cd6..3f59fea4f17b13d76123d31cf523de53955d09dd 100644 --- a/src/module/module_sdl2.c +++ b/src/module/module_sdl2.c @@ -69,7 +69,6 @@ module_set_function(void *arg__, void *handle__) win->toggle_pause = module_sdl2_toggle_pause; win->load_file = module_sdl2_load_file; win->set_volume = module_sdl2_set_volume; - win->is_paused = module_sdl2_is_paused; win->get_duration = module_sdl2_get_duration; win->get_elapsed = module_sdl2_get_elapsed; win->handle_events = module_sdl2_handle_events; @@ -205,14 +204,11 @@ module_sdl2_free(struct lkt_win *const win) } bool -module_sdl2_toggle_pause(struct lkt_win *const win, bool *new_paused) +module_sdl2_toggle_pause(struct lkt_win *const win) { if (win == NULL || win->window == NULL) return false; - int pause, ret = ! lmpv_toggle_pause(((struct module_sdl2_window *) win->window)->mpv, &pause); - if (new_paused) - *new_paused = pause; - return ret; + return ! lmpv_toggle_pause(((struct module_sdl2_window *) win->window)->mpv); } bool @@ -235,16 +231,6 @@ module_sdl2_set_volume(struct lkt_win *const win, int vol) return ! lmpv_set_volume(((struct module_sdl2_window *) win->window)->mpv, vol); } -bool -module_sdl2_is_paused(struct lkt_win *const win, bool *ret) -{ - if (win == NULL || win->window == NULL) - return false; - int ret_, sta = ! lmpv_is_paused(((struct module_sdl2_window *) win->window)->mpv, &ret_); - *ret = ret_; - return sta; -} - bool module_sdl2_get_duration(struct lkt_win *const win, int *dur_sec) { diff --git a/src/module/module_x11.c b/src/module/module_x11.c index cc800fd3dc09af294166e078edc9d20ae3d46ead..6d51472fffc95478f01d4a54b17b195f5348658c 100644 --- a/src/module/module_x11.c +++ b/src/module/module_x11.c @@ -53,7 +53,6 @@ module_set_function(void *arg__, void *handle__) win->toggle_pause = module_x11_toggle_pause; win->load_file = module_x11_load_file; win->set_volume = module_x11_set_volume; - win->is_paused = module_x11_is_paused; win->get_duration = module_x11_get_duration; win->get_elapsed = module_x11_get_elapsed; win->handle_events = module_x11_handle_events; @@ -286,13 +285,11 @@ module_x11_free(struct lkt_win *const win) } bool -module_x11_toggle_pause(struct lkt_win *const win, bool *new_paused) +module_x11_toggle_pause(struct lkt_win *const win) { if (win == NULL || win->window == NULL) return false; - int pause, ret = ! lmpv_toggle_pause(((struct module_x11_window *) win->window)->mpv, &pause); - *new_paused = pause; - return ret; + return ! lmpv_toggle_pause(((struct module_x11_window *) win->window)->mpv); } bool @@ -315,16 +312,6 @@ module_x11_set_volume(struct lkt_win *const win, int vol) return ! lmpv_set_volume(((struct module_x11_window *) win->window)->mpv, vol); } -bool -module_x11_is_paused(struct lkt_win *const win, bool *ret) -{ - if (win == NULL || win->window == NULL) - return false; - int ret_, sta = ! lmpv_is_paused(((struct module_x11_window *) win->window)->mpv, &ret_); - *ret = ret_; - return sta; -} - bool module_x11_get_duration(struct lkt_win *const win, int *dur_sec) { diff --git a/src/module/mpv.c b/src/module/mpv.c index 31cad22a73ec9df605880222386dfbf5d9ad0d3b..746741094163972c729411d4e8cb2fb332fbd7b2 100644 --- a/src/module/mpv.c +++ b/src/module/mpv.c @@ -182,7 +182,7 @@ lmpv_load_file(mpv_handle *ctx, const char *file) } int -lmpv_toggle_pause(mpv_handle *ctx, int *pause) +lmpv_toggle_pause(mpv_handle *ctx) { if (!ctx) { fprintf(stderr, " ! lmpv_toggle_pause: failed due to missing mpv ctx\n"); @@ -197,7 +197,7 @@ lmpv_toggle_pause(mpv_handle *ctx, int *pause) mpv_error_string(status)); return 1; } - return lmpv_is_paused(ctx, pause); + return 0; } int