Skip to content

Commit

Permalink
DVDVideoCodecDRMPRIME: Add setting to enable hw deinterlace
Browse files Browse the repository at this point in the history
HW deinterlace has lower cpu, but may have higher quality,
so allow user to choose appropriate setting.
  • Loading branch information
popcornmix committed Feb 21, 2024
1 parent 4bb8228 commit c45d803
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
11 changes: 11 additions & 0 deletions addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -7363,6 +7363,11 @@ msgctxt "#13438"
msgid "Allow hardware acceleration with DRM PRIME"
msgstr ""

#: system/settings/settings.xml
msgctxt "#13500"
msgid "Allow hardware deinterlace with DRM PRIME"
msgstr ""

#: system/settings/settings.xml
msgctxt "#13439"
msgid "Allow hardware acceleration - MediaCodec"
Expand Down Expand Up @@ -19550,6 +19555,12 @@ msgctxt "#36172"
msgid "Enable PRIME decoding of video files"
msgstr ""

#. Description of setting with label #13500 "Allow hardware deinterlace - PRIME"
#: system/settings/settings.xml
msgctxt "#36290"
msgid "Enable PRIME hardware deinterlace of video files"
msgstr ""

#. Description of setting with label #14109 "Short date format"
#: system/settings/settings.xml
msgctxt "#36173"
Expand Down
12 changes: 12 additions & 0 deletions system/settings/linux.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,18 @@
<default>true</default>
<control type="toggle" />
</setting>
<setting id="videoplayer.primeallowhwdeinterlace" type="boolean" parent="videoplayer.useprimedecoder" label="13500" help="36290">
<requirement>HAS_GLES</requirement>
<visible>false</visible>
<dependencies>
<dependency type="enable">
<condition setting="videoplayer.useprimedecoder" operator="is">true</condition>
</dependency>
</dependencies>
<level>3</level>
<default>true</default>
<control type="toggle" />
</setting>
<setting id="videoplayer.useprimerenderer" type="integer" label="13462" help="13463">
<requirement>HAS_GLES</requirement>
<visible>false</visible>
Expand Down
16 changes: 15 additions & 1 deletion xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace
{

constexpr const char* SETTING_VIDEOPLAYER_USEPRIMEDECODERFORHW{"videoplayer.useprimedecoderforhw"};
constexpr const char* SETTING_VIDEOPLAYER_ALLOWHWDEINTERLACE{"videoplayer.primeallowhwdeinterlace"};

static void ReleaseBuffer(void* opaque, uint8_t* data)
{
Expand Down Expand Up @@ -149,6 +150,15 @@ void CDVDVideoCodecDRMPRIME::Register()

setting->SetVisible(true);

setting = settings->GetSetting(SETTING_VIDEOPLAYER_ALLOWHWDEINTERLACE);
if (!setting)
{
CLog::Log(LOGERROR, "Failed to load setting for: {}", SETTING_VIDEOPLAYER_ALLOWHWDEINTERLACE);
return;
}

setting->SetVisible(true);

CDVDFactoryCodec::RegisterHWVideoCodec("drm_prime", CDVDVideoCodecDRMPRIME::Create);
}

Expand Down Expand Up @@ -651,7 +661,11 @@ void CDVDVideoCodecDRMPRIME::FilterTest(AVPixelFormat pix_fmt)
m_deintFilterName.clear();

// look twice, first for DRM_PRIME support, then for actual pixel format
for (int i=0; i < 2; i++)

bool hw = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
SETTING_VIDEOPLAYER_ALLOWHWDEINTERLACE);

for (int i = hw ? 0 : 1; i < 2; i++)
{
const AVFilter* filter;
void* opaque{};
Expand Down
1 change: 1 addition & 0 deletions xbmc/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class CSettings : public CSettingsBase, public CSettingCreator, public CSettingC
static constexpr auto SETTING_VIDEOPLAYER_USEMEDIACODEC = "videoplayer.usemediacodec";
static constexpr auto SETTING_VIDEOPLAYER_USEMEDIACODECSURFACE =
"videoplayer.usemediacodecsurface";
static constexpr auto SETTING_VIDEOPLAYER_ALLOWHWDEINTERLACE = "videoplayer.primeallowhwdeinterlace";
static constexpr auto SETTING_VIDEOPLAYER_USEVDPAU = "videoplayer.usevdpau";
static constexpr auto SETTING_VIDEOPLAYER_USEVDPAUMIXER = "videoplayer.usevdpaumixer";
static constexpr auto SETTING_VIDEOPLAYER_USEVDPAUMPEG2 = "videoplayer.usevdpaumpeg2";
Expand Down

0 comments on commit c45d803

Please sign in to comment.