Blame channels/rdpsnd/client/opensles/opensl_io.h

Packit 1fb8d4
/*
Packit 1fb8d4
opensl_io.c:
Packit 1fb8d4
Android OpenSL input/output module header
Packit 1fb8d4
Copyright (c) 2012, Victor Lazzarini
Packit 1fb8d4
All rights reserved.
Packit 1fb8d4
Packit 1fb8d4
Redistribution and use in source and binary forms, with or without
Packit 1fb8d4
modification, are permitted provided that the following conditions are met:
Packit Service 5a9772
    * Redistributions of source code must retain the above copyright
Packit Service 5a9772
      notice, this list of conditions and the following disclaimer.
Packit Service 5a9772
    * Redistributions in binary form must reproduce the above copyright
Packit Service 5a9772
      notice, this list of conditions and the following disclaimer in the
Packit Service 5a9772
      documentation and/or other materials provided with the distribution.
Packit Service 5a9772
    * Neither the name of the <organization> nor the
Packit Service 5a9772
      names of its contributors may be used to endorse or promote products
Packit Service 5a9772
      derived from this software without specific prior written permission.
Packit 1fb8d4
Packit 1fb8d4
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
Packit 1fb8d4
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Packit 1fb8d4
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Packit 1fb8d4
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
Packit 1fb8d4
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Packit 1fb8d4
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Packit 1fb8d4
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
Packit 1fb8d4
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 1fb8d4
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Packit 1fb8d4
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 1fb8d4
*/
Packit 1fb8d4
Packit 1fb8d4
#ifndef FREERDP_CHANNEL_RDPSND_CLIENT_OPENSL_IO_H
Packit 1fb8d4
#define FREERDP_CHANNEL_RDPSND_CLIENT_OPENSL_IO_H
Packit 1fb8d4
Packit 1fb8d4
#include <SLES/OpenSLES.h>
Packit 1fb8d4
#include <SLES/OpenSLES_Android.h>
Packit 1fb8d4
#include <stdlib.h>
Packit 1fb8d4
#include <winpr/synch.h>
Packit 1fb8d4
Packit 1fb8d4
#include <freerdp/api.h>
Packit 1fb8d4
Packit 1fb8d4
#ifdef __cplusplus
Packit Service 5a9772
extern "C"
Packit Service 5a9772
{
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit Service 5a9772
	typedef struct opensl_stream
Packit Service 5a9772
	{
Packit Service 5a9772
		// engine interfaces
Packit Service 5a9772
		SLObjectItf engineObject;
Packit Service 5a9772
		SLEngineItf engineEngine;
Packit 1fb8d4
Packit Service 5a9772
		// output mix interfaces
Packit Service 5a9772
		SLObjectItf outputMixObject;
Packit 1fb8d4
Packit Service 5a9772
		// buffer queue player interfaces
Packit Service 5a9772
		SLObjectItf bqPlayerObject;
Packit Service 5a9772
		SLPlayItf bqPlayerPlay;
Packit Service 5a9772
		SLVolumeItf bqPlayerVolume;
Packit Service 5a9772
		SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;
Packit Service 5a9772
		SLEffectSendItf bqPlayerEffectSend;
Packit 1fb8d4
Packit Service 5a9772
		unsigned int outchannels;
Packit Service 5a9772
		unsigned int sr;
Packit 1fb8d4
Packit Service 5a9772
		unsigned int queuesize;
Packit Service 5a9772
		wQueue* queue;
Packit Service 5a9772
	} OPENSL_STREAM;
Packit 1fb8d4
Packit Service 5a9772
	/*
Packit Service 5a9772
	Open the audio device with a given sampling rate (sr), output channels and IO buffer size
Packit Service 5a9772
	in frames. Returns a handle to the OpenSL stream
Packit Service 5a9772
	*/
Packit Service 5a9772
	FREERDP_LOCAL OPENSL_STREAM* android_OpenAudioDevice(int sr, int outchannels, int bufferframes);
Packit Service 5a9772
	/*
Packit Service 5a9772
	Close the audio device
Packit Service 5a9772
	*/
Packit Service 5a9772
	FREERDP_LOCAL void android_CloseAudioDevice(OPENSL_STREAM* p);
Packit Service 5a9772
	/*
Packit Service 5a9772
	Write a buffer to the OpenSL stream *p, of size samples. Returns the number of samples written.
Packit Service 5a9772
	*/
Packit Service 5a9772
	FREERDP_LOCAL int android_AudioOut(OPENSL_STREAM* p, const short* buffer, int size);
Packit Service 5a9772
	/*
Packit Service 5a9772
	 * Set the volume input level.
Packit Service 5a9772
	 */
Packit Service 5a9772
	FREERDP_LOCAL void android_SetInputVolume(OPENSL_STREAM* p, int level);
Packit Service 5a9772
	/*
Packit Service 5a9772
	 * Get the current output mute setting.
Packit Service 5a9772
	 */
Packit Service 5a9772
	FREERDP_LOCAL int android_GetOutputMute(OPENSL_STREAM* p);
Packit Service 5a9772
	/*
Packit Service 5a9772
	 * Change the current output mute setting.
Packit Service 5a9772
	 */
Packit Service 5a9772
	FREERDP_LOCAL BOOL android_SetOutputMute(OPENSL_STREAM* p, BOOL mute);
Packit Service 5a9772
	/*
Packit Service 5a9772
	 * Get the current output volume level.
Packit Service 5a9772
	 */
Packit Service 5a9772
	FREERDP_LOCAL int android_GetOutputVolume(OPENSL_STREAM* p);
Packit Service 5a9772
	/*
Packit Service 5a9772
	 * Get the maximum output volume level.
Packit Service 5a9772
	 */
Packit Service 5a9772
	FREERDP_LOCAL int android_GetOutputVolumeMax(OPENSL_STREAM* p);
Packit 1fb8d4
Packit Service 5a9772
	/*
Packit Service 5a9772
	 * Set the volume output level.
Packit Service 5a9772
	 */
Packit Service 5a9772
	FREERDP_LOCAL BOOL android_SetOutputVolume(OPENSL_STREAM* p, int level);
Packit 1fb8d4
#ifdef __cplusplus
Packit 1fb8d4
};
Packit 1fb8d4
#endif
Packit 1fb8d4
Packit 1fb8d4
#endif /* FREERDP_CHANNEL_RDPSND_CLIENT_OPENSL_IO_H */