aboutsummaryrefslogtreecommitdiff
path: root/video_player
diff options
context:
space:
mode:
Diffstat (limited to 'video_player')
-rw-r--r--video_player/src/main.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/video_player/src/main.cpp b/video_player/src/main.cpp
index 7489873..03acd93 100644
--- a/video_player/src/main.cpp
+++ b/video_player/src/main.cpp
@@ -255,12 +255,21 @@ static void mpv_set_before_init_options(mpv_handle *mpv_ctx, const Args &args) {
else
check_error(mpv_set_option_string(mpv_ctx, property.key.c_str(), property.value.c_str()), property.key.c_str());
}
-}
-static void mpv_set_after_load_options(mpv_handle *mpv_ctx, const Args &args) {
if(args.audio_file) {
- const char* cmd_args[] = { "audio-add", args.audio_file, "select", "Default track", nullptr };
- check_error(mpv_command_async(mpv_ctx, 0, cmd_args), "audio-add");
+ mpv_node first_element;
+ first_element.format = MPV_FORMAT_STRING;
+ first_element.u.string = (char*)args.audio_file;
+
+ mpv_node_list list;
+ list.num = 1;
+ list.keys = NULL;
+ list.values = &first_element;
+
+ mpv_node node;
+ node.format = MPV_FORMAT_NODE_ARRAY;
+ node.u.list = &list;
+ check_error(mpv_set_option(mpv_ctx, "audio-files", MPV_FORMAT_NODE, &node), "audio-files");
}
}
@@ -313,7 +322,6 @@ int main(int argc, char **argv) {
if(event->event_id == MPV_EVENT_START_FILE && !file_started) {
file_started = true;
- mpv_set_after_load_options(mpv_ctx, args);
} else if(event->event_id == MPV_EVENT_SHUTDOWN) {
running = false;
break;