Skip to content

Commit

Permalink
feats: add new option low quality for low gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonflylee committed Oct 12, 2024
1 parent a3b455e commit 1bda613
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* save windows state when exit
* support touch input on linux
* support paste text to search input
* new option low quality

### Fixed

Expand Down
1 change: 1 addition & 0 deletions app/include/tab/setting_tab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class SettingTab : public AttachedView {
BRLS_BIND(brls::DetailCell, btnUser, "setting/user");
BRLS_BIND(brls::DetailCell, btnServer, "setting/server");
BRLS_BIND(brls::BooleanCell, btnHWDEC, "setting/video/hwdec");
BRLS_BIND(brls::BooleanCell, btnQuality, "setting/video/low_quality");
BRLS_BIND(brls::BooleanCell, btnDirectPlay, "setting/video/directplay");
BRLS_BIND(brls::SelectorCell, selectorCodec, "setting/video/codec");
BRLS_BIND(brls::SelectorCell, selectorQuality, "setting/video/quality");
Expand Down
3 changes: 3 additions & 0 deletions app/src/activity/player_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ PlayerView::~PlayerView() {
DanmakuCore::instance().reset();
}

PlayerSetting::selectedSubtitle = 0;
PlayerSetting::selectedAudio = 0;

if (!mpv.isStopped()) this->reportStop();
brls::Application::getExitEvent()->unsubscribe(this->exitSubscribeID);
brls::Logger::debug("trying delete PlayerView...");
Expand Down
8 changes: 8 additions & 0 deletions app/src/tab/setting_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ void SettingTab::onCreate() {
});
#endif

/// Decode quality
btnQuality->init("main/setting/playback/low_quality"_i18n, MPVCore::LOW_QUALITY, [&conf](bool value) {
if (MPVCore::LOW_QUALITY == value) return;
MPVCore::LOW_QUALITY = value;
MPVCore::instance().restart();
conf.setItem(AppConfig::PLAYER_LOW_QUALITY, value);
});

btnDirectPlay->init("main/setting/playback/force_directplay"_i18n, MPVCore::FORCE_DIRECTPLAY, [&conf](bool value) {
if (MPVCore::FORCE_DIRECTPLAY == value) return;
MPVCore::FORCE_DIRECTPLAY = value;
Expand Down
3 changes: 3 additions & 0 deletions app/src/view/mpv_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ void MPVCore::init() {
brls::Logger::info("lavc: skip loop filter and set fast decode");
mpv_set_option_string(mpv, "vd-lavc-skiploopfilter", "all");
mpv_set_option_string(mpv, "vd-lavc-fast", "yes");
if (mpv_client_api_version() > MPV_MAKE_VERSION(2, 1)) {
mpv_set_option_string(mpv, "profile", "fast");
}
}

if (MPVCore::INMEMORY_CACHE) {
Expand Down
2 changes: 2 additions & 0 deletions resources/xml/tabs/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
marginBottom="30px">
<brls:BooleanCell
id="setting/video/hwdec" />
<brls:BooleanCell
id="setting/video/low_quality" />
<brls:SelectorCell
id="setting/video/codec" />
<brls:BooleanCell
Expand Down

0 comments on commit 1bda613

Please sign in to comment.