Skip to content
This repository was archived by the owner on Dec 24, 2024. It is now read-only.

Commit 59e5e48

Browse files
committed
ADD: Selective disabling of h/w acceleration in settings (#208)
1 parent 1e08883 commit 59e5e48

5 files changed

Lines changed: 120 additions & 31 deletions

File tree

addons/resource.language.en_gb/resources/strings.po

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18191,3 +18191,18 @@ msgctxt "#38113"
1819118191
msgid "This option uses frame-packing to output full resolution for 3D through HDMI"
1819218192
msgstr ""
1819318193

18194+
msgctxt "#39000"
18195+
msgid "HD and up"
18196+
msgstr ""
18197+
18198+
msgctxt "#39001"
18199+
msgid "Accelerate MPEG2"
18200+
msgstr ""
18201+
18202+
msgctxt "#39002"
18203+
msgid "Accelerate MPEG4"
18204+
msgstr ""
18205+
18206+
msgctxt "#39003"
18207+
msgid "Accelerate h264"
18208+
msgstr ""

system/settings/settings.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,47 @@
844844
<control type="toggle" />
845845
</setting>
846846
</group>
847+
<group id="4">
848+
<setting id="videoplayer.accelmpeg2" type="integer" label="39001">
849+
<level>2</level>
850+
<default>800</default>
851+
<constraints>
852+
<options>
853+
<option label="20420">9999</option> <!-- Never -->
854+
<option label="39000">800</option> <!-- HD -->
855+
<option label="20422">0</option> <!-- Always -->
856+
</options>
857+
</constraints>
858+
<control type="spinner" format="string" />
859+
<control type="edit" format="integer" />
860+
</setting>
861+
<setting id="videoplayer.accelmpeg4" type="integer" label="39002">
862+
<level>2</level>
863+
<default>800</default>
864+
<constraints>
865+
<options>
866+
<option label="20420">9999</option> <!-- Never -->
867+
<option label="39000">800</option> <!-- HD -->
868+
<option label="20422">0</option> <!-- Always -->
869+
</options>
870+
</constraints>
871+
<control type="spinner" format="string" />
872+
<control type="edit" format="integer" />
873+
</setting>
874+
<setting id="videoplayer.accelh264" type="integer" label="39003">
875+
<level>2</level>
876+
<default>0</default>
877+
<constraints>
878+
<options>
879+
<option label="20420">9999</option> <!-- Never -->
880+
<option label="39000">800</option> <!-- HD -->
881+
<option label="20422">0</option> <!-- Always -->
882+
</options>
883+
</constraints>
884+
<control type="spinner" format="string" />
885+
<control type="edit" format="integer" />
886+
</setting>
887+
</group>
847888
</category>
848889
<category id="myvideos" label="14081" help="36601">
849890
<group id="1">

xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,18 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, const C
218218
case AV_CODEC_ID_MPEG4:
219219
case AV_CODEC_ID_MSMPEG4V2:
220220
case AV_CODEC_ID_MSMPEG4V3:
221+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELMPEG2))
222+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAmlogic(), hint, options)) ) return pCodec;
223+
break;
221224
case AV_CODEC_ID_MPEG1VIDEO:
222225
case AV_CODEC_ID_MPEG2VIDEO:
223-
// Avoid h/w decoder for SD; Those files might use features
224-
// not supported and can easily be soft-decoded
225-
if (hint.width <= 800)
226-
break;
226+
if (hint.width >CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELMPEG2))
227+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAmlogic(), hint, options)) ) return pCodec;
228+
break;
229+
case AV_CODEC_ID_H264:
230+
if (hint.width >CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELH264))
231+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAmlogic(), hint, options)) ) return pCodec;
232+
break;
227233
default:
228234
if ( (pCodec = OpenCodec(new CDVDVideoCodecAmlogic(), hint, options)) ) return pCodec;
229235
}
@@ -272,48 +278,69 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, const C
272278
{
273279
switch(hint.codec)
274280
{
275-
case AV_CODEC_ID_MPEG4:
276-
case AV_CODEC_ID_MSMPEG4V2:
277-
case AV_CODEC_ID_MSMPEG4V3:
278-
// Avoid h/w decoder for SD; Those files might use features
279-
// not supported and can easily be soft-decoded
280-
if (hint.width <= 800)
281-
break;
282-
default:
283-
CLog::Log(LOGINFO, "MediaCodec (Surface) Video Decoder...");
281+
case AV_CODEC_ID_MPEG4:
282+
case AV_CODEC_ID_MSMPEG4V2:
283+
case AV_CODEC_ID_MSMPEG4V3:
284+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELMPEG4))
285+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(true), hint, options)) ) return pCodec;
286+
break;
287+
case AV_CODEC_ID_MPEG1VIDEO:
288+
case AV_CODEC_ID_MPEG2VIDEO:
289+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELMPEG2))
284290
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(true), hint, options)) ) return pCodec;
291+
break;
292+
case AV_CODEC_ID_H264:
293+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELH264))
294+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(true), hint, options)) ) return pCodec;
295+
break;
296+
default:
297+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(true), hint, options)) ) return pCodec;
285298
}
286299
}
287300
if (!hint.software && CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEMEDIACODEC))
288301
{
289302
switch(hint.codec)
290303
{
291-
case AV_CODEC_ID_MPEG4:
292-
case AV_CODEC_ID_MSMPEG4V2:
293-
case AV_CODEC_ID_MSMPEG4V3:
294-
// Avoid h/w decoder for SD; Those files might use features
295-
// not supported and can easily be soft-decoded
296-
if (hint.width <= 800)
297-
break;
298-
default:
299-
CLog::Log(LOGINFO, "MediaCodec Video Decoder...");
304+
case AV_CODEC_ID_MPEG4:
305+
case AV_CODEC_ID_MSMPEG4V2:
306+
case AV_CODEC_ID_MSMPEG4V3:
307+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELMPEG4))
300308
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(false), hint, options)) ) return pCodec;
309+
break;
310+
case AV_CODEC_ID_MPEG1VIDEO:
311+
case AV_CODEC_ID_MPEG2VIDEO:
312+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELMPEG2))
313+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(false), hint, options)) ) return pCodec;
314+
break;
315+
case AV_CODEC_ID_H264:
316+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELH264))
317+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(false), hint, options)) ) return pCodec;
318+
break;
319+
default:
320+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(false), hint, options)) ) return pCodec;
301321
}
302322
}
303323
if (!hint.software && hint.height <= 1080 && CSettings::GetInstance().GetBool(CSettings::SETTING_VIDEOPLAYER_USEMEDIACODECSURFACE))
304324
{
305325
switch(hint.codec)
306326
{
307-
case AV_CODEC_ID_MPEG4:
308-
case AV_CODEC_ID_MSMPEG4V2:
309-
case AV_CODEC_ID_MSMPEG4V3:
310-
// Avoid h/w decoder for SD; Those files might use features
311-
// not supported and can easily be soft-decoded
312-
if (hint.width <= 800)
313-
break;
314-
default:
315-
CLog::Log(LOGINFO, "MediaCodec (Surface) Video Decoder...");
327+
case AV_CODEC_ID_MPEG4:
328+
case AV_CODEC_ID_MSMPEG4V2:
329+
case AV_CODEC_ID_MSMPEG4V3:
330+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELMPEG4))
331+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(true), hint, options)) ) return pCodec;
332+
break;
333+
case AV_CODEC_ID_MPEG1VIDEO:
334+
case AV_CODEC_ID_MPEG2VIDEO:
335+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELMPEG2))
316336
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(true), hint, options)) ) return pCodec;
337+
break;
338+
case AV_CODEC_ID_H264:
339+
if (hint.width > CSettings::GetInstance().GetInt(CSettings::SETTING_VIDEOPLAYER_ACCELH264))
340+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(true), hint, options)) ) return pCodec;
341+
break;
342+
default:
343+
if ( (pCodec = OpenCodec(new CDVDVideoCodecAndroidMediaCodec(true), hint, options)) ) return pCodec;
317344
}
318345
}
319346
#endif

xbmc/settings/Settings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ const std::string CSettings::SETTING_VIDEOPLAYER_USEVIDEOTOOLBOX = "videoplayer.
181181
const std::string CSettings::SETTING_VIDEOPLAYER_USEVDA = "videoplayer.usevda";
182182
const std::string CSettings::SETTING_VIDEOPLAYER_USEMMAL = "videoplayer.usemmal";
183183
const std::string CSettings::SETTING_VIDEOPLAYER_USESTAGEFRIGHT = "videoplayer.usestagefright";
184+
const std::string CSettings::SETTING_VIDEOPLAYER_ACCELMPEG2 = "videoplayer.accelmpeg2";
185+
const std::string CSettings::SETTING_VIDEOPLAYER_ACCELMPEG4 = "videoplayer.accelmpeg4";
186+
const std::string CSettings::SETTING_VIDEOPLAYER_ACCELH264 = "videoplayer.accelh264";
184187
const std::string CSettings::SETTING_VIDEOPLAYER_LIMITGUIUPDATE = "videoplayer.limitguiupdate";
185188
const std::string CSettings::SETTING_MYVIDEOS_SELECTACTION = "myvideos.selectaction";
186189
const std::string CSettings::SETTING_MYVIDEOS_EXTRACTFLAGS = "myvideos.extractflags";

xbmc/settings/Settings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ class CSettings : public CSettingCreator, public CSettingControlCreator
137137
static const std::string SETTING_VIDEOPLAYER_USEVDA;
138138
static const std::string SETTING_VIDEOPLAYER_USEMMAL;
139139
static const std::string SETTING_VIDEOPLAYER_USESTAGEFRIGHT;
140+
static const std::string SETTING_VIDEOPLAYER_ACCELMPEG2;
141+
static const std::string SETTING_VIDEOPLAYER_ACCELMPEG4;
142+
static const std::string SETTING_VIDEOPLAYER_ACCELH264;
140143
static const std::string SETTING_VIDEOPLAYER_LIMITGUIUPDATE;
141144
static const std::string SETTING_MYVIDEOS_SELECTACTION;
142145
static const std::string SETTING_MYVIDEOS_EXTRACTFLAGS;

0 commit comments

Comments
 (0)