Skip to content

Commit

Permalink
changed, add a proper GUI selector for AMLogic video decoder, refacto…
Browse files Browse the repository at this point in the history
…r AMLogic bits in AESinkAUDIOTRACK
  • Loading branch information
davilla committed Sep 28, 2013
1 parent d0fc511 commit de34a76
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 23 deletions.
14 changes: 12 additions & 2 deletions language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions system/settings/android.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
</category>
</section>
<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">
Expand Down
27 changes: 12 additions & 15 deletions xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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())

This comment has been minimized.

Copy link
@Memphiz

Memphiz Sep 28, 2013

want to use the setting here instead of aml_present like you did with the othrer?

This comment has been minimized.

Copy link
@davilla

davilla Sep 28, 2013

Author Owner

no, if the device is some AMLogic SoC, then the m_audiotrack_empty_sec_tweaks applied for all audio, not just audio that comes from playing a video with amcodec. So it is device depended, not video codec dependent

m_audiotrack_empty_sec_tweaks = 0.250;

This comment has been minimized.

Copy link
@Memphiz

Memphiz Sep 28, 2013

will be overwritten with 0.0 below ... if the diff shows it right - might want to add an else here?

This comment has been minimized.

Copy link
@davilla

davilla Sep 28, 2013

Author Owner

crap, I'll rework it, I don't want a dangling else just waiting to f**k us over if someone does not watch what they are doing.

#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)
Expand All @@ -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.
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
16 changes: 10 additions & 6 deletions xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions xbmc/settings/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit de34a76

Please sign in to comment.