Skip to content

Commit

Permalink
Fix compatibility with lower version MPV
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Jul 31, 2023
1 parent 1ebf6a8 commit 490e381
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions wiliwili/source/view/mpv_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,11 @@ void MPVCore::eventMainLoop() {
disableDimming(false);
brls::Logger::info("========> MPV_STOP");
mpvCoreEvent.fire(MpvEventEnum::MPV_STOP);
mpv_node dst;
mpv_event_to_node(&dst, event);
std::unordered_map<std::string, mpv_node> node_map;
for (int i = 0; i < dst.u.list->num; i++) {
node_map.insert(
std::make_pair(std::string(dst.u.list->keys[i]),
dst.u.list->values[i]));
}
if (node_map.count("file_error") != 0) {

auto node = (mpv_event_end_file *)event->data;
if (node->reason == MPV_END_FILE_REASON_ERROR) {
brls::Logger::error("mpv error: {}",
mpv_error_string(node->error));
mpvCoreEvent.fire(MpvEventEnum::MPV_FILE_ERROR);
}

Expand Down

0 comments on commit 490e381

Please sign in to comment.