Skip to content

Commit

Permalink
AESinkAudioTrack: Support Mono layout
Browse files Browse the repository at this point in the history
v2: use get_static_field
  • Loading branch information
fritsch committed Oct 30, 2016
1 parent fa27065 commit e75604c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
Expand Up @@ -162,8 +162,10 @@ static int AEChannelMapToAUDIOTRACKChannelMask(CAEChannelInfo info)
| CJNIAudioFormat::CHANNEL_OUT_SIDE_RIGHT;
else if (info.Count() > 2)
return CJNIAudioFormat::CHANNEL_OUT_5POINT1;
else
else if (info.Count() == 2)
return CJNIAudioFormat::CHANNEL_OUT_STEREO;
else
return CJNIAudioFormat::CHANNEL_OUT_MONO;
#endif

info.ResolveChannels(KnownChannels);
Expand Down Expand Up @@ -323,6 +325,7 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)

while (!m_at_jni)
{
CLog::Log(LOGNOTICE, "Trying to open: %u samplerate %d channelMask %d encoding", m_sink_sampleRate, atChannelMask, m_encoding);
int min_buffer = CJNIAudioTrack::getMinBufferSize(m_sink_sampleRate,
atChannelMask,
m_encoding);
Expand Down
2 changes: 2 additions & 0 deletions xbmc/platform/android/jni/AudioFormat.cpp
Expand Up @@ -34,6 +34,7 @@ int CJNIAudioFormat::ENCODING_DTS_HD = 0x00000008;
int CJNIAudioFormat::ENCODING_DOLBY_TRUEHD = 0x00000009;
int CJNIAudioFormat::ENCODING_IEC61937 = 0x0000000d;

int CJNIAudioFormat::CHANNEL_OUT_MONO = 0x00000004;
int CJNIAudioFormat::CHANNEL_OUT_STEREO = 0x0000000c;
int CJNIAudioFormat::CHANNEL_OUT_5POINT1 = 0x000000fc;

Expand Down Expand Up @@ -76,6 +77,7 @@ void CJNIAudioFormat::PopulateStaticFields()
if (sdk >= 5)
{
CJNIAudioFormat::CHANNEL_OUT_STEREO = get_static_field<int>(c, "CHANNEL_OUT_STEREO");
CJNIAudioFormat::CHANNEL_OUT_MONO = get_static_field<int>(c, "CHANNEL_OUT_MONO");
CJNIAudioFormat::CHANNEL_OUT_5POINT1 = get_static_field<int>(c, "CHANNEL_OUT_5POINT1");
CJNIAudioFormat::CHANNEL_OUT_FRONT_LEFT = get_static_field<int>(c, "CHANNEL_OUT_FRONT_LEFT");
CJNIAudioFormat::CHANNEL_OUT_FRONT_LEFT_OF_CENTER = get_static_field<int>(c, "CHANNEL_OUT_FRONT_LEFT_OF_CENTER");
Expand Down
1 change: 1 addition & 0 deletions xbmc/platform/android/jni/AudioFormat.h
Expand Up @@ -40,6 +40,7 @@ class CJNIAudioFormat : public CJNIBase
static int ENCODING_DOLBY_TRUEHD;
static int ENCODING_IEC61937;

static int CHANNEL_OUT_MONO;
static int CHANNEL_OUT_STEREO;
static int CHANNEL_OUT_5POINT1;

Expand Down

0 comments on commit e75604c

Please sign in to comment.