aboutsummaryrefslogtreecommitdiff
path: root/include/VideoPlayer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/VideoPlayer.hpp')
-rw-r--r--include/VideoPlayer.hpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/include/VideoPlayer.hpp b/include/VideoPlayer.hpp
index f75d76f..989bfd2 100644
--- a/include/VideoPlayer.hpp
+++ b/include/VideoPlayer.hpp
@@ -33,14 +33,31 @@ namespace QuickMedia {
EXITED
};
+ struct StartupArgs {
+ std::string path;
+ std::string audio_path;
+ mgl::WindowHandle parent_window;
+ bool no_video = false;
+ bool use_system_mpv_config = false;
+ bool use_system_input_config = false; // use_system_mpv_config has to be true for this
+ bool keep_open = false;
+ std::string resource_root;
+ int monitor_height = 1080;
+ bool use_youtube_dl = false;
+ std::string title;
+ std::string start_time;
+ std::vector<MediaChapter> chapters;
+ std::string plugin_name;
+ };
+
// @event_callback is called from another thread
- VideoPlayer(bool no_video, bool use_system_mpv_config, bool keep_open, EventCallbackFunc event_callback, VideoPlayerWindowCreateCallback window_create_callback, const std::string &resource_root, int monitor_height, std::string plugin_name);
+ VideoPlayer(StartupArgs startup_args, EventCallbackFunc event_callback, VideoPlayerWindowCreateCallback window_create_callback);
~VideoPlayer();
VideoPlayer(const VideoPlayer&) = delete;
VideoPlayer& operator=(const VideoPlayer&) = delete;
// |audio_path| is only set when video and audio are separate files/urls.
- Error load_video(const char *path, const char *audio_path, mgl::WindowHandle parent_window, bool use_youtube_dl, const std::string &title, const std::string &start_time = "", const std::vector<MediaChapter> &chapters = {});
+ Error load_video();
// Should be called every update frame
Error update();
@@ -52,24 +69,19 @@ namespace QuickMedia {
private:
uint32_t get_next_request_id();
Error send_command(Json::Value &json_root, Json::Value *result, Json::ValueType result_type);
- Error launch_video_process(const char *path, const char *audio_path, mgl::WindowHandle parent_window, const std::string &title, const std::string &start_time);
+ Error launch_video_process();
VideoPlayer::Error read_ipc_func();
private:
- std::string plugin_name;
- bool no_video;
- bool use_system_mpv_config;
- bool keep_open;
- bool use_youtube_dl;
+ StartupArgs startup_args;
+
pid_t video_process_id;
mgl::Clock retry_timer;
int connect_tries;
int find_window_tries;
- int monitor_height;
int ipc_socket = -1;
EventCallbackFunc event_callback;
VideoPlayerWindowCreateCallback window_create_callback;
mgl::WindowHandle window_handle;
- mgl::WindowHandle parent_window;
Display *display;
unsigned int request_id_counter;
unsigned int expected_request_id;
@@ -81,7 +93,6 @@ namespace QuickMedia {
ERROR
};
ResponseDataStatus response_data_status;
- std::string resource_root;
char tmp_chapters_filepath[27];
};
}