From: Olaf Wintermann Date: Sat, 15 Jan 2022 12:46:25 +0000 (+0100) Subject: use mpv binary path from settings X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=f2c881b827db459ee641c90bcfe4ef9e1ed25c0e;p=uwplayer.git use mpv binary path from settings --- diff --git a/application/Makefile b/application/Makefile index ea21439..8b53092 100644 --- a/application/Makefile +++ b/application/Makefile @@ -41,7 +41,7 @@ SRC += json.c OBJ = $(SRC:%.c=$(BUILD_ROOT)/build/application/%.$(OBJ_EXT)) -BINTARGET = mediaplayer +BINTARGET = uwplayer all: $(BUILD_ROOT)/build/bin/$(BINTARGET) diff --git a/application/player.c b/application/player.c index 9e47049..9e65410 100644 --- a/application/player.c +++ b/application/player.c @@ -39,6 +39,7 @@ #include #include "json.h" +#include "settings.h" extern char **environ; @@ -121,7 +122,11 @@ static int start_player_process(Player *player, MainWindow *win) { return 1; } - char *player_bin = "/usr/local/bin/mpv"; // TODO: get bin from settings + char *player_bin = SettingsGetPlayerBin(); + if(!player_bin) { + fprintf(stderr, "No mpv binary available\n"); + return 1; + } // -wid parameter value for embedding the player in the player_widget Window wid = XtWindow(win->player_widget); diff --git a/application/settings.c b/application/settings.c index ceff1c7..59c366c 100644 --- a/application/settings.c +++ b/application/settings.c @@ -174,3 +174,7 @@ static void* player_bin_search_thread(void *data) { ucx_buffer_free(buf); return NULL; } + +char* SettingsGetPlayerBin(void) { + return ucx_map_cstr_get(uwp_settings, UWP_PLAYER_BIN); +} diff --git a/application/settings.h b/application/settings.h index 57be624..aabd835 100644 --- a/application/settings.h +++ b/application/settings.h @@ -37,6 +37,8 @@ typedef struct PlayerInfo { int load_settings(void); +char* SettingsGetPlayerBin(void); + #ifdef __cplusplus }