changed, add a proper GUI selector for AMLogic video decoder, refactor AMLogic bits...
authorS. Davilla <davilla@4pi.com>
Sat, 28 Sep 2013 13:51:49 +0000 (09:51 -0400)
committerS. Davilla <davilla@4pi.com>
Sat, 28 Sep 2013 13:51:49 +0000 (09:51 -0400)
language/English/strings.po
system/settings/android.xml
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h
xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
xbmc/settings/Settings.cpp

index 63ea425..b59f647 100755 (executable)
@@ -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
index a335b50..756d223 100644 (file)
   <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>
index 4a8948b..1feb2c4 100644 (file)
 #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);
+#if defined(HAS_LIBAMCODEC)
+  if (aml_present())
+    m_audiotrack_empty_sec_tweaks = 0.250;
 #endif
+  m_audiotrack_empty_sec_tweaks = 0.0;
+  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;
 }
 
index a2b4dc6..30c6f59 100644 (file)
@@ -69,4 +69,5 @@ private:
 
   double             m_audiotrackbuffer_sec;
   double             m_audiotrack_empty_sec;
+  double             m_audiotrack_empty_sec_tweaks;
 };
index 3ff3993..bc3072a 100644 (file)
@@ -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;
index ef9904b..be6990d 100644 (file)
 #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