(2018-12-09, 19:56)Micromax Wrote: Would be really great also to have the source code. Thanks :-)
I also compiled my own version to be able to enable these settings. You only have to modify three lines of code in settings.xml and eight in DVDVideoCodecAndroidMediaCodec.cpp. It is probably not the best way to do it, since it reuses the amcodec settings, but it's very easy to change and it works perfectly.
In my specific case I have enabled hardware acceleration for mpeg2 only when the video is HD in the settings and my problem is solved.
Here you have the changes that I have made regarding the official version (I did it between the rc1 and the rc2), really only the lines with the '-' or '+' matter:
kodi/system/settings/settings.xml
Code:
@@ -119,13 +119,13 @@
<updates>
<update type="change" />
</updates>
<control type="toggle" />
</setting>
<setting id="videoplayer.useamcodecmpeg2" type="integer" label="39001" >
- <requirement>HAVE_AMCODEC</requirement>
+ <requirement>HAS_MEDIACODEC</requirement>
<level>2</level>
<default>0</default>
<constraints>
<options>
<option label="20420">9999</option> <!-- Never -->
<option label="39000">800</option> <!-- HD -->
@@ -141,13 +141,13 @@
</dependency>
</dependencies>
<control type="spinner" format="string" />
<control type="edit" format="integer" />
</setting>
<setting id="videoplayer.useamcodecmpeg4" type="integer" label="39002">
- <requirement>HAVE_AMCODEC</requirement>
+ <requirement>HAS_MEDIACODEC</requirement>
<level>2</level>
<default>800</default>
<constraints>
<options>
<option label="20420">9999</option> <!-- Never -->
<option label="39000">800</option> <!-- HD -->
@@ -163,13 +163,13 @@
</dependency>
</dependencies>
<control type="spinner" format="string" />
<control type="edit" format="integer" />
</setting>
<setting id="videoplayer.useamcodech264" type="integer" label="39003">
- <requirement>HAVE_AMCODEC</requirement>
+ <requirement>HAS_MEDIACODEC</requirement>
<level>2</level>
<default>0</default>
<constraints>
<options>
<option label="20420">9999</option> <!-- Never -->
<option label="39000">800</option> <!-- HD -->
kodi/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp
Code:
@@ -426,23 +426,25 @@
CLog::Log(LOGDEBUG, LOGVIDEO, "CDVDVideoCodecAndroidMediaCodec::Open hints: Tag %d \n", m_hints.codec_tag);
CLog::Log(LOGDEBUG, LOGVIDEO, "CDVDVideoCodecAndroidMediaCodec::Open hints: %dx%d \n", m_hints.width, m_hints.height);
switch(m_hints.codec)
{
case AV_CODEC_ID_MPEG2VIDEO:
+ if (m_hints.width <= CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOPLAYER_USEAMCODECMPEG2))
+ goto FAIL;
m_mime = "video/mpeg2";
m_mpeg2_sequence = new mpeg2_sequence;
m_mpeg2_sequence->width = m_hints.width;
m_mpeg2_sequence->height = m_hints.height;
m_mpeg2_sequence->ratio = m_hints.aspect;
m_mpeg2_sequence->fps_scale = m_hints.fpsscale;
m_mpeg2_sequence->fps_rate = m_hints.fpsrate;
m_formatname = "amc-mpeg2";
break;
case AV_CODEC_ID_MPEG4:
- if (hints.width <= 800)
+ if (m_hints.width <= CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOPLAYER_USEAMCODECMPEG4))
goto FAIL;
m_mime = "video/mp4v-es";
m_formatname = "amc-mpeg4";
break;
case AV_CODEC_ID_H263:
m_mime = "video/3gpp";
@@ -477,12 +479,17 @@
m_mime = "video/x-vnd.on2.vp9";
m_formatname = "amc-vp9";
break;
case AV_CODEC_ID_AVS:
case AV_CODEC_ID_CAVS:
case AV_CODEC_ID_H264:
+ if (m_hints.width <= CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOPLAYER_USEAMCODECH264))
+ {
+ CLog::Log(LOGDEBUG, "CDVDVideoCodecAmlogic::h264 size check failed %d",CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_VIDEOPLAYER_USEAMCODECH264));
+ goto FAIL;
+ }
switch(hints.profile)
{
case FF_PROFILE_H264_HIGH_10:
profile = CJNIMediaCodecInfoCodecProfileLevel::AVCProfileHigh10;
break;
case FF_PROFILE_H264_HIGH_10_INTRA: