Permalink
Browse files

Merge pull request #3344 from davilla/amcodec-guisettings

changed, add a proper GUI selector for AMLogic video decoder, refactor AMLogic bits in AESinkAUDIOTRACK
  • Loading branch information...
2 parents 548a96b + 0e45cbb commit 405488defe14f6ed9a7cd39be43d50d692c2f408 @davilla davilla committed Oct 1, 2013
@@ -5796,7 +5796,12 @@ msgctxt "#13437"
msgid "Prefer VDPAU Video Mixer"
msgstr ""
-#empty strings from id 13438 to 13499
+#: system/settings/settings.xml
+msgctxt "#13438"
+msgid "Allow hardware acceleration (amcodec)"
+msgstr ""
+
+#empty strings from id 13439 to 13499
#: system/settings/settings.xml
msgctxt "#13500"
@@ -14196,7 +14201,12 @@ msgctxt "#36421"
msgid "Bypassing VDPAU mixer saves resources on low power systems but slightly reduces picture quality"
msgstr ""
-#empty strings from id 36422 to 36499
+#: system/settings/settings.xml
+msgctxt "#36422"
+msgid "Enable hardware video decode using AMLogic decoder"
+msgstr ""
+
+#empty strings from id 36423 to 36499
#end reservation
#: system/settings/settings.xml
@@ -10,6 +10,15 @@
<section id="videos">
<category id="videoplayer">
<group id="2">
+ <setting id="videoplayer.useamcodec" type="boolean" label="13438" help="36422">
+ <requirement>HAVE_AMCODEC</requirement>
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ </group>
+ </category>
+ <category id="videoplayer">
+ <group id="2">
<setting id="videoplayer.usestagefright" type="boolean" label="13436" help="36260">
<requirement>HAVE_LIBSTAGEFRIGHTDECODER</requirement>
<level>2</level>
@@ -22,10 +22,11 @@
#include "Utils/AEUtil.h"
#include "Utils/AERingBuffer.h"
#include "android/activity/XBMCApp.h"
-#include "utils/log.h"
-#if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC)
+#include "settings/Settings.h"
+#if defined(HAS_LIBAMCODEC)
#include "utils/AMLUtils.h"
#endif
+#include "utils/log.h"
#include <jni.h>
@@ -82,17 +83,16 @@ CAESinkAUDIOTRACK::CAESinkAUDIOTRACK()
m_draining = false;
m_audiotrackbuffer_sec = 0.0;
m_audiotrack_empty_sec = 0.0;
- m_volume = 1.0;
-#if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC)
- aml_cpufreq_limit(true);
+ m_audiotrack_empty_sec_tweaks = 0.0;
+#if defined(HAS_LIBAMCODEC)
+ if (aml_present())
+ m_audiotrack_empty_sec_tweaks = 0.250;
#endif
+ m_volume = 1.0;
}
CAESinkAUDIOTRACK::~CAESinkAUDIOTRACK()
{
-#if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC)
- aml_cpufreq_limit(false);
-#endif
}
bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
@@ -105,8 +105,9 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
m_passthrough = false;
#if defined(HAS_LIBAMCODEC)
- if (aml_present())
+ if (CSettings::Get().GetBool("videoplayer.useamcodec"))
aml_set_audio_passthrough(m_passthrough);
+ }
#endif
// default to 44100, all android devices support it.
@@ -184,10 +185,8 @@ double CAESinkAUDIOTRACK::GetDelay()
double sinkbuffer_seconds_to_empty = m_sinkbuffer_sec_per_byte * (double)m_sinkbuffer->GetReadSize();
sinkbuffer_seconds_to_empty += m_audiotrack_empty_sec;
-#if defined(HAS_LIBAMCODEC)
if (sinkbuffer_seconds_to_empty > 0.0)
- sinkbuffer_seconds_to_empty += 0.250;
-#endif
+ sinkbuffer_seconds_to_empty += m_audiotrack_empty_sec_tweaks;
return sinkbuffer_seconds_to_empty;
}
@@ -198,10 +197,8 @@ double CAESinkAUDIOTRACK::GetCacheTime()
double sinkbuffer_seconds_to_empty = m_sinkbuffer_sec_per_byte * (double)m_sinkbuffer->GetReadSize();
sinkbuffer_seconds_to_empty += m_audiotrack_empty_sec;
-#if defined(HAS_LIBAMCODEC)
if (sinkbuffer_seconds_to_empty > 0.0)
- sinkbuffer_seconds_to_empty += 0.250;
-#endif
+ sinkbuffer_seconds_to_empty += m_audiotrack_empty_sec_tweaks;
return sinkbuffer_seconds_to_empty;
}
@@ -69,4 +69,5 @@ class CAESinkAUDIOTRACK : public CThread, public IAESink
double m_audiotrackbuffer_sec;
double m_audiotrack_empty_sec;
+ double m_audiotrack_empty_sec_tweaks;
};
@@ -186,13 +186,17 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne
#endif
CLog::Log(LOGDEBUG, "CDVDFactoryCodec: compiled in hardware support: %s", hwSupport.c_str());
-#if !defined(HAS_LIBAMCODEC)
- // dvd's have weird still-frames in it, which is not fully supported in ffmpeg
- if(hint.stills && (hint.codec == AV_CODEC_ID_MPEG2VIDEO || hint.codec == AV_CODEC_ID_MPEG1VIDEO))
+#if defined(HAS_LIBAMCODEC)
+ // amcodec can handle dvd playback.
+ if (!CSettings::Get().GetBool("videoplayer.useamcodec"))
+#endif
{
- if( (pCodec = OpenCodec(new CDVDVideoCodecLibMpeg2(), hint, options)) ) return pCodec;
+ // dvd's have weird still-frames in it, which is not fully supported in ffmpeg
+ if(hint.stills && (hint.codec == AV_CODEC_ID_MPEG2VIDEO || hint.codec == AV_CODEC_ID_MPEG1VIDEO))
+ {
+ if( (pCodec = OpenCodec(new CDVDVideoCodecLibMpeg2(), hint, options)) ) return pCodec;
+ }
}
-#endif
#if defined(TARGET_DARWIN_OSX)
if (!hint.software && CSettings::Get().GetBool("videoplayer.usevda"))
@@ -248,7 +252,7 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne
#endif
#if defined(HAS_LIBAMCODEC)
- if (!hint.software && aml_present())
+ if (!hint.software && CSettings::Get().GetBool("videoplayer.useamcodec"))
{
CLog::Log(LOGINFO, "Amlogic Video Decoder...");
if ( (pCodec = OpenCodec(new CDVDVideoCodecAmlogic(), hint, options)) ) return pCodec;
@@ -83,6 +83,10 @@
#include "view/ViewStateSettings.h"
#include "windowing/WindowingFactory.h"
+#if defined(HAS_LIBAMCODEC)
+#include "utils/AMLUtils.h"
+#endif
+
#define SETTINGS_XML_FOLDER "special://xbmc/system/settings/"
#define SETTINGS_XML_ROOT "settings"
@@ -760,6 +764,10 @@ void CSettings::InitializeConditions()
if (g_sysinfo.HasVideoToolBoxDecoder())
m_settingsManager->AddCondition("hasvideotoolboxdecoder");
#endif
+#ifdef HAS_LIBAMCODEC
+ if (aml_present())
+ m_settingsManager->AddCondition("have_amcodec");
+#endif
#ifdef HAS_LIBSTAGEFRIGHT
m_settingsManager->AddCondition("have_libstagefrightdecoder");
#endif

0 comments on commit 405488d

Please sign in to comment.