Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ADD: [ouya] passthrough

  • Loading branch information...
commit 21e785becc00bd4ff232eaf06433932ac0b4581f 1 parent 9f1ab40
@koying authored
View
10 xbmc/android/jni/AudioFormat.cpp
@@ -27,6 +27,9 @@ using namespace jni;
int CJNIAudioFormat::ENCODING_PCM_16BIT = 0x00000002;
int CJNIAudioFormat::CHANNEL_OUT_STEREO = 0x0000000c;
+// OUYA-specific
+int CJNIAudioFormat::ENCODING_IEC61937_16BIT = -1;
+
void CJNIAudioFormat::PopulateStaticFields()
{
int sdk = CJNIBase::GetSDKVersion();
@@ -36,6 +39,13 @@ void CJNIAudioFormat::PopulateStaticFields()
CJNIAudioFormat::ENCODING_PCM_16BIT = get_static_field<int>(c, "ENCODING_PCM_16BIT");
if (sdk >= 5)
CJNIAudioFormat::CHANNEL_OUT_STEREO = get_static_field<int>(c, "CHANNEL_OUT_STEREO");
+
+ // OUYA-specific
+ jfieldID id = get_static_field_id<jclass>(c, "ENCODING_IEC61937_16BIT", "I");
+ if (id != NULL)
+ CJNIAudioFormat::ENCODING_IEC61937_16BIT = get_static_field<int>(c, "ENCODING_IEC61937_16BIT");
+ else
+ xbmc_jnienv()->ExceptionClear();
}
}
View
3  xbmc/android/jni/AudioFormat.h
@@ -29,6 +29,9 @@ class CJNIAudioFormat
static int ENCODING_PCM_16BIT;
static int CHANNEL_OUT_STEREO;
+
+ // OUYA-specific
+ static int ENCODING_IEC61937_16BIT;
};
};
View
20 xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
@@ -84,8 +84,16 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
m_lastFormat = format;
m_format = format;
+ int stream = CJNIAudioManager::STREAM_MUSIC;
+ int encoding = CJNIAudioFormat::ENCODING_PCM_16BIT;
+ int channelConfig = CJNIAudioFormat::CHANNEL_OUT_STEREO;
+
if (AE_IS_RAW(m_format.m_dataFormat))
+ {
m_passthrough = true;
+ if (CJNIAudioFormat::ENCODING_IEC61937_16BIT != -1) // OUYA
+ encoding = CJNIAudioFormat::ENCODING_IEC61937_16BIT;
+ }
else
m_passthrough = false;
@@ -94,22 +102,22 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
aml_set_audio_passthrough(m_passthrough);
#endif
- m_format.m_sampleRate = CJNIAudioTrack::getNativeOutputSampleRate(CJNIAudioManager::STREAM_MUSIC);
+ m_format.m_sampleRate = CJNIAudioTrack::getNativeOutputSampleRate(stream);
m_format.m_dataFormat = AE_FMT_S16LE;
m_format.m_channelLayout = m_info.m_channels;
m_format.m_frameSize = m_format.m_channelLayout.Count() *
(CAEUtil::DataFormatToBits(m_format.m_dataFormat) / 8);
int min_buffer_size = CJNIAudioTrack::getMinBufferSize( m_format.m_sampleRate,
- CJNIAudioFormat::CHANNEL_OUT_STEREO,
- CJNIAudioFormat::ENCODING_PCM_16BIT);
+ channelConfig,
+ encoding);
m_sink_frameSize = m_format.m_channelLayout.Count() *
(CAEUtil::DataFormatToBits(AE_FMT_S16LE) / 8);
m_min_frames = min_buffer_size / m_sink_frameSize;
m_audiotrackbuffer_sec = (double)m_min_frames / (double)m_format.m_sampleRate;
- m_at_jni = new CJNIAudioTrack( CJNIAudioManager::STREAM_MUSIC,
+ m_at_jni = new CJNIAudioTrack( stream,
m_format.m_sampleRate,
- CJNIAudioFormat::CHANNEL_OUT_STEREO,
- CJNIAudioFormat::ENCODING_PCM_16BIT,
+ channelConfig,
+ encoding,
min_buffer_size,
CJNIAudioTrack::MODE_STREAM);
m_format.m_frames = m_min_frames / 2;

0 comments on commit 21e785b

Please sign in to comment.
Something went wrong with that request. Please try again.