Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ADD: [ouya] passthrough

  • Loading branch information...
commit 21e785becc00bd4ff232eaf06433932ac0b4581f 1 parent 9f1ab40
Chris Browet authored
10 xbmc/android/jni/AudioFormat.cpp
@@ -27,6 +27,9 @@ using namespace jni;
27 27 int CJNIAudioFormat::ENCODING_PCM_16BIT = 0x00000002;
28 28 int CJNIAudioFormat::CHANNEL_OUT_STEREO = 0x0000000c;
29 29
  30 +// OUYA-specific
  31 +int CJNIAudioFormat::ENCODING_IEC61937_16BIT = -1;
  32 +
30 33 void CJNIAudioFormat::PopulateStaticFields()
31 34 {
32 35 int sdk = CJNIBase::GetSDKVersion();
@@ -36,6 +39,13 @@ void CJNIAudioFormat::PopulateStaticFields()
36 39 CJNIAudioFormat::ENCODING_PCM_16BIT = get_static_field<int>(c, "ENCODING_PCM_16BIT");
37 40 if (sdk >= 5)
38 41 CJNIAudioFormat::CHANNEL_OUT_STEREO = get_static_field<int>(c, "CHANNEL_OUT_STEREO");
  42 +
  43 + // OUYA-specific
  44 + jfieldID id = get_static_field_id<jclass>(c, "ENCODING_IEC61937_16BIT", "I");
  45 + if (id != NULL)
  46 + CJNIAudioFormat::ENCODING_IEC61937_16BIT = get_static_field<int>(c, "ENCODING_IEC61937_16BIT");
  47 + else
  48 + xbmc_jnienv()->ExceptionClear();
39 49 }
40 50 }
41 51
3  xbmc/android/jni/AudioFormat.h
@@ -29,6 +29,9 @@ class CJNIAudioFormat
29 29
30 30 static int ENCODING_PCM_16BIT;
31 31 static int CHANNEL_OUT_STEREO;
  32 +
  33 + // OUYA-specific
  34 + static int ENCODING_IEC61937_16BIT;
32 35 };
33 36
34 37 };
20 xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
@@ -84,8 +84,16 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
84 84 m_lastFormat = format;
85 85 m_format = format;
86 86
  87 + int stream = CJNIAudioManager::STREAM_MUSIC;
  88 + int encoding = CJNIAudioFormat::ENCODING_PCM_16BIT;
  89 + int channelConfig = CJNIAudioFormat::CHANNEL_OUT_STEREO;
  90 +
87 91 if (AE_IS_RAW(m_format.m_dataFormat))
  92 + {
88 93 m_passthrough = true;
  94 + if (CJNIAudioFormat::ENCODING_IEC61937_16BIT != -1) // OUYA
  95 + encoding = CJNIAudioFormat::ENCODING_IEC61937_16BIT;
  96 + }
89 97 else
90 98 m_passthrough = false;
91 99
@@ -94,22 +102,22 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
94 102 aml_set_audio_passthrough(m_passthrough);
95 103 #endif
96 104
97   - m_format.m_sampleRate = CJNIAudioTrack::getNativeOutputSampleRate(CJNIAudioManager::STREAM_MUSIC);
  105 + m_format.m_sampleRate = CJNIAudioTrack::getNativeOutputSampleRate(stream);
98 106 m_format.m_dataFormat = AE_FMT_S16LE;
99 107 m_format.m_channelLayout = m_info.m_channels;
100 108 m_format.m_frameSize = m_format.m_channelLayout.Count() *
101 109 (CAEUtil::DataFormatToBits(m_format.m_dataFormat) / 8);
102 110 int min_buffer_size = CJNIAudioTrack::getMinBufferSize( m_format.m_sampleRate,
103   - CJNIAudioFormat::CHANNEL_OUT_STEREO,
104   - CJNIAudioFormat::ENCODING_PCM_16BIT);
  111 + channelConfig,
  112 + encoding);
105 113 m_sink_frameSize = m_format.m_channelLayout.Count() *
106 114 (CAEUtil::DataFormatToBits(AE_FMT_S16LE) / 8);
107 115 m_min_frames = min_buffer_size / m_sink_frameSize;
108 116 m_audiotrackbuffer_sec = (double)m_min_frames / (double)m_format.m_sampleRate;
109   - m_at_jni = new CJNIAudioTrack( CJNIAudioManager::STREAM_MUSIC,
  117 + m_at_jni = new CJNIAudioTrack( stream,
110 118 m_format.m_sampleRate,
111   - CJNIAudioFormat::CHANNEL_OUT_STEREO,
112   - CJNIAudioFormat::ENCODING_PCM_16BIT,
  119 + channelConfig,
  120 + encoding,
113 121 min_buffer_size,
114 122 CJNIAudioTrack::MODE_STREAM);
115 123 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.