[Audio_test]修复Ql_AudPlayer_PlayFrmFile播放完成回调方法不生效的问题
1.修复Ql_AudPlayer_PlayFrmFile播放完成回调方法不生效的问题
2.修复write操作后返回值为-1报错的问题
Change-Id: I2b9695653301e4bbe6f805a359c47c0ce77d1a9c
diff --git a/mbtk/ql_lib/src/ql_audio.c b/mbtk/ql_lib/src/ql_audio.c
index e273396..4e4dbc9 100755
--- a/mbtk/ql_lib/src/ql_audio.c
+++ b/mbtk/ql_lib/src/ql_audio.c
@@ -3,7 +3,9 @@
#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 _cb_onPlayer player_cb_fun = NULL;
static int Samprate = 8000;
/*****************************************************************
@@ -34,7 +36,9 @@
*****************************************************************/
int Ql_AudPlayer_Open(char* device, _cb_onPlayer cb_func)
{
- return (int)mbtk_audio_open(MBTK_AUTIO_TYPE_OUT, 1, Samprate, cb_func);
+ player_cb_fun = cb_func;
+ player_hdl = mbtk_audio_open(MBTK_AUTIO_TYPE_OUT, 1, Samprate, cb_func);
+ return (int)player_hdl;
}
/*========================================================================
@@ -82,9 +86,10 @@
Ql_AudPlayer_Open() must be first called successfully.
*/
/*=======================================================================*/
+
int Ql_AudPlayer_PlayFrmFile(int hdl, int fd, int offset)
{
- return mbtk_audio_play_file((void *)hdl, fd, offset);
+ return mbtk_audio_play_file((void *)hdl, fd, offset, player_cb_fun);
}
//
@@ -598,4 +603,4 @@
{
return 0;
-}
+}
\ No newline at end of file