if (mAudioSink.get() != NULL) {
status_t err = mAudioSink->open(
- mSampleRate, numChannels, AUDIO_FORMAT_PCM_16_BIT,
+ mSampleRate, numChannels, CHANNEL_MASK_USE_CHANNEL_ORDER, AUDIO_FORMAT_PCM_16_BIT,
DEFAULT_AUDIOSINK_BUFFERCOUNT,
&VideoEditorAudioPlayer::AudioSinkCallback, this);
if (err != OK) {
}
status_t VideoEditorPlayer::VeAudioOutput::open(
- uint32_t sampleRate, int channelCount, audio_format_t format, int bufferCount,
+ uint32_t sampleRate, int channelCount, audio_channel_mask_t channelMask,
+ audio_format_t format, int bufferCount,
AudioCallback cb, void *cookie) {
mCallback = cb;
frameCount = (sampleRate*afFrameCount*bufferCount)/afSampleRate;
+ if (channelMask == CHANNEL_MASK_USE_CHANNEL_ORDER) {
+ switch(channelCount) {
+ case 1:
+ channelMask = AUDIO_CHANNEL_OUT_MONO;
+ break;
+ case 2:
+ channelMask = AUDIO_CHANNEL_OUT_STEREO;
+ break;
+ default:
+ return NO_INIT;
+ }
+ }
+
AudioTrack *t;
if (mCallback != NULL) {
t = new AudioTrack(
mStreamType,
sampleRate,
format,
- (channelCount == 2) ?
- AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO,
+ channelMask,
frameCount,
0 /* flags */,
CallbackWrapper,
mStreamType,
sampleRate,
format,
- (channelCount == 2) ?
- AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO,
+ channelMask,
frameCount);
}
virtual int getSessionId();
virtual status_t open(
- uint32_t sampleRate, int channelCount,
+ uint32_t sampleRate, int channelCount, audio_channel_mask_t channelMask,
audio_format_t format, int bufferCount,
AudioCallback cb, void *cookie);