Skip to content

Commit

Permalink
VideoPlayer: Add setting to disable non-hevc accel
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Apr 1, 2020
1 parent 540617b commit 803443d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -7256,6 +7256,16 @@ msgctxt "#13465"
msgid "EGL"
msgstr ""

#: system/settings/settings.xml
msgctxt "#13500"
msgid "Only allow acceleration for HEVC"
msgstr ""

#: system/settings/settings.xml
msgctxt "#13501"
msgid "This option disables acceleration for other codecs as they don't currently support seeking with V4L2"
msgstr ""

#empty strings from id 13466 to 13504

#: system/settings/settings.xml
Expand Down
6 changes: 6 additions & 0 deletions system/settings/gbm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<default>true</default>
<control type="toggle" />
</setting>
<setting id="videoplayer.disablenonhevc" type="boolean" label="13500" help="13501">
<visible>true</visible>
<level>2</level>
<default>true</default>
<control type="toggle" />
</setting>
<setting id="videoplayer.useprimerenderer" type="integer" label="13462" help="13463">
<visible>false</visible>
<level>2</level>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avct

bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& options)
{
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_VIDEOPLAYER_DISABLE_NON_HEVC) && hints.codec != AV_CODEC_ID_HEVC)
{
CLog::Log(LOGNOTICE, "CDVDVideoCodecDRMPRIME::{} - codec {} disallowed",
__FUNCTION__, hints.codec);
return false;
}

const AVCodec* pCodec = FindDecoder(hints);
if (!pCodec)
{
Expand Down
2 changes: 2 additions & 0 deletions xbmc/settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ const std::string CSettings::SETTING_VIDEOPLAYER_RENDERMETHOD = "videoplayer.ren
const std::string CSettings::SETTING_VIDEOPLAYER_HQSCALERS = "videoplayer.hqscalers";
const std::string CSettings::SETTING_VIDEOPLAYER_USEMEDIACODEC = "videoplayer.usemediacodec";
const std::string CSettings::SETTING_VIDEOPLAYER_USEMEDIACODECSURFACE = "videoplayer.usemediacodecsurface";
const std::string CSettings::SETTING_VIDEOPLAYER_DISABLE_NON_HEVC = "videoplayer.disablenonhevc";
const std::string CSettings::SETTING_VIDEOPLAYER_USEVDPAU = "videoplayer.usevdpau";
const std::string CSettings::SETTING_VIDEOPLAYER_USEVDPAUMIXER = "videoplayer.usevdpaumixer";
const std::string CSettings::SETTING_VIDEOPLAYER_USEVDPAUMPEG2 = "videoplayer.usevdpaumpeg2";
Expand Down Expand Up @@ -952,6 +953,7 @@ void CSettings::InitializeISettingCallbacks()
settingSet.insert(CSettings::SETTING_VIDEOSCREEN_TESTPATTERN);
settingSet.insert(CSettings::SETTING_VIDEOPLAYER_USEMEDIACODEC);
settingSet.insert(CSettings::SETTING_VIDEOPLAYER_USEMEDIACODECSURFACE);
settingSet.insert(CSettings::SETTING_VIDEOPLAYER_DISABLE_NON_HEVC);
settingSet.insert(CSettings::SETTING_AUDIOOUTPUT_VOLUMESTEPS);
settingSet.insert(CSettings::SETTING_SOURCE_VIDEOS);
settingSet.insert(CSettings::SETTING_SOURCE_MUSIC);
Expand Down
1 change: 1 addition & 0 deletions xbmc/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class CSettings : public CSettingsBase, public CSettingCreator, public CSettingC
static const std::string SETTING_VIDEOPLAYER_HQSCALERS;
static const std::string SETTING_VIDEOPLAYER_USEMEDIACODEC;
static const std::string SETTING_VIDEOPLAYER_USEMEDIACODECSURFACE;
static const std::string SETTING_VIDEOPLAYER_DISABLE_NON_HEVC;
static const std::string SETTING_VIDEOPLAYER_USEVDPAU;
static const std::string SETTING_VIDEOPLAYER_USEVDPAUMIXER;
static const std::string SETTING_VIDEOPLAYER_USEVDPAUMPEG2;
Expand Down

0 comments on commit 803443d

Please sign in to comment.