aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--src/QuickMedia.cpp5
-rw-r--r--src/VideoPlayer.cpp17
3 files changed, 17 insertions, 9 deletions
diff --git a/README.md b/README.md
index 7a12460..544167b 100644
--- a/README.md
+++ b/README.md
@@ -16,4 +16,6 @@ If a search returns no results, then "No results found for ..." should be shown
Give user the option to start where they left off or from the start.
For manga, view the next chapter when reaching the end of a chapter.
Make network requests asynchronous to not freeze gui when navigating. Also have loading animation.
-Retain search text when navigating back. \ No newline at end of file
+Retain search text when navigating back.
+Disable ytdl_hook subtitles. If a video has subtitles for many languages, then it will stall video playback for several seconds
+until all subtitles have been downloaded and loaded. \ No newline at end of file
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 88c74f9..a9087b1 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -281,12 +281,13 @@ namespace QuickMedia {
search_bar->onTextUpdateCallback = nullptr;
search_bar->onTextSubmitCallback = nullptr;
- std::unique_ptr<VideoPlayer> video_player;
+ std::unique_ptr<VideoPlayer> video_player = nullptr;
try {
printf("Play video: %s\n", video_url.c_str());
- video_player = std::make_unique<VideoPlayer>(window_size.x, window_size.y, window.getSystemHandle(), video_url.c_str());
+ video_player.reset(new VideoPlayer(window_size.x, window_size.y, window.getSystemHandle(), video_url.c_str()));
} catch(VideoInitializationException &e) {
fprintf(stderr, "Failed to create video player!. TODO: Show this to the user");
+ video_player = nullptr;
}
std::vector<std::unique_ptr<BodyItem>> related_media = current_plugin->get_related_media(video_url);
diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp
index 51caa8c..7ce5f19 100644
--- a/src/VideoPlayer.cpp
+++ b/src/VideoPlayer.cpp
@@ -79,7 +79,11 @@ namespace QuickMedia {
if(mpv_initialize(mpv) < 0)
throw VideoInitializationException("Failed to initialize mpv");
- //check_error(mpv_set_option_string(mpv, "vo", "opengl-cb"));
+ // TODO: Enabling vo=gpu will make mpv create its own window, or take over the QuickMedia window fully
+ // if "wid" option is used. To take advantage of vo=gpu, QuickMedia should create a parent window
+ // and make mpv use that and then embed that into the parent QuickMedia window.
+ // This will also remove the need for rendering with sfml (no need for texture copy!).
+ //check_error(mpv_set_option_string(mpv, "vo", "gpu"));
//check_error(mpv_set_option_string(mpv, "hwdec", "auto"));
check_error(mpv_set_option_string(mpv, "terminal", "yes"));
@@ -95,6 +99,7 @@ namespace QuickMedia {
mpv_opengl_init_params opengl_init_params;
opengl_init_params.get_proc_address = getProcAddressMpv;
opengl_init_params.get_proc_address_ctx = nullptr;
+ opengl_init_params.extra_exts = nullptr;
mpv_render_param params[] = {
{ MPV_RENDER_PARAM_API_TYPE, (void*)MPV_RENDER_API_TYPE_OPENGL },
{ MPV_RENDER_PARAM_OPENGL_INIT_PARAMS, &opengl_init_params },
@@ -114,15 +119,16 @@ namespace QuickMedia {
VideoPlayer::~VideoPlayer() {
if(mpvGl) {
- mpv_render_context_set_update_callback(mpvGl, nullptr, nullptr);
+ //mpv_render_context_set_update_callback(mpvGl, nullptr, nullptr);
mpv_render_context_free(mpvGl);
}
free(textureBuffer);
if(mpv) {
- mpv_set_wakeup_callback(mpv, nullptr, nullptr);
- mpv_detach_destroy(mpv);
+ //mpv_set_wakeup_callback(mpv, nullptr, nullptr);
+ //mpv_detach_destroy(mpv);
+ mpv_terminate_destroy(mpv);
}
}
@@ -202,8 +208,7 @@ namespace QuickMedia {
}
void VideoPlayer::draw(sf::RenderWindow &window) {
- bool do_event_update = event_update.exchange(false);
- if(do_event_update)
+ if(event_update.exchange(false))
handle_events();
if(textureBuffer && redraw) {