MCPcopy Create free account
hub / github.com/Cpasjuste/pplay / load

Method load

src/player/player.cpp:50–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50bool Player::load(const MediaFile &f) {
51
52 file = f;
53 std::string path = file.path;
54#ifdef __SMB2__
55#if 0
56 if (Utility::startWith(path, "smb://")) {
57 std::replace(path.begin(), path.end(), '\\', '/');
58 }
59#endif
60#endif
61
62 // disable subtitles if slang option not set in "mpv.conf" (overridden by "watch_later")
63 char *slang = mpv_get_property_string(mpv->getHandle(), "slang");
64 if (strlen(slang) <= 0) {
65 printf("slang not set, disabling subtitles by default");
66 mpv_set_option_string(mpv->getHandle(), "sid", "no");
67 }
68
69 int res = mpv->load(path, Mpv::LoadType::Replace, "pause=yes,speed=1");
70 if (res != 0) {
71 main->getStatus()->show("Error...", "Could not play file:\n" + std::string(mpv_error_string(res)));
72 printf("Player::load: could not play file: %s\n", mpv_error_string(res));
73 return false;
74 }
75
76 return true;
77}
78
79void Player::onLoadEvent() {
80 // load/update media information

Callers

nothing calls this directly

Calls 3

getHandleMethod · 0.80
getStatusMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected