Skip to content

Commit

Permalink
VideoPlayer: add setting for using VAAPI AVC
Browse files Browse the repository at this point in the history
  • Loading branch information
smp79 committed May 22, 2024
1 parent 3b2688a commit e24708e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
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 @@ -7536,6 +7536,17 @@ msgctxt "#13469"
msgid "Enable this option to use hardware acceleration for the AV1 codec. If disabled the CPU will be used instead."
msgstr ""

#: system/settings/settings.xml
msgctxt "#13470"
msgid "Use AVC VAAPI"
msgstr ""

#. Description of setting with label #13470 "Use AVC VAAPI"
#: system/settings/settings.xml
msgctxt "#13471"
msgid "Enable this option to use hardware acceleration for the AVC codec. If disabled the CPU will be used instead."
msgstr ""

#empty strings from id 13468 to 13504

#: system/settings/settings.xml
Expand Down
12 changes: 12 additions & 0 deletions system/settings/linux.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@
<default>true</default>
<control type="toggle" />
</setting>
<setting id="videoplayer.usevaapiavc" type="boolean" parent="videoplayer.usevaapi" label="13470" help="13471">
<requirement>HAVE_LIBVA</requirement>
<visible>false</visible>
<dependencies>
<dependency type="enable">
<condition setting="videoplayer.usevaapi" operator="is">true</condition>
</dependency>
</dependencies>
<level>3</level>
<default>true</default>
<control type="toggle" />
</setting>
<setting id="videoplayer.prefervaapirender" type="boolean" parent="videoplayer.usevaapi" label="13457" help="36433">
<requirement>HAVE_LIBVA</requirement>
<visible>false</visible>
Expand Down
6 changes: 4 additions & 2 deletions xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ using namespace std::chrono_literals;

constexpr auto SETTING_VIDEOPLAYER_USEVAAPI = "videoplayer.usevaapi";
constexpr auto SETTING_VIDEOPLAYER_USEVAAPIAV1 = "videoplayer.usevaapiav1";
constexpr auto SETTING_VIDEOPLAYER_USEVAAPIAVC = "videoplayer.usevaapiavc";
constexpr auto SETTING_VIDEOPLAYER_USEVAAPIHEVC = "videoplayer.usevaapihevc";
constexpr auto SETTING_VIDEOPLAYER_USEVAAPIMPEG2 = "videoplayer.usevaapimpeg2";
constexpr auto SETTING_VIDEOPLAYER_USEVAAPIMPEG4 = "videoplayer.usevaapimpeg4";
Expand Down Expand Up @@ -542,6 +543,7 @@ bool CDecoder::Open(AVCodecContext* avctx, AVCodecContext* mainctx, const enum A
{AV_CODEC_ID_VP9, SETTING_VIDEOPLAYER_USEVAAPIVP9},
{AV_CODEC_ID_HEVC, SETTING_VIDEOPLAYER_USEVAAPIHEVC},
{AV_CODEC_ID_AV1, SETTING_VIDEOPLAYER_USEVAAPIAV1},
{AV_CODEC_ID_H264, SETTING_VIDEOPLAYER_USEVAAPIAVC},
};

auto entry = settings_map.find(avctx->codec_id);
Expand Down Expand Up @@ -1277,12 +1279,12 @@ void CDecoder::Register(IVaapiWinSystem *winSystem, bool deepColor)
if (!settings)
return;

constexpr std::array<const char*, 9> vaapiSettings = {
constexpr std::array<const char*, 10> vaapiSettings = {
SETTING_VIDEOPLAYER_USEVAAPI, SETTING_VIDEOPLAYER_USEVAAPIMPEG4,
SETTING_VIDEOPLAYER_USEVAAPIVC1, SETTING_VIDEOPLAYER_USEVAAPIMPEG2,
SETTING_VIDEOPLAYER_USEVAAPIVP8, SETTING_VIDEOPLAYER_USEVAAPIVP9,
SETTING_VIDEOPLAYER_USEVAAPIHEVC, SETTING_VIDEOPLAYER_PREFERVAAPIRENDER,
SETTING_VIDEOPLAYER_USEVAAPIAV1};
SETTING_VIDEOPLAYER_USEVAAPIAV1, SETTING_VIDEOPLAYER_USEVAAPIAVC};

for (const auto vaapiSetting : vaapiSettings)
{
Expand Down

0 comments on commit e24708e

Please sign in to comment.