Merge branch 'master' of ssh://g.hz.netease.com:22222/IoT/PV2/SmartAudioPV2
This commit is contained in:
commit
6aca06771a
lichee/brandy/u-boot-2014.07/board/sunxi/sun8iw15p1
package
allwinner
bluetooth/3rdparty/embedded/bsa_examples/linux
app_avk/source
app_manager/source
app_nevsps
libbtapp
softap/src
base-files/files/etc/init.d
libs/avahi/files
netease
KPlayer/src
ihw_player/src
target/allwinner
updateSubmodules.sh
|
@ -29,6 +29,7 @@
|
|||
#include <asm/io.h>
|
||||
#include <power/sunxi/pmu.h>
|
||||
#include <asm/arch/ccmu.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
|
@ -42,6 +43,195 @@ int enable_smp(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
__s32 boot_set_gpio(void *user_gpio_list, __u32 group_count_max, __s32 set_gpio)
|
||||
{
|
||||
normal_gpio_set_t *tmp_user_gpio_data, *gpio_list;
|
||||
__u32 first_port; //保存真正有效的GPIO的个数
|
||||
__u32 tmp_group_func_data;
|
||||
__u32 tmp_group_pull_data;
|
||||
__u32 tmp_group_dlevel_data;
|
||||
__u32 tmp_group_data_data;
|
||||
__u32 data_change = 0;
|
||||
// __u32 *tmp_group_port_addr;
|
||||
volatile __u32 *tmp_group_func_addr, *tmp_group_pull_addr;
|
||||
volatile __u32 *tmp_group_dlevel_addr, *tmp_group_data_addr;
|
||||
__u32 port, port_num, port_num_func, port_num_pull;
|
||||
__u32 pre_port, pre_port_num_func;
|
||||
__u32 pre_port_num_pull;
|
||||
__s32 i, tmp_val;
|
||||
|
||||
|
||||
gpio_list = (normal_gpio_set_t *)user_gpio_list;
|
||||
|
||||
for(first_port = 0; first_port < group_count_max; first_port++)
|
||||
{
|
||||
tmp_user_gpio_data = gpio_list + first_port;
|
||||
port = tmp_user_gpio_data->port; //读出端口数值
|
||||
port_num = tmp_user_gpio_data->port_num; //读出端口中的某一个GPIO
|
||||
if(!port)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
port_num_func = (port_num >> 3);
|
||||
port_num_pull = (port_num >> 4);
|
||||
|
||||
tmp_group_func_addr = PIO_REG_CFG(port, port_num_func); //更新功能寄存器地址
|
||||
tmp_group_pull_addr = PIO_REG_PULL(port, port_num_pull); //更新pull寄存器
|
||||
tmp_group_dlevel_addr = PIO_REG_DLEVEL(port, port_num_pull);//更新level寄存器
|
||||
tmp_group_data_addr = PIO_REG_DATA(port); //更新data寄存器
|
||||
|
||||
tmp_group_func_data = GPIO_REG_READ(tmp_group_func_addr);
|
||||
tmp_group_pull_data = GPIO_REG_READ(tmp_group_pull_addr);
|
||||
tmp_group_dlevel_data = GPIO_REG_READ(tmp_group_dlevel_addr);
|
||||
tmp_group_data_data = GPIO_REG_READ(tmp_group_data_addr);
|
||||
|
||||
pre_port = port;
|
||||
pre_port_num_func = port_num_func;
|
||||
pre_port_num_pull = port_num_pull;
|
||||
//更新功能寄存器
|
||||
tmp_val = (port_num - (port_num_func << 3)) << 2;
|
||||
tmp_group_func_data &= ~(0x07 << tmp_val);
|
||||
if(set_gpio)
|
||||
{
|
||||
tmp_group_func_data |= (tmp_user_gpio_data->mul_sel & 0x07) << tmp_val;
|
||||
}
|
||||
//根据pull的值决定是否更新pull寄存器
|
||||
tmp_val = (port_num - (port_num_pull << 4)) << 1;
|
||||
if(tmp_user_gpio_data->pull >= 0)
|
||||
{
|
||||
tmp_group_pull_data &= ~( 0x03 << tmp_val);
|
||||
tmp_group_pull_data |= (tmp_user_gpio_data->pull & 0x03) << tmp_val;
|
||||
}
|
||||
//根据driver level的值决定是否更新driver level寄存器
|
||||
if(tmp_user_gpio_data->drv_level >= 0)
|
||||
{
|
||||
tmp_group_dlevel_data &= ~( 0x03 << tmp_val);
|
||||
tmp_group_dlevel_data |= (tmp_user_gpio_data->drv_level & 0x03) << tmp_val;
|
||||
}
|
||||
//根据用户输入,以及功能分配决定是否更新data寄存器
|
||||
if(tmp_user_gpio_data->mul_sel == 1)
|
||||
{
|
||||
if(tmp_user_gpio_data->data >= 0)
|
||||
{
|
||||
tmp_val = tmp_user_gpio_data->data & 1;
|
||||
tmp_group_data_data &= ~(1 << port_num);
|
||||
tmp_group_data_data |= tmp_val << port_num;
|
||||
data_change = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
//检查是否有数据存在
|
||||
if(first_port >= group_count_max)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
//保存用户数据
|
||||
for(i = first_port + 1; i < group_count_max; i++)
|
||||
{
|
||||
tmp_user_gpio_data = gpio_list + i; //gpio_set依次指向用户的每个GPIO数组成员
|
||||
port = tmp_user_gpio_data->port; //读出端口数值
|
||||
port_num = tmp_user_gpio_data->port_num; //读出端口中的某一个GPIO
|
||||
if(!port)
|
||||
{
|
||||
break;
|
||||
}
|
||||
port_num_func = (port_num >> 3);
|
||||
port_num_pull = (port_num >> 4);
|
||||
|
||||
if((port_num_pull != pre_port_num_pull) || (port != pre_port)) //如果发现当前引脚的端口不一致,或者所在的pull寄存器不一致
|
||||
{
|
||||
GPIO_REG_WRITE(tmp_group_func_addr, tmp_group_func_data); //回写功能寄存器
|
||||
GPIO_REG_WRITE(tmp_group_pull_addr, tmp_group_pull_data); //回写pull寄存器
|
||||
GPIO_REG_WRITE(tmp_group_dlevel_addr, tmp_group_dlevel_data); //回写driver level寄存器
|
||||
if(data_change)
|
||||
{
|
||||
data_change = 0;
|
||||
GPIO_REG_WRITE(tmp_group_data_addr, tmp_group_data_data); //回写data寄存器
|
||||
}
|
||||
|
||||
tmp_group_func_addr = PIO_REG_CFG(port, port_num_func); //更新功能寄存器地址
|
||||
tmp_group_pull_addr = PIO_REG_PULL(port, port_num_pull); //更新pull寄存器
|
||||
tmp_group_dlevel_addr = PIO_REG_DLEVEL(port, port_num_pull);//更新level寄存器
|
||||
tmp_group_data_addr = PIO_REG_DATA(port); //更新data寄存器
|
||||
|
||||
tmp_group_func_data = GPIO_REG_READ(tmp_group_func_addr);
|
||||
tmp_group_pull_data = GPIO_REG_READ(tmp_group_pull_addr);
|
||||
tmp_group_dlevel_data = GPIO_REG_READ(tmp_group_dlevel_addr);
|
||||
tmp_group_data_data = GPIO_REG_READ(tmp_group_data_addr);
|
||||
}
|
||||
else if(pre_port_num_func != port_num_func) //如果发现当前引脚的功能寄存器不一致
|
||||
{
|
||||
GPIO_REG_WRITE(tmp_group_func_addr, tmp_group_func_data); //则只回写功能寄存器
|
||||
tmp_group_func_addr = PIO_REG_CFG(port, port_num_func); //更新功能寄存器地址
|
||||
|
||||
tmp_group_func_data = GPIO_REG_READ(tmp_group_func_addr);
|
||||
}
|
||||
//保存当前硬件寄存器数据
|
||||
pre_port_num_pull = port_num_pull; //设置当前GPIO成为前一个GPIO
|
||||
pre_port_num_func = port_num_func;
|
||||
pre_port = port;
|
||||
|
||||
//更新功能寄存器
|
||||
tmp_val = (port_num - (port_num_func << 3)) << 2;
|
||||
if(tmp_user_gpio_data->mul_sel >= 0)
|
||||
{
|
||||
tmp_group_func_data &= ~( 0x07 << tmp_val);
|
||||
if(set_gpio)
|
||||
{
|
||||
tmp_group_func_data |= (tmp_user_gpio_data->mul_sel & 0x07) << tmp_val;
|
||||
}
|
||||
}
|
||||
//根据pull的值决定是否更新pull寄存器
|
||||
tmp_val = (port_num - (port_num_pull << 4)) << 1;
|
||||
if(tmp_user_gpio_data->pull >= 0)
|
||||
{
|
||||
tmp_group_pull_data &= ~( 0x03 << tmp_val);
|
||||
tmp_group_pull_data |= (tmp_user_gpio_data->pull & 0x03) << tmp_val;
|
||||
}
|
||||
//根据driver level的值决定是否更新driver level寄存器
|
||||
if(tmp_user_gpio_data->drv_level >= 0)
|
||||
{
|
||||
tmp_group_dlevel_data &= ~( 0x03 << tmp_val);
|
||||
tmp_group_dlevel_data |= (tmp_user_gpio_data->drv_level & 0x03) << tmp_val;
|
||||
}
|
||||
//根据用户输入,以及功能分配决定是否更新data寄存器
|
||||
if(tmp_user_gpio_data->mul_sel == 1)
|
||||
{
|
||||
if(tmp_user_gpio_data->data >= 0)
|
||||
{
|
||||
tmp_val = tmp_user_gpio_data->data & 1;
|
||||
tmp_group_data_data &= ~(1 << port_num);
|
||||
tmp_group_data_data |= tmp_val << port_num;
|
||||
data_change = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//for循环结束,如果存在还没有回写的寄存器,这里写回到硬件当中
|
||||
if(tmp_group_func_addr) //只要更新过寄存器地址,就可以对硬件赋值
|
||||
{ //那么把所有的值全部回写到硬件寄存器
|
||||
GPIO_REG_WRITE(tmp_group_func_addr, tmp_group_func_data); //回写功能寄存器
|
||||
GPIO_REG_WRITE(tmp_group_pull_addr, tmp_group_pull_data); //回写pull寄存器
|
||||
GPIO_REG_WRITE(tmp_group_dlevel_addr, tmp_group_dlevel_data); //回写driver level寄存器
|
||||
if(data_change)
|
||||
{
|
||||
GPIO_REG_WRITE(tmp_group_data_addr, tmp_group_data_data); //回写data寄存器
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Netease_gpio_init(void) {
|
||||
normal_gpio_set_t ldo_gpio[2] =
|
||||
{
|
||||
{ 8, 4, 1, -1, -1, 1, {0}},//4v5_ldo_en = port:PH04<1><default><default><0>
|
||||
{ 8, 5, 1, -1, -1, 1, {0}} //3v_ldo_en = port:PH05<1><default><default><0>
|
||||
};
|
||||
boot_set_gpio(ldo_gpio,2,1);
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
//asm volatile("b .");
|
||||
|
@ -71,6 +261,9 @@ int board_init(void)
|
|||
writel(reg_val, CCMU_VE_BGR_REG);
|
||||
}
|
||||
|
||||
printf("Enable GPIO PH04 PH05, by Netease!\n");
|
||||
Netease_gpio_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1352,12 +1352,12 @@ static void app_avk_cback(tBSA_AVK_EVT event, tBSA_AVK_MSG *p_data)
|
|||
connection->rc_handle, p_data->abs_volume.label);
|
||||
|
||||
/* Change the code below based on which interface audio is going out to. */
|
||||
char buffer[100];
|
||||
/*char buffer[100];
|
||||
int alsa_vol = 0;
|
||||
alsa_vol = (63 * app_avk_cb.volume)/(BSA_MAX_ABS_VOLUME - BSA_MIN_ABS_VOLUME);
|
||||
APP_INFO1("abs volume %d, alsa volume %d", app_avk_cb.volume, alsa_vol);
|
||||
sprintf(buffer, "amixer cset name='headphone volume' '%d'", alsa_vol);
|
||||
system(buffer);
|
||||
system(buffer);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -42,7 +42,9 @@
|
|||
#define APP_DEFAULT_BT_NAME "三音云音箱-" //jira pv1-32
|
||||
|
||||
/* Default COD SetTopBox (Major Service = none) (MajorDevclass = Audio/Video) (Minor=STB) */
|
||||
#define APP_DEFAULT_CLASS_OF_DEVICE {0x00, 0x04, 0x24}
|
||||
/*we need set SOD loadspeaker(Major Service = none) (MajorDevclass = Audio/Video) (Minor = loudspeaker)
|
||||
forbid same device cannot sound through bt (such as windows devices)*/
|
||||
#define APP_DEFAULT_CLASS_OF_DEVICE {0x00, 0x04, 0x14}//{0x00, 0x04, 0x24}
|
||||
|
||||
#define APP_DEFAULT_ROOT_PATH "./pictures"
|
||||
|
||||
|
@ -177,7 +179,7 @@ int app_mgr_write_config(void)
|
|||
\t\n Discoverable:%d \
|
||||
\t\n Connectable:%d \
|
||||
\t\n Name:%s \
|
||||
\t\n Bdaddr %02x:%02x:%02x:%02x:%02x:%02x \
|
||||
\t\n BTaddr %02x:%02x:%02x:%02x:%02x:%02x \
|
||||
\t\n ClassOfDevice:%02x:%02x:%02x \
|
||||
\t\n RootPath:%s\n" \
|
||||
, app_xml_config.enable \
|
||||
|
|
|
@ -133,6 +133,7 @@ typedef enum
|
|||
LE_MSG_TYPY_NEVSPS_TX_WRITE,
|
||||
LE_MSG_TYPE_DISC,
|
||||
LE_MSG_TYPE_SERV_OUT,
|
||||
LE_MSG_TYPE_NEVSPS_KALIVE,
|
||||
LE_MSG_TYPE_COUNT,
|
||||
}le_msgtype_edef;
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ typedef tBSA_BLE_CBACK * on_evsps_evt_cb;
|
|||
#define APP_BLE_NEVSPS_TX_CHAR_UUID 0xfff1
|
||||
#define APP_BLE_NEVSPS_RX_CHAR_UUID 0xfff2
|
||||
#define APP_BLE_NEVSPS_CTS_CHAR_UUID 0xfff3
|
||||
#define APP_BLE_NEVSPS_KALIVE_CHAR_UUID 0xfff4
|
||||
|
||||
|
||||
#define APP_BLE_NEVSPS_USR_DESC_UUID 0x2901
|
||||
#define APP_BLE_NEVSPS_CHARAC_DESC_UUID 0x2902
|
||||
|
@ -66,6 +68,7 @@ typedef tBSA_BLE_CBACK * on_evsps_evt_cb;
|
|||
#define APP_BLE_NEVSPS_TX_USR_DESCRIP "NeVsps Tx line"
|
||||
#define APP_BLE_NEVSPS_RX_USR_DESCRIP "NeVsps Rx line"
|
||||
#define APP_BLE_NEVSPS_CTS_USR_DESCRIP "NeVsps Cts line"
|
||||
#define APP_BLE_NEVSPS_KALIVE_USR_DESCRIP "NeVsps Kalive line"
|
||||
#define APP_BLE_NEVSPS_NULL_READ "NULL"
|
||||
|
||||
|
||||
|
@ -101,6 +104,9 @@ typedef enum
|
|||
APP_NEVSPS_CHAR_RX_CCCD_INDEX,
|
||||
APP_NEVSPS_CHAR_CTS_UD_INDEX,
|
||||
APP_NEVSPS_CHAR_CTS_CCCD_INDEX,
|
||||
APP_NEVSPS_CHAR_KALIVE_INDEX, //lupeng add 20180731
|
||||
APP_NEVSPS_CHAR_KALIVE_UD_INDEX, //lupeng add 20180731
|
||||
APP_NEVSPS_CHAR_KALIVE_CCCD_INDEX, //lupeng add 20180731
|
||||
APP_NEVSPS_CHAR_CNT,
|
||||
}nevsps_idx_edf;
|
||||
|
||||
|
@ -141,6 +147,9 @@ typedef struct nevsps_env_s
|
|||
INT16 cts_ud_handle;
|
||||
INT16 cts_cccd_handle;
|
||||
INT16 serv_ud_handle;
|
||||
INT16 kalive_handle;
|
||||
INT16 kalive_ud_handle;
|
||||
INT16 kalive_cccd_handle;
|
||||
UINT8 cts_val;
|
||||
UINT16 con_id;
|
||||
bool rx_enabled;
|
||||
|
@ -167,8 +176,14 @@ bool is_attr_indicate_enable(UINT8 *data,UINT8 size);
|
|||
bool is_attr_indicate_disable(UINT8 *data,UINT8 size);
|
||||
|
||||
|
||||
void app_nevsps_kalive_ntf_start();
|
||||
void app_nevsps_kalive_ntf_stop();
|
||||
|
||||
|
||||
int api_nevsps_rx_indicate(UINT16 size,UINT8 *p_data);
|
||||
|
||||
int api_nevsps_kalive_indicate(UINT16 size,UINT8 *p_data);
|
||||
|
||||
int api_get_nevsps_notify_msg_id();
|
||||
|
||||
int api_nevsps_le_state_notify(le_msgtype_edef evt,UINT32 code);
|
||||
|
|
|
@ -287,6 +287,15 @@ static void ble_server_callback_handle(tBSA_BLE_EVT event, tBSA_BLE_MSG *p_data)
|
|||
app_print_info("read cts ud\r\n");
|
||||
break;
|
||||
}
|
||||
else if(p_data->ser_read.handle == app_ble_server_get_attr_id(p_nevsps_env->server_handle,p_nevsps_env->kalive_ud_handle)
|
||||
|| p_data->ser_read.handle == app_ble_server_get_attr_id(p_nevsps_env->server_handle,p_nevsps_env->kalive_cccd_handle))
|
||||
{
|
||||
send_server_resp.handle =app_ble_server_get_attr_id(p_nevsps_env->server_handle,p_nevsps_env->kalive_ud_handle);
|
||||
send_server_resp.len = strlen(APP_BLE_NEVSPS_KALIVE_USR_DESCRIP);
|
||||
memcpy(send_server_resp.value, APP_BLE_NEVSPS_KALIVE_USR_DESCRIP, send_server_resp.len);
|
||||
BSA_BleSeSendRsp(&send_server_resp);
|
||||
app_print_info("read kalive ud\r\n");
|
||||
}
|
||||
else if(p_data->ser_read.handle == app_ble_server_get_attr_id(p_nevsps_env->server_handle,p_nevsps_env->cts_handle))
|
||||
{
|
||||
send_server_resp.handle =app_ble_server_get_attr_id(p_nevsps_env->server_handle,p_nevsps_env->cts_handle);
|
||||
|
@ -295,7 +304,8 @@ static void ble_server_callback_handle(tBSA_BLE_EVT event, tBSA_BLE_MSG *p_data)
|
|||
BSA_BleSeSendRsp(&send_server_resp);
|
||||
app_print_info("read cts char\r\n");
|
||||
break;
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
send_server_resp.handle = p_data->ser_read.handle;
|
||||
send_server_resp.len = strlen(APP_BLE_NEVSPS_NULL_READ);
|
||||
|
@ -352,12 +362,14 @@ static void ble_server_callback_handle(tBSA_BLE_EVT event, tBSA_BLE_MSG *p_data)
|
|||
if(0 != status)
|
||||
{
|
||||
APP_ERROR1("send bt evt dbus err:%d\r\n",status);
|
||||
|
||||
|
||||
}
|
||||
|
||||
APP_MEM_FREE(p_bt_evt_json);
|
||||
p_bt_evt_json = NULL;
|
||||
|
||||
//lupeng add 20180731 start kalive ntf
|
||||
app_nevsps_kalive_ntf_start();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -377,6 +389,9 @@ static void ble_server_callback_handle(tBSA_BLE_EVT event, tBSA_BLE_MSG *p_data)
|
|||
APP_ERROR1("set the ble undiscoverable err:%d\r\n",status);
|
||||
}
|
||||
|
||||
//lupeng add 20180731 start kalive ntf
|
||||
app_nevsps_kalive_ntf_stop();
|
||||
|
||||
status = api_nevsps_le_state_notify(LE_MSG_TYPE_DISC,p_data->ser_close.reason);
|
||||
if(APP_NEVSPS_SUCCESS != status)
|
||||
{
|
||||
|
@ -473,6 +488,9 @@ nevsps_env_sdef * nevsps_env_share(void)
|
|||
.rx_cccd_handle = APP_NEVSPS_ATTR_HANDLE_INVALID,
|
||||
.cts_ud_handle = APP_NEVSPS_ATTR_HANDLE_INVALID,
|
||||
.cts_cccd_handle = APP_NEVSPS_ATTR_HANDLE_INVALID,
|
||||
.kalive_handle = APP_NEVSPS_ATTR_HANDLE_INVALID,
|
||||
.kalive_ud_handle= APP_NEVSPS_ATTR_HANDLE_INVALID,
|
||||
.kalive_cccd_handle= APP_NEVSPS_ATTR_HANDLE_INVALID,
|
||||
.on_nevsps_evt = ble_server_callback_handle,
|
||||
.serv_creatred_wait =false,
|
||||
.rx_enabled = false,
|
||||
|
@ -561,7 +579,9 @@ int ble_adv_set()
|
|||
|
||||
adv_conf.len = 0;
|
||||
adv_conf.flag = BSA_DM_BLE_ADV_FLAG_MASK;
|
||||
adv_conf.adv_data_mask = BSA_DM_BLE_AD_BIT_DEV_NAME |BSA_DM_BLE_AD_BIT_FLAGS|BSA_DM_BLE_AD_BIT_SERVICE|BSA_DM_BLE_AD_BIT_APPEARANCE|BSA_DM_BLE_AD_BIT_MANU;
|
||||
//adv_conf.adv_data_mask = BSA_DM_BLE_AD_BIT_DEV_NAME |BSA_DM_BLE_AD_BIT_FLAGS|BSA_DM_BLE_AD_BIT_SERVICE|BSA_DM_BLE_AD_BIT_APPEARANCE|BSA_DM_BLE_AD_BIT_MANU;
|
||||
adv_conf.adv_data_mask = BSA_DM_BLE_AD_BIT_DEV_NAME |BSA_DM_BLE_AD_BIT_FLAGS|BSA_DM_BLE_AD_BIT_SERVICE|BSA_DM_BLE_AD_BIT_MANU;
|
||||
|
||||
adv_conf.num_service =BLE_SERV_CNT;
|
||||
for(int i=0; i <adv_conf.num_service;i++ )
|
||||
{
|
||||
|
@ -616,6 +636,56 @@ int api_nevsps_rx_indicate(UINT16 size,UINT8 *p_data)
|
|||
return app_ble_server_send_indication_k(p_nevsps_env->server_handle,p_nevsps_env->service_handle,p_nevsps_env->rx_handle,false,p_data,size );
|
||||
}
|
||||
|
||||
int api_nevsps_kalive_indicate(UINT16 size,UINT8 *p_data)
|
||||
{
|
||||
nevsps_env_sdef * p_nevsps_env = nevsps_env_share();
|
||||
|
||||
if(NULL == p_nevsps_env) return APP_NEVSPS_NULL;
|
||||
if(0 == size || NULL == p_data) return APP_NEVSPS_NULL;
|
||||
|
||||
APP_INFO1("<================================kalive=======Notify data size is %d : \r\n",size);
|
||||
debug_raw_dump(p_data,size);
|
||||
|
||||
return app_ble_server_send_indication_k(p_nevsps_env->server_handle,p_nevsps_env->service_handle,p_nevsps_env->kalive_handle,false,p_data,size);
|
||||
}
|
||||
|
||||
static int kalive_flag = 0;
|
||||
|
||||
static void * app_nevsps_kalive_ntf_thread(void *args)
|
||||
{
|
||||
INT16 i2_cnt = 0;
|
||||
kalive_flag = 1;
|
||||
char* ntfdata = "Hi";
|
||||
while(kalive_flag)
|
||||
{
|
||||
if(i2_cnt == 50)
|
||||
{
|
||||
api_nevsps_kalive_indicate(strlen(ntfdata), ntfdata);
|
||||
i2_cnt = 0;
|
||||
}
|
||||
i2_cnt++;
|
||||
usleep(100 * 1000);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void app_nevsps_kalive_ntf_start()
|
||||
{
|
||||
pthread_t kalive_pth;
|
||||
APP_ERROR0("app_nevsps_kalive_ntf_start enter!!!\r\n");
|
||||
pthread_create(&kalive_pth,NULL,app_nevsps_kalive_ntf_thread,NULL);
|
||||
pthread_detach(kalive_pth);
|
||||
}
|
||||
|
||||
void app_nevsps_kalive_ntf_stop()
|
||||
{
|
||||
kalive_flag = 0;
|
||||
APP_ERROR0("app_nevsps_kalive_ntf_stop enter!!!\r\n");
|
||||
}
|
||||
|
||||
|
||||
int app_nevsps_create_characs(nevsps_env_sdef * p_nevsps_env)
|
||||
{
|
||||
if(NULL == p_nevsps_env) return APP_NEVSPS_ERR_NULL;
|
||||
|
@ -734,6 +804,44 @@ int app_nevsps_create_characs(nevsps_env_sdef * p_nevsps_env)
|
|||
return -1;
|
||||
}
|
||||
|
||||
//lupeng add 20180731
|
||||
|
||||
p_nevsps_env->kalive_handle = app_ble_server_add_char_k(p_nevsps_env->server_handle,
|
||||
p_nevsps_env->service_handle,
|
||||
APP_BLE_NEVSPS_KALIVE_CHAR_UUID,
|
||||
false,
|
||||
BLE_ATTR_PERMISSION_WRITE_AND_READ,
|
||||
BLE_ATTR_PROPERTY_NOTIFY);
|
||||
if(0 > p_nevsps_env->kalive_handle)
|
||||
{
|
||||
APP_ERROR0("Couldn't Create nevsps keepalive charac user descrip,exiting");
|
||||
return -1;
|
||||
}
|
||||
|
||||
p_nevsps_env->kalive_cccd_handle = app_ble_server_add_char_k(p_nevsps_env->server_handle,
|
||||
p_nevsps_env->service_handle,
|
||||
APP_BLE_NEVSPS_CHARAC_DESC_UUID,
|
||||
true,
|
||||
BLE_ATTR_PERMISSION_WRITE_AND_READ,
|
||||
BLE_ATTR_PROPERTY_WRITE);
|
||||
if(0 > p_nevsps_env->kalive_cccd_handle)
|
||||
{
|
||||
APP_ERROR0("Couldn't Create nevsps rx charac user descript, exiting");
|
||||
return -1;
|
||||
}
|
||||
|
||||
p_nevsps_env->kalive_ud_handle = app_ble_server_add_char_k(p_nevsps_env->server_handle,
|
||||
p_nevsps_env->service_handle,
|
||||
APP_BLE_NEVSPS_USR_DESC_UUID,
|
||||
true,
|
||||
BLE_ATTR_PERMISSION_RAED,
|
||||
BLE_ATTR_PROPERTY_READ);
|
||||
if(0 > p_nevsps_env->kalive_ud_handle)
|
||||
{
|
||||
APP_ERROR0("Couldn't Create nevsps rx charac user descript, exiting");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return APP_NEVSPS_SUCCESS;
|
||||
}
|
||||
|
@ -1042,7 +1150,7 @@ int app_nevsps_disconnect(void)
|
|||
|
||||
if(NULL == p_nevsps_env)
|
||||
{
|
||||
APP_ERROR0("Nevsps env get nul!!");
|
||||
APP_ERROR0("Nevsps env get null!!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1540,6 +1648,25 @@ int api_nevsps_trig_service_create()
|
|||
return status;
|
||||
}
|
||||
|
||||
int api_nevsps_kalive_evt_notify(INT16 start)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
le_evt_msg_sdef le_msg;
|
||||
nevsps_env_sdef * p_nevsps_env = nevsps_env_share();
|
||||
|
||||
if(NULL == p_nevsps_env) return APP_NEVSPS_NULL;
|
||||
|
||||
le_msg.evt = LE_MSG_TYPE_NEVSPS_KALIVE;
|
||||
le_msg.data.recode = start;
|
||||
|
||||
APP_CHECK_HDL(p_nevsps_env->le_evt_noti_handle)
|
||||
{
|
||||
status = p_nevsps_env->le_evt_noti_handle(p_nevsps_env,le_msg);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
#if APP_NEVSPS_MODULE_MAIN
|
||||
|
|
|
@ -46,6 +46,7 @@ typedef enum{
|
|||
APP_AVK_RC_PAUSE,
|
||||
APP_AVK_RC_PLAY,
|
||||
APP_AVK_VOL_CHANGE,
|
||||
APP_AVK_NEW_DEVICE_TRY_CONNECT,
|
||||
}APP_BT_EVENT;
|
||||
|
||||
typedef struct{
|
||||
|
|
|
@ -34,6 +34,7 @@ enum BT_EVENT{
|
|||
BT_AVK_RC_PAUSE,
|
||||
BT_AVK_RC_PLAY,
|
||||
BT_AVK_VOL_CHANGE,
|
||||
BT_AVK_NEW_DEVICE_TRY_CONNECT,
|
||||
};
|
||||
|
||||
enum BLE_EVENT{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define APP_CMD_WIFI_CONFIG_RESP 0x1002
|
||||
|
||||
#define APP_ADDR_MAC_SIZE 6
|
||||
#define APP_BT_ADDR_JSON_KEY "blueAddr"
|
||||
#define APP_BT_ADDR_JSON_KEY "btAddr"
|
||||
#define APP_BT_DEFAULT_ADDR "FF:FF:FF:FF:FF:FF"
|
||||
#define APP_CHECK_MOUNTS_CMD_STR "cat /proc/mounts"
|
||||
#define APP_CHECK_UNDISK_STR "/mnt/UDISK"
|
||||
|
@ -62,6 +62,7 @@ static const char* g_pDBusInterfaceName = NULL;
|
|||
static uv_timer_t timerCurPosMsg;
|
||||
static bool firstEntry = true;
|
||||
static BtAvkRcStatusEdef mRcStatus = BT_AVK_RC_STATUS_PAUSE;
|
||||
static int tmpVol = -1;
|
||||
|
||||
c_bt c;
|
||||
|
||||
|
@ -422,6 +423,41 @@ std::string addrsFormatHex(char * addr,int size)
|
|||
return retNss.substr(0,retNss.length()-1);
|
||||
}
|
||||
|
||||
|
||||
int btNameBroadcast(void)
|
||||
{
|
||||
int ret = 0;
|
||||
char * p_name =NULL;
|
||||
char *p_json_name = NULL;
|
||||
|
||||
ret = c.get_bt_name(&p_name);
|
||||
if( 0 != ret || NULL == p_name)
|
||||
{
|
||||
LOG_EX(LOG_Info,"get bt name err:%d\r\n",ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
p_json_name = api_nevsps_bt_name_json_get(p_name);
|
||||
if(NULL != p_json_name )
|
||||
{
|
||||
ret = api_nevsps_module_cmd_send((1<<MODULE_CONTROLLER)|(1<<MODULE_MANUFACTURE)|(1<<MODULE_BT_DEMO),CMD_BT_NAME_GET_RESP,p_json_name);
|
||||
if(0 != ret)
|
||||
{
|
||||
LOG_EX(LOG_Info,"send bt name resp dbus err:%d\r\n",ret);
|
||||
goto END;
|
||||
}
|
||||
LOG_EX(LOG_Info,"btNameBroadcast ok\r\n");
|
||||
}
|
||||
|
||||
END:
|
||||
if(p_name) free(p_name);
|
||||
p_name = NULL;
|
||||
if(p_json_name) free(p_json_name);
|
||||
p_json_name = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
PDBUS_MSG_PACK DBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn,
|
||||
PDBUS_MSG_PACK pMsg) {
|
||||
unsigned int * p_wifi_cnf_res=NULL;
|
||||
|
@ -472,42 +508,10 @@ PDBUS_MSG_PACK DBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn,
|
|||
|
||||
break;
|
||||
case CMD_BT_NAME_GET_REQ:
|
||||
//get bt name
|
||||
status = c.get_bt_name(&p_name);
|
||||
if( 0 != status)
|
||||
{
|
||||
LOG_EX(LOG_Info,"get bt name err:%d\r\n",status);
|
||||
break;
|
||||
}
|
||||
|
||||
if(NULL == p_name )
|
||||
{
|
||||
LOG_EX(LOG_Info,"no intitial\r\n");
|
||||
p_name =BT_NAME_NO_INIT;
|
||||
}
|
||||
|
||||
p_json_name = api_nevsps_bt_name_json_get(p_name);
|
||||
if(NULL != p_json_name )
|
||||
{
|
||||
status = api_nevsps_module_cmd_send((1<<MODULE_CONTROLLER)|(1<<MODULE_MANUFACTURE)|(1<<MODULE_BT_DEMO),CMD_BT_NAME_GET_RESP,p_json_name);
|
||||
if(0 != status)
|
||||
{
|
||||
LOG_EX(LOG_Info,"send bt name resp dbus err:%d\r\n",status);
|
||||
|
||||
free(p_name);
|
||||
p_name = NULL;
|
||||
free(p_json_name);
|
||||
p_json_name = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(p_name);
|
||||
p_name = NULL;
|
||||
free(p_json_name);
|
||||
p_json_name = NULL;
|
||||
|
||||
|
||||
if((status = btNameBroadcast()) != 0)
|
||||
{
|
||||
LOG_EX(LOG_Error,"btNameBroadcast error\r\n");
|
||||
}
|
||||
break;
|
||||
case CMD_BT_RESET:
|
||||
LOG_EX(LOG_Info,"cmd CMD_BT_RESET\r\n");
|
||||
|
@ -644,6 +648,7 @@ PDBUS_MSG_PACK DBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn,
|
|||
}
|
||||
}
|
||||
break;
|
||||
#if 1
|
||||
case CMD_CONTROLLER_RSPMSG_PLAYERSTATUS:
|
||||
{
|
||||
char * pSrcType = NULL;
|
||||
|
@ -661,7 +666,10 @@ PDBUS_MSG_PACK DBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn,
|
|||
{
|
||||
int volPer = (*(int *)p_volPer);
|
||||
LOG_EX(LOG_Debug, "volPer = %d\r\n",volPer);
|
||||
c.avk_set_volume(volPer);
|
||||
if(tmpVol >= 0 && tmpVol != volPer){
|
||||
c.avk_set_volume(volPer);
|
||||
}
|
||||
tmpVol = volPer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -684,6 +692,7 @@ PDBUS_MSG_PACK DBusOnMessage(uv_loop_t *pLoop, DBusConnection *pConn,
|
|||
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
||||
|
@ -724,6 +733,8 @@ void bt_event_f(BT_EVENT event, void *reply, int *len)
|
|||
LOG_EX(LOG_Info,"Media stop playing!\n");
|
||||
//c.avk_resume_pcm_alsa();
|
||||
api_nevsps_module_cmd_send(1<<MODULE_CONTROLLER,CMD_BT_AVK_SOUND_STOP_EVT,NULL);
|
||||
//api_nevsps_module_cmd_send(1<<MODULE_CONTROLLER,CMD_BT_AVK_RC_PAUSE,NULL);
|
||||
tmpVol = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -753,10 +764,10 @@ void bt_event_f(BT_EVENT event, void *reply, int *len)
|
|||
|
||||
case BT_AVK_RC_PAUSE:
|
||||
{
|
||||
if(BT_AVK_RC_STATUS_PLAY == mRcStatus)
|
||||
//if(BT_AVK_RC_STATUS_PLAY == mRcStatus)
|
||||
{
|
||||
LOG_EX(LOG_Info,"bt rc pause evt!\n");
|
||||
mRcStatus = BT_AVK_RC_STATUS_PAUSE;
|
||||
//mRcStatus = BT_AVK_RC_STATUS_PAUSE;
|
||||
api_nevsps_module_cmd_send(1<<MODULE_CONTROLLER,CMD_BT_AVK_RC_PAUSE,NULL);
|
||||
|
||||
//notify
|
||||
|
@ -766,10 +777,10 @@ void bt_event_f(BT_EVENT event, void *reply, int *len)
|
|||
|
||||
case BT_AVK_RC_PLAY:
|
||||
{
|
||||
if(BT_AVK_RC_STATUS_PAUSE == mRcStatus)
|
||||
//if(BT_AVK_RC_STATUS_PAUSE == mRcStatus)
|
||||
{
|
||||
LOG_EX(LOG_Info,"bt rc play evt!\n");
|
||||
mRcStatus = BT_AVK_RC_STATUS_PLAY;
|
||||
//mRcStatus = BT_AVK_RC_STATUS_PLAY;
|
||||
api_nevsps_module_cmd_send(1<<MODULE_CONTROLLER,CMD_BT_AVK_RC_PLAY,NULL);
|
||||
//notify
|
||||
}
|
||||
|
@ -783,7 +794,13 @@ void bt_event_f(BT_EVENT event, void *reply, int *len)
|
|||
api_nevsps_module_msg_Send(1<<MODULE_CONTROLLER,CMD_BT_VOL_CHANGE,"volume", *(int*)reply);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BT_AVK_NEW_DEVICE_TRY_CONNECT:
|
||||
{
|
||||
LOG_EX(LOG_Info,"connect conflict\n");
|
||||
api_nevsps_module_cmd_send(1<<MODULE_CONTROLLER,CMD_BT_AVK_DEV_CON_CONFLICT,NULL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -890,6 +907,11 @@ int main(int argc, char *args[]){
|
|||
ret = uv_timer_start(&timerCurPosMsg, callback, BT_WAIT_TIME, 0);
|
||||
LOG_EX(LOG_Warn, "uv_timer_start: %d\n", ret);
|
||||
|
||||
if((status = btNameBroadcast()) != 0)
|
||||
{
|
||||
LOG_EX(LOG_Error,"btNameBroadcast error\r\n");
|
||||
}
|
||||
|
||||
//uv_run(pLoop, UV_RUN_DEFAULT);
|
||||
RunUVLoop(pLoop);
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@ static int ble_discoverable;
|
|||
static int ble_connectable;
|
||||
static tBSA_BLE_MSG bsa_ble_msg;
|
||||
|
||||
//link status
|
||||
static int link_status = 0;
|
||||
//link type
|
||||
static UINT8 link_type = 0;
|
||||
|
||||
//avk status
|
||||
static int avk_music_playing = 0;
|
||||
|
@ -524,7 +524,7 @@ static void app_avk_callback(tBSA_AVK_EVT event, tBSA_AVK_MSG *p_data)
|
|||
{
|
||||
|
||||
APP_ERROR1("-------INFO: avk evt get is %d\r\n",event);
|
||||
static int pause_flag =0;
|
||||
//static int pause_flag =0;
|
||||
switch(event)
|
||||
{
|
||||
case BSA_AVK_OPEN_EVT:
|
||||
|
@ -549,11 +549,11 @@ static void app_avk_callback(tBSA_AVK_EVT event, tBSA_AVK_MSG *p_data)
|
|||
}
|
||||
case BSA_AVK_START_EVT:
|
||||
{
|
||||
if(1 == pause_flag)
|
||||
/*if(1 == pause_flag)
|
||||
{
|
||||
pause_flag =0;
|
||||
bt_event_transact(p_cbt, APP_AVK_RC_PAUSE, NULL, NULL);
|
||||
}
|
||||
}*/
|
||||
/* already received BSA_AVK_OPEN_EVT */
|
||||
if(avk_connected_inner == 1){
|
||||
avk_connected_inner = 2;
|
||||
|
@ -577,32 +577,36 @@ static void app_avk_callback(tBSA_AVK_EVT event, tBSA_AVK_MSG *p_data)
|
|||
{
|
||||
APP_DEBUG0("BT is stop music!\n");
|
||||
avk_music_playing = 0;
|
||||
pause_flag =0;
|
||||
//pause_flag =0;
|
||||
bt_event_transact(p_cbt, APP_AVK_STOP_EVT, NULL, NULL);
|
||||
APP_INFO0("-----Avk Stop,rc pause remap cmd\r\n");
|
||||
bt_event_transact(p_cbt, APP_AVK_RC_PAUSE, NULL, NULL);
|
||||
//bt_event_transact(p_cbt, APP_AVK_RC_PAUSE, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
case BSA_AVK_REGISTER_NOTIFICATION_EVT:
|
||||
{
|
||||
|
||||
APP_ERROR1("-------INFO: avk register player status is %d,opcode is %d\r\n",p_data->reg_notif.rsp.param.play_status,p_data->reg_notif.rsp.opcode);
|
||||
if(AVRC_PLAYSTATE_PAUSED == p_data->reg_notif.rsp.param.play_status)
|
||||
APP_ERROR1("-------INFO: avk register player event_id is %d, status is %d,opcode is %d\r\n",
|
||||
p_data->reg_notif.rsp.event_id, p_data->reg_notif.rsp.param.play_status,p_data->reg_notif.rsp.opcode);
|
||||
if(p_data->reg_notif.rsp.event_id == AVRC_EVT_PLAY_STATUS_CHANGE)
|
||||
{
|
||||
//bt_event_transact(p_cbt, APP_AVK_RC_PAUSE, NULL, NULL);
|
||||
pause_flag =1;
|
||||
}else if(AVRC_PLAYSTATE_PLAYING == p_data->reg_notif.rsp.param.play_status)
|
||||
{
|
||||
pause_flag =0;
|
||||
bt_event_transact(p_cbt, APP_AVK_RC_PLAY, NULL, NULL);
|
||||
}
|
||||
if(AVRC_PLAYSTATE_PAUSED == p_data->reg_notif.rsp.param.play_status)
|
||||
{
|
||||
bt_event_transact(p_cbt, APP_AVK_RC_PAUSE, NULL, NULL);
|
||||
//pause_flag =1;
|
||||
}else if(AVRC_PLAYSTATE_PLAYING == p_data->reg_notif.rsp.param.play_status)
|
||||
{
|
||||
//pause_flag =0;
|
||||
bt_event_transact(p_cbt, APP_AVK_RC_PLAY, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BSA_AVK_CP_INFO_EVT:
|
||||
{
|
||||
pause_flag =0;
|
||||
//pause_flag =0;
|
||||
APP_ERROR0("-----Content protect,rc play remap cmd\r\n");
|
||||
bt_event_transact(p_cbt, APP_AVK_RC_PLAY, NULL, NULL);
|
||||
}
|
||||
|
@ -610,7 +614,7 @@ static void app_avk_callback(tBSA_AVK_EVT event, tBSA_AVK_MSG *p_data)
|
|||
|
||||
case BSA_AVK_RC_CLOSE_EVT:
|
||||
{
|
||||
pause_flag =0;
|
||||
//pause_flag =0;
|
||||
APP_ERROR0("-----Avk rc close, rc pause remap cmd\r\n");
|
||||
bt_event_transact(p_cbt, APP_AVK_RC_PAUSE, NULL, NULL);
|
||||
}
|
||||
|
@ -921,20 +925,35 @@ static void bsa_sec_callback(tBSA_SEC_EVT event, tBSA_SEC_MSG *p_data)
|
|||
|
||||
switch(event){
|
||||
case BSA_SEC_LINK_UP_EVT:
|
||||
APP_DEBUG0("BSA_SEC_LINK_UP_EVT\r\n");
|
||||
link_status = 1;
|
||||
APP_DEBUG1("BSA_SEC_LINK_UP_EVT, link_type = %d\r\n", link_type);
|
||||
if(link_type > 0)
|
||||
{
|
||||
if((p_data->link_up.link_type == (p_data->link_up.link_type & link_type)) && (p_data->link_up.link_type == BT_TRANSPORT_BR_EDR))
|
||||
{
|
||||
bt_event_transact(p_cbt, APP_AVK_NEW_DEVICE_TRY_CONNECT, NULL, NULL);
|
||||
APP_DEBUG0("BSA_SEC_LINK_UP_EVT one device has connected...\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
link_type |= p_data->link_up.link_type;
|
||||
break;
|
||||
|
||||
case BSA_SEC_LINK_DOWN_EVT:
|
||||
APP_DEBUG1("BSA_SEC_LINK_DOWN_EVT, avk disconnect cmd %d avk connected %d\r\n", avk_disconnect_cmd, avk_connected_inner);
|
||||
if(avk_disconnect_cmd == 1 || avk_connected_inner == 0){
|
||||
avk_disconnect_cmd = 0;
|
||||
link_status = 0;
|
||||
connect_link_status = 0;
|
||||
link_reason = p_data->link_down.status;
|
||||
reply_len = 4;
|
||||
bt_event_transact(p_cbt, APP_AVK_DISCONNECTED_EVT, (void *)&link_reason, &reply_len);
|
||||
APP_DEBUG0("BSA_SEC_LINK_DOWN_EVT return from app!\n");
|
||||
if((cur_connected_dev[0] == 0 && cur_connected_dev[1] == 0 && cur_connected_dev[2] == 0 && cur_connected_dev[3] == 0
|
||||
&& cur_connected_dev[4] == 0 && cur_connected_dev[5] == 0) || bdcmp(cur_connected_dev, p_data->link_down.bd_addr) == 0)
|
||||
{
|
||||
APP_DEBUG1("BSA_SEC_LINK_DOWN_EVT, avk disconnect cmd %d avk connected %d link_type:%d\r\n",
|
||||
avk_disconnect_cmd, avk_connected_inner, link_type);
|
||||
if(avk_disconnect_cmd == 1 || avk_connected_inner == 0){
|
||||
avk_disconnect_cmd = 0;
|
||||
if((link_type ^ p_data->link_down.link_type) != (BT_TRANSPORT_BR_EDR | BT_TRANSPORT_LE))
|
||||
link_type ^= p_data->link_down.link_type;
|
||||
connect_link_status = 0;
|
||||
link_reason = p_data->link_down.status;
|
||||
reply_len = 4;
|
||||
bt_event_transact(p_cbt, APP_AVK_DISCONNECTED_EVT, (void *)&link_reason, &reply_len);
|
||||
APP_DEBUG0("BSA_SEC_LINK_DOWN_EVT return from app!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -943,6 +962,7 @@ static void bsa_sec_callback(tBSA_SEC_EVT event, tBSA_SEC_MSG *p_data)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int bluetooth_init()
|
||||
{
|
||||
discoverable = 1;
|
||||
|
@ -1199,9 +1219,9 @@ void s_set_volume(int volume)
|
|||
}
|
||||
|
||||
app_avk_cb.volume = volume;
|
||||
alsa_vol = (63 * app_avk_cb.volume)/127;
|
||||
/*alsa_vol = (63 * app_avk_cb.volume)/127;
|
||||
sprintf(buffer, "amixer cset name='headphone volume' '%d'", alsa_vol);
|
||||
system(buffer);
|
||||
system(buffer);*/
|
||||
|
||||
app_avk_reg_notfn_rsp(app_avk_cb.volume,
|
||||
connection->rc_handle,
|
||||
|
@ -1242,14 +1262,14 @@ int s_connect_auto()
|
|||
printf("s connect auto\n");
|
||||
|
||||
/* wait disconnect completed */
|
||||
while(link_status == 1){
|
||||
while((link_type & BT_TRANSPORT_BR_EDR) == BT_TRANSPORT_BR_EDR){
|
||||
usleep(100*1000);
|
||||
i++;
|
||||
if(i>60){
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("link status %d\n", link_status);
|
||||
printf("link_type %d\n", link_type);
|
||||
|
||||
connect_link_status = 1;
|
||||
memset(last_connected_dev, 0, sizeof(last_connected_dev));
|
||||
|
@ -1314,7 +1334,7 @@ void s_disconnect()
|
|||
|
||||
app_avk_close(cur_connected_dev);
|
||||
|
||||
while(1 == link_status)
|
||||
while((link_type & BT_TRANSPORT_BR_EDR) == BT_TRANSPORT_BR_EDR)
|
||||
{
|
||||
usleep(500*1000);
|
||||
if(++cnt>12)
|
||||
|
|
|
@ -668,6 +668,11 @@ extern "C" void bt_event_transact(void *p, APP_BT_EVENT event, void *reply, int
|
|||
p_c_bt->event_callback(BT_AVK_VOL_CHANGE, reply, len);
|
||||
break;
|
||||
}
|
||||
case APP_AVK_NEW_DEVICE_TRY_CONNECT:
|
||||
{
|
||||
p_c_bt->event_callback(BT_AVK_NEW_DEVICE_TRY_CONNECT, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
|
|
@ -150,20 +150,24 @@ int wifi_change_fw_path(const char *fwpath);
|
|||
*/
|
||||
|
||||
#ifndef WIFI_ENTROPY_FILE
|
||||
#define WIFI_ENTROPY_FILE "/etc/wifi/entropy.bin"
|
||||
//#define WIFI_ENTROPY_FILE "/etc/wifi/entropy.bin"
|
||||
#define WIFI_ENTROPY_FILE "/mnt/UDISK/wifi/entropy.bin"
|
||||
#endif
|
||||
int ensure_entropy_file_exists();
|
||||
|
||||
/*path of firmware for WIFI in different mode*/
|
||||
#ifndef WIFI_DRIVER_FW_PATH_STA
|
||||
#define WIFI_DRIVER_FW_PATH_STA "/lib/firmware/fw_bcm43438a0.bin"
|
||||
//#define WIFI_DRIVER_FW_PATH_STA "/lib/firmware/fw_bcm43438a0.bin"
|
||||
#define WIFI_DRIVER_FW_PATH_STA "/lib/firmware/fw_bcm43436b0.bin"
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_DRIVER_FW_PATH_AP
|
||||
#define WIFI_DRIVER_FW_PATH_AP "/lib/firmware/fw_bcm43438a0_apsta.bin"
|
||||
//#define WIFI_DRIVER_FW_PATH_AP "/lib/firmware/fw_bcm43438a0_apsta.bin"
|
||||
#define WIFI_DRIVER_FW_PATH_AP "/lib/firmware/fw_bcm43436b0_apsta.bin"
|
||||
#endif
|
||||
#ifndef WIFI_DRIVER_FW_PATH_P2P
|
||||
#define WIFI_DRIVER_FW_PATH_P2P "/lib/firmware/fw_bcm43438a0_p2p.bin"
|
||||
//#define WIFI_DRIVER_FW_PATH_P2P "/lib/firmware/fw_bcm43438a0_p2p.bin"
|
||||
#define WIFI_DRIVER_FW_PATH_P2P "/lib/firmware/fw_bcm43436b0_p2p.bin"
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_DRIVER_FW_PATH_PARAM
|
||||
|
|
|
@ -43,15 +43,18 @@
|
|||
#include "netd_softap_controller.h"
|
||||
#include "filesystem_config.h"
|
||||
|
||||
static const char HOSTAPD_CONF_FILE[] = "/etc/wifi/hostapd.conf";
|
||||
static const char HOSTAPD_CONF_FILE_PREV[] = "/etc/wifi/hostapd.conf";
|
||||
static const char HOSTAPD_CONF_FILE[] = "/mnt/UDISK/wifi/hostapd.conf";
|
||||
static const char HOSTAPD_BIN_FILE[] = "/usr/sbin/hostapd";
|
||||
static const char SUPP_CONFIG_DIR[] = "/mnt/UDISK/wifi/";
|
||||
|
||||
#ifndef SHA256_DIGEST_LENGTH
|
||||
#define SHA256_DIGEST_LENGTH 32
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_ENTROPY_FILE
|
||||
#define WIFI_ENTROPY_FILE "/etc/wifi/entropy.bin"
|
||||
//#define WIFI_ENTROPY_FILE "/etc/wifi/entropy.bin"
|
||||
#define WIFI_ENTROPY_FILE "/mnt/UDISK/wifi/entropy.bin"
|
||||
#endif
|
||||
|
||||
#ifndef WIFI_GET_FW_PATH_AP
|
||||
|
@ -93,6 +96,104 @@ SoftapController::SoftapController()
|
|||
SoftapController::~SoftapController() {
|
||||
}
|
||||
*/
|
||||
|
||||
static int ensure_dir_exits(const char * dir)
|
||||
{
|
||||
if(NULL == dir) return -1;
|
||||
if(NULL == opendir(dir))
|
||||
{
|
||||
return mkdir(dir,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ensure_file_exists(const char *config_file,const char *temp_file)
|
||||
{
|
||||
char* buf = NULL;
|
||||
int srcfd, destfd;
|
||||
struct stat sb;
|
||||
int nread;
|
||||
int ret;
|
||||
|
||||
ret = access(config_file, R_OK|W_OK);
|
||||
if ((ret == 0) || (errno == EACCES)) {
|
||||
goto END;
|
||||
} else if (errno != ENOENT) {
|
||||
printf("Cannot access \"%s\": %s\n", config_file, strerror(errno));
|
||||
goto ERR;
|
||||
}
|
||||
|
||||
srcfd = TEMP_FAILURE_RETRY(open(temp_file, O_RDONLY));
|
||||
if (srcfd < 0) {
|
||||
printf("Cannot open \"%s\": %s\n", temp_file, strerror(errno));
|
||||
goto ERR;
|
||||
}
|
||||
|
||||
destfd = TEMP_FAILURE_RETRY(open(config_file, O_CREAT|O_RDWR, 0660));
|
||||
if (destfd < 0) {
|
||||
close(srcfd);
|
||||
printf("Cannot create \"%s\": %s\n", config_file, strerror(errno));
|
||||
goto ERR;
|
||||
}
|
||||
|
||||
buf = (char*)calloc(1, sizeof(char)*2048);
|
||||
if(buf == NULL)
|
||||
{
|
||||
printf("Cannot malloc buf!\n");
|
||||
goto ERR;
|
||||
}
|
||||
|
||||
while ((nread = TEMP_FAILURE_RETRY(read(srcfd, buf, sizeof(buf)))) != 0) {
|
||||
if (nread < 0) {
|
||||
printf("Error reading \"%s\": %s\n", temp_file, strerror(errno));
|
||||
close(srcfd);
|
||||
close(destfd);
|
||||
unlink(config_file);
|
||||
goto ERR;
|
||||
}
|
||||
TEMP_FAILURE_RETRY(write(destfd, buf, nread));
|
||||
memset(buf, 0, 2048);
|
||||
}
|
||||
|
||||
close(destfd);
|
||||
close(srcfd);
|
||||
|
||||
/* chmod is needed because open() didn't set permisions properly */
|
||||
if (chmod(config_file, 0660) < 0) {
|
||||
printf("Error changing permissions of %s to 0660: %s\n",config_file, strerror(errno));
|
||||
unlink(config_file);
|
||||
goto ERR;
|
||||
}
|
||||
|
||||
END:
|
||||
if(buf) free(buf);
|
||||
return 0;
|
||||
|
||||
ERR:
|
||||
if(buf) free(buf);
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int check_conf_file()
|
||||
{
|
||||
if(ensure_dir_exits(SUPP_CONFIG_DIR))
|
||||
{
|
||||
printf("ensure_dir_exits %s fail\n", SUPP_CONFIG_DIR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(ensure_file_exists(HOSTAPD_CONF_FILE,HOSTAPD_CONF_FILE_PREV))
|
||||
{
|
||||
printf("ensure_file_exists %s error\n", HOSTAPD_CONF_FILE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sig_chld(int signo)
|
||||
{
|
||||
int status;
|
||||
|
@ -193,7 +294,7 @@ int is_softap_started() {
|
|||
* argv[6] - Security:wpa-psk/wpa2-psk/open
|
||||
* argv[7] - Key
|
||||
*/
|
||||
int set_softap(int set_num, char *argv[]) {
|
||||
int set_softap(int argc, char *argv[]) {
|
||||
char psk_str[2*SHA256_DIGEST_LENGTH+1];
|
||||
tRESPONSE_CODE ret = SOFTAP_STATUS_RESULT;
|
||||
int i = 0;
|
||||
|
@ -207,7 +308,13 @@ int set_softap(int set_num, char *argv[]) {
|
|||
char wbuf[FW_BUF_SIZE] = {0};
|
||||
char fbuf[FW_BUF_SIZE] = {0};
|
||||
|
||||
if (set_num < 5) {
|
||||
if(check_conf_file() == -1)
|
||||
{
|
||||
printf("Softap conf file path err!");
|
||||
return OPERATION_FAILED;
|
||||
}
|
||||
|
||||
if (argc < 5) {
|
||||
printf("Softap set is missing arguments. Please use:");
|
||||
printf("softap <wlan iface> <SSID> <hidden/broadcast> <channel> <wpa2?-psk|open> <passphrase>");
|
||||
return COMMAND_SYNTAX_ERROR;
|
||||
|
@ -216,7 +323,7 @@ int set_softap(int set_num, char *argv[]) {
|
|||
if (!strcasecmp(argv[4], "hidden"))
|
||||
hidden = 1;
|
||||
|
||||
if (set_num >= 5) {
|
||||
if (argc >= 5) {
|
||||
channel = atoi(argv[5]);
|
||||
if (channel <= 0)
|
||||
channel = AP_CHANNEL_DEFAULT;
|
||||
|
@ -232,7 +339,7 @@ int set_softap(int set_num, char *argv[]) {
|
|||
"hw_mode=g\nignore_broadcast_ssid=%d\n",
|
||||
argv[2], argv[3], channel, hidden);
|
||||
|
||||
if (set_num > 7) {
|
||||
if (argc > 7) {
|
||||
if (!strcmp(argv[6], "wpa-psk")) {
|
||||
generate_psk(argv[3], argv[7], psk_str);
|
||||
/*
|
||||
|
@ -252,7 +359,7 @@ int set_softap(int set_num, char *argv[]) {
|
|||
*/
|
||||
sprintf(fbuf, "%s", wbuf);
|
||||
}
|
||||
} else if (set_num > 6) {
|
||||
} else if (argc > 6) {
|
||||
if (!strcmp(argv[6], "open")) {
|
||||
/*
|
||||
asprintf(&fbuf, "%s", wbuf);
|
||||
|
@ -310,32 +417,32 @@ int set_softap(int set_num, char *argv[]) {
|
|||
* argv[2] - interface name
|
||||
* argv[3] - AP or P2P or STA
|
||||
*/
|
||||
int fw_reload_softap(int set_num, char *argv[])
|
||||
int fw_reload_softap(int argc, char *argv[])
|
||||
{
|
||||
int i = 0;
|
||||
char *fwpath = NULL;
|
||||
|
||||
if (set_num < 1) {
|
||||
if (argc < 4) {
|
||||
printf("SoftAP fwreload is missing arguments. Please use: softap <wlan iface> <AP|P2P|STA>");
|
||||
printf("fw_reload_softap: argc is %d\n",set_num);
|
||||
printf("fw_reload_softap: argc is %d\n",argc);
|
||||
return COMMAND_SYNTAX_ERROR;
|
||||
}
|
||||
|
||||
if (strcmp(argv[0], "AP") == 0) {
|
||||
if (strcmp(argv[3], "AP") == 0) {
|
||||
fwpath = (char *)wifi_get_fw_path(WIFI_GET_FW_PATH_AP);
|
||||
} else if (strcmp(argv[0], "P2P") == 0) {
|
||||
} else if (strcmp(argv[3], "P2P") == 0) {
|
||||
fwpath = (char *)wifi_get_fw_path(WIFI_GET_FW_PATH_P2P);
|
||||
} else if (strcmp(argv[0], "STA") == 0) {
|
||||
} else if (strcmp(argv[3], "STA") == 0) {
|
||||
fwpath = (char *)wifi_get_fw_path(WIFI_GET_FW_PATH_STA);
|
||||
}
|
||||
if (!fwpath)
|
||||
return COMMAND_PARAMETER_ERROR;
|
||||
if (wifi_change_fw_path((const char *)fwpath)) {
|
||||
printf("Softap fwReload failed\n");
|
||||
printf("Softap fwReload failed");
|
||||
return OPERATION_FAILED;
|
||||
}
|
||||
else {
|
||||
printf("Softap fwReload - Ok\n");
|
||||
printf("Softap fwReload - Ok");
|
||||
}
|
||||
return SOFTAP_STATUS_RESULT;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ system_config() {
|
|||
return 1
|
||||
}
|
||||
|
||||
hostname=`cat /sys/class/net/wlan0/address | awk '{gsub(":","",$0); print "Netease"substr(toupper($0), 9)}'`
|
||||
echo "$hostname" > /proc/sys/kernel/hostname
|
||||
[ -z "$conloglevel" -a -z "$buffersize" ] || dmesg ${conloglevel:+-n $conloglevel} ${buffersize:+-s $buffersize}
|
||||
echo "$timezone" > /tmp/TZ
|
||||
|
|
|
@ -5,6 +5,7 @@ use-ipv4=yes
|
|||
use-ipv6=yes
|
||||
check-response-ttl=no
|
||||
use-iff-running=no
|
||||
disallow-other-stacks=yes
|
||||
|
||||
[publish]
|
||||
publish-addresses=yes
|
||||
|
|
|
@ -63,9 +63,11 @@ void KPlayerRender::OnAction(const char * pAction,int value)
|
|||
}else
|
||||
if(strcmp(pAction, KPLAYER_ACTION_STOP) == 0)
|
||||
{
|
||||
m_playState = KPLAYERRENDER_STATE_PAUSE;
|
||||
avt->SetStateVariable("TransportState", "PAUSED_PLAYBACK");
|
||||
//m_playState = KPLAYERRENDER_STATE_PAUSE;
|
||||
//avt->SetStateVariable("TransportState", "PAUSED_PLAYBACK");
|
||||
//NotifyState(0,0);
|
||||
m_playState = KPLAYERRENDER_STATE_STOP;
|
||||
NotifyState(NONINT_NULL,NONINT_NULL);
|
||||
}else
|
||||
if(strcmp(pAction, KPLAYER_ACTION_PAUSE) == 0)
|
||||
{
|
||||
|
@ -132,13 +134,13 @@ void KPlayerRender::NotifyState(int secTime,int secDuration,int vol)
|
|||
}
|
||||
|
||||
/* don't update state while transitioning */
|
||||
NPT_String state;
|
||||
/*NPT_String state;
|
||||
avt->GetStateVariableValue("TransportState", state);
|
||||
if(state == "TRANSITIONING")
|
||||
{
|
||||
LOG_EX(LOG_Info,"Get state is TRANSITIONING!, do not notify state\r\n");
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
if(-1 != vol)
|
||||
{
|
||||
|
@ -217,8 +219,8 @@ NPT_Result KPlayerRender::PlayAction(const NPT_String& uri, const NPT_String& me
|
|||
|
||||
// just return success because the play actions are asynchronous
|
||||
NPT_AutoLock lock(m_state);
|
||||
service->SetStateVariable("TransportState", "PLAYING");
|
||||
service->SetStateVariable("TransportStatus", "OK");
|
||||
//service->SetStateVariable("TransportState", "PLAYING");
|
||||
//service->SetStateVariable("TransportStatus", "OK");
|
||||
service->SetStateVariable("AVTransportURI", uri);
|
||||
service->SetStateVariable("AVTransportURIMetaData", meta);
|
||||
|
||||
|
@ -328,8 +330,8 @@ NPT_Result KPlayerRender::OnSetAVTransportURI(PLT_ActionReference & action)
|
|||
|
||||
LOG_EX(LOG_Info,"OnSetAVTransportURI\r\n");
|
||||
|
||||
//m_playState = KPLAYERRENDER_STATE_STOP;
|
||||
//NotifyState(NONINT_NULL,NONINT_NULL);
|
||||
m_playState = KPLAYERRENDER_STATE_STOP;
|
||||
NotifyState(NONINT_NULL,NONINT_NULL);
|
||||
|
||||
NPT_CHECK_SEVERE(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", service));
|
||||
|
||||
|
@ -351,7 +353,7 @@ NPT_Result KPlayerRender::OnSetAVTransportURI(PLT_ActionReference & action)
|
|||
|
||||
}
|
||||
|
||||
|
||||
m_time = 0;
|
||||
NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
|
||||
|
||||
MesgDai::shareInst().mesgSend(KPLAYER_MSG_TYPE_SET_URL,KPLAYER_URL_JSON_KEY,(char *)uri.GetChars());
|
||||
|
@ -360,8 +362,6 @@ NPT_Result KPlayerRender::OnSetAVTransportURI(PLT_ActionReference & action)
|
|||
LOG_EX(LOG_Info,"Get Uri is %s\r\n",uri.GetChars());
|
||||
LOG_EX(LOG_Info,"Get meta is %s\r\n",meta.GetChars());
|
||||
|
||||
curUri = uri;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -411,6 +411,12 @@ bool KPlayerRender::CheckMusicUri(char* uri)
|
|||
{
|
||||
if(uri == NULL) return false;
|
||||
|
||||
NPT_String curUri;
|
||||
PLT_Service* service;
|
||||
// look for value set previously by SetAVTransportURI
|
||||
NPT_CHECK_SEVERE(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", service));
|
||||
NPT_CHECK_SEVERE(service->GetStateVariableValue("AVTransportURI", curUri));
|
||||
|
||||
int uriLen = strlen(uri);
|
||||
char _uri[uriLen+1] = {0};
|
||||
if(uri[0] == '\"')
|
||||
|
|
|
@ -70,8 +70,6 @@ private:
|
|||
int m_time = 0;
|
||||
int m_duration = 0;
|
||||
int m_metaDuration;
|
||||
NPT_String curUri;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#endif
|
||||
|
||||
#define CUR_POS_MSG_TIME 3000
|
||||
#define POS_NO_CHANGE_TIMEOUT 6000 //6秒如果还没有更新pos就认为网络有问题,直接停止
|
||||
|
||||
/*
|
||||
* 是否允许terminal控制播放模块,仅测试用
|
||||
*/
|
||||
|
@ -78,6 +80,8 @@ static unsigned long lastCmdTime = 0; // 毫秒
|
|||
|
||||
static unsigned int maxLastTime = 0, minLastTime = 0xffffffff;
|
||||
|
||||
static void playerCallbackHandler(uint32 playerId, PlayerStatus st, char *musicUuid, int musicUuidLen);
|
||||
|
||||
inline static unsigned long getTime(){
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv,NULL);
|
||||
|
@ -524,8 +528,9 @@ static void DBusSendPlayerSt(PlayerStatusOut playerSt){
|
|||
return;
|
||||
}
|
||||
memset(player_to_ctrl, 0, sizeof(PLAYER_TO_CTRL));
|
||||
if(NULL != playerSt.musicUuid){
|
||||
if(NULL != playerSt.musicUuid && (strlen(playerSt.musicUuid) < MAX_MUSIC_UUID)){
|
||||
memcpy(player_to_ctrl->musicUuid, playerSt.musicUuid, strlen(playerSt.musicUuid) + 1);
|
||||
*(player_to_ctrl->musicUuid + strlen(playerSt.musicUuid)) = 0;
|
||||
}
|
||||
|
||||
player_to_ctrl->plySt = playerSt.playerStatus;
|
||||
|
@ -567,6 +572,8 @@ static void DBusSendPlayerSt(PlayerStatusOut playerSt){
|
|||
RETURNED VALUES: void
|
||||
*****************************************************************************/
|
||||
static void curPosMsgCallBack(uv_timer_t *handle){
|
||||
static int timeoutForPosNotchange = 0;
|
||||
static int lastPeriodTime = CUR_POS_MSG_TIME;
|
||||
if(MUSIC_ST_PLAYING == playerStatusOut.playerStatus){
|
||||
static int pos = -1;
|
||||
if (AirPlayerId == playerStatusOut.playerId){
|
||||
|
@ -579,13 +586,23 @@ static void curPosMsgCallBack(uv_timer_t *handle){
|
|||
if(pos != playerStatusOut.curPostionOfMs){
|
||||
DBusSendPlayerSt(playerStatusOut);
|
||||
pos = playerStatusOut.curPostionOfMs;
|
||||
timeoutForPosNotchange = 0;
|
||||
} else
|
||||
if(playerStatusOut.durationOfMs - playerStatusOut.curPostionOfMs < 1000){
|
||||
playerStatusOut.curPostionOfMs = playerStatusOut.durationOfMs;
|
||||
DBusSendPlayerSt(playerStatusOut);
|
||||
pos = playerStatusOut.curPostionOfMs;
|
||||
timeoutForPosNotchange = 0;
|
||||
}else{
|
||||
LOG_EX(LOG_Warn, "curPos is not change, pos:%d duration:%d\n", pos, playerStatusOut.durationOfMs);
|
||||
timeoutForPosNotchange += lastPeriodTime;
|
||||
if(timeoutForPosNotchange >= POS_NO_CHANGE_TIMEOUT){
|
||||
timeoutForPosNotchange = 0;
|
||||
PlayerCtrlParamsIn playerCtrlParamsIn = {playerStatusOut.playerId, NULL, playerStatusOut.musicUuid, -1, MUSIC_MODE_MAX, MAX_MUSIC_LIST, (char)-1};
|
||||
LOG_EX(LOG_Error, "music play timeout, cur pos:%d duration:%d\n", pos, playerStatusOut.durationOfMs);
|
||||
cmdProcess(CMD_PLAY_STOP, playerCtrlParamsIn);
|
||||
playerCallbackHandler(playerStatusOut.playerId, MUSIC_ST_ERR_PREPARING_TIMEOUT, playerStatusOut.musicUuid, strlen(playerStatusOut.musicUuid) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
uv_timer_stop(&timerCurPosMsg);
|
||||
|
@ -598,6 +615,8 @@ static void curPosMsgCallBack(uv_timer_t *handle){
|
|||
{
|
||||
periodTime = 1000;//min(1000, playerStatusOut.durationOfMs - playerStatusOut.curPostionOfMs);
|
||||
}
|
||||
|
||||
lastPeriodTime = periodTime;
|
||||
uv_timer_start(&timerCurPosMsg, curPosMsgCallBack, periodTime, 0);
|
||||
}
|
||||
}
|
||||
|
@ -643,6 +662,7 @@ static void playerCallbackHandler(uint32 playerId, PlayerStatus st, char *musicU
|
|||
playerStatusTmp.musicUuid = (char *)malloc(sizeof(char) * musicUuidLen);
|
||||
if(NULL != playerStatusTmp.musicUuid){
|
||||
memcpy(playerStatusTmp.musicUuid, musicUuid, musicUuidLen);
|
||||
*(playerStatusTmp.musicUuid + musicUuidLen -1) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -737,6 +757,7 @@ int main(int argv, char** argc){
|
|||
LOG_EX(LOG_Warn, "cjson.\n");
|
||||
#endif
|
||||
|
||||
SetHBLAutoExit(TRUE);
|
||||
playerInit(playerCallbackHandler);
|
||||
SEPlayerCbRegister(sePlayerStateNotify);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ typedef struct Command
|
|||
static const Command commands[] =
|
||||
{
|
||||
{"help", PLAYER_CMD_HELP, "show this help message."},
|
||||
{"mode change", CMD_PLAY_MODECHANGE, "change the mode,0: list cycle, 1: signal cycle, for example: mode change: 0"},
|
||||
{"mode change", CMD_PLAY_MODECHANGE, "change the mode,0: list cycle, 1: single cycle, for example: mode change: 0"},
|
||||
{"play", CMD_PLAY_PLAY, "start playback."},
|
||||
{"playurl", MUSIC_CMD_PLAY_URL, "prepare url, playurl:$(url)."},
|
||||
{"pause", CMD_PLAY_PAUSE, "pause the playback."},
|
||||
|
|
|
@ -65,8 +65,6 @@ static bool needWaitMain = true;
|
|||
static pthread_mutex_t mutexStop = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_cond_t condStop = PTHREAD_COND_INITIALIZER;
|
||||
volatile static bool needWaitStop = true;
|
||||
//播放器是否需要reset标志,tinaplay出现error的时候需要reset
|
||||
volatile static bool needResetTinaplay = FALSE;
|
||||
|
||||
#if TTS_TEXT_ROKID
|
||||
#define ERR_NIL_ID -1
|
||||
|
@ -111,6 +109,9 @@ AudioPlayer mAudioPlayer;
|
|||
|
||||
#define PREPARING_TTS_TIMEOUT 5000 //tts缓存超时时间:5s
|
||||
static uv_timer_t timerPrepareTts;
|
||||
static bool isTimerPrepareTts = false;
|
||||
static uv_loop_t * pLoop;
|
||||
|
||||
|
||||
/************** tts *******************/
|
||||
/*
|
||||
|
@ -492,13 +493,13 @@ nil_tts_play:
|
|||
RETURNED VALUES: bool
|
||||
*****************************************************************************/
|
||||
static bool setAudioPlayerReset(){
|
||||
LOG_EX(LOG_Debug, "TinyPlayer reset start...\n");
|
||||
if(mAudioPlayer.nTinaplayer->reset() != 0){
|
||||
LOG_EX(LOG_Error, "TinyPlayer reset error\n");
|
||||
notifyCallback(nonMusicPlayerId, AUDIO_ST_ERR);
|
||||
return false;
|
||||
}
|
||||
|
||||
needResetTinaplay = FALSE;
|
||||
LOG_EX(LOG_Debug, "TinyPlayer reset successfull\n");
|
||||
|
||||
return true;
|
||||
|
@ -514,8 +515,8 @@ static bool setAudioPlayerReset(){
|
|||
RETURNED VALUES: void
|
||||
*****************************************************************************/
|
||||
static void timerCallBack(uv_timer_t *handle){
|
||||
LOG_EX(LOG_Debug, "timeout when tts preparing.\n");
|
||||
|
||||
LOG_EX(LOG_Warn, "timeout when tts preparing.\n");
|
||||
isTimerPrepareTts = true;
|
||||
setAudioPlayerReset();
|
||||
}
|
||||
|
||||
|
@ -531,6 +532,7 @@ static void timerCallBack(uv_timer_t *handle){
|
|||
RETURNED VALUES: bool
|
||||
*****************************************************************************/
|
||||
static bool setAudioPlayerUrlSource(char* pUrl){
|
||||
LOG_EX(LOG_Debug, "setAudioPlayerUrlSource start....\n");
|
||||
if(!setAudioPlayerReset()){
|
||||
return false;
|
||||
}
|
||||
|
@ -541,13 +543,15 @@ static bool setAudioPlayerUrlSource(char* pUrl){
|
|||
return false;
|
||||
}
|
||||
|
||||
isTimerPrepareTts = false;
|
||||
uv_update_time(pLoop);
|
||||
uv_timer_start(&timerPrepareTts, timerCallBack, (PREPARING_TTS_TIMEOUT), 0);
|
||||
if(mAudioPlayer.nTinaplayer->prepareAsync() != 0){
|
||||
uv_timer_stop(&timerPrepareTts);
|
||||
LOG_EX(LOG_Error, "prepareAsync err, exit\n");
|
||||
notifyCallback(nonMusicPlayerId, AUDIO_ST_ERR);
|
||||
return false;
|
||||
}
|
||||
|
||||
uv_timer_start(&timerPrepareTts, timerCallBack, (PREPARING_TTS_TIMEOUT), 0);
|
||||
|
||||
LOG_EX(LOG_Debug, "url:%s\n", pUrl);
|
||||
return true;
|
||||
|
@ -623,6 +627,7 @@ int audio_play(char *source, char type)
|
|||
|
||||
static void audio_stop()
|
||||
{
|
||||
LOG_EX(LOG_Debug, "audio_stop to setAudioPlayerReset....\n");
|
||||
switch (curSourceType){
|
||||
case AUDIO_TYPE_URL:
|
||||
if(setAudioPlayerReset()){
|
||||
|
@ -715,11 +720,6 @@ static void audioPlayerPlayThreadFun(void){
|
|||
needWaitPlay = true;
|
||||
pthread_mutex_unlock(&mutexPlay);
|
||||
|
||||
if(needResetTinaplay == true){
|
||||
setAudioPlayerReset();
|
||||
continue;
|
||||
}
|
||||
|
||||
LOG_EX(LOG_Debug, "Begin to play audio>>>>>>>>>>>>\n");
|
||||
|
||||
if (AUDIO_ST_PREPARED == mAudioPlayer.nStatus){
|
||||
|
@ -811,23 +811,21 @@ static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* par
|
|||
case TPLAYER_NOTIFY_MEDIA_ERROR:
|
||||
{
|
||||
PlayerStatus audioSt;
|
||||
if(param0 == NOTIFY_ERROR_TYPE_IO)
|
||||
|
||||
uv_timer_stop(&timerPrepareTts);
|
||||
if(param0 == NOTIFY_ERROR_TYPE_IO || isTimerPrepareTts)
|
||||
{
|
||||
isTimerPrepareTts = false;
|
||||
audioSt = AUDIO_ST_ERR;
|
||||
LOG_EX(LOG_Error, "TINA_NOTIFY_ERROR, net is disconnect!\n");
|
||||
}else{
|
||||
audioSt = AUDIO_ST_INTERRUPT;
|
||||
LOG_EX(LOG_Error, "TINA_NOTIFY_ERROR, maybe interrupt by cc, errCode:0x%x\n", param0);
|
||||
}
|
||||
pthread_mutex_lock(&mutexPlay);
|
||||
needResetTinaplay = true;
|
||||
needWaitPlay = false;
|
||||
pthread_cond_signal(&condPlay);
|
||||
pthread_mutex_unlock(&mutexPlay);
|
||||
|
||||
#if LOCK_ENABLE
|
||||
pthread_mutex_lock(&mAudioPlayer->nMutex);
|
||||
#endif
|
||||
uv_timer_stop(&timerPrepareTts);
|
||||
mAudioPlayer->nStatus = AUDIO_ST_IDLE;
|
||||
#if LOCK_ENABLE
|
||||
pthread_mutex_unlock(&mAudioPlayer->nMutex);
|
||||
|
@ -889,7 +887,8 @@ static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* par
|
|||
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case TPLAYER_NOTIFY_AUDIO_FRAME:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
// todo: 跟踪会不会走到该分支
|
||||
|
@ -983,7 +982,8 @@ bool audioPlayerInit(AudioPlayerCallback callback){
|
|||
}
|
||||
#endif
|
||||
|
||||
uv_timer_init(uv_default_loop(), &timerPrepareTts);
|
||||
pLoop = uv_default_loop();
|
||||
uv_timer_init(pLoop, &timerPrepareTts);
|
||||
|
||||
LOG_EX(LOG_Debug, "audioPlayerCreate successfully.\n");
|
||||
return true;
|
||||
|
@ -1012,10 +1012,6 @@ ErrRet:
|
|||
RETURNED VALUES: bool
|
||||
*****************************************************************************/
|
||||
bool audioPlayerControl(uint32 playerId, uint32 cmd, char *source, int sourceLen, char audioPlayerSourceType){
|
||||
if(needResetTinaplay == true){
|
||||
setAudioPlayerReset();
|
||||
}
|
||||
|
||||
if(CMD_PLAY_AUDIO_PLAY == cmd){
|
||||
nonMusicPlayerId = playerId;
|
||||
LOG_EX(LOG_Debug, "CMD_PLAY_AUDIO_PLAY, trig main thread. sourceLen:%d\n", sourceLen);
|
||||
|
@ -1044,8 +1040,12 @@ bool audioPlayerControl(uint32 playerId, uint32 cmd, char *source, int sourceLen
|
|||
|
||||
// 如果是停止命令,直接调用stop,不要去触发主线程
|
||||
audio_stop();
|
||||
}else if(audioPlayerSourceType == AUDIO_STOP_MIX_TYPE){
|
||||
LOG_EX(LOG_Warn, "Cmd: 0x%x(700:Stop), stop tts when mix mode!\n", cmd);
|
||||
setAudioPlayerReset();
|
||||
}else{
|
||||
LOG_EX(LOG_Warn, "Cmd: 0x%x(700:Stop), but new tts run already, so do nothing!\n", cmd);
|
||||
LOG_EX(LOG_Warn, "Cmd: 0x%x(700:Stop), new tts run already, reset old one!\n", cmd);
|
||||
setAudioPlayerReset();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,8 @@ static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* par
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
case TPLAYER_NOTIFY_AUDIO_FRAME:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
LOG_EX(LOG_Debug, "warning: unknown callback from Tinaplayer. msg: %d\n",msg);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
using namespace aw;
|
||||
|
||||
#define THREADHOLD_PREPARE_NEXT 5000 // 5 s
|
||||
#define THREADHOLD_PREPARE_NEXT 15000 // 15 s
|
||||
|
||||
/* prepared 后开始播放以及 completed之后播放下一首,不再在musicplayer中控制,而是通过player统一控制 */
|
||||
#define CUT_MAINTHREAD
|
||||
|
|
|
@ -80,7 +80,7 @@ typedef enum{
|
|||
|
||||
typedef enum {
|
||||
MUSIC_LIST_CYCLE = 0x01,
|
||||
MUSIC_SIGNAL_CYCLE,
|
||||
MUSIC_SINGLE_CYCLE,
|
||||
|
||||
MUSIC_MODE_MAX,
|
||||
}PlayMode;
|
||||
|
@ -244,6 +244,7 @@ typedef enum {
|
|||
// audioplayer中,无需判断参数,直接停止
|
||||
#define AUDIO_STOP_REPLAY_MUSIC 0x30
|
||||
#define AUDIO_STOP_NOT_REPLAY_MUSIC 0X31
|
||||
#define AUDIO_STOP_MIX_TYPE 0X32 // 混音播放的时候,stop命令用,内部type
|
||||
|
||||
#define AUDIO_NULL_TYPE 0XFF
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ typedef struct {
|
|||
bool nSeekable;
|
||||
u8 nError;
|
||||
pthread_mutex_t nMutex[MUSIC_TINA_PALYER_NUM];
|
||||
bool needResetTinaplay[MUSIC_TINA_PALYER_NUM];//播放器是否需要reset标志,tinaplay出现error的时候需要reset
|
||||
}MusicPlayer;
|
||||
|
||||
static bool musicPlayerLoop = false;
|
||||
|
@ -141,6 +140,8 @@ inline static bool needPrepareNext(int curPos, int duration){
|
|||
RETURNED VALUES: bool
|
||||
*****************************************************************************/
|
||||
static bool setMusicPlayerUrlSource(char* pUrl, bool curMusic){
|
||||
LOG_EX(LOG_Warn, "setMusicPlayerUrlSource start... curMusic:%d.\n" ,curMusic);
|
||||
|
||||
MusicPlayerIndex musicPlayerIndex;
|
||||
if(curMusic){
|
||||
lastHasEndWhenForNext = true;
|
||||
|
@ -164,7 +165,6 @@ static bool setMusicPlayerUrlSource(char* pUrl, bool curMusic){
|
|||
return false;
|
||||
}
|
||||
|
||||
musicplayer.needResetTinaplay[musicPlayerIndex] = false;
|
||||
musicplayer.nSeekable = true;
|
||||
|
||||
notifyCallback(musicPlayerId, MUSIC_ST_PREPARING);
|
||||
|
@ -206,6 +206,7 @@ static bool setMusicPlayerUrlSource(char* pUrl, bool curMusic){
|
|||
*****************************************************************************/
|
||||
static bool setMusicPlayerStart()
|
||||
{
|
||||
LOG_EX(LOG_Warn, "setMusicPlayerStart.....PlayerIndex=%d\n", musicplayer.nPlayerIndex);
|
||||
if(musicplayer.nStatus[musicplayer.nPlayerIndex] != MUSIC_ST_PREPARED &&
|
||||
musicplayer.nStatus[musicplayer.nPlayerIndex] != MUSIC_ST_SEEKING &&
|
||||
musicplayer.nStatus[musicplayer.nPlayerIndex] != MUSIC_ST_PAUSED &&
|
||||
|
@ -354,12 +355,14 @@ static bool setMusicPlayerReset(MusicPlayerIndex num){
|
|||
return false;
|
||||
}
|
||||
|
||||
musicplayer.needResetTinaplay[num] = false;
|
||||
LOG_EX(LOG_Debug, "TinyPlayer Music(index=%d) reset end\n", num);
|
||||
|
||||
pthread_mutex_lock(&musicplayer.nMutex[num]);
|
||||
isMusicPlayerPlaying = false;
|
||||
musicplayer.nStatus[num] = MUSIC_ST_IDLE;
|
||||
pthread_mutex_unlock(&musicplayer.nMutex[num]);
|
||||
|
||||
|
||||
LOG_EX(LOG_Debug, "TinyPlayer Music reset successfull\n");
|
||||
notifyCallback(musicPlayerId, MUSIC_ST_IDLE);
|
||||
return true;
|
||||
}
|
||||
|
@ -485,6 +488,11 @@ static void threadChangeVol(void){
|
|||
struct timeval timeOut;
|
||||
u8 cnt = 0;
|
||||
do{
|
||||
if(musicplayer.nStatus[musicplayer.nPlayerIndex] != MUSIC_ST_PLAYING){
|
||||
volBegin = volOriginal;
|
||||
LOG_EX(LOG_Debug, "music not playing, so vol restore to (%d)\n", volBegin);
|
||||
break;
|
||||
}
|
||||
timeOut.tv_sec = 0;
|
||||
timeOut.tv_usec = VOL_TIMER_PERIOD;
|
||||
select(0, NULL, NULL, NULL, &timeOut);
|
||||
|
@ -583,17 +591,21 @@ static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* par
|
|||
//case TINA_NOTIFY_ERROR:
|
||||
case TPLAYER_NOTIFY_MEDIA_ERROR:
|
||||
{
|
||||
for(int i = 0; i < MUSIC_TINA_PALYER_NUM ; i++){
|
||||
pthread_mutex_lock(&pMusicPlayer->nMutex[i]);
|
||||
pMusicPlayer->nStatus[i] = MUSIC_ST_IDLE;
|
||||
pMusicPlayer->nPreStatus[i] = MUSIC_ST_IDLE;
|
||||
pMusicPlayer->needResetTinaplay[i] = true;
|
||||
pthread_mutex_unlock(&pMusicPlayer->nMutex[i]);
|
||||
}
|
||||
notifyCallback(musicPlayerId, PLAYER_ERR_TINA_NOTIFY);
|
||||
|
||||
LOG_EX(LOG_Error, "TINA_NOTIFY_ERROR, errCode:0x%x\n", param0);
|
||||
break;
|
||||
if(param0 == NOTIFY_ERROR_TYPE_IO)
|
||||
{
|
||||
//网络出错情况
|
||||
for(int i = 0; i < MUSIC_TINA_PALYER_NUM ; i++){
|
||||
pthread_mutex_lock(&pMusicPlayer->nMutex[i]);
|
||||
pMusicPlayer->nStatus[i] = MUSIC_ST_IDLE;
|
||||
pMusicPlayer->nPreStatus[i] = MUSIC_ST_IDLE;
|
||||
pthread_mutex_unlock(&pMusicPlayer->nMutex[i]);
|
||||
}
|
||||
notifyCallback(musicPlayerId, PLAYER_ERR_TINA_NOTIFY);
|
||||
LOG_EX(LOG_Error, "TINA_NOTIFY_ERROR, net is disconnect!\n");
|
||||
}else{
|
||||
LOG_EX(LOG_Error, "TINA_NOTIFY_ERROR, maybe cancel by ihwplayer perpare timeout, errCode:0x%x\n", param0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//case TINA_NOTIFY_PREPARED:
|
||||
|
@ -701,7 +713,8 @@ static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* par
|
|||
LOG_EX(LOG_Debug, "TINA_NOTIFY_BUFFER_END\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case TPLAYER_NOTIFY_AUDIO_FRAME:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
LOG_EX(LOG_Debug, "warning: unknown callback from Tinaplayer. msg:%d\n", msg);
|
||||
|
@ -767,8 +780,6 @@ bool musicPlayerInit(MusicPlayerCallback callback){
|
|||
//musicplayer.nTinaplayer[1] = new TinaPlayer();
|
||||
musicplayer.nTinaplayer[0] = new LuPlayer();
|
||||
musicplayer.nTinaplayer[1] = new LuPlayer();
|
||||
musicplayer.needResetTinaplay[0] = false;
|
||||
musicplayer.needResetTinaplay[1] = false;
|
||||
|
||||
musicPlayerInited = true;
|
||||
|
||||
|
@ -847,13 +858,8 @@ bool musicPlayerControl(MusicCtrlParams params){
|
|||
|
||||
musicPlayerLoop = params.loop;
|
||||
|
||||
for(int i = 0; i < MUSIC_TINA_PALYER_NUM ; i++){
|
||||
if(musicplayer.needResetTinaplay[i]){
|
||||
setMusicPlayerReset((MusicPlayerIndex)i);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_EX(LOG_Debug, "cmd:0x%x loop:%d ignorePause:%d playerId:%d\n",params.cmdCtrl, params.loop, params.ignorePause, params.playerId);
|
||||
LOG_EX(LOG_Debug, "cmd:0x%x loop:%d ignorePause:%d playerId:%d, index=%d\n",params.cmdCtrl, params.loop, params.ignorePause, params.playerId,musicplayer.nPlayerIndex);
|
||||
|
||||
bool forcePlayWhenSeek = false;
|
||||
switch(params.cmdCtrl){
|
||||
|
@ -918,6 +924,7 @@ bool musicPlayerControl(MusicCtrlParams params){
|
|||
setMusicPlayerPause();
|
||||
break;
|
||||
case CMD_PLAY_STOP:
|
||||
LOG_EX(LOG_Debug, "TinyPlayer Music CMD_PLAY_STOP... playerIndex=%d\n", musicplayer.nPlayerIndex);
|
||||
// 目前播放器没有暂停的逻辑,直接reset掉
|
||||
setMusicPlayerReset(musicplayer.nPlayerIndex);
|
||||
break;
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
#include "background.h"
|
||||
|
||||
#define UV_TIMER 0 // 0:没有使用uv的定时器,因为歌曲播报时,会wait住线程,导致定时器失效
|
||||
#define PREPARING_TIMEOUT THREADHOLD_PREPARE_NEXT
|
||||
#define PREPARING_TIMEOUT 5000 //5s
|
||||
#define PREPARING_NEXT_TIMEOUT THREADHOLD_PREPARE_NEXT
|
||||
#define TIMER_UINT 1
|
||||
#define PREPARING_TIMEOUT_PLUS 2000 //2s, 如果tts播放完成后,混音音乐还没有结束,再多缓存2s
|
||||
|
||||
#ifdef CALLBACK_MSG
|
||||
IhwPlayerCallback playerCallback;
|
||||
|
@ -45,6 +47,13 @@ volatile static bool audioPlayerRunning = false; // 是否有非音乐类音频
|
|||
volatile bool ignoreRAudioPlayerRunning = false; // 是否忽略修改audioPlayerRunning的状态
|
||||
volatile static bool pauseWhenPreparing = false; // 在preparing时是否有过暂停动作
|
||||
|
||||
typedef enum{
|
||||
NULL_WHEN_PAUSE = 0,
|
||||
PREPARING_WHEN_PAUSE, //正在缓存
|
||||
PREPARED_WHEN_PAUSE, //缓存完成
|
||||
}StatusWhenPause;
|
||||
volatile static StatusWhenPause musicStWhenPause = NULL_WHEN_PAUSE; // 在暂停过程music的状态
|
||||
|
||||
static bool replayMusicWhenStopAudio = true; // tts结束时是否唤醒音乐播放
|
||||
|
||||
static bool ttsTrigByPlayerInner = false; // 判断播放的tts是否是播放器自动触发,如果是,不回调消息给控制中心
|
||||
|
@ -58,12 +67,6 @@ volatile static PlayMode playMode = MUSIC_LIST_CYCLE;
|
|||
static MusicListType curMusicListType = NORMAL_MUSIC_LIST;
|
||||
|
||||
static uint32 musicPlayerId = 1, nonMusicPlayerId = 0, sePlayerId = 0, bgPlayerId = 0;
|
||||
/* 如果先调用了music,但是此时music状态没有返回,又调用了audio播放,有混音的bug
|
||||
* fix方案:如果调用了music接口,且未返回时,当再次调用audio,此时等待music接口返回在往下走
|
||||
*/
|
||||
volatile static bool hasCallMusicFunc = false;
|
||||
static pthread_mutex_t mutexWaitMusicFuncCb = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_cond_t condWaitMusicFuncCb = PTHREAD_COND_INITIALIZER;
|
||||
bool ignoreMusicPause = false;
|
||||
|
||||
static pthread_t threadCallBack;
|
||||
|
@ -74,6 +77,7 @@ static pthread_cond_t condTimer = PTHREAD_COND_INITIALIZER;
|
|||
static bool needWaitTimer = true;
|
||||
volatile static bool cancleTimer;
|
||||
volatile static int timerOut;
|
||||
volatile static int prepareTimecnt = 0;
|
||||
|
||||
static uv_timer_t timerPreparing;
|
||||
static bool musicPreparingTimeoutForTtsMix = false; //播放混音时当音乐缓存失败,取消tts播放
|
||||
|
@ -91,6 +95,12 @@ static PlayerCtrlParamsIn prepareTtsParams = {
|
|||
.source = NULL,
|
||||
};
|
||||
|
||||
static PlayerCtrlParamsIn MixTtsParams = {
|
||||
.playerId = 1,
|
||||
.source = NULL,
|
||||
};
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
FUNCTION NAME: clearPrepareTts
|
||||
|
||||
|
@ -290,22 +300,31 @@ static void playerStatusChangedHandler(uint32 playerId, PlayerStatus status, cha
|
|||
RETURNED VALUES: void
|
||||
*****************************************************************************/
|
||||
static void timerCallBack(uv_timer_t *handle){
|
||||
LOG_EX(LOG_Debug, "timeout when preparing.\n");
|
||||
MusicCtrlParams musicParams;
|
||||
|
||||
LOG_EX(LOG_Warn, "timeout when music preparing.\n");
|
||||
|
||||
musicPreparingTimeoutForTtsMix = true;
|
||||
|
||||
pauseWhenPreparing = true;
|
||||
musicStWhenPause = NULL_WHEN_PAUSE;
|
||||
musicPlayerStatus = MUSIC_ST_IDLE;
|
||||
|
||||
pthread_mutex_lock(&mutexWaitMusicFuncCb);
|
||||
hasCallMusicFunc = false;
|
||||
pthread_cond_signal(&condWaitMusicFuncCb);
|
||||
pthread_mutex_unlock(&mutexWaitMusicFuncCb);
|
||||
ttsTrigByPlayerInner = false;
|
||||
|
||||
preparedNextSt = PREPARE_NEXT_INIT;
|
||||
|
||||
musicParams.playerId = musicPlayerId;
|
||||
backGroundPlayerControl(bgPlayerId, BG_CMD_STOP, NULL, false);
|
||||
musicParams.cmdCtrl = CMD_PLAY_STOP;
|
||||
musicPlayerControl(musicParams);
|
||||
clearPrepareTts();
|
||||
|
||||
playerStatusChangedHandler(musicPlayerId, MUSIC_ST_ERR_PREPARING_TIMEOUT, NULL, NULL);
|
||||
if(NULL == urlArrayInfo[0].at(urlIndex).musicUuid){
|
||||
playerStatusChangedHandler(musicPlayerId, MUSIC_ST_ERR_PREPARING_TIMEOUT, NULL, NULL);
|
||||
} else {
|
||||
playerStatusChangedHandler(musicPlayerId, MUSIC_ST_ERR_PREPARING_TIMEOUT, urlArrayInfo[0].at(urlIndex).musicUuid, \
|
||||
strlen(urlArrayInfo[0].at(urlIndex).musicUuid) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -327,13 +346,25 @@ static void threadPrepareTimerFunc(void){
|
|||
needWaitTimer = true;
|
||||
pthread_mutex_unlock(&mutexTimer);
|
||||
|
||||
int cnt = 0;
|
||||
prepareTimecnt = 0;
|
||||
do {
|
||||
usleep(TIMER_UINT*1000); // 1ms
|
||||
if(!cancleTimer && timerOut == ++cnt){
|
||||
timerCallBack(NULL);
|
||||
if(!cancleTimer && timerOut <= ++prepareTimecnt){
|
||||
if(ttsTrigByPlayerInner && audioPlayerStatus == AUDIO_ST_START){
|
||||
//混音播放的时候,tts没有播放完成,music延长缓存时间
|
||||
timerOut += PREPARING_TIMEOUT;
|
||||
LOG_EX(LOG_Debug, "<<<reset wait for prepare timer=%d>>>\n", timerOut);
|
||||
} else {
|
||||
cancleTimer = true;
|
||||
timerCallBack(NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(prepareTimecnt%1000 == 0){
|
||||
LOG_EX(LOG_Debug, "wait for prepare timer=%d\n", prepareTimecnt);
|
||||
}
|
||||
} while(!cancleTimer);
|
||||
LOG_EX(LOG_Warn, "wait for prepare total timer=%d\n", prepareTimecnt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,6 +394,7 @@ static void playerCallBackThread(){
|
|||
while(true){
|
||||
pthread_mutex_lock(&mutexMain);
|
||||
while(needWaitMain){
|
||||
LOG_EX(LOG_Debug, "needWaitMain: pthread_cond_wait condMain\n");
|
||||
pthread_cond_wait(&condMain,&mutexMain);
|
||||
}
|
||||
needWaitMain = true;
|
||||
|
@ -402,9 +434,13 @@ static void playerCallBackThread(){
|
|||
if (!ttsTrigByPlayerInner) {
|
||||
playerStatusChangedHandler(nonMusicPlayerId, audioPlayerStatus, NULL, NULL);
|
||||
} else {
|
||||
LOG_EX(LOG_Debug, "<!!!>ttsTrigByPlayerInner(%d) ignore up tts status(0x%x).<!!!>\n",
|
||||
ttsTrigByPlayerInner,
|
||||
audioPlayerStatus);
|
||||
params.volRestoreTime = MixTtsParams.volRestoreTime;
|
||||
params.volBegin = MixTtsParams.volBegin;
|
||||
params.cmdCtrl = CMD_PLAY_VOL_SET;
|
||||
musicPlayerControl(params);
|
||||
|
||||
LOG_EX(LOG_Debug, "<!!!>ttsTrigByPlayerInner(%d) ignore up tts status(0x%x). preparing Time: %d ms, music timeout: %d ms<!!!>\n",
|
||||
ttsTrigByPlayerInner, audioPlayerStatus, prepareTimecnt, timerOut);
|
||||
}
|
||||
|
||||
LOG_EX(LOG_Debug, "AUDIO_ST_START(0x%x)\n", AUDIO_ST_START);
|
||||
|
@ -424,9 +460,12 @@ static void playerCallBackThread(){
|
|||
if (!ttsTrigByPlayerInner) {
|
||||
playerStatusChangedHandler(nonMusicPlayerId, audioPlayerStatus, NULL, NULL);
|
||||
} else {
|
||||
LOG_EX(LOG_Debug, "<!!!>ttsTrigByPlayerInner(%d) ignore up tts status(0x%x).<!!!>\n",
|
||||
ttsTrigByPlayerInner,
|
||||
audioPlayerStatus);
|
||||
if((audioPlayerStatus == AUDIO_ST_FINISH)
|
||||
&& ((prepareTimecnt > PREPARING_TIMEOUT) || ((timerOut - prepareTimecnt) < PREPARING_TIMEOUT_PLUS))){
|
||||
timerOut = prepareTimecnt + PREPARING_TIMEOUT_PLUS;
|
||||
}
|
||||
LOG_EX(LOG_Debug, "<!!!>ttsTrigByPlayerInner(%d) ignore up tts status(0x%x). preparing Time: %d ms, music timeout: %d ms<!!!>\n",
|
||||
ttsTrigByPlayerInner, audioPlayerStatus, prepareTimecnt, timerOut);
|
||||
ttsTrigByPlayerInner = false;
|
||||
}
|
||||
|
||||
|
@ -447,8 +486,19 @@ static void playerCallBackThread(){
|
|||
LOG_EX(LOG_Warn, "ignore replay music when audio stop.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
LOG_EX(LOG_Warn, "isMusicPlayerBeInterrupted:%d, musicPlayerStatus:%d.\n", isMusicPlayerBeInterrupted, musicPlayerStatus);
|
||||
if(isMusicPlayerBeInterrupted){
|
||||
if(PREPARED_WHEN_PAUSE == musicStWhenPause){
|
||||
LOG_EX(LOG_Debug, "MUSIC_ST_PREPARED, wait for cc music play cmd...\n");
|
||||
musicPlayerStatus = MUSIC_ST_PREPARED;
|
||||
break;
|
||||
} else if(PREPARING_WHEN_PAUSE == musicStWhenPause){
|
||||
LOG_EX(LOG_Debug, "MUSIC_ST_PREPARING, replay the music, reset timeout:%d ms\n", PREPARING_TIMEOUT);
|
||||
musicPlayerStatus = MUSIC_ST_PREPARING;
|
||||
startTimer(PREPARING_TIMEOUT);
|
||||
}
|
||||
|
||||
switch(musicPlayerStatus){
|
||||
#ifdef CUT_MAINTHREAD
|
||||
case MUSIC_ST_PREPARED:
|
||||
|
@ -501,6 +551,7 @@ static void playerCallBackThread(){
|
|||
default: // not audioplayer status
|
||||
switch(musicPlayerStatus){
|
||||
case MUSIC_ST_PLAYING:
|
||||
musicStWhenPause = NULL_WHEN_PAUSE;
|
||||
if(NULL == urlArrayInfo[0].at(urlIndex).musicUuid){
|
||||
playerStatusChangedHandler(musicPlayerId, MUSIC_ST_PLAYING, NULL, NULL);
|
||||
} else {
|
||||
|
@ -512,13 +563,9 @@ static void playerCallBackThread(){
|
|||
if(pauseWhenPreparing){
|
||||
pauseWhenPreparing = false;
|
||||
|
||||
musicPlayerStatus = MUSIC_ST_IDLE;
|
||||
|
||||
pthread_mutex_lock(&mutexWaitMusicFuncCb);
|
||||
hasCallMusicFunc = false;
|
||||
pthread_cond_signal(&condWaitMusicFuncCb);
|
||||
pthread_mutex_unlock(&mutexWaitMusicFuncCb);
|
||||
|
||||
musicPlayerStatus = MUSIC_ST_PREPARED;
|
||||
musicStWhenPause = PREPARED_WHEN_PAUSE;
|
||||
|
||||
LOG_EX(LOG_Debug, "clear pauseWhenPreparing and do nothing.\n");
|
||||
} else {
|
||||
if(NULL == urlArrayInfo[0].at(urlIndex).musicUuid){
|
||||
|
@ -528,19 +575,20 @@ static void playerCallBackThread(){
|
|||
strlen(urlArrayInfo[0].at(urlIndex).musicUuid) + 1);
|
||||
}
|
||||
#ifdef CUT_MAINTHREAD
|
||||
if(!audioPlayerRunning){
|
||||
if(!audioPlayerRunning || ttsTrigByPlayerInner){
|
||||
//如果tts有内容,就开始混音缓存播放
|
||||
if(NULL != prepareTtsParams.source){
|
||||
LOG_EX(LOG_Debug, "mix tts play.\n");
|
||||
playerControl(CMD_PLAY_AUDIO_PLAY, prepareTtsParams);
|
||||
clearPrepareTts();
|
||||
}
|
||||
|
||||
|
||||
//ttsTrigByPlayerInner为true混音播放,也同时开始播放音乐
|
||||
params.cmdCtrl = CMD_PLAY_PLAY;
|
||||
params.loop = musicLoop;
|
||||
params.gain = gainArr.at(0);
|
||||
musicPlayerControl(params);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
isMusicPlayerBeInterrupted = true;
|
||||
}
|
||||
#endif
|
||||
|
@ -643,11 +691,13 @@ static void musicCallback(uint32 playerId, PlayerStatus msg){
|
|||
return;
|
||||
}
|
||||
|
||||
if(hasCallMusicFunc && (MUSIC_ST_PLAYING == msg || MUSIC_ST_SEEKING == msg || PLAYER_ERR_TINA_NOTIFY == msg)){
|
||||
pthread_mutex_lock(&mutexWaitMusicFuncCb);
|
||||
hasCallMusicFunc = false;
|
||||
pthread_cond_signal(&condWaitMusicFuncCb);
|
||||
pthread_mutex_unlock(&mutexWaitMusicFuncCb);
|
||||
if(PLAYER_ERR_TINA_NOTIFY == msg){
|
||||
#if UV_TIMER
|
||||
uv_timer_stop(&timerPreparing);
|
||||
#else
|
||||
stopTimer();
|
||||
#endif
|
||||
musicStWhenPause = NULL_WHEN_PAUSE;
|
||||
}
|
||||
|
||||
if (MUSIC_ST_PAUSED == msg && (preparedNextSt == PREPARE_NEXT_OK || preparedNextSt == PREPARE_NEXT_BEGIN)){
|
||||
|
@ -664,11 +714,11 @@ static void musicCallback(uint32 playerId, PlayerStatus msg){
|
|||
if(prepareNext){
|
||||
prepareNext = false;
|
||||
#if UV_TIMER
|
||||
uv_timer_start(&timerPreparing, timerCallBack, (PREPARING_TIMEOUT), 0);
|
||||
LOG_EX(LOG_Debug, "set uv timer for preparing(prepareNext)...%d\n", (PREPARING_TIMEOUT));
|
||||
uv_timer_start(&timerPreparing, timerCallBack, (PREPARING_NEXT_TIMEOUT), 0);
|
||||
LOG_EX(LOG_Debug, "set uv timer for preparing(prepareNext)...%d\n", (PREPARING_NEXT_TIMEOUT));
|
||||
#else
|
||||
startTimer(PREPARING_TIMEOUT);
|
||||
LOG_EX(LOG_Debug, "set pthread timer for preparing(prepareNext)...%d\n", (PREPARING_TIMEOUT));
|
||||
startTimer(PREPARING_NEXT_TIMEOUT);
|
||||
LOG_EX(LOG_Debug, "set pthread timer for preparing(prepareNext)...%d\n", (PREPARING_NEXT_TIMEOUT));
|
||||
#endif
|
||||
} else{
|
||||
#if UV_TIMER
|
||||
|
@ -833,7 +883,7 @@ static bool playerInitInter(void){
|
|||
BGPlayerStatus = BG_ST_IDLE;
|
||||
urlArrayInfoReset();
|
||||
|
||||
if(playMode == MUSIC_SIGNAL_CYCLE){
|
||||
if(playMode == MUSIC_SINGLE_CYCLE){
|
||||
musicLoop = true;
|
||||
}
|
||||
else{
|
||||
|
@ -940,7 +990,7 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
&& pauseWhenPreparing){
|
||||
pauseWhenPreparing = false;
|
||||
LOG_EX(LOG_Debug, "pause when preparing:%d.\n",musicPlayerStatus);
|
||||
break;
|
||||
//break;
|
||||
} else{
|
||||
pauseWhenPreparing = false;
|
||||
}
|
||||
|
@ -960,7 +1010,19 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
playerStatusChangedHandler(params.playerId, PLAYER_ERR_SOURCE_NULL, NULL, NULL);
|
||||
return false;
|
||||
}
|
||||
LOG_EX(LOG_Debug, "control want to replay the music.\n");
|
||||
LOG_EX(LOG_Debug, "control want to replay the music, musicPlayerStatus =%d, musicStWhenPause=%d\n", musicPlayerStatus, musicStWhenPause);
|
||||
if(PREPARED_WHEN_PAUSE == musicStWhenPause){
|
||||
LOG_EX(LOG_Debug, "MUSIC_ST_PREPARED, replay the music...\n");
|
||||
musicParams.cmdCtrl = CMD_PLAY_PLAY;
|
||||
musicParams.loop = musicLoop;
|
||||
musicParams.gain = gainArr.at(0);
|
||||
musicPlayerControl(musicParams);
|
||||
break;
|
||||
} else if(PREPARING_WHEN_PAUSE == musicStWhenPause){
|
||||
LOG_EX(LOG_Debug, "MUSIC_ST_PREPARING, replay the music, reset timeout:%d ms\n", PREPARING_TIMEOUT_PLUS);
|
||||
startTimer(PREPARING_TIMEOUT_PLUS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
preparedNextSt = PREPARE_NEXT_INIT;
|
||||
|
@ -971,6 +1033,7 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
gainArr.at(0) = params.gain;
|
||||
|
||||
pauseWhenPreparing = false;
|
||||
musicStWhenPause = NULL_WHEN_PAUSE;
|
||||
/* 播放传入的url,如果当前正在播放,替换 */
|
||||
ignoreMusicPause = true;
|
||||
// url 和 id 需要同时存在
|
||||
|
@ -987,9 +1050,6 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
}
|
||||
|
||||
if(!audioPlayerRunning){
|
||||
pthread_mutex_lock(&mutexWaitMusicFuncCb);
|
||||
hasCallMusicFunc = true;
|
||||
pthread_mutex_unlock(&mutexWaitMusicFuncCb);
|
||||
prepareNext = false;
|
||||
musicParams.cmdCtrl = CMD_PLAY_PLAY;
|
||||
musicParams.url = urlArrayInfo[0].at(urlIndex).musicUrl;
|
||||
|
@ -1063,9 +1123,16 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
LOG_EX(LOG_Debug, "clear isMusicPlayerBeInterrupted becauseof pause.\n");
|
||||
break;
|
||||
}
|
||||
if(hasCallMusicFunc ||
|
||||
(preparedNextSt != PREPARE_NEXT_BEGIN && preparedNextSt != PREPARE_NEXT_OK &&
|
||||
(MUSIC_ST_PREPARING == musicPlayerStatus || MUSIC_ST_PREPARED == musicPlayerStatus))){
|
||||
if(preparedNextSt != PREPARE_NEXT_BEGIN && preparedNextSt != PREPARE_NEXT_OK &&
|
||||
(MUSIC_ST_PREPARING == musicPlayerStatus || MUSIC_ST_PREPARED == musicPlayerStatus)){
|
||||
if(MUSIC_ST_PREPARING == musicPlayerStatus){
|
||||
musicStWhenPause = PREPARING_WHEN_PAUSE;
|
||||
#if UV_TIMER
|
||||
uv_timer_stop(&timerPreparing);
|
||||
#else
|
||||
stopTimer();
|
||||
#endif
|
||||
}
|
||||
pauseWhenPreparing = true;
|
||||
LOG_EX(LOG_Debug, "pause when preparing:%d.\n",musicPlayerStatus);
|
||||
musicCallback(params.playerId, MUSIC_ST_PAUSED);
|
||||
|
@ -1076,7 +1143,12 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
musicPlayerControl(musicParams);
|
||||
|
||||
if (audioPlayerRunning){
|
||||
audioPlayerControl(nonMusicPlayerId, CMD_PLAY_AUDIO_STOP, NULL, NULL, NULL);
|
||||
if(ttsTrigByPlayerInner){
|
||||
//混音播放需要将tts停止
|
||||
audioPlayerControl(nonMusicPlayerId, CMD_PLAY_AUDIO_STOP, NULL, NULL, AUDIO_STOP_MIX_TYPE);
|
||||
}else{
|
||||
audioPlayerControl(nonMusicPlayerId, CMD_PLAY_AUDIO_STOP, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CMD_PLAY_STOP:
|
||||
|
@ -1113,21 +1185,6 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
params.audioSourceType = AUDIO_TYPE_URL;
|
||||
LOG_EX(LOG_Warn, "not need replay music when stop.\n");
|
||||
}
|
||||
/* 如果调用了music接口,但是没有返回,等在这里 */
|
||||
if(AUDIO_TYPE_TEXT_MIX == params.audioSourceType || AUDIO_TYPE_URL_MIX == params.audioSourceType){
|
||||
pthread_mutex_lock(&mutexWaitMusicFuncCb);
|
||||
while(hasCallMusicFunc){
|
||||
LOG_EX(LOG_Debug, "mix tts wait for music play.\n");
|
||||
pthread_cond_wait(&condWaitMusicFuncCb,&mutexWaitMusicFuncCb);
|
||||
}
|
||||
pthread_mutex_unlock(&mutexWaitMusicFuncCb);
|
||||
|
||||
if(musicPreparingTimeoutForTtsMix){
|
||||
LOG_EX(LOG_Debug, "give up tts because of timeout.\n");
|
||||
musicPreparingTimeoutForTtsMix = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_EX(LOG_Debug, "audioPlayerRunning: %d ttsTrigByPlayer:%d.\n", audioPlayerRunning, ttsTrigByPlayerInner);
|
||||
if(!audioPlayerRunning){
|
||||
|
@ -1143,16 +1200,7 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
#endif
|
||||
isMusicPlayerBeInterrupted = true;
|
||||
if(MUSIC_ST_PLAYING == musicPlayerStatus || MUSIC_ST_PREPARED == musicPlayerStatus || \
|
||||
MUSIC_ST_PREPARING == musicPlayerStatus || MUSIC_ST_FOR_NEXT == musicPlayerStatus){
|
||||
/* 如果当前是prepare或者prepared状态,暂停会没法执行,因此等play状态 */
|
||||
//if (MUSIC_ST_PREPARED == musicPlayerStatus || MUSIC_ST_PREPARING == musicPlayerStatus){
|
||||
// pthread_mutex_lock(&mutexWaitMusicFuncCb);
|
||||
// hasCallMusicFunc = true;
|
||||
// pthread_cond_wait(&condWaitMusicFuncCb,&mutexWaitMusicFuncCb);
|
||||
// pthread_mutex_unlock(&mutexWaitMusicFuncCb);
|
||||
//}
|
||||
|
||||
//musicPlayerControl(musicPlayerId, CMD_PLAY_PAUSE, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
MUSIC_ST_PREPARING == musicPlayerStatus || MUSIC_ST_FOR_NEXT == musicPlayerStatus){
|
||||
musicParams.cmdCtrl = CMD_PLAY_PAUSE;
|
||||
musicParams.playerId = musicPlayerId;
|
||||
musicPlayerControl(musicParams);
|
||||
|
@ -1165,19 +1213,13 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
}
|
||||
} else if (AUDIO_TYPE_TEXT_MIX == params.audioSourceType){
|
||||
params.audioSourceType = AUDIO_TYPE_TEXT;
|
||||
|
||||
//musicPlayerControl(params.playerId, CMD_PLAY_VOL_SET, NULL, NULL, NULL, NULL, params.volRestoreTime, params.volBegin);
|
||||
musicParams.cmdCtrl = CMD_PLAY_VOL_SET;
|
||||
musicParams.playerId = musicPlayerId;
|
||||
musicPlayerControl(musicParams);
|
||||
MixTtsParams.volBegin = params.volBegin;
|
||||
MixTtsParams.volRestoreTime = params.volRestoreTime;
|
||||
LOG_EX(LOG_Debug, "mix with music.\n");
|
||||
} else if (AUDIO_TYPE_URL_MIX == params.audioSourceType){
|
||||
params.audioSourceType = AUDIO_TYPE_URL;
|
||||
|
||||
//musicPlayerControl(params.playerId, CMD_PLAY_VOL_SET, NULL, NULL, NULL, NULL, params.volRestoreTime, params.volBegin);
|
||||
musicParams.cmdCtrl = CMD_PLAY_VOL_SET;
|
||||
musicParams.playerId = musicPlayerId;
|
||||
musicPlayerControl(musicParams);
|
||||
MixTtsParams.volBegin = params.volBegin;
|
||||
MixTtsParams.volRestoreTime = params.volRestoreTime;
|
||||
LOG_EX(LOG_Debug, "mix with music.\n");
|
||||
}
|
||||
audioPlayerRunning = true;
|
||||
|
@ -1195,17 +1237,13 @@ bool playerControl(uint32 cmd, PlayerCtrlParamsIn params){
|
|||
|
||||
if (AUDIO_TYPE_TEXT_MIX == params.audioSourceType){
|
||||
params.audioSourceType = AUDIO_TYPE_TEXT;
|
||||
|
||||
musicParams.cmdCtrl = CMD_PLAY_VOL_SET;
|
||||
musicParams.playerId = musicPlayerId;
|
||||
musicPlayerControl(musicParams);
|
||||
MixTtsParams.volBegin = params.volBegin;
|
||||
MixTtsParams.volRestoreTime = params.volRestoreTime;
|
||||
LOG_EX(LOG_Debug, "mix with music.\n");
|
||||
} else if (AUDIO_TYPE_URL_MIX == params.audioSourceType){
|
||||
params.audioSourceType = AUDIO_TYPE_URL;
|
||||
|
||||
musicParams.cmdCtrl = CMD_PLAY_VOL_SET;
|
||||
musicParams.playerId = musicPlayerId;
|
||||
musicPlayerControl(musicParams);
|
||||
MixTtsParams.volBegin = params.volBegin;
|
||||
MixTtsParams.volRestoreTime = params.volRestoreTime;
|
||||
LOG_EX(LOG_Debug, "mix with music.\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,8 @@ static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* par
|
|||
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case TPLAYER_NOTIFY_AUDIO_FRAME:
|
||||
break;
|
||||
default:
|
||||
{
|
||||
LOG_EX(LOG_Debug, "warning: unknown callback from Tinaplayer. msg: d%\n", msg);
|
||||
|
|
Binary file not shown.
|
@ -8,7 +8,7 @@ CONFIG_ALIGNMENT_TRAP=y
|
|||
CONFIG_ANDROID=y
|
||||
# CONFIG_ANDROID_BINDER_IPC is not set
|
||||
# CONFIG_ANDROID_LOW_MEMORY_KILLER is not set
|
||||
CONFIG_ANDROID_PARANOID_NETWORK=y
|
||||
# CONFIG_ANDROID_PARANOID_NETWORK is not set
|
||||
# CONFIG_APM_EMULATION is not set
|
||||
CONFIG_ARCH_CLOCKSOURCE_DATA=y
|
||||
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
|
||||
|
@ -265,9 +265,12 @@ CONFIG_DEBUG_VM=y
|
|||
# CONFIG_DEBUG_VM_VMACACHE is not set
|
||||
# CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set
|
||||
CONFIG_DECOMPRESS_GZIP=y
|
||||
CONFIG_DEFAULT_BBR=y
|
||||
CONFIG_DEFAULT_CFQ=y
|
||||
# CONFIG_DEFAULT_CUBIC is not set
|
||||
# CONFIG_DEFAULT_DEADLINE is not set
|
||||
CONFIG_DEFAULT_IOSCHED="cfq"
|
||||
CONFIG_DEFAULT_TCP_CONG="bbr"
|
||||
# CONFIG_DEFAULT_USE_ENERGY_AWARE is not set
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DEVTMPFS_MOUNT=y
|
||||
|
@ -883,7 +886,7 @@ CONFIG_SWP_EMULATE=y
|
|||
CONFIG_SW_SYNC=y
|
||||
CONFIG_SYNC_FILE=y
|
||||
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
|
||||
# CONFIG_TCP_CONG_BBR is not set
|
||||
CONFIG_TCP_CONG_BBR=y
|
||||
# CONFIG_TCP_CONG_NV is not set
|
||||
# CONFIG_TEE is not set
|
||||
# CONFIG_TEST_BITMAP is not set
|
||||
|
|
|
@ -254,7 +254,7 @@ uart1_rts = port:PG8<7><1><default><default>
|
|||
uart1_cts = port:PG9<7><1><default><default>
|
||||
|
||||
[uart2]
|
||||
uart2_used = 0
|
||||
uart2_used = 1
|
||||
uart2_port = 2
|
||||
uart2_type = 4
|
||||
uart2_tx = port:PB0<2><1><default><default>
|
||||
|
|
|
@ -1266,16 +1266,6 @@ CONFIG_BUSYBOX_DEFAULT_ASH_TEST=y
|
|||
# CONFIG_BUSYBOX_DEFAULT_HUSH_MEMLEAK is not set
|
||||
CONFIG_BUSYBOX_DEFAULT_FEATURE_SH_MATH=y
|
||||
CONFIG_BUSYBOX_DEFAULT_FEATURE_SH_MATH_64=y
|
||||
# CONFIG_BUSYBOX_CONFIG_INSTALL_APPLET_SYMLINKS is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_INSTALL_APPLET_HARDLINKS is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_INSTALL_APPLET_DONT is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_NO_DEBUG_LIB is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_DMALLOC is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_EFENCE is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_SH_IS_ASH is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_SH_IS_HUSH is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_SH_IS_NONE is not set
|
||||
CONFIG_PACKAGE_ca-certificates=y
|
||||
CONFIG_PACKAGE_dnsmasq=y
|
||||
# CONFIG_PACKAGE_dnsmasq-full is not set
|
||||
|
@ -2831,6 +2821,7 @@ CONFIG_TTF2_SUPPORT=y
|
|||
#
|
||||
CONFIG_PACKAGE_libcae=y
|
||||
CONFIG_PACKAGE_libduilite=y
|
||||
CONFIG_PACKAGE_libmsc=y
|
||||
CONFIG_PACKAGE_libneteasedc=y
|
||||
CONFIG_PACKAGE_libneteasevoicews=y
|
||||
CONFIG_PACKAGE_libyunxin=y
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
git submodule sync
|
||||
git submodule update --init
|
||||
git submodule foreach git checkout master
|
||||
git submodule foreach git pull origin master
|
Loading…
Reference in New Issue