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 Sep 8, 2023
1 parent 5fb34d6 commit 47b9758
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 @@ -7317,6 +7317,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 @@ -19446,6 +19451,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 @@ -118,6 +118,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

1 comment on commit 47b9758

@graysky2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting tons of CMake errors building this branch. Are you?

cores/RetroPlayer/process/X11 -> build/cores/RetroPlayer/process/X11
CMake Error at cmake/scripts/common/Macros.cmake:78 (target_link_libraries):
  Target "udfread" of type UTILITY may not be linked into another target.
  One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
  executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
  xbmc/cores/RetroPlayer/process/X11/CMakeLists.txt:5 (core_add_library)


--   core_add_subdirs_from_filelist - adding subdir: /build/kodi-rpi-git/src/xbmc-ff765cc6e49d9eca77aee5b49b9ee5cb24b013eb/xbmc/cores/VideoPlayer/Process/X11 -> build/cores/VideoPlayer/Process/X11
CMake Error at cmake/scripts/common/Macros.cmake:78 (target_link_libraries):
  Target "udfread" of type UTILITY may not be linked into another target.
  One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to
  executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
  xbmc/cores/VideoPlayer/Process/X11/CMakeLists.txt:5 (core_add_library)

...

Full build log.

Please sign in to comment.