Permalink
Browse files

add DVDVideoCodecAmlogic

  • Loading branch information...
davilla committed May 5, 2013
1 parent db6cb62 commit 73fae08231724b1d883a5678b78d73cb630186a6
View
@@ -30,6 +30,21 @@ AC_DEFUN([XB_ADD_PLAYER],
esac
])
# check for enabling additional codecs
AC_DEFUN([XB_ADD_CODEC],
[
AC_MSG_CHECKING([for $2])
case $add_codecs in
*$2*)
AC_SUBST([USE_$1], 1)
AC_DEFINE([HAS_$1], 1, [using $2])
AC_MSG_RESULT([enabling $2])
;;
*)
AC_MSG_RESULT([$2 is not enabled])
esac
])
# check for library basenames
AC_DEFUN([XB_FIND_SONAME],
[
@@ -513,6 +528,12 @@ AC_ARG_ENABLE([gtest],
[configure_gtest=$enableval],
[configure_gtest=no])
AC_ARG_ENABLE([codec],
[AS_HELP_STRING([--enable-codec],
[enable additional codecs from a list of comma separated names, (default is none, choices are amcodec)])],
[add_codecs=$enableval],
[add_codecs=no])
### External libraries options
AC_ARG_ENABLE([external-libraries],
[AS_HELP_STRING([--enable-external-libraries],
@@ -1878,6 +1899,14 @@ case $add_players in
;;
esac
# additional internal codecs
case $add_codecs in
*amcodec*)
AC_CHECK_HEADER([amlplayer/codec_error.h],, AC_MSG_ERROR($missing_headers))
XB_ADD_CODEC([LIBAMCODEC], [amcodec])
;;
esac
# platform specific bin utilities
if test "$build_vendor" != "apple" ; then
AC_CHECK_PROG(HAVE_GAWK,gawk,"yes","no",)
@@ -146,7 +146,7 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device)
m_channelLayout = GetChannelLayout(format);
m_passthrough = false;
}
#if defined(HAS_AMLPLAYER)
#if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC)
if (aml_present())
{
aml_set_audio_passthrough(m_passthrough);
@@ -23,8 +23,8 @@
#include "Utils/AERingBuffer.h"
#include "android/activity/XBMCApp.h"
#include "utils/log.h"
#if defined(HAS_AMLPLAYER)
#include "cores/amlplayer/AMLUtils.h"
#if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC)
#include "utils/AMLUtils.h"
#endif
#include <jni.h>
@@ -83,14 +83,14 @@ CAESinkAUDIOTRACK::CAESinkAUDIOTRACK()
m_audiotrackbuffer_sec = 0.0;
m_audiotrack_empty_sec = 0.0;
m_volume = 0.0;
#if defined(HAS_AMLPLAYER)
#if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC)
aml_cpufreq_limit(true);
#endif
}
CAESinkAUDIOTRACK::~CAESinkAUDIOTRACK()
{
#if defined(HAS_AMLPLAYER)
#if defined(HAS_AMLPLAYER) || defined(HAS_LIBAMCODEC)
aml_cpufreq_limit(false);
#endif
}
@@ -99,6 +99,16 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
{
m_format = format;
if (AE_IS_RAW(m_format.m_dataFormat))
m_passthrough = true;
else
m_passthrough = false;
#if defined(HAS_LIBAMCODEC)
if (aml_present())
aml_set_audio_passthrough(m_passthrough);
#endif
// default to 44100, all android devices support it.
// then check if we can support the requested rate.
unsigned int sampleRate = 44100;
@@ -173,7 +183,12 @@ double CAESinkAUDIOTRACK::GetDelay()
// AudioMixer (if any) and audio hardware driver.
double sinkbuffer_seconds_to_empty = m_sinkbuffer_sec_per_byte * (double)m_sinkbuffer->GetReadSize();
return sinkbuffer_seconds_to_empty + m_audiotrack_empty_sec;
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
return sinkbuffer_seconds_to_empty;
}
double CAESinkAUDIOTRACK::GetCacheTime()
@@ -182,7 +197,12 @@ double CAESinkAUDIOTRACK::GetCacheTime()
// to underrun the buffer if no sample is added.
double sinkbuffer_seconds_to_empty = m_sinkbuffer_sec_per_byte * (double)m_sinkbuffer->GetReadSize();
return sinkbuffer_seconds_to_empty + m_audiotrack_empty_sec;
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
return sinkbuffer_seconds_to_empty;
}
double CAESinkAUDIOTRACK::GetCacheTotal()
@@ -244,7 +264,8 @@ void CAESinkAUDIOTRACK::SetVolume(float scale)
// Android uses fixed steps, reverse scale back to percent
float gain = CAEUtil::ScaleToGain(scale);
m_volume = CAEUtil::GainToPercent(gain);
m_volume_changed = true;
if (!m_passthrough)
m_volume_changed = true;
}
void CAESinkAUDIOTRACK::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
@@ -313,6 +334,12 @@ void CAESinkAUDIOTRACK::Process()
min_buffer_size,
GetStaticIntField(jenv, "AudioTrack", "MODE_STREAM"));
// Set the initial volume
float volume = 1.0;
if (!m_passthrough)
volume = m_volume;
CXBMCApp::SetSystemVolume(jenv, volume);
// The AudioTrack object has been created and waiting to play,
m_inited.Set();
// yield to give other threads a chance to do some work.
@@ -329,7 +356,7 @@ void CAESinkAUDIOTRACK::Process()
while (!m_bStop)
{
if (m_volume_changed)
if (m_volume_changed && !m_passthrough)
{
// check of volume changes and make them,
// do it here to keep jni calls local to this thread.
@@ -62,6 +62,8 @@ class CAESinkAUDIOTRACK : public CThread, public IAESink
CEvent m_wake;
CEvent m_inited;
volatile bool m_draining;
bool m_passthrough;
double m_audiotrackbuffer_sec;
double m_audiotrack_empty_sec;
};
@@ -38,6 +38,9 @@
#if defined(HAVE_LIBCRYSTALHD)
#include "Video/DVDVideoCodecCrystalHD.h"
#endif
#if defined(HAS_LIBAMCODEC)
#include "Video/DVDVideoCodecAmlogic.h"
#endif
#include "Audio/DVDAudioCodecFFmpeg.h"
#include "Audio/DVDAudioCodecLibMad.h"
#include "Audio/DVDAudioCodecPcm.h"
@@ -151,6 +154,11 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne
#else
hwSupport += "CrystalHD:no ";
#endif
#if defined(HAS_LIBAMCODEC)
hwSupport += "AMCodec:yes ";
#else
hwSupport += "AMCodec:no ";
#endif
#if defined(HAVE_LIBOPENMAX) && defined(_LINUX)
hwSupport += "OpenMax:yes ";
#elif defined(_LINUX)
@@ -173,12 +181,14 @@ 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 == CODEC_ID_MPEG2VIDEO || hint.codec == CODEC_ID_MPEG1VIDEO))
{
if( (pCodec = OpenCodec(new CDVDVideoCodecLibMpeg2(), hint, options)) ) return pCodec;
}
#endif
#if defined(HAVE_LIBVDADECODER)
if (!hint.software && CSettings::Get().GetBool("videoplayer.usevda"))
{
@@ -235,6 +245,14 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne
}
#endif
#if defined(HAS_LIBAMCODEC)
if (!hint.software)
{
CLog::Log(LOGINFO, "Amlogic Video Decoder...");
if ( (pCodec = OpenCodec(new CDVDVideoCodecAmlogic(), hint, options)) ) return pCodec;
}
#endif
#if defined(HAVE_LIBOPENMAX)
if (CSettings::Get().GetBool("videoplayer.useomx") && !hint.software )
{
Oops, something went wrong.

0 comments on commit 73fae08

Please sign in to comment.