修改API框架,兼容1806
Change-Id: Ic68e966a32e4c7ffd7137b3d7ba94e4d813c71b2
diff --git a/mbtk/ql_lib/src/ql_audio.c b/mbtk/ql_lib/src/ql_audio.c
index b94db61..184c48f 100755
--- a/mbtk/ql_lib/src/ql_audio.c
+++ b/mbtk/ql_lib/src/ql_audio.c
@@ -1,11 +1,15 @@
#include "ql/ql_audio.h"
#include "mbtk_log.h"
+#ifdef MBTK_PLATFORM_ASR1803
#include "mbtk_audio.h"
static mbtk_audio_handle record_hdl = NULL;
static mbtk_audio_handle player_hdl = NULL;
static _cb_onRecorder record_cb_fun = NULL;
static int Samprate = 8000;
+#else
+
+#endif
/*****************************************************************
* Function: Ql_AudPlayer_Open
@@ -35,8 +39,12 @@
*****************************************************************/
int Ql_AudPlayer_Open(char* device, _cb_onPlayer cb_func)
{
+#ifdef MBTK_PLATFORM_ASR1803
player_hdl = mbtk_audio_open(MBTK_AUTIO_TYPE_OUT, 1, Samprate, cb_func);
return (int)player_hdl;
+#else
+ return 0;
+#endif
}
/*========================================================================
@@ -59,7 +67,11 @@
/*=======================================================================*/
int Ql_AudPlayer_Play(int hdl, unsigned char* pData, unsigned int length)
{
+#ifdef MBTK_PLATFORM_ASR1803
return mbtk_audio_play_stream((void *)hdl, pData, length);
+#else
+ return 0;
+#endif
}
/*========================================================================
@@ -87,7 +99,11 @@
int Ql_AudPlayer_PlayFrmFile(int hdl, int fd, int offset)
{
+#ifdef MBTK_PLATFORM_ASR1803
return mbtk_audio_play_file((void *)hdl, fd, offset);
+#else
+ return 0;
+#endif
}
//
@@ -99,7 +115,11 @@
// Handle received from Ql_AudPlayer_Open().
int Ql_AudPlayer_Pause(int hdl)
{
+#ifdef MBTK_PLATFORM_ASR1803
return mbtk_audio_pause((void *)hdl);
+#else
+ return 0;
+#endif
}
//
@@ -111,7 +131,11 @@
// Handle received from Ql_AudPlayer_Open().
int Ql_AudPlayer_Resume(int hdl)
{
+#ifdef MBTK_PLATFORM_ASR1803
return mbtk_audio_resume((void *)hdl);
+#else
+ return 0;
+#endif
}
//
@@ -123,7 +147,11 @@
// Handle received from Ql_AudPlayer_Open().
void Ql_AudPlayer_Stop(int hdl)
{
- return mbtk_audio_stop((void *)hdl);
+#ifdef MBTK_PLATFORM_ASR1803
+ mbtk_audio_stop((void *)hdl);
+#else
+
+#endif
}
//
@@ -135,7 +163,11 @@
// Handle received from Ql_AudPlayer_Open().
void Ql_AudPlayer_Close(int hdl)
{
+#ifdef MBTK_PLATFORM_ASR1803
mbtk_audio_close((void *)hdl);
+#else
+
+#endif
}
@@ -171,9 +203,14 @@
*****************************************************************/
int Ql_AudRecorder_Open(char* device, _cb_onRecorder cb_fun)
{
+#ifdef MBTK_PLATFORM_ASR1803
record_hdl = mbtk_audio_open(MBTK_AUTIO_TYPE_IN, 1, 8000, NULL);
record_cb_fun = cb_fun;
return (int)record_hdl;
+#else
+ return 0;
+
+#endif
}
//
@@ -188,7 +225,12 @@
// -1 on failure
int Ql_AudRecorder_StartRecord(void)
{
+#ifdef MBTK_PLATFORM_ASR1803
return mbtk_audio_record(record_hdl, record_cb_fun, NULL);
+#else
+ return 0;
+
+#endif
}
//
@@ -228,9 +270,13 @@
// Close recorder, and free the resource
void Ql_AudRecorder_Close(void)
{
+#ifdef MBTK_PLATFORM_ASR1803
mbtk_audio_close(record_hdl);
record_hdl = NULL;
record_cb_fun = NULL;
+#else
+
+#endif
}
//
@@ -364,7 +410,7 @@
int Ql_Rxgain_Set(int value)
{
-
+#ifdef MBTK_PLATFORM_ASR1803
printf("Volume is %d \n",value);
int volume =0;
int handler = 0;
@@ -380,8 +426,11 @@
mbtk_audio_ubus_client_init(&handler, dtmf_cb1);
mbtk_audio_dsp_set(1, volume);
+ return 0;
+#else
- return 0;
+ return 0;
+#endif
}
@@ -395,6 +444,7 @@
*/
int Ql_Playback_Samprate_Set(int samprate)
{
+#ifdef MBTK_PLATFORM_ASR1803
printf("samprate is %d \n",samprate);
if(samprate == 1)
{
@@ -405,24 +455,38 @@
}
return 0;
+#else
+
+ return 0;
+#endif
}
int Ql_Mp3_To_Wav(const char *wavpath, char *mp3path)
{
+#ifdef MBTK_PLATFORM_ASR1803
#ifdef MBTK_MP3_SUPPORT
return mbtk_audio_mp3_to_wav(wavpath, mp3path);
#else
return 0;
#endif
+#else
+
+ return 0;
+#endif
}
int Ql_Mp3_To_Play(char *mp3path, int hdl,int sample_rate)
{
+#ifdef MBTK_PLATFORM_ASR1803
#ifdef MBTK_MP3_SUPPORT
return mbtk_audio_mp3_to_play(mp3path, hdl, sample_rate);
#else
return 0;
#endif
+#else
+
+ return 0;
+#endif
}
//add by grady, 2018-6-2