修复摄像头、科大讯飞、rcsp、彩屏仓等相关测试问题;
This commit is contained in:
+2
-1
@@ -1760,6 +1760,7 @@
|
|||||||
<Unit filename="apps/watch/include/app_testbox.h" />
|
<Unit filename="apps/watch/include/app_testbox.h" />
|
||||||
<Unit filename="apps/watch/include/app_tone.h" />
|
<Unit filename="apps/watch/include/app_tone.h" />
|
||||||
<Unit filename="apps/watch/include/app_version.h" />
|
<Unit filename="apps/watch/include/app_version.h" />
|
||||||
|
<Unit filename="apps/watch/include/app_video.h" />
|
||||||
<Unit filename="apps/watch/include/audio_app_def.h" />
|
<Unit filename="apps/watch/include/audio_app_def.h" />
|
||||||
<Unit filename="apps/watch/include/audio_manager.h" />
|
<Unit filename="apps/watch/include/audio_manager.h" />
|
||||||
<Unit filename="apps/watch/include/battery_manager.h" />
|
<Unit filename="apps/watch/include/battery_manager.h" />
|
||||||
@@ -1879,6 +1880,7 @@
|
|||||||
<Unit filename="apps/watch/mode/rtc/rtc_app_msg_handler.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="apps/watch/mode/rtc/rtc_app_msg_handler.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="apps/watch/mode/rtc/rtc_key_msg_table.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="apps/watch/mode/rtc/rtc_key_msg_table.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="apps/watch/mode/update/update.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="apps/watch/mode/update/update.c"><Option compilerVer="CC"/></Unit>
|
||||||
|
<Unit filename="apps/watch/mode/video/video.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="apps/watch/net/net_event.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="apps/watch/net/net_event.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="apps/watch/product_test/product_test.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="apps/watch/product_test/product_test.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="apps/watch/product_test/product_test.h" />
|
<Unit filename="apps/watch/product_test/product_test.h" />
|
||||||
@@ -2323,7 +2325,6 @@
|
|||||||
<Unit filename="cpu/br35/ui_driver/lcd_drive/lcd_spi/lcd_spi_st7789_BOE1.54_update_240x240.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="cpu/br35/ui_driver/lcd_drive/lcd_spi/lcd_spi_st7789_BOE1.54_update_240x240.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="cpu/br35/ui_driver/lcd_drive/lcd_spi/lcd_spi_st7789v_240x240.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="cpu/br35/ui_driver/lcd_drive/lcd_spi/lcd_spi_st7789v_240x240.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="cpu/br35/ui_driver/lcd_drive/lcd_spi/oled_spi_nb3030_172x320.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="cpu/br35/ui_driver/lcd_drive/lcd_spi/oled_spi_nb3030_172x320.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="cpu/br35/user_p11_cmd.h" />
|
|
||||||
<Unit filename="cpu/components/iic_api.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="cpu/components/iic_api.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="cpu/components/iic_soft.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="cpu/components/iic_soft.c"><Option compilerVer="CC"/></Unit>
|
||||||
<Unit filename="cpu/components/ir_decoder.c"><Option compilerVer="CC"/></Unit>
|
<Unit filename="cpu/components/ir_decoder.c"><Option compilerVer="CC"/></Unit>
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ char *ifly_tts_format_text_data(void)
|
|||||||
cJSON *cjson_business = NULL;
|
cJSON *cjson_business = NULL;
|
||||||
cJSON *cjson_data = NULL;
|
cJSON *cjson_data = NULL;
|
||||||
|
|
||||||
char *buf = net_iflytek_malloc(MAX_SPARKDESK_LEN);
|
char *buf = net_iflytek_malloc(MAX_SPARKDESK_LEN * 4); // 因base64编码比字符串要大,根据需要加大buf
|
||||||
mbedtls_base64_encode((unsigned char *)buf, MAX_SPARKDESK_LEN, (size_t *)&out_len, (unsigned char *)tts_info.param->text_res, strlen(tts_info.param->text_res) + 1);
|
mbedtls_base64_encode((unsigned char *)buf, MAX_SPARKDESK_LEN, (size_t *)&out_len, (unsigned char *)tts_info.param->text_res, strlen(tts_info.param->text_res) + 1);
|
||||||
//定义最长回答
|
//定义最长回答
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "system/includes.h"
|
#include "system/includes.h"
|
||||||
#include "gSensor/gSensor_manage.h"
|
#include "gSensor/gSensor_manage.h"
|
||||||
#include "ble_fmy_modet.h"
|
#include "ble_fmy_modet.h"
|
||||||
#include "user_p11_cmd.h"
|
|
||||||
#if (TCFG_GSENSOR_ENABLE && TCFG_P11GSENSOR_EN)
|
#if (TCFG_GSENSOR_ENABLE && TCFG_P11GSENSOR_EN)
|
||||||
|
|
||||||
#if GSENSOR_PRINTF_ENABLE
|
#if GSENSOR_PRINTF_ENABLE
|
||||||
|
|||||||
+5
-2
@@ -64,10 +64,13 @@ int JL_rcsp_extra_flash_cmd_resp(void *priv, u8 OpCode, u8 OpCode_SN, u8 *data,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case JL_OPCODE_EXTRA_FLASH_INFO: // 0xD6 - 获取外部Flash信息
|
case JL_OPCODE_EXTRA_FLASH_INFO: // 0xD6 - 获取外部Flash信息
|
||||||
ret = rcsp_get_extra_flash_info(priv, data);
|
u8 *resp_data = NULL;
|
||||||
|
ret = rcsp_get_extra_flash_info(priv, &resp_data);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
u16 data_len = (u16) ret;
|
u16 data_len = (u16) ret;
|
||||||
JL_CMD_response_send(OpCode, JL_PRO_STATUS_SUCCESS, OpCode_SN, data, data_len, 0, NULL);
|
JL_CMD_response_send(OpCode, JL_PRO_STATUS_SUCCESS, OpCode_SN, resp_data, data_len, 0, NULL);
|
||||||
|
free(resp_data);
|
||||||
|
resp_data = NULL;
|
||||||
ret = rcsp_extra_flash_opt_start();
|
ret = rcsp_extra_flash_opt_start();
|
||||||
} else {
|
} else {
|
||||||
JL_CMD_response_send(OpCode, JL_PRO_STATUS_FAIL, OpCode_SN, NULL, 0, 0, NULL);
|
JL_CMD_response_send(OpCode, JL_PRO_STATUS_FAIL, OpCode_SN, NULL, 0, 0, NULL);
|
||||||
|
|||||||
+32
-17
@@ -1129,7 +1129,7 @@ static u16 get_communication_mtu(u16 expect_mtu)
|
|||||||
@note
|
@note
|
||||||
*/
|
*/
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
int rcsp_get_extra_flash_info(void *priv, u8 *resp_data)
|
int rcsp_get_extra_flash_info(void *priv, u8 **p_resp_data)
|
||||||
{
|
{
|
||||||
struct RcspModel *rcspModel = (struct RcspModel *)priv;
|
struct RcspModel *rcspModel = (struct RcspModel *)priv;
|
||||||
int data_len = 0;
|
int data_len = 0;
|
||||||
@@ -1151,6 +1151,13 @@ int rcsp_get_extra_flash_info(void *priv, u8 *resp_data)
|
|||||||
u16 screen_height = 0;
|
u16 screen_height = 0;
|
||||||
get_cur_srreen_width_and_height(&screen_width, &screen_height);
|
get_cur_srreen_width_and_height(&screen_width, &screen_height);
|
||||||
|
|
||||||
|
u8 *resp_data = zalloc(sizeof(flash_size) + sizeof(fat_size) + sizeof(sys_type) + sizeof(g_eflash_state_flag) + \
|
||||||
|
sizeof(version) + sizeof(resp_mtu) + sizeof(sector) + sizeof(ver_len) + ver_len + \
|
||||||
|
sizeof(recv_mtu) + sizeof(screen_width) + sizeof(screen_height));
|
||||||
|
if (!resp_data) {
|
||||||
|
*p_resp_data = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
// 填充
|
// 填充
|
||||||
data_len = 0; // 用作计数
|
data_len = 0; // 用作计数
|
||||||
data_len += rcsp_extra_flash_opt_data_fill(resp_data + data_len, (u8 *)&flash_size, sizeof(flash_size));
|
data_len += rcsp_extra_flash_opt_data_fill(resp_data + data_len, (u8 *)&flash_size, sizeof(flash_size));
|
||||||
@@ -1168,6 +1175,7 @@ int rcsp_get_extra_flash_info(void *priv, u8 *resp_data)
|
|||||||
data_len += rcsp_extra_flash_opt_data_fill(resp_data + data_len, (u8 *)&recv_mtu, sizeof(recv_mtu));
|
data_len += rcsp_extra_flash_opt_data_fill(resp_data + data_len, (u8 *)&recv_mtu, sizeof(recv_mtu));
|
||||||
data_len += rcsp_extra_flash_opt_data_fill(resp_data + data_len, (u8 *)&screen_width, sizeof(screen_width));
|
data_len += rcsp_extra_flash_opt_data_fill(resp_data + data_len, (u8 *)&screen_width, sizeof(screen_width));
|
||||||
data_len += rcsp_extra_flash_opt_data_fill(resp_data + data_len, (u8 *)&screen_height, sizeof(screen_height));
|
data_len += rcsp_extra_flash_opt_data_fill(resp_data + data_len, (u8 *)&screen_height, sizeof(screen_height));
|
||||||
|
*p_resp_data = resp_data;
|
||||||
return data_len;
|
return data_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1744,54 +1752,61 @@ int rcsp_extra_flash_opt(u8 *param, u16 len, u8 OpCode, u8 OpCode_SN)
|
|||||||
u8 offset = 0;
|
u8 offset = 0;
|
||||||
u8 opt_flag = param[offset++];
|
u8 opt_flag = param[offset++];
|
||||||
u8 state = param[offset++];
|
u8 state = param[offset++];
|
||||||
|
u8 *resp_buf = zalloc(100);
|
||||||
|
if (!resp_buf) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ASSERT(len <= 100);
|
||||||
|
memcpy(resp_buf, param, len);
|
||||||
|
|
||||||
switch (opt_flag) {
|
switch (opt_flag) {
|
||||||
case CURR_SYSTEM_OPT_READ:
|
case CURR_SYSTEM_OPT_READ:
|
||||||
result = rcsp_extra_flash_read_opt(param, &len, offset, state);
|
result = rcsp_extra_flash_read_opt(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_WRITE:
|
case CURR_SYSTEM_OPT_WRITE:
|
||||||
result = rcsp_extra_flash_write_opt(param, &len, offset, state, OpCode);
|
result = rcsp_extra_flash_write_opt(resp_buf, &len, offset, state, OpCode);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_INSERT:
|
case CURR_SYSTEM_OPT_INSERT:
|
||||||
result = rcsp_extra_flash_insert_opt(param, &len, offset, state);
|
result = rcsp_extra_flash_insert_opt(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_DIAL:
|
case CURR_SYSTEM_OPT_DIAL:
|
||||||
result = rcsp_extra_flash_dial_opt(param, &len, offset, state);
|
result = rcsp_extra_flash_dial_opt(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_ERASE:
|
case CURR_SYSTEM_OPT_ERASE:
|
||||||
result = rcsp_extra_flash_erase_opt(param, &len, offset, state);
|
result = rcsp_extra_flash_erase_opt(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_DELETE:
|
case CURR_SYSTEM_OPT_DELETE:
|
||||||
result = rcsp_extra_flash_delete_opt(param, &len, offset, state);
|
result = rcsp_extra_flash_delete_opt(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_UPDATE_FAT:
|
case CURR_SYSTEM_OPT_UPDATE_FAT:
|
||||||
result = rcsp_extra_flash_update_fat_opt(param, &len, offset, state);
|
result = rcsp_extra_flash_update_fat_opt(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_UPDATE_UI:
|
case CURR_SYSTEM_OPT_UPDATE_UI:
|
||||||
result = rcsp_extra_flash_update_ui_opt(param, &len, offset, state);
|
result = rcsp_extra_flash_update_ui_opt(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_TRAN_REPLY:
|
case CURR_SYSTEM_OPT_TRAN_REPLY:
|
||||||
result = rcsp_extra_flash_update_state_to_app(param, &len, offset, state);
|
result = rcsp_extra_flash_update_state_to_app(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_UPDATE_FLAG:
|
case CURR_SYSTEM_OPT_UPDATE_FLAG:
|
||||||
result = rcsp_extra_flash_ota_update_state(param, &len, offset, state);
|
result = rcsp_extra_flash_ota_update_state(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_RESTORE:
|
case CURR_SYSTEM_OPT_RESTORE:
|
||||||
result = rcsp_extra_flash_restore(param, &len, offset, state);
|
result = rcsp_extra_flash_restore(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_FILE_INFO_GET:
|
case CURR_SYSTEM_OPT_FILE_INFO_GET:
|
||||||
result = rcsp_extra_flash_file_info_get(param, &len, offset, state);
|
result = rcsp_extra_flash_file_info_get(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_REMAIN_SPACE:
|
case CURR_SYSTEM_OPT_REMAIN_SPACE:
|
||||||
result = rcsp_extra_flash_remain_space(param, &len, offset, state);
|
result = rcsp_extra_flash_remain_space(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
case CURR_SYSTEM_OPT_RES_SPACE:
|
case CURR_SYSTEM_OPT_RES_SPACE:
|
||||||
result = rcsp_extra_flash_res_space(param, &len, offset, state);
|
result = rcsp_extra_flash_res_space(resp_buf, &len, offset, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 resp_len = rcsp_extra_flash_opt_resp_data_get(param + 1, len, opt_flag, state) + 1;
|
u16 resp_len = rcsp_extra_flash_opt_resp_data_get(resp_buf + 1, len, opt_flag, state) + 1;
|
||||||
rcsp_extra_flash_opt_resp(0, OpCode, OpCode_SN, param, resp_len);
|
rcsp_extra_flash_opt_resp(0, OpCode, OpCode_SN, resp_buf, resp_len);
|
||||||
|
free(resp_buf);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -13,12 +13,12 @@
|
|||||||
int rcsp_extra_flash_opt(u8 *data, u16 len, u8 OpCode, u8 OpCode_SN);
|
int rcsp_extra_flash_opt(u8 *data, u16 len, u8 OpCode, u8 OpCode_SN);
|
||||||
//*----------------------------------------------------------------------------*/
|
//*----------------------------------------------------------------------------*/
|
||||||
/**@brief 填充表盘操作第一条命令的数据回复包
|
/**@brief 填充表盘操作第一条命令的数据回复包
|
||||||
@param resp_data:数据回复包
|
@param resp_data:获取数据回复包
|
||||||
@return 负数-失败,正数-数据长度
|
@return 负数-失败,正数-数据长度
|
||||||
@note
|
@note
|
||||||
*/
|
*/
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
int rcsp_get_extra_flash_info(void *priv, u8 *resp_data);
|
int rcsp_get_extra_flash_info(void *priv, u8 **p_resp_data);
|
||||||
//*----------------------------------------------------------------------------*/
|
//*----------------------------------------------------------------------------*/
|
||||||
/**@brief 外部flash开始操作
|
/**@brief 外部flash开始操作
|
||||||
@param
|
@param
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
#include "clock_manager/clock_manager.h"
|
#include "clock_manager/clock_manager.h"
|
||||||
#include "product_test.h"
|
#include "product_test.h"
|
||||||
#include "chgbox_ctrl.h"
|
#include "chgbox_ctrl.h"
|
||||||
|
#include "app_video.h"
|
||||||
|
|
||||||
#define LOG_TAG "[APP]"
|
#define LOG_TAG "[APP]"
|
||||||
#define LOG_ERROR_ENABLE
|
#define LOG_ERROR_ENABLE
|
||||||
@@ -767,7 +768,12 @@ static void app_task_loop(void *p)
|
|||||||
mode = app_enter_rcsp_mode(g_mode_switch_arg);
|
mode = app_enter_rcsp_mode(g_mode_switch_arg);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#if TCFG_APP_VIDEO_EN
|
||||||
|
case APP_MODE_VIDEO:
|
||||||
|
log_info("APP_MODE_VIDEO \n");
|
||||||
|
mode = app_enter_video_mode(g_mode_switch_arg);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -673,7 +673,14 @@
|
|||||||
//camera
|
//camera
|
||||||
#define TCFG_CAMERA_MANAGER_ENABLE 0//相机、相册、摄像头功能
|
#define TCFG_CAMERA_MANAGER_ENABLE 0//相机、相册、摄像头功能
|
||||||
#define TCFG_CAMERA_DEV_BF30A2 0//摄像头驱动bf30a2
|
#define TCFG_CAMERA_DEV_BF30A2 0//摄像头驱动bf30a2
|
||||||
|
#if TCFG_VIDEO_DIAL_ENABLE || TCFG_CAMERA_MANAGER_ENABLE
|
||||||
|
#define TCFG_APP_VIDEO_EN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//*********************************************************************************//
|
||||||
|
// USB配置 //
|
||||||
|
//*********************************************************************************//
|
||||||
|
// #define TCFG_OTG_MODE 0
|
||||||
//*********************************************************************************//
|
//*********************************************************************************//
|
||||||
// 产测配置 //
|
// 产测配置 //
|
||||||
//*********************************************************************************//
|
//*********************************************************************************//
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ enum app_mode_t {
|
|||||||
APP_MODE_SPDIF = 11,
|
APP_MODE_SPDIF = 11,
|
||||||
APP_MODE_RCSP = 12,
|
APP_MODE_RCSP = 12,
|
||||||
APP_MODE_SMARTBOX = 13,
|
APP_MODE_SMARTBOX = 13,
|
||||||
|
APP_MODE_VIDEO = 14,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef CONFIG_APP_VIDEO_H
|
||||||
|
#define CONFIG_APP_VIDEO_H
|
||||||
|
|
||||||
|
#include "system/includes.h"
|
||||||
|
|
||||||
|
struct app_mode *app_enter_video_mode(int arg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -734,6 +734,9 @@
|
|||||||
//*********************************************************************************//
|
//*********************************************************************************//
|
||||||
// VIDEO CONFIG //
|
// VIDEO CONFIG //
|
||||||
//*********************************************************************************//
|
//*********************************************************************************//
|
||||||
|
#ifndef TCFG_APP_VIDEO_EN
|
||||||
|
#define TCFG_APP_VIDEO_EN DISABLE
|
||||||
|
#endif
|
||||||
#ifndef TCFG_VIDEO_DIAL_ENABLE
|
#ifndef TCFG_VIDEO_DIAL_ENABLE
|
||||||
#define TCFG_VIDEO_DIAL_ENABLE DISABLE
|
#define TCFG_VIDEO_DIAL_ENABLE DISABLE
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -562,6 +562,7 @@
|
|||||||
#define BASEFORM_1355 0XA61000
|
#define BASEFORM_1355 0XA61000
|
||||||
#define BASEFORM_1356 0XA60C00
|
#define BASEFORM_1356 0XA60C00
|
||||||
#define BASEFORM_1357 0XA63000
|
#define BASEFORM_1357 0XA63000
|
||||||
|
#define BASEFORM_1358 0XA83002
|
||||||
#define BASEFORM_1359 0X7C0C0D
|
#define BASEFORM_1359 0X7C0C0D
|
||||||
#define BASEFORM_136 0X4A3C12
|
#define BASEFORM_136 0X4A3C12
|
||||||
#define BASEFORM_1360 0X7C3002
|
#define BASEFORM_1360 0X7C3002
|
||||||
@@ -1724,6 +1725,17 @@
|
|||||||
#define DISCONN_QR_BUTTON 0X303004
|
#define DISCONN_QR_BUTTON 0X303004
|
||||||
#define DISCONN_QR_LAYOUT 0X300C01
|
#define DISCONN_QR_LAYOUT 0X300C01
|
||||||
#define DISCONN_YES_BUTTON 0X302001
|
#define DISCONN_YES_BUTTON 0X302001
|
||||||
|
#define DUER_BASEFORM_ERROR 0XA80C00
|
||||||
|
#define DUER_BASEFORM_RECORD 0XA80C03
|
||||||
|
#define DUER_BASEFORM_RESPONSE 0XA80C01
|
||||||
|
#define DUER_BASEFORM_THINK 0XA80C02
|
||||||
|
#define DUER_ERROR_NOTE 0XA83000
|
||||||
|
#define DUER_RECORD_BUTTON 0XA81C00
|
||||||
|
#define DUER_RECORD_TIME 0XA83C00
|
||||||
|
#define DUER_RECORD_TXT 0XA83003
|
||||||
|
#define DUER_RESPONSE_TTS 0XA82000
|
||||||
|
#define DUER_RESPONSE_TXT 0XA83001
|
||||||
|
#define DUER_THINKING 0XA82001
|
||||||
#define ENGINEERING_MODE_VLIST 0X8A1400
|
#define ENGINEERING_MODE_VLIST 0X8A1400
|
||||||
#define FACE_INDEX 0X803C00
|
#define FACE_INDEX 0X803C00
|
||||||
#define FINDMY_BINDING 0X942002
|
#define FINDMY_BINDING 0X942002
|
||||||
@@ -1767,6 +1779,7 @@
|
|||||||
#define IFLY_TIME_VAD 0XA03C00
|
#define IFLY_TIME_VAD 0XA03C00
|
||||||
#define INDOOR_SPORT_LAYOUT 0X580C00
|
#define INDOOR_SPORT_LAYOUT 0X580C00
|
||||||
#define INDOOR_SPORT_LIST 0X581400
|
#define INDOOR_SPORT_LIST 0X581400
|
||||||
|
#define INTELLIGENT_DUER_LAYER 0XA81000
|
||||||
#define LAYER_WOMEN_HEALTH 0X4A1000
|
#define LAYER_WOMEN_HEALTH 0X4A1000
|
||||||
#define LAYOUT_MENU_WATERFALL 0X480C00
|
#define LAYOUT_MENU_WATERFALL 0X480C00
|
||||||
#define LAYOUT_UVC_SHOW 0XA20C00
|
#define LAYOUT_UVC_SHOW 0XA20C00
|
||||||
@@ -2000,6 +2013,7 @@
|
|||||||
#define PAGE_81 0XA20851
|
#define PAGE_81 0XA20851
|
||||||
#define PAGE_82 0XA40852
|
#define PAGE_82 0XA40852
|
||||||
#define PAGE_83 0XA60853
|
#define PAGE_83 0XA60853
|
||||||
|
#define PAGE_84 0XA80854
|
||||||
#define PAGE_9 0X120809
|
#define PAGE_9 0X120809
|
||||||
#define PASSWORD_0_BUTTON 0X162010
|
#define PASSWORD_0_BUTTON 0X162010
|
||||||
#define PASSWORD_1_BUTTON 0X162007
|
#define PASSWORD_1_BUTTON 0X162007
|
||||||
@@ -2554,7 +2568,7 @@
|
|||||||
#define TIME_UNDISTURB_MODE_START_TIME 0X102800
|
#define TIME_UNDISTURB_MODE_START_TIME 0X102800
|
||||||
#define TRANSIT_LOADING_PIC 0X22200C
|
#define TRANSIT_LOADING_PIC 0X22200C
|
||||||
#define UI_ROTATE 0X0
|
#define UI_ROTATE 0X0
|
||||||
#define UI_VERSION 0X3E18F271
|
#define UI_VERSION 0X74A92D3
|
||||||
#define UNDISTURB_MODE_ESETTING_BACK_BUTTON 0X102004
|
#define UNDISTURB_MODE_ESETTING_BACK_BUTTON 0X102004
|
||||||
#define UNDISTURB_MODE_ESETTING_HOUR_VLIST 0X101401
|
#define UNDISTURB_MODE_ESETTING_HOUR_VLIST 0X101401
|
||||||
#define UNDISTURB_MODE_ESETTING_LAYOUT 0X100C05
|
#define UNDISTURB_MODE_ESETTING_LAYOUT 0X100C05
|
||||||
|
|||||||
@@ -59,16 +59,25 @@ const int ENABLE_PSRAM_UI_FRAME = 0; //psram特效,暂不使用
|
|||||||
const int JLUI_CORE_GRID_KEY_VER = 0x1; //列表编码器转动版本
|
const int JLUI_CORE_GRID_KEY_VER = 0x1; //列表编码器转动版本
|
||||||
const int UI_NANDFLASH_RES_BY_PACKRES = TCFG_NANDFLASH_UI_FAT_ENABLE; //使用标准fat+packres打包资源
|
const int UI_NANDFLASH_RES_BY_PACKRES = TCFG_NANDFLASH_UI_FAT_ENABLE; //使用标准fat+packres打包资源
|
||||||
const int UI_CORE_FOCUS_FILTER_ENABLE = 1;
|
const int UI_CORE_FOCUS_FILTER_ENABLE = 1;
|
||||||
|
|
||||||
|
|
||||||
const int config_jpeg_isr_delay_us = 50; //参考值100,最小50
|
|
||||||
const int JLJPEG_STREAM_ENABLE = 1;
|
|
||||||
const int config_jpeg_sync_wait_in_irq = 0; //在中断同步等待
|
|
||||||
#if CONFIG_DOUBLE_BANK_ENABLE
|
#if CONFIG_DOUBLE_BANK_ENABLE
|
||||||
const int UI_RES_FLASH_TAB_OFFSET = 0x20; //双备份内置资源偏移
|
const int UI_RES_FLASH_TAB_OFFSET = 0x20; //双备份内置资源偏移
|
||||||
#else
|
#else
|
||||||
const int UI_RES_FLASH_TAB_OFFSET = 0x0;
|
const int UI_RES_FLASH_TAB_OFFSET = 0x0;
|
||||||
#endif
|
#endif
|
||||||
|
//================================================//
|
||||||
|
// JPEG //
|
||||||
|
//================================================//
|
||||||
|
const int config_jpeg_isr_delay_us = 50; //参考值100,最小50
|
||||||
|
const int JLJPEG_STREAM_ENABLE = 1;
|
||||||
|
#if TCFG_HOST_UVC_ENABLE
|
||||||
|
const int config_jpeg_sync_wait_in_irq = 1; //在中断同步等待,效率低
|
||||||
|
const int config_jpeg_ff_rst_enable = 1; //支持带DRI标志的图片,部分摄像头只输出这种类型的图片
|
||||||
|
#else
|
||||||
|
const int config_jpeg_sync_wait_in_irq = 0; //在中断同步等待
|
||||||
|
const int config_jpeg_ff_rst_enable = 0; //支持带DRI标志的图片,非UVC功能不开,由app等转码。带DRI标志解码效率低
|
||||||
|
#endif
|
||||||
|
const int config_jpeg_pend_timeout = 20; //
|
||||||
|
|
||||||
//================================================//
|
//================================================//
|
||||||
// GPU中断 //
|
// GPU中断 //
|
||||||
//================================================//
|
//================================================//
|
||||||
@@ -97,7 +106,11 @@ const int KHMER_MODE_SWITCH = 0;
|
|||||||
const int INDIC_MODE_SWITCH = 0;
|
const int INDIC_MODE_SWITCH = 0;
|
||||||
const int TIBETAN_MODE_SWITCH = 0;
|
const int TIBETAN_MODE_SWITCH = 0;
|
||||||
const int MIXLEFT_MODE_SWITCH = 0;
|
const int MIXLEFT_MODE_SWITCH = 0;
|
||||||
|
#if TCFG_IFLYTEK_ENABLE
|
||||||
|
const int MIXRIGHT_MODE_SWITCH = 1;
|
||||||
|
#else
|
||||||
const int MIXRIGHT_MODE_SWITCH = 0;
|
const int MIXRIGHT_MODE_SWITCH = 0;
|
||||||
|
#endif
|
||||||
const int FONT_UNIC_SWITCH = 1;
|
const int FONT_UNIC_SWITCH = 1;
|
||||||
const int FONT_USE_PTR = !TCFG_NANDFLASH_DEV_ENABLE;
|
const int FONT_USE_PTR = !TCFG_NANDFLASH_DEV_ENABLE;
|
||||||
const int SCALE_EFFECT_WITHOUT_PSRAM_ENABLE = 0;
|
const int SCALE_EFFECT_WITHOUT_PSRAM_ENABLE = 0;
|
||||||
@@ -115,7 +128,7 @@ const u32 config_ui_alloc_psram_mod_sel = \
|
|||||||
BIT(UI_MODULE_RESOURCE) | \
|
BIT(UI_MODULE_RESOURCE) | \
|
||||||
BIT(UI_MODULE_GPU) | \
|
BIT(UI_MODULE_GPU) | \
|
||||||
BIT(UI_MODULE_FONT) | \
|
BIT(UI_MODULE_FONT) | \
|
||||||
BIT(UI_MODULE_JPEG) | \
|
/* BIT(UI_MODULE_JPEG) | \ */ \
|
||||||
BIT(UI_MODULE_CACHE) | \
|
BIT(UI_MODULE_CACHE) | \
|
||||||
BIT(UI_MODULE_CUSTOM_DRAW);
|
BIT(UI_MODULE_CUSTOM_DRAW);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
#ifdef SUPPORT_MS_EXTENSIONS
|
||||||
|
#pragma bss_seg(".video.data.bss")
|
||||||
|
#pragma data_seg(".video.data")
|
||||||
|
#pragma const_seg(".video.text.const")
|
||||||
|
#pragma code_seg(".video.text")
|
||||||
|
#endif
|
||||||
|
#include "system/includes.h"
|
||||||
|
#include "app_main.h"
|
||||||
|
#include "app_video.h"
|
||||||
|
#include "ui/ui_api.h"
|
||||||
|
|
||||||
|
#define LOG_TAG "[APP_VIDEO]"
|
||||||
|
#define LOG_ERROR_ENABLE
|
||||||
|
#define LOG_DEBUG_ENABLE
|
||||||
|
#define LOG_INFO_ENABLE
|
||||||
|
/* #define LOG_DUMP_ENABLE */
|
||||||
|
#define LOG_CLI_ENABLE
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#if TCFG_APP_VIDEO_EN
|
||||||
|
|
||||||
|
extern u8 get_avi_audio_status();
|
||||||
|
|
||||||
|
|
||||||
|
static int app_video_init()
|
||||||
|
{
|
||||||
|
log_info("%s", __func__);
|
||||||
|
|
||||||
|
app_send_message(APP_MSG_ENTER_MODE, APP_MODE_VIDEO);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void app_video_exit()
|
||||||
|
{
|
||||||
|
static int count = 0;
|
||||||
|
log_info("%s", __func__);
|
||||||
|
|
||||||
|
UI_MSG_POST("video_show_exit");
|
||||||
|
while (get_avi_audio_status() && count < 30) {
|
||||||
|
++count;
|
||||||
|
os_time_dly(10);
|
||||||
|
}
|
||||||
|
count = 0;
|
||||||
|
app_send_message(APP_MSG_EXIT_MODE, APP_MODE_VIDEO);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct app_mode *app_enter_video_mode(int arg)
|
||||||
|
{
|
||||||
|
int msg[16];
|
||||||
|
struct app_mode *next_mode;
|
||||||
|
|
||||||
|
app_video_init();
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (!app_get_message(msg, ARRAY_SIZE(msg), NULL)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
next_mode = app_mode_switch_handler(msg);
|
||||||
|
if (next_mode) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (msg[0]) {
|
||||||
|
case MSG_FROM_APP:
|
||||||
|
break;
|
||||||
|
case MSG_FROM_DEVICE:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
app_default_msg_handler(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
app_video_exit();
|
||||||
|
|
||||||
|
return next_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int video_mode_try_enter(int arg)
|
||||||
|
{
|
||||||
|
log_info("%s", __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int video_mode_try_exit()
|
||||||
|
{
|
||||||
|
log_info("%s", __func__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct app_mode_ops video_mode_ops = {
|
||||||
|
.try_enter = video_mode_try_enter,
|
||||||
|
.try_exit = video_mode_try_exit,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 注册video模式
|
||||||
|
*/
|
||||||
|
REGISTER_APP_MODE(video_mode) = {
|
||||||
|
.name = APP_MODE_VIDEO,
|
||||||
|
.index = 0xff,
|
||||||
|
.ops = &video_mode_ops,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*TCFG_APP_VIDEO_EN*/
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
.section .sys.version, "ax"
|
.section .sys.version, "ax"
|
||||||
|
|
||||||
.long 313049334
|
.long 313673739
|
||||||
.asciz "-@20251202-$410e8ade"
|
.asciz "-@20251209-$fa0a9cb7"
|
||||||
|
|||||||
@@ -137,7 +137,9 @@ static int ai_text_rx_cb(u8 ai_text, u8 *data, int len)
|
|||||||
// UTF8
|
// UTF8
|
||||||
ai_txttempa = tts_txt;
|
ai_txttempa = tts_txt;
|
||||||
ai_txttempb = ai_txt2;
|
ai_txttempb = ai_txt2;
|
||||||
|
if (ai_text) {
|
||||||
UI_MSG_POST("SEND_TXT");
|
UI_MSG_POST("SEND_TXT");
|
||||||
|
}
|
||||||
log_i("rx text:%d, %s \n", ai_text, data);
|
log_i("rx text:%d, %s \n", ai_text, data);
|
||||||
put_buf(data, len);
|
put_buf(data, len);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -447,6 +447,8 @@ static void ai_txt_empty_handler(void *priv)
|
|||||||
char empty_str_copy[50] = "您好像并没有说话";
|
char empty_str_copy[50] = "您好像并没有说话";
|
||||||
strcpy(empty_str, empty_str_copy);
|
strcpy(empty_str, empty_str_copy);
|
||||||
ui_text_set_textu_by_id(AI_DIAL_TXT, (char *)empty_str, strlen((char *)empty_str), FONT_DEFAULT | FONT_SHOW_MULTI_LINE);
|
ui_text_set_textu_by_id(AI_DIAL_TXT, (char *)empty_str, strlen((char *)empty_str), FONT_DEFAULT | FONT_SHOW_MULTI_LINE);
|
||||||
|
} else {
|
||||||
|
ui_text_set_textu_by_id(AI_DIAL_TXT, (char *)ai_dial_txt1, strlen((char *)ai_dial_txt1), FONT_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,6 +687,30 @@ static int AI_dialogue_ontouch(void *ctr, struct element_touch_event *e)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
static int AI_dial_time_onchange(void *ctr, enum element_change_event e, void *arg)
|
||||||
|
{
|
||||||
|
struct ui_number *ui_num = (struct ui_number *)ctr;
|
||||||
|
struct unumber num;
|
||||||
|
switch (e) {
|
||||||
|
case ON_CHANGE_INIT:
|
||||||
|
cuntdown_flag = 60;
|
||||||
|
num.type = TYPE_NUM;
|
||||||
|
num.numbs = 1;
|
||||||
|
num.number[0] = cuntdown_flag;
|
||||||
|
ui_number_update(ui_num, &num);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
REGISTER_UI_EVENT_HANDLER(AI_DIALOGUE)
|
||||||
|
.onchange = AI_dialogue_onchange,
|
||||||
|
.onkey = NULL,
|
||||||
|
.ontouch = NULL,
|
||||||
|
};
|
||||||
|
|
||||||
REGISTER_UI_EVENT_HANDLER(AI_DIALOGUE)
|
REGISTER_UI_EVENT_HANDLER(AI_DIALOGUE)
|
||||||
.onchange = AI_dialogue_onchange,
|
.onchange = AI_dialogue_onchange,
|
||||||
@@ -696,6 +722,12 @@ REGISTER_UI_EVENT_HANDLER(AI_DIAL_VOICE)
|
|||||||
.onkey = NULL,
|
.onkey = NULL,
|
||||||
.ontouch = AI_dialogue_ontouch,
|
.ontouch = AI_dialogue_ontouch,
|
||||||
};
|
};
|
||||||
|
REGISTER_UI_EVENT_HANDLER(AI_DIAL_TIME)
|
||||||
|
.onchange = AI_dial_time_onchange,
|
||||||
|
.onkey = NULL,
|
||||||
|
.ontouch = NULL,
|
||||||
|
};
|
||||||
|
|
||||||
//****************************************************************************************/
|
//****************************************************************************************/
|
||||||
// layout3-AI表盘 //
|
// layout3-AI表盘 //
|
||||||
/****************************************************************************************/
|
/****************************************************************************************/
|
||||||
|
|||||||
@@ -128,8 +128,10 @@ void camera_dec_reflush_sync(int status)
|
|||||||
int msg[3] = {0};
|
int msg[3] = {0};
|
||||||
|
|
||||||
if (!status) {
|
if (!status) {
|
||||||
|
//正常刷新
|
||||||
msg[0] = (int)camera_dec_flush;
|
msg[0] = (int)camera_dec_flush;
|
||||||
} else {
|
} else {
|
||||||
|
//异常显示
|
||||||
msg[0] = (int) camera_rec_err;
|
msg[0] = (int) camera_rec_err;
|
||||||
}
|
}
|
||||||
msg[1] = 1;
|
msg[1] = 1;
|
||||||
@@ -178,6 +180,9 @@ static int cam_ctrl_view_video(int enable)
|
|||||||
}
|
}
|
||||||
static void cam_camera_photo_savc_cb(char *path)
|
static void cam_camera_photo_savc_cb(char *path)
|
||||||
{
|
{
|
||||||
|
if (jljpeg_stream_src_data_get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
jljpeg_stream_src_data_save_to_file(path);
|
jljpeg_stream_src_data_save_to_file(path);
|
||||||
if (__this && (__this->photo_save_cnt > 0)) {
|
if (__this && (__this->photo_save_cnt > 0)) {
|
||||||
__this->photo_save_cnt--;
|
__this->photo_save_cnt--;
|
||||||
@@ -357,6 +362,29 @@ static int cam_handler_prepare_cb(void *ctrl, int count, int start)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//****************************************************************************************//
|
||||||
|
// 消息处理
|
||||||
|
//****************************************************************************************//
|
||||||
|
static int ui_video_show_exit_handler(const char *type, u32 arg)
|
||||||
|
{
|
||||||
|
log_info("[%s]", __func__);
|
||||||
|
|
||||||
|
switch (__this->layout_curr) {
|
||||||
|
case CAM_SHOW_LAYOUT:
|
||||||
|
cam_layout_sw(CAM_PHOTO_LAYOUT);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct uimsg_handl ui_msg_handler[] = {
|
||||||
|
{ "video_show_exit", ui_video_show_exit_handler },
|
||||||
|
{ NULL, NULL}, /* 必须以此结尾! */
|
||||||
|
};
|
||||||
|
|
||||||
//****************************************************************************************//
|
//****************************************************************************************//
|
||||||
// 提醒
|
// 提醒
|
||||||
//****************************************************************************************//
|
//****************************************************************************************//
|
||||||
@@ -390,6 +418,7 @@ static int cam_layer_onchange(void *ctrl, enum element_change_event event, void
|
|||||||
//图层初始化变量
|
//图层初始化变量
|
||||||
/* f_format("sd0","fat",0); */
|
/* f_format("sd0","fat",0); */
|
||||||
cam_ctrl_init();
|
cam_ctrl_init();
|
||||||
|
ui_register_msg_handler(ID_WINDOW_CAMERA, ui_msg_handler);
|
||||||
break;
|
break;
|
||||||
case ON_CHANGE_RELEASE:
|
case ON_CHANGE_RELEASE:
|
||||||
cam_ctrl_deinit();
|
cam_ctrl_deinit();
|
||||||
@@ -522,6 +551,10 @@ static int cam_camera_layout_onchange(void *ctrl, enum element_change_event even
|
|||||||
jljpeg_stream_src_data_len_get());
|
jljpeg_stream_src_data_len_get());
|
||||||
break;
|
break;
|
||||||
case ON_CHANGE_RELEASE:
|
case ON_CHANGE_RELEASE:
|
||||||
|
if (__this->video_doing) {
|
||||||
|
jlcamera_video_rec_stop();
|
||||||
|
__this->video_doing = 0;
|
||||||
|
}
|
||||||
//关闭摄像头
|
//关闭摄像头
|
||||||
jlcamera_video_rec_deinit();
|
jlcamera_video_rec_deinit();
|
||||||
//关闭jpeg数据流解码
|
//关闭jpeg数据流解码
|
||||||
@@ -817,6 +850,8 @@ static int cam_photo_list_ontouch(void *_ctrl, struct element_touch_event *e)
|
|||||||
if (__this->view_remap[i] == dyn_idx) {
|
if (__this->view_remap[i] == dyn_idx) {
|
||||||
if (!__this->view_vaild[i]) {
|
if (!__this->view_vaild[i]) {
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -912,7 +947,88 @@ static void avi_flush_timer(void *p)
|
|||||||
jlgpu_scheduler_wait_sync();
|
jlgpu_scheduler_wait_sync();
|
||||||
}
|
}
|
||||||
void __jpeg_draw_cb_gpu(int id, u8 *dst_buf, struct rect *dst_r, struct rect *src_r, u8 bytes_per_pixel, void *priv, void *matrix);
|
void __jpeg_draw_cb_gpu(int id, u8 *dst_buf, struct rect *dst_r, struct rect *src_r, u8 bytes_per_pixel, void *priv, void *matrix);
|
||||||
|
static void camera_video_dec_flush(void)
|
||||||
|
{
|
||||||
|
struct element *elm;
|
||||||
|
elm = ui_core_get_element_by_id(CAM_SHOW_LAYOUT);
|
||||||
|
if (elm != NULL) {
|
||||||
|
/* printf(">>>>>>elm != NULL"); */
|
||||||
|
ui_redraw(CAM_SHOW_LAYOUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void video_dec_reflush_sync(int status)
|
||||||
|
{
|
||||||
|
void jlui_malloc_ram_info_dump();
|
||||||
|
/* jlui_malloc_ram_info_dump(); */
|
||||||
|
log_debug("%s status:%d !!\n", __func__, status);
|
||||||
|
|
||||||
|
int msg[3] = {0};
|
||||||
|
|
||||||
|
if (!status) {
|
||||||
|
//正常刷新
|
||||||
|
msg[0] = (int) camera_video_dec_flush;
|
||||||
|
} else {
|
||||||
|
//异常显示
|
||||||
|
}
|
||||||
|
msg[1] = 1;
|
||||||
|
msg[2] = 0;
|
||||||
|
int ret = os_taskq_post_type("ui", Q_CALLBACK, 3, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0//使用video_dec解码测试.
|
||||||
|
|
||||||
|
extern int video_dec_init();
|
||||||
|
extern int video_dec_deinit();
|
||||||
|
extern int video_dec_set_path(s8(*path)[64], u8 path_number);
|
||||||
|
extern int video_dec_start(u8 index, u8 mode);
|
||||||
|
extern int video_dec_refresh_cb_register(void (*cb)(int status));
|
||||||
|
extern int video_dec_stop();
|
||||||
static int cam_show_layout_onchange(void *ctrl, enum element_change_event event, void *arg)
|
static int cam_show_layout_onchange(void *ctrl, enum element_change_event event, void *arg)
|
||||||
|
{
|
||||||
|
struct ui_grid *grid = (struct ui_grid *)ctrl;
|
||||||
|
struct element *elm = (struct element *)ctrl;
|
||||||
|
struct draw_context *dc = (struct draw_context *)arg;
|
||||||
|
switch (event) {
|
||||||
|
case ON_CHANGE_INIT:
|
||||||
|
if (!__this->sel_path) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (__this->view_video) {
|
||||||
|
video_dec_init();
|
||||||
|
video_dec_refresh_cb_register(video_dec_reflush_sync);
|
||||||
|
video_dec_set_path((s8(*)[64])__this->sel_path, 1);
|
||||||
|
video_dec_start(0, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ON_CHANGE_SHOW_POST:
|
||||||
|
if (!__this->sel_path) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ui_custom_draw_clear(dc);
|
||||||
|
if (__this->view_video) {
|
||||||
|
//实时显示画面
|
||||||
|
if (!jljpeg_stream_src_data_len_get()) {
|
||||||
|
//码流数据为空时不显示
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
jpeg_image_ram(dc, 40, 0, 240, 320,
|
||||||
|
jljpeg_stream_src_data_get(),
|
||||||
|
jljpeg_stream_src_data_len_get());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ON_CHANGE_RELEASE:
|
||||||
|
video_dec_stop();
|
||||||
|
video_dec_deinit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int cam_show_layout_onchange1(void *ctrl, enum element_change_event event, void *arg)
|
||||||
{
|
{
|
||||||
struct ui_grid *grid = (struct ui_grid *)ctrl;
|
struct ui_grid *grid = (struct ui_grid *)ctrl;
|
||||||
struct element *elm = (struct element *)ctrl;
|
struct element *elm = (struct element *)ctrl;
|
||||||
@@ -935,11 +1051,11 @@ static int cam_show_layout_onchange(void *ctrl, enum element_change_event event,
|
|||||||
if (!get_aviplay_handle()) {
|
if (!get_aviplay_handle()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* u16 timer_id = 0; */
|
u16 timer_id = 0;
|
||||||
/* if (!avi_get_avi_playtimer_id()) { */
|
if (!avi_get_avi_playtimer_id()) {
|
||||||
/* timer_id = sys_timeout_add((void *)elm->id, (avi_flush_timer), 10); // 强制满帧刷新 */
|
timer_id = sys_timeout_add((void *)elm->id, (avi_flush_timer), 10); // 强制满帧刷新
|
||||||
/* avi_set_avi_playtimer_id(timer_id); */
|
avi_set_avi_playtimer_id(timer_id);
|
||||||
/* } */
|
}
|
||||||
u32 avip = (u32)get_avi_player_st_handle();
|
u32 avip = (u32)get_avi_player_st_handle();
|
||||||
log_debug("player->st %x %d %d ", avip, avi_get_width(get_avi_player_st_handle()), avi_get_height(get_avi_player_st_handle()));
|
log_debug("player->st %x %d %d ", avip, avi_get_width(get_avi_player_st_handle()), avi_get_height(get_avi_player_st_handle()));
|
||||||
ui_draw(dc,
|
ui_draw(dc,
|
||||||
@@ -970,9 +1086,9 @@ static int cam_show_layout_onchange(void *ctrl, enum element_change_event event,
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_UI_EVENT_HANDLER(CAM_SHOW_LAYOUT)
|
REGISTER_UI_EVENT_HANDLER(CAM_SHOW_LAYOUT)
|
||||||
.onchange = cam_show_layout_onchange,
|
/* .onchange = cam_show_layout_onchange, */
|
||||||
|
.onchange = cam_show_layout_onchange1,
|
||||||
.onkey = NULL,
|
.onkey = NULL,
|
||||||
.ontouch = NULL,
|
.ontouch = NULL,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -165,6 +165,11 @@ static int show_onchange(void *ctr, enum element_change_event e, void *arg)
|
|||||||
{
|
{
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case ON_CHANGE_INIT:
|
case ON_CHANGE_INIT:
|
||||||
|
struct unumber num;
|
||||||
|
num.type = TYPE_NUM;
|
||||||
|
num.numbs = 1;
|
||||||
|
num.number[0] = 20;
|
||||||
|
ui_number_update_by_id(AI_TIME, &num);
|
||||||
send_0X09_ENTER();
|
send_0X09_ENTER();
|
||||||
break;
|
break;
|
||||||
case ON_CHANGE_FIRST_SHOW:
|
case ON_CHANGE_FIRST_SHOW:
|
||||||
@@ -254,6 +259,7 @@ static void AI_time1_handler(void *priv)//20秒倒计时,不息屏
|
|||||||
if (i_flag == 0) { //20倒计时结束后,超时标志位置1
|
if (i_flag == 0) { //20倒计时结束后,超时标志位置1
|
||||||
i_flag = 20;
|
i_flag = 20;
|
||||||
ai_timeout = true;
|
ai_timeout = true;
|
||||||
|
ui_text_show_index_by_id(AI_TEXT, 0);
|
||||||
} else if (flag_button == 0) { //按钮控件按下,开始录音倒计时
|
} else if (flag_button == 0) { //按钮控件按下,开始录音倒计时
|
||||||
i_flag = 20;
|
i_flag = 20;
|
||||||
}
|
}
|
||||||
@@ -391,7 +397,7 @@ static void AI_thinking_handler(void *priv)
|
|||||||
ui_core_redraw(pic);
|
ui_core_redraw(pic);
|
||||||
}
|
}
|
||||||
flag++;
|
flag++;
|
||||||
if (flag == 25) { //等待5秒没有获得信号,切到列表
|
if (flag == 100) { //等待5秒没有获得信号,切到列表
|
||||||
flag = 0;
|
flag = 0;
|
||||||
page_showtxt();
|
page_showtxt();
|
||||||
}
|
}
|
||||||
@@ -480,10 +486,10 @@ static void reflash_gettxt_handler(void *priv)
|
|||||||
static void reflash_gettxtII_handler(void *priv)
|
static void reflash_gettxtII_handler(void *priv)
|
||||||
{
|
{
|
||||||
if (ai_txt1) {
|
if (ai_txt1) {
|
||||||
ui_text_set_textu_by_id(AI_TXT1, (char *)ai_txt1, strlen((char *)ai_txt1), FONT_DEFAULT | FONT_SHOW_SCROLL);
|
ui_text_set_textu_by_id(AI_TXT1, (char *)ai_txt1, strlen((char *)ai_txt1), FONT_DEFAULT);
|
||||||
} else {
|
} else {
|
||||||
ai_txt1 = NULL;
|
ai_txt1 = NULL;
|
||||||
ui_text_set_textu_by_id(AI_TXT1, (char *)ai_txt1, 0, FONT_DEFAULT | FONT_SHOW_SCROLL);
|
ui_text_set_textu_by_id(AI_TXT1, (char *)ai_txt1, 0, FONT_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void memset_txt(void)
|
void memset_txt(void)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "vad_main.h"
|
#include "vad_main.h"
|
||||||
#include "ifly_socket.h"
|
#include "ifly_socket.h"
|
||||||
#include "cat1/cat1_common.h"
|
#include "cat1/cat1_common.h"
|
||||||
|
#include "font/language_list.h"
|
||||||
|
|
||||||
#if TCFG_IFLYTEK_ENABLE //科大讯飞网络版
|
#if TCFG_IFLYTEK_ENABLE //科大讯飞网络版
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
|
|
||||||
// ui参数
|
// ui参数
|
||||||
struct ifly_ui_t {
|
struct ifly_ui_t {
|
||||||
|
u8 net_fail;
|
||||||
u16 time_id; // 定时器
|
u16 time_id; // 定时器
|
||||||
u16 task_create_timer;
|
u16 task_create_timer;
|
||||||
u16 switch_pic_cnt; // 动图循环
|
u16 switch_pic_cnt; // 动图循环
|
||||||
@@ -184,12 +186,18 @@ REGISTER_UI_EVENT_HANDLER(IFLY_BUTTON_TTS_PLAY)
|
|||||||
|
|
||||||
static void reflash_gettxt_handler(void *priv)
|
static void reflash_gettxt_handler(void *priv)
|
||||||
{
|
{
|
||||||
if (ifly_check_net_connect() == false) {
|
u8 *net_fail = (u8 *)priv;
|
||||||
|
if (ifly_check_net_connect() == false && !(*net_fail)) {
|
||||||
UI_MSG_POST("tts_network_no_connect");
|
UI_MSG_POST("tts_network_no_connect");
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_auto_shut_down_re_run();
|
ui_auto_shut_down_re_run();
|
||||||
|
|
||||||
|
font_lang_set(UnicodeMixRightword);
|
||||||
|
ui_text_set_textu_by_id(AI_4,
|
||||||
|
p_ifly_net->local_text, strlen(p_ifly_net->local_text),
|
||||||
|
FONT_DEFAULT | FONT_SHOW_MULTI_LINE);
|
||||||
|
|
||||||
ui_text_set_textu_by_id(IFLY_TEXT_TTS_TXT,
|
ui_text_set_textu_by_id(IFLY_TEXT_TTS_TXT,
|
||||||
p_ifly_net->ai_text, strlen(p_ifly_net->ai_text),
|
p_ifly_net->ai_text, strlen(p_ifly_net->ai_text),
|
||||||
FONT_DEFAULT | FONT_SHOW_MULTI_LINE | FONT_VERTICAL_SCROLL);
|
FONT_DEFAULT | FONT_SHOW_MULTI_LINE | FONT_VERTICAL_SCROLL);
|
||||||
@@ -217,7 +225,12 @@ static int showtxt_onchange(void *ctr, enum element_change_event e, void *arg)
|
|||||||
sys_timer_del(ifly_ui->time_id);
|
sys_timer_del(ifly_ui->time_id);
|
||||||
ifly_ui->time_id = 0;
|
ifly_ui->time_id = 0;
|
||||||
}
|
}
|
||||||
ifly_ui->time_id = sys_timer_add(NULL, reflash_gettxt_handler, 1000);
|
if (ifly_check_net_connect()) {
|
||||||
|
ifly_ui->net_fail = 0;
|
||||||
|
} else {
|
||||||
|
ifly_ui->net_fail = 1;
|
||||||
|
}
|
||||||
|
ifly_ui->time_id = sys_timer_add((void *)&ifly_ui->net_fail, reflash_gettxt_handler, 1000);
|
||||||
break;
|
break;
|
||||||
case ON_CHANGE_FIRST_SHOW:
|
case ON_CHANGE_FIRST_SHOW:
|
||||||
break;
|
break;
|
||||||
@@ -502,6 +515,26 @@ REGISTER_UI_EVENT_HANDLER(IFLY_LAYOUT_VAD)
|
|||||||
.ontouch = NULL,
|
.ontouch = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int no_connect_ontouch(void *ctr, struct element_touch_event *e)
|
||||||
|
{
|
||||||
|
switch (e->event) {
|
||||||
|
case ELM_EVENT_TOUCH_R_MOVE:
|
||||||
|
if (ifly_ui && ifly_ui->cur_layout) {
|
||||||
|
ui_hide(IFLY_LAYOUT_NO_CONNECT);
|
||||||
|
ui_show(ifly_ui->cur_layout);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
REGISTER_UI_EVENT_HANDLER(IFLY_LAYOUT_NO_CONNECT)
|
||||||
|
.onchange = NULL,
|
||||||
|
.onkey = NULL,
|
||||||
|
.ontouch = no_connect_ontouch,
|
||||||
|
};
|
||||||
|
|
||||||
static void ifly_no_content_time_deal(void *priv)
|
static void ifly_no_content_time_deal(void *priv)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ static int uvc_layout_onchange(void *ctrl, enum element_change_event event, void
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ON_CHANGE_INIT:
|
case ON_CHANGE_INIT:
|
||||||
|
ui_auto_shut_down_disable();
|
||||||
jljpeg_stream_init();
|
jljpeg_stream_init();
|
||||||
jluvc_set_refresh_cb(ui_uvc_ui_reflush);
|
jluvc_set_refresh_cb(ui_uvc_ui_reflush);
|
||||||
break;
|
break;
|
||||||
@@ -97,6 +98,7 @@ static int uvc_layout_onchange(void *ctrl, enum element_change_event event, void
|
|||||||
}
|
}
|
||||||
dc = (struct draw_context *)arg;
|
dc = (struct draw_context *)arg;
|
||||||
/* ui_custom_draw_clear(dc); */
|
/* ui_custom_draw_clear(dc); */
|
||||||
|
/* put_buf(jljpeg_stream_src_data_get(),128); */
|
||||||
jlgpu_scheduler_wait_sync();
|
jlgpu_scheduler_wait_sync();
|
||||||
jlgpu_task_clean_up_by_id(dc->gpu_task_head, dc->elm->id, 0x1);
|
jlgpu_task_clean_up_by_id(dc->gpu_task_head, dc->elm->id, 0x1);
|
||||||
jpeg_image_ram(dc, 0, 0, UVC_JPG_WIDTH , UVC_JPG_HEIGHT,
|
jpeg_image_ram(dc, 0, 0, UVC_JPG_WIDTH , UVC_JPG_HEIGHT,
|
||||||
@@ -105,6 +107,7 @@ static int uvc_layout_onchange(void *ctrl, enum element_change_event event, void
|
|||||||
break;
|
break;
|
||||||
case ON_CHANGE_RELEASE:
|
case ON_CHANGE_RELEASE:
|
||||||
jljpeg_stream_deinit();
|
jljpeg_stream_deinit();
|
||||||
|
ui_auto_shut_down_enable();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1216,6 +1216,10 @@ static void menu_list_anim_ready_cb(struct _ui_anim_t *p)
|
|||||||
if (elm) {
|
if (elm) {
|
||||||
ui_hide(__this->target_page);
|
ui_hide(__this->target_page);
|
||||||
}
|
}
|
||||||
|
if (__this->target_page == ID_WINDOW_NOTICE) {
|
||||||
|
extern u8 create_control_by_menu_set(u8 en);
|
||||||
|
create_control_by_menu_set(1);
|
||||||
|
}
|
||||||
UI_SHOW_WINDOW(__this->target_page);
|
UI_SHOW_WINDOW(__this->target_page);
|
||||||
}
|
}
|
||||||
/* 清空过渡动画任务链 */
|
/* 清空过渡动画任务链 */
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
#include "avilib.h"
|
#include "avilib.h"
|
||||||
#include "app_config.h"
|
#include "app_config.h"
|
||||||
|
|
||||||
|
//创建另外的文件存储AVI索引, 节约ram内存。在结束录像时合并索引到AVI文件中
|
||||||
|
#define AVI_INDXE_FILE_ENABLE 1
|
||||||
|
|
||||||
//#include <time.h>
|
//#include <time.h>
|
||||||
#if TCFG_PSRAM_DEV_ENABLE
|
#if TCFG_PSRAM_DEV_ENABLE
|
||||||
#define malloc(size) malloc_psram(size)
|
#define malloc(size) malloc_psram(size)
|
||||||
@@ -80,7 +83,7 @@ static size_t avi_write(void *fd, char *buf, size_t len)
|
|||||||
|
|
||||||
while (r < len) {
|
while (r < len) {
|
||||||
n = fwrite(buf + r, 1, len - r, (FILE *)fd);
|
n = fwrite(buf + r, 1, len - r, (FILE *)fd);
|
||||||
if ((ssize_t)n < 0) {
|
if ((ssize_t)n <= 0) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,10 +177,64 @@ static int avi_add_chunk(avi_t *AVI, unsigned char *tag, unsigned char *data, in
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int avi_add_idx_chunk(avi_t *AVI, u32 length)
|
||||||
|
{
|
||||||
|
unsigned char c[8] = { 'i', 'd', 'x', '1', 0, 0, 0, 0 };
|
||||||
|
long2str(c + 4, length);
|
||||||
|
|
||||||
|
if (avi_write(AVI->fdes, (char *)c, 8) != 8) {
|
||||||
|
fseek(AVI->fdes, AVI->pos, SEEK_SET);
|
||||||
|
AVI_errno = AVI_ERR_WRITE;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update file position */
|
||||||
|
AVI->pos += 8;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int avi_add_idx_data(avi_t *AVI, unsigned char *data, int length)
|
||||||
|
{
|
||||||
|
/* Output tag, length and data, restore previous position
|
||||||
|
if the write fails */
|
||||||
|
|
||||||
|
length = PAD_EVEN(length);
|
||||||
|
|
||||||
|
if (avi_write(AVI->fdes, (char *)data, length) != length) {
|
||||||
|
fseek(AVI->fdes, AVI->pos, SEEK_SET);
|
||||||
|
AVI_errno = AVI_ERR_WRITE;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update file position */
|
||||||
|
|
||||||
|
AVI->pos += length;
|
||||||
|
|
||||||
|
//fprintf(stderr, "pos=%lu %s\n", AVI->pos, tag);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int avi_add_index_entry(avi_t *AVI, unsigned char *tag, long flags, unsigned long pos, unsigned long len)
|
static int avi_add_index_entry(avi_t *AVI, unsigned char *tag, long flags, unsigned long pos, unsigned long len)
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
|
if (AVI->index_fdes) {
|
||||||
|
unsigned char c[16];
|
||||||
|
|
||||||
|
memcpy(c, tag, 4);
|
||||||
|
long2str(c + 4, flags);
|
||||||
|
//pos - movi_addr
|
||||||
|
long2str(c + 8, pos - (HEADERBYTES - 4));
|
||||||
|
long2str(c + 12, len);
|
||||||
|
|
||||||
|
//写入索引文件
|
||||||
|
if (avi_write(AVI->index_fdes, (char *)c, 16) != 16) {
|
||||||
|
printf("wirte index fail \n");
|
||||||
|
AVI_errno = AVI_ERR_WRITE;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (AVI->n_idx >= AVI->max_idx) {
|
if (AVI->n_idx >= AVI->max_idx) {
|
||||||
|
|
||||||
size_t old_count = AVI->max_idx; // 原有元素个数
|
size_t old_count = AVI->max_idx; // 原有元素个数
|
||||||
@@ -220,6 +277,7 @@ static int avi_add_index_entry(avi_t *AVI, unsigned char *tag, long flags, unsig
|
|||||||
//pos - movi_addr
|
//pos - movi_addr
|
||||||
long2str(AVI->idx[AVI->n_idx] + 8, pos - (HEADERBYTES - 4));
|
long2str(AVI->idx[AVI->n_idx] + 8, pos - (HEADERBYTES - 4));
|
||||||
long2str(AVI->idx[AVI->n_idx] + 12, len);
|
long2str(AVI->idx[AVI->n_idx] + 12, len);
|
||||||
|
}
|
||||||
|
|
||||||
/* Update counter */
|
/* Update counter */
|
||||||
|
|
||||||
@@ -288,6 +346,28 @@ avi_t *AVI_open_output_file(char *filename)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if AVI_INDXE_FILE_ENABLE
|
||||||
|
//创建索引文件
|
||||||
|
char index_filename[128];
|
||||||
|
char *dir_path = strrchr(filename, '/');
|
||||||
|
strcpy(index_filename, filename);
|
||||||
|
if (dir_path) {
|
||||||
|
dir_path++;
|
||||||
|
sprintf(index_filename + (dir_path - filename), "IDX_****.idx");
|
||||||
|
} else {
|
||||||
|
sprintf(index_filename, "%s.idx", filename);
|
||||||
|
}
|
||||||
|
/* printf("index :%s \n", index_filename); */
|
||||||
|
AVI->index_fdes = fopen(index_filename, "w+");
|
||||||
|
if (AVI->index_fdes == NULL) {
|
||||||
|
printf("fopen index file err \n");
|
||||||
|
fclose(AVI->fdes);
|
||||||
|
AVI_errno = AVI_ERR_OPEN;
|
||||||
|
free(AVI);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Write out HEADERBYTES bytes, the header will go here
|
/* Write out HEADERBYTES bytes, the header will go here
|
||||||
when we are finished with writing */
|
when we are finished with writing */
|
||||||
|
|
||||||
@@ -298,6 +378,9 @@ avi_t *AVI_open_output_file(char *filename)
|
|||||||
if (i != HEADERBYTES) {
|
if (i != HEADERBYTES) {
|
||||||
fclose(AVI->fdes);
|
fclose(AVI->fdes);
|
||||||
AVI->fdes = NULL;
|
AVI->fdes = NULL;
|
||||||
|
#if AVI_INDXE_FILE_ENABLE
|
||||||
|
fdelete(AVI->index_fdes);
|
||||||
|
#endif
|
||||||
AVI_errno = AVI_ERR_WRITE;
|
AVI_errno = AVI_ERR_WRITE;
|
||||||
free(AVI);
|
free(AVI);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -642,7 +725,7 @@ int avi_update_header(avi_t *AVI)
|
|||||||
static int avi_close_output_file(avi_t *AVI)
|
static int avi_close_output_file(avi_t *AVI)
|
||||||
{
|
{
|
||||||
|
|
||||||
int ret, njunk, sampsize, hasIndex, ms_per_frame, frate, idxerror, flag;
|
int ret = 0, njunk, sampsize, hasIndex, ms_per_frame, frate, idxerror, flag;
|
||||||
unsigned long movi_len;
|
unsigned long movi_len;
|
||||||
int hdrl_start, strl_start, j;
|
int hdrl_start, strl_start, j;
|
||||||
unsigned char AVI_header[HEADERBYTES];
|
unsigned char AVI_header[HEADERBYTES];
|
||||||
@@ -664,7 +747,43 @@ static int avi_close_output_file(avi_t *AVI)
|
|||||||
|
|
||||||
idxerror = 0;
|
idxerror = 0;
|
||||||
// fprintf(stderr, "pos=%lu, index_len=%ld \n", AVI->pos, AVI->n_idx*16);
|
// fprintf(stderr, "pos=%lu, index_len=%ld \n", AVI->pos, AVI->n_idx*16);
|
||||||
|
if (AVI->index_fdes) {
|
||||||
|
//合并索引文件到AVI文件中
|
||||||
|
int buffer_size = 1024;
|
||||||
|
unsigned char *index_data = (unsigned char *)malloc(buffer_size);
|
||||||
|
if (!index_data) {
|
||||||
|
idxerror = 1;
|
||||||
|
AVI_errno = AVI_ERR_NO_MEM;
|
||||||
|
} else {
|
||||||
|
//读取索引文件内容
|
||||||
|
/* fflush(AVI->index_fdes); */
|
||||||
|
u32 index_file_size = flen(AVI->index_fdes);
|
||||||
|
|
||||||
|
fseek(AVI->index_fdes, 0, SEEK_SET);
|
||||||
|
|
||||||
|
size_t read_bytes = avi_read(AVI->index_fdes, (char *)index_data, buffer_size);
|
||||||
|
avi_add_idx_chunk(AVI, index_file_size);
|
||||||
|
while (read_bytes > 0) {
|
||||||
|
//写入AVI文件中
|
||||||
|
ret = avi_add_idx_data(AVI, index_data, read_bytes);
|
||||||
|
hasIndex = (ret == 0);
|
||||||
|
if (ret) {
|
||||||
|
idxerror = 1;
|
||||||
|
AVI_errno = AVI_ERR_WRITE_INDEX;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
read_bytes = avi_read(AVI->index_fdes, (char *)index_data, buffer_size);
|
||||||
|
}
|
||||||
|
free(index_data);
|
||||||
|
}
|
||||||
|
//删除索引文件
|
||||||
|
fdelete(AVI->index_fdes);
|
||||||
|
//(AVI->index_fdes);
|
||||||
|
AVI->index_fdes = NULL;
|
||||||
|
} else {
|
||||||
|
//内存索引写入AVI文件中
|
||||||
ret = avi_add_chunk(AVI, (unsigned char *)"idx1", (unsigned char *)AVI->idx, AVI->n_idx * 16);
|
ret = avi_add_chunk(AVI, (unsigned char *)"idx1", (unsigned char *)AVI->idx, AVI->n_idx * 16);
|
||||||
|
}
|
||||||
hasIndex = (ret == 0);
|
hasIndex = (ret == 0);
|
||||||
//fprintf(stderr, "pos=%lu, index_len=%d\n", AVI->pos, hasIndex);
|
//fprintf(stderr, "pos=%lu, index_len=%d\n", AVI->pos, hasIndex);
|
||||||
|
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
void *fdes; /* File descriptor of AVI file */
|
void *fdes; /* File descriptor of AVI file */
|
||||||
|
void *index_fdes; /* File descriptor of AVI file */
|
||||||
long mode; /* 0 for reading, 1 for writing */
|
long mode; /* 0 for reading, 1 for writing */
|
||||||
|
|
||||||
long width; /* Width of a video frame */
|
long width; /* Width of a video frame */
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
#include "media/includes.h"
|
#include "media/includes.h"
|
||||||
#include "audio_config.h"
|
#include "audio_config.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
#include "app_task.h"
|
||||||
|
|
||||||
#define LOG_TAG_CONST AVI_VIDEO
|
#define LOG_TAG_CONST AVI_VIDEO
|
||||||
#define LOG_TAG "[AVI_VIDEO]"
|
#define LOG_TAG "[AVI_VIDEO]"
|
||||||
@@ -122,6 +123,8 @@ static const char *avi_files[] = {
|
|||||||
"storage/UI_FAT/C/Btest.avi",
|
"storage/UI_FAT/C/Btest.avi",
|
||||||
// 可以继续添加更多文件
|
// 可以继续添加更多文件
|
||||||
};
|
};
|
||||||
|
static u16 task_switch_flag;
|
||||||
|
|
||||||
#define AVI_FILE_COUNT (sizeof(avi_files) / sizeof(avi_files[0]))
|
#define AVI_FILE_COUNT (sizeof(avi_files) / sizeof(avi_files[0]))
|
||||||
|
|
||||||
static void parse_list_chunk(FILE *file, long list_end, ChunkCallback callback,
|
static void parse_list_chunk(FILE *file, long list_end, ChunkCallback callback,
|
||||||
@@ -231,7 +234,7 @@ static void pcm_cbuf_deinit(void)
|
|||||||
log_info("\n[pcm_cbuf_deinit]mem_status:\n");
|
log_info("\n[pcm_cbuf_deinit]mem_status:\n");
|
||||||
mem_stats();
|
mem_stats();
|
||||||
}
|
}
|
||||||
|
__attribute__((weak))
|
||||||
u8 get_avi_audio_status()
|
u8 get_avi_audio_status()
|
||||||
{
|
{
|
||||||
if (__this == NULL) {
|
if (__this == NULL) {
|
||||||
@@ -289,6 +292,13 @@ void avi_play_shutdown(void)
|
|||||||
u32 rets;
|
u32 rets;
|
||||||
__asm__ volatile("%0 = rets":"=r"(rets));
|
__asm__ volatile("%0 = rets":"=r"(rets));
|
||||||
log_info("\n\n avi_play_shutdown rets=%x\n\n", rets);
|
log_info("\n\n avi_play_shutdown rets=%x\n\n", rets);
|
||||||
|
#if TCFG_APP_VIDEO_EN
|
||||||
|
if (app_get_current_mode_name() == APP_MODE_VIDEO) {
|
||||||
|
app_mode_stack_clr(APP_MODE_VIDEO);
|
||||||
|
app_task_switch_back();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (__this == NULL) {
|
if (__this == NULL) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@@ -1941,11 +1951,42 @@ void *get_avi_player_st_handle()
|
|||||||
{
|
{
|
||||||
return __this->st;
|
return __this->st;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TCFG_APP_VIDEO_EN
|
||||||
|
static void app_video_mode_switch(void *priv)
|
||||||
|
{
|
||||||
|
u16 flag = (u16)priv;
|
||||||
|
if (flag != task_switch_flag) {
|
||||||
|
log_info("\n\n %s, %d \n\n", __func__, __LINE__);
|
||||||
|
log_info("flag:%d, %d \n", flag, task_switch_flag);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
++task_switch_flag;
|
||||||
|
if (app_get_current_mode_name() == APP_MODE_VIDEO) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int ret = app_task_switch_to(APP_MODE_VIDEO, NULL_VALUE);
|
||||||
|
if (ret == FALSE) {
|
||||||
|
sys_timeout_add((void *)(long)task_switch_flag, app_video_mode_switch, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void *animig_open(char *name, int window_id, int arg)
|
void *animig_open(char *name, int window_id, int arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
u8 type = 0;
|
u8 type = 0;
|
||||||
|
|
||||||
|
#if TCFG_APP_VIDEO_EN
|
||||||
|
if (app_get_current_mode_name() != APP_MODE_VIDEO) {
|
||||||
|
int ret = app_task_switch_to(APP_MODE_VIDEO, NULL_VALUE);
|
||||||
|
if (ret == FALSE) {
|
||||||
|
sys_timeout_add((void *)(long)task_switch_flag, app_video_mode_switch, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void *f = fopen(name, "r");
|
void *f = fopen(name, "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
log_info("open file fail %s", name);
|
log_info("open file fail %s", name);
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ struct camera_handle {
|
|||||||
// JPEG 编码线程
|
// JPEG 编码线程
|
||||||
char task_name[32];
|
char task_name[32];
|
||||||
u8 task_runing;
|
u8 task_runing;
|
||||||
|
u8 task_stoping;
|
||||||
OS_SEM task_kill_sem;
|
OS_SEM task_kill_sem;
|
||||||
|
|
||||||
// SPI接收行数统计
|
// SPI接收行数统计
|
||||||
@@ -164,6 +165,16 @@ static void camera_jpeg_dec_task(void *priv)
|
|||||||
u32 enc_time;
|
u32 enc_time;
|
||||||
|
|
||||||
while (hdl->task_runing) {
|
while (hdl->task_runing) {
|
||||||
|
if (hdl->task_stoping) {
|
||||||
|
log_char('L');
|
||||||
|
os_time_dly(1);
|
||||||
|
if (lbuf_data) {
|
||||||
|
lbuf_free(lbuf_data);
|
||||||
|
lbuf_data = NULL;
|
||||||
|
}
|
||||||
|
line_cnt = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
u8 *chunk = NULL;
|
u8 *chunk = NULL;
|
||||||
/* dma_memcpy_wait_idle(); */
|
/* dma_memcpy_wait_idle(); */
|
||||||
chunk = queue_buf_pop(__this->qbuf);
|
chunk = queue_buf_pop(__this->qbuf);
|
||||||
@@ -222,6 +233,31 @@ static void camera_jpeg_dec_task(void *priv)
|
|||||||
if (software_jpegenc_line(jpegenc_hdl, cur_bits, remain_size,
|
if (software_jpegenc_line(jpegenc_hdl, cur_bits, remain_size,
|
||||||
in_buf, DMA_CAMERA_SIZE, line_cnt, &out_bits_size)) {
|
in_buf, DMA_CAMERA_SIZE, line_cnt, &out_bits_size)) {
|
||||||
log_error("software jpgenc line err \n");
|
log_error("software jpgenc line err \n");
|
||||||
|
printf("jpeg enc err,reset !!!\n");
|
||||||
|
//pass当前帧
|
||||||
|
queue_buf_reset(__this->qbuf);
|
||||||
|
line_cnt = 0;
|
||||||
|
if (lbuf_data) {
|
||||||
|
lbuf_free(lbuf_data);
|
||||||
|
lbuf_data = NULL;
|
||||||
|
/* os_time_dly(1); */
|
||||||
|
/* continue; */
|
||||||
|
}
|
||||||
|
//reset jpg_hd
|
||||||
|
software_jpegenc_exit(jpegenc_hdl);
|
||||||
|
jpegenc_hdl = software_jpegenc_init(
|
||||||
|
__this->dev->width,
|
||||||
|
__this->dev->height,
|
||||||
|
__this->dev->width + SPI_FHEAD_SIZE,
|
||||||
|
jpeg_qval);
|
||||||
|
|
||||||
|
if (!jpegenc_hdl) {
|
||||||
|
log_error("software jpegenc init err \n");
|
||||||
|
//下面禁止加打印{
|
||||||
|
os_sem_post(&__this->task_kill_sem);
|
||||||
|
os_time_dly(-1);
|
||||||
|
//}
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,6 +344,9 @@ int camera_spi_deinit()
|
|||||||
|
|
||||||
int camera_manager_start(void)
|
int camera_manager_start(void)
|
||||||
{
|
{
|
||||||
|
if (!__this) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
mem_stats();
|
mem_stats();
|
||||||
@@ -384,12 +423,12 @@ __err:
|
|||||||
|
|
||||||
int camera_manager_stop(void)
|
int camera_manager_stop(void)
|
||||||
{
|
{
|
||||||
|
if (!__this) {
|
||||||
printf("%s %d", __func__, __LINE__);
|
return -1;
|
||||||
|
}
|
||||||
camera_manager_suspend();
|
camera_manager_suspend();
|
||||||
camera_spi_deinit();
|
camera_spi_deinit();
|
||||||
|
|
||||||
|
|
||||||
if (__this->task_runing) {
|
if (__this->task_runing) {
|
||||||
__this->task_runing = 0;
|
__this->task_runing = 0;
|
||||||
os_sem_pend(&__this->task_kill_sem, 0);
|
os_sem_pend(&__this->task_kill_sem, 0);
|
||||||
@@ -397,7 +436,6 @@ int camera_manager_stop(void)
|
|||||||
|
|
||||||
task_kill(__this->task_name);
|
task_kill(__this->task_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__this->qbuf) {
|
if (__this->qbuf) {
|
||||||
queue_buf_destroy(__this->qbuf);
|
queue_buf_destroy(__this->qbuf);
|
||||||
__this->qbuf = NULL;
|
__this->qbuf = NULL;
|
||||||
@@ -406,14 +444,12 @@ int camera_manager_stop(void)
|
|||||||
free_psram(__this->lbuf_ptr);
|
free_psram(__this->lbuf_ptr);
|
||||||
__this->lbuf_ptr = NULL;
|
__this->lbuf_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(__this->dma_recv_buf); i++) {
|
for (int i = 0; i < ARRAY_SIZE(__this->dma_recv_buf); i++) {
|
||||||
if (__this->dma_recv_buf[i]) {
|
if (__this->dma_recv_buf[i]) {
|
||||||
free(__this->dma_recv_buf[i]);
|
free(__this->dma_recv_buf[i]);
|
||||||
__this->dma_recv_buf[i] = NULL;
|
__this->dma_recv_buf[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,7 +480,39 @@ void camera_manager_suspend(void)
|
|||||||
}
|
}
|
||||||
__this->dev->supend();
|
__this->dev->supend();
|
||||||
}
|
}
|
||||||
|
void camera_manager_deep_resume(void)
|
||||||
|
{
|
||||||
|
if (!__this) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if (!__this->dev) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
queue_buf_reset(__this->qbuf);
|
||||||
|
__this->dma_recv_buf_index = 0;
|
||||||
|
__this->spi_recv_line_cnt = 0;
|
||||||
|
if (__this->dev->init) {
|
||||||
|
__this->dev->init();
|
||||||
|
}
|
||||||
|
camera_spi_init();
|
||||||
|
camera_manager_resume();
|
||||||
|
__this->task_stoping = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void camera_manager_deep_suspend(void)
|
||||||
|
{
|
||||||
|
if (!__this) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if (!__this->dev) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
__this->task_stoping = 1;
|
||||||
|
camera_spi_deinit();
|
||||||
|
if (__this->dev->deinit) {
|
||||||
|
__this->dev->deinit();
|
||||||
|
}
|
||||||
|
}
|
||||||
static int camera_manager_dev_check(void)
|
static int camera_manager_dev_check(void)
|
||||||
{
|
{
|
||||||
struct camera_device *dev = NULL;
|
struct camera_device *dev = NULL;
|
||||||
@@ -464,8 +532,8 @@ int camera_manager_init(void)
|
|||||||
{
|
{
|
||||||
ASSERT(!__this);
|
ASSERT(!__this);
|
||||||
__this = malloc(sizeof(struct camera_handle));
|
__this = malloc(sizeof(struct camera_handle));
|
||||||
|
memset(__this, 0, sizeof(struct camera_handle));
|
||||||
camera_manager_dev_check();
|
camera_manager_dev_check();
|
||||||
|
|
||||||
if (!__this->dev) {
|
if (!__this->dev) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -478,18 +546,22 @@ int camera_manager_init(void)
|
|||||||
|
|
||||||
int camera_manager_deinit(void)
|
int camera_manager_deinit(void)
|
||||||
{
|
{
|
||||||
|
int ret = -1;
|
||||||
if (!__this) {
|
if (!__this) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!__this->dev) {
|
if (!__this->dev) {
|
||||||
return -1;
|
goto __err;
|
||||||
}
|
}
|
||||||
if (!__this->dev->deinit) {
|
if (!__this->dev->deinit) {
|
||||||
return -1;
|
goto __err;
|
||||||
}
|
}
|
||||||
int ret = __this->dev->deinit();
|
ret = __this->dev->deinit();
|
||||||
|
__err:
|
||||||
|
if (__this) {
|
||||||
free(__this);
|
free(__this);
|
||||||
__this = NULL;
|
__this = NULL;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -545,3 +617,4 @@ int camera_manager_get_dev_fps(int *fps)
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ int camera_manager_stop(void);
|
|||||||
void camera_manager_resume(void);
|
void camera_manager_resume(void);
|
||||||
void camera_manager_suspend(void);
|
void camera_manager_suspend(void);
|
||||||
|
|
||||||
|
void camera_manager_deep_resume(void);
|
||||||
|
void camera_manager_deep_suspend(void);
|
||||||
|
|
||||||
int camera_manager_init(void);
|
int camera_manager_init(void);
|
||||||
int camera_manager_deinit(void);
|
int camera_manager_deinit(void);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,363 @@
|
|||||||
#include "avilib.h"
|
#include "avilib.h"
|
||||||
|
#include "media/includes.h"
|
||||||
|
#include "audio_config.h"
|
||||||
|
#include "avi_audio_player.h"
|
||||||
|
//===========================================================================
|
||||||
|
// 使用avilib解码参考
|
||||||
|
//===========================================================================
|
||||||
|
#if TCFG_PSRAM_DEV_ENABLE
|
||||||
|
#define malloc(size) malloc_psram(size)
|
||||||
|
#define free(ptr) free_psram(ptr)
|
||||||
|
#else
|
||||||
|
#define malloc(size) malloc(size)
|
||||||
|
#define free(ptr) free(ptr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
extern cbuffer_t avi_pcm_cbuf;
|
||||||
|
extern int jljpeg_stream_src_data_copy(u8 *buf, int size);
|
||||||
|
#define VIDEO_DEC_TASK_NAME "VIDEO_DEC"
|
||||||
|
#define PATH_LEN 64
|
||||||
|
#define PCM_CBUF_SIZE (12*1024)
|
||||||
|
|
||||||
|
|
||||||
|
struct video_player {
|
||||||
|
s8(*path)[64];
|
||||||
|
u8 path_number;
|
||||||
|
u8 path_index;
|
||||||
|
u8 play_mode;
|
||||||
|
u8 play_status;
|
||||||
|
int frame_index;
|
||||||
|
int frame_rate;
|
||||||
|
int video_chunks;
|
||||||
|
int audio_chunks;
|
||||||
|
u32 start_msec;
|
||||||
|
u32 pause_msec;
|
||||||
|
u32 curr_msec;
|
||||||
|
u32 audio_offset;
|
||||||
|
u16 tick_id;
|
||||||
|
void *dec_hd;
|
||||||
|
void (*ui_refresh_cb)(int status);
|
||||||
|
u8 *audio_buf;
|
||||||
|
OS_SEM task_kill_sem;
|
||||||
|
} *__player;
|
||||||
|
|
||||||
|
#define __this (__player)
|
||||||
|
|
||||||
|
enum {
|
||||||
|
VIDEO_DEC_MSG_INIT,
|
||||||
|
VIDEO_DEC_MSG_EXIT,
|
||||||
|
VIDEO_DEC_MSG_START,
|
||||||
|
VIDEO_DEC_MSG_STOP,
|
||||||
|
VIDEO_DEC_MSG_UPDATE_FILE,
|
||||||
|
VIDEO_DEC_MSG_TICK,
|
||||||
|
VIDEO_DEC_MSG_SUSPEND,
|
||||||
|
VIDEO_DEC_MSG_RESUME,
|
||||||
|
};
|
||||||
|
enum {
|
||||||
|
VIDEO_DEC_PLAY_MODE_SINGLE,//单次播放
|
||||||
|
VIDEO_DEC_PLAY_MODE_SINGLE_LOOP,//单次循环
|
||||||
|
VIDEO_DEC_PLAY_MODE_LIST,//列表播放,不循环
|
||||||
|
VIDEO_DEC_PLAY_MODE_LIST_LOOP,//列表播放,循环
|
||||||
|
};
|
||||||
|
#if 0//使用video_dec解码时打开
|
||||||
|
u8 get_avi_audio_status()
|
||||||
|
{
|
||||||
|
if (__this == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
static int video_msg_post(int msg, void *priv, int priv_len)
|
||||||
|
{
|
||||||
|
int err = os_taskq_post_type(VIDEO_DEC_TASK_NAME, msg, priv_len, priv);
|
||||||
|
if (err) {
|
||||||
|
printf("%s err::%d\n", __func__, err);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int video_dec_player_update_dec_hd()
|
||||||
|
{
|
||||||
|
if (__this->dec_hd) {
|
||||||
|
AVI_close(__this->dec_hd);
|
||||||
|
__this->dec_hd = NULL;
|
||||||
|
}
|
||||||
|
printf("%s path:%s\n", __func__, (char *)__this->path[__this->path_index]);
|
||||||
|
__this->dec_hd = AVI_open_input_file((char *)__this->path[__this->path_index], 1);
|
||||||
|
__this->frame_rate = AVI_frame_rate(__this->dec_hd);
|
||||||
|
__this->audio_chunks = AVI_audio_chunks(__this->dec_hd);
|
||||||
|
__this->video_chunks = AVI_video_frames(__this->dec_hd);
|
||||||
|
__this->frame_index = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static void video_dec_tick_cb(void *p)
|
||||||
|
{
|
||||||
|
video_msg_post(VIDEO_DEC_MSG_TICK, NULL, 0);
|
||||||
|
}
|
||||||
|
int video_dec_tick_update()
|
||||||
|
{
|
||||||
|
video_msg_post(VIDEO_DEC_MSG_TICK, NULL, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int video_dec_player_tick()
|
||||||
|
{
|
||||||
|
if (!__this->frame_index) {
|
||||||
|
__this->start_msec = jiffies_msec();
|
||||||
|
}
|
||||||
|
__this->curr_msec = jiffies_msec2offset(__this->start_msec, jiffies_msec());
|
||||||
|
int real_frame_index = __this->curr_msec * __this->frame_rate / 1000;
|
||||||
|
/* printf("%s rf:%d total:%d",__func__,real_frame_index,__this->video_chunks); */
|
||||||
|
if (real_frame_index >= __this->video_chunks) {
|
||||||
|
//stop
|
||||||
|
if (__this->tick_id) {
|
||||||
|
usr_timer_del(__this->tick_id);
|
||||||
|
__this->tick_id = 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
AVI_set_video_position(__this->dec_hd, real_frame_index);
|
||||||
|
int keyframe;
|
||||||
|
u32 offset = 0;
|
||||||
|
int frame_len = AVI_frame_size(__this->dec_hd, real_frame_index);
|
||||||
|
u8 *file_buf = malloc(20 * 1024);
|
||||||
|
if (frame_len <= 20 * 1024) {
|
||||||
|
int file_len = AVI_read_frame(__this->dec_hd, (char *)file_buf, &keyframe);
|
||||||
|
//copy_to_ui
|
||||||
|
if (!jljpeg_stream_src_data_copy(file_buf, file_len)) {
|
||||||
|
if (__this->ui_refresh_cb) {
|
||||||
|
__this->ui_refresh_cb(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int exit = 0;
|
||||||
|
if (__this->video_chunks) {
|
||||||
|
real_frame_index = real_frame_index * __this->audio_chunks / __this->video_chunks;
|
||||||
|
}
|
||||||
|
/* printf("%s %d->%d(%d)",__func__,__this->frame_index,real_frame_index,__this->audio_chunks); */
|
||||||
|
for (int i = __this->frame_index ; i < real_frame_index; i++) {
|
||||||
|
int audio_chunk_size = AVI_audio_size(__this->dec_hd, i);
|
||||||
|
AVI_set_audio_position(__this->dec_hd, __this->audio_offset);
|
||||||
|
int file_len = AVI_read_audio_chunk(__this->dec_hd, (char *)file_buf);
|
||||||
|
//copy_to_pcm_player
|
||||||
|
int len = file_len;
|
||||||
|
u8 *ptr = file_buf;
|
||||||
|
while (len) {
|
||||||
|
int w = cbuf_write(&avi_pcm_cbuf, ptr, len);
|
||||||
|
/* printf("[w] len:%d wl:%d",len,w); */
|
||||||
|
if (w == 0) {
|
||||||
|
/* os_time_dly(1); */
|
||||||
|
exit = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ptr += w;
|
||||||
|
len -= w;
|
||||||
|
}
|
||||||
|
if (exit) {
|
||||||
|
__this->frame_index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* printf("[cw] i:%d chunks:%d filelen:%d",i,audio_chunk_size,file_len); */
|
||||||
|
//todo
|
||||||
|
__this->audio_offset += audio_chunk_size;
|
||||||
|
}
|
||||||
|
if (!exit) {
|
||||||
|
__this->frame_index = real_frame_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!__this->frame_index) {
|
||||||
|
__this->frame_index ++;
|
||||||
|
}
|
||||||
|
free(file_buf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int video_dec_player_start()
|
||||||
|
{
|
||||||
|
int msec = (int)1000 / __this->frame_rate; // /2?
|
||||||
|
if (__this->tick_id) {
|
||||||
|
usr_timer_del(__this->tick_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
__this->tick_id = usr_timer_add(NULL, video_dec_tick_cb, msec, 1);
|
||||||
|
|
||||||
|
|
||||||
|
app_audio_state_switch(APP_AUDIO_STATE_MUSIC, app_audio_volume_max_query(AppVol_MUSIC), NULL); // 音量状态设置
|
||||||
|
audio_dac_set_volume(&dac_hdl, app_audio_volume_max_query(AppVol_MUSIC) / 100); // dac 音量设置
|
||||||
|
|
||||||
|
struct avi_audio_player_param param = {0};
|
||||||
|
param.coding_type = AUDIO_CODING_PCM;
|
||||||
|
param.channel_mode = (AVI_audio_channels(__this->dec_hd) == 1) ? AUDIO_CH_L : AUDIO_CH_MIX;
|
||||||
|
param.sample_rate = AVI_audio_rate(__this->dec_hd);
|
||||||
|
param.bit_rate = AVI_audio_channels(__this->dec_hd) * AVI_audio_rate(__this->dec_hd) * AVI_audio_bits(__this->dec_hd);
|
||||||
|
param.type = AVI_SERVICE_VOICE;
|
||||||
|
printf("simple_rate:%d channel:%d bitrate:%d", param.sample_rate, param.channel_mode, param.bit_rate);
|
||||||
|
// 打开AI voice播放
|
||||||
|
int ret = avi_audio_player_open(NULL, 0, ¶m);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int video_dec_player_stop()
|
||||||
|
{
|
||||||
|
|
||||||
|
avi_audio_player_close(0);
|
||||||
|
if (__this->tick_id) {
|
||||||
|
usr_timer_del(__this->tick_id);
|
||||||
|
__this->tick_id = 0;
|
||||||
|
}
|
||||||
|
if (__this->audio_buf) {
|
||||||
|
free(__this->audio_buf);
|
||||||
|
__this->audio_buf = NULL;
|
||||||
|
}
|
||||||
|
if (__this->dec_hd) {
|
||||||
|
AVI_close(__this->dec_hd);
|
||||||
|
__this->dec_hd = NULL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int video_dec_player_suspend()
|
||||||
|
{
|
||||||
|
/* if(__this->tick_id){ */
|
||||||
|
/* usr_timer_del(__this->tick_id); */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int video_dec_player_resume()
|
||||||
|
{
|
||||||
|
/* int msec = (int)1000/__this->frame_rate;// /2? */
|
||||||
|
/* if(__this->tick_id){ */
|
||||||
|
/* usr_timer_del(__this->tick_id); */
|
||||||
|
/* } */
|
||||||
|
/* __this->tick_id = usr_timer_add(NULL, video_dec_tick_cb,msec,1); */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void video_dec_task(void *p)
|
||||||
|
{
|
||||||
|
int msg[32];
|
||||||
|
int ret;
|
||||||
|
while (1) {
|
||||||
|
ret = os_taskq_pend(NULL, msg, ARRAY_SIZE(msg));
|
||||||
|
printf("%s msg:%d \n", __func__, msg[0]);
|
||||||
|
if (!__this) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (msg[0]) {
|
||||||
|
case VIDEO_DEC_MSG_TICK:
|
||||||
|
video_dec_player_tick();
|
||||||
|
break;
|
||||||
|
case VIDEO_DEC_MSG_UPDATE_FILE:
|
||||||
|
video_dec_player_update_dec_hd();
|
||||||
|
break;
|
||||||
|
case VIDEO_DEC_MSG_START:
|
||||||
|
video_dec_player_start();
|
||||||
|
break;
|
||||||
|
case VIDEO_DEC_MSG_STOP:
|
||||||
|
video_dec_player_stop();
|
||||||
|
break;
|
||||||
|
case VIDEO_DEC_MSG_SUSPEND:
|
||||||
|
video_dec_player_suspend();
|
||||||
|
break;
|
||||||
|
case VIDEO_DEC_MSG_RESUME:
|
||||||
|
video_dec_player_resume();
|
||||||
|
break;
|
||||||
|
case VIDEO_DEC_MSG_EXIT:
|
||||||
|
os_sem_post(&__this->task_kill_sem);
|
||||||
|
os_time_dly(-1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int video_dec_init()
|
||||||
|
{
|
||||||
|
if (!__this) {
|
||||||
|
__this = malloc(sizeof(struct video_player));
|
||||||
|
memset(__this, 0, sizeof(struct video_player));
|
||||||
|
}
|
||||||
|
if (!__this->audio_buf) {
|
||||||
|
__this->audio_buf = malloc(PCM_CBUF_SIZE);
|
||||||
|
}
|
||||||
|
cbuf_init(&avi_pcm_cbuf, __this->audio_buf, PCM_CBUF_SIZE);
|
||||||
|
os_sem_create(&__this->task_kill_sem, 0);
|
||||||
|
//create_task
|
||||||
|
int ret = os_task_create(video_dec_task, NULL, 8, 1024, 1024, VIDEO_DEC_TASK_NAME);
|
||||||
|
if (ret) {
|
||||||
|
printf("%s err\n", __func__);
|
||||||
|
free(__this);
|
||||||
|
__this = NULL;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
int video_dec_deinit()
|
||||||
|
{
|
||||||
|
//kill
|
||||||
|
if (__this->tick_id) {
|
||||||
|
usr_timer_del(__this->tick_id);
|
||||||
|
__this->tick_id = 0;
|
||||||
|
}
|
||||||
|
int ret = video_msg_post(VIDEO_DEC_MSG_EXIT, NULL, 0);
|
||||||
|
|
||||||
|
os_sem_pend(&__this->task_kill_sem, 0);
|
||||||
|
os_sem_del(&__this->task_kill_sem, OS_DEL_ALWAYS);
|
||||||
|
|
||||||
|
task_kill(VIDEO_DEC_TASK_NAME);
|
||||||
|
//free
|
||||||
|
|
||||||
|
if (__this->audio_buf) {
|
||||||
|
free(__this->audio_buf);
|
||||||
|
__this->audio_buf = NULL;
|
||||||
|
}
|
||||||
|
if (__this->dec_hd) {
|
||||||
|
AVI_close(__this->dec_hd);
|
||||||
|
__this->dec_hd = NULL;
|
||||||
|
}
|
||||||
|
if (__this) {
|
||||||
|
free(__this);
|
||||||
|
__this = NULL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int video_dec_set_path(s8(*path)[64], u8 path_number)
|
||||||
|
{
|
||||||
|
__this->path = path;
|
||||||
|
__this->path_number = path_number;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int video_dec_start(u8 index, u8 mode)
|
||||||
|
{
|
||||||
|
if ((index < __this->path_number) && (index >= 0)) {
|
||||||
|
__this->frame_index = index;
|
||||||
|
} else {
|
||||||
|
__this->frame_index = 0;
|
||||||
|
}
|
||||||
|
int ret = 0;
|
||||||
|
ret += video_msg_post(VIDEO_DEC_MSG_UPDATE_FILE, NULL, 0);
|
||||||
|
|
||||||
|
ret += video_msg_post(VIDEO_DEC_MSG_START, NULL, 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int video_dec_stop()
|
||||||
|
{
|
||||||
|
int ret = video_msg_post(VIDEO_DEC_MSG_STOP, NULL, 0);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
int video_dec_refresh_cb_register(void (*cb)(int status))
|
||||||
|
{
|
||||||
|
if (!__this) {
|
||||||
|
printf("%s not find\n", __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
__this->ui_refresh_cb = cb;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
//读取AVI文件视频帧和音频帧行写卡在PC上验证
|
//读取AVI文件视频帧和音频帧行写卡在PC上验证
|
||||||
int video_dec_demo(void)
|
int video_dec_demo(void)
|
||||||
{
|
{
|
||||||
@@ -63,3 +421,5 @@ int video_dec_demo(void)
|
|||||||
/* os_time_dly(-1); */
|
/* os_time_dly(-1); */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -31,11 +31,15 @@ struct video_rec_handle {
|
|||||||
int video_rate;
|
int video_rate;
|
||||||
int sample_rate;
|
int sample_rate;
|
||||||
void (*ui_refresh_cb)(int status);
|
void (*ui_refresh_cb)(int status);
|
||||||
|
int bytes_per_sample;
|
||||||
};
|
};
|
||||||
static struct video_rec_handle *video_rec;
|
static struct video_rec_handle *video_rec;
|
||||||
#define __this (video_rec)
|
#define __this (video_rec)
|
||||||
|
|
||||||
//摄像头流程 camera_manager_init->start->read->read_done->read...->stop->exit.
|
|
||||||
|
extern uint32_t timer_get_ms(void);
|
||||||
|
|
||||||
|
//摄像头流程 bf30a2_camera_init->start->read->read_done->read...->stop->exit.
|
||||||
//麦克风流程 pcm_data_init->read->read_done->read...->exit.
|
//麦克风流程 pcm_data_init->read->read_done->read...->exit.
|
||||||
|
|
||||||
extern int jljpeg_stream_src_data_copy(u8 *buf, int size);
|
extern int jljpeg_stream_src_data_copy(u8 *buf, int size);
|
||||||
@@ -181,17 +185,17 @@ static void video_show_task(void *priv)
|
|||||||
frame_cnt = 0;
|
frame_cnt = 0;
|
||||||
/* break; */
|
/* break; */
|
||||||
} else if (msg[0] == Q_AVI_TASK_REC_STOP) {
|
} else if (msg[0] == Q_AVI_TASK_REC_STOP) {
|
||||||
|
|
||||||
log_debug("avi task rec stop!\n");
|
log_debug("avi task rec stop!\n");
|
||||||
if (out_fd) {
|
if (out_fd) {
|
||||||
ret = AVI_close(out_fd);
|
ret = AVI_close(out_fd);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
log_error("camera devide avi close err :%d \n", ret);
|
log_error("camera devide avi close err :%d \n", ret);
|
||||||
ASSERT(0);
|
__this->write_error = 1;
|
||||||
|
/* ASSERT(0); */
|
||||||
} else {
|
} else {
|
||||||
log_debug("avi write success \n");
|
log_debug("avi write success \n");
|
||||||
out_fd = NULL;
|
|
||||||
}
|
}
|
||||||
|
out_fd = NULL;
|
||||||
}
|
}
|
||||||
if (__this->pcm_hdl) {
|
if (__this->pcm_hdl) {
|
||||||
pcm_data_exit(__this->pcm_hdl);
|
pcm_data_exit(__this->pcm_hdl);
|
||||||
@@ -229,6 +233,23 @@ static void video_show_task(void *priv)
|
|||||||
__this->write_error = AVI_write_frame(out_fd, (char *)jpeg_data, jpeg_data_len, 1);
|
__this->write_error = AVI_write_frame(out_fd, (char *)jpeg_data, jpeg_data_len, 1);
|
||||||
}
|
}
|
||||||
camera_manager_read_done(jpeg_data);
|
camera_manager_read_done(jpeg_data);
|
||||||
|
#if 0
|
||||||
|
static int cam_last_msec = 0;
|
||||||
|
static int cam_frame_sum = 0;
|
||||||
|
static int cam_frame_cnt = 0;
|
||||||
|
if (cam_last_msec) {
|
||||||
|
u32 cur_msec = jiffies_msec();
|
||||||
|
u32 offset = jiffies_msec2offset(cam_last_msec, cur_msec);
|
||||||
|
cam_frame_sum += offset;
|
||||||
|
cam_frame_cnt ++;
|
||||||
|
if (cam_frame_cnt && cam_frame_sum) {
|
||||||
|
u32 avg = cam_frame_sum / cam_frame_cnt;
|
||||||
|
u32 fps = 1000 / avg;
|
||||||
|
printf("CAM avg:%d fps:%d \n", avg, fps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cam_last_msec = jiffies_msec();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out_fd && (cyc_time != -1)) {
|
if (out_fd && (cyc_time != -1)) {
|
||||||
@@ -287,14 +308,12 @@ int jlcamera_video_rec_init(void)
|
|||||||
//初始化驱动
|
//初始化驱动
|
||||||
ret = camera_manager_init();
|
ret = camera_manager_init();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
//TODO
|
goto __err;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
//启动摄像头
|
//启动摄像头
|
||||||
ret = camera_manager_start();
|
ret = camera_manager_start();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
//TODO
|
goto __err;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
int fps;
|
int fps;
|
||||||
camera_manager_get_dev_fps(&fps);
|
camera_manager_get_dev_fps(&fps);
|
||||||
@@ -307,11 +326,19 @@ int jlcamera_video_rec_init(void)
|
|||||||
snprintf(__this->avi_task_name, sizeof(__this->avi_task_name), "video_show_task");
|
snprintf(__this->avi_task_name, sizeof(__this->avi_task_name), "video_show_task");
|
||||||
if (os_task_create(video_show_task, __this, 8, 1024, 1024, __this->avi_task_name)) {
|
if (os_task_create(video_show_task, __this, 8, 1024, 1024, __this->avi_task_name)) {
|
||||||
log_error("avi task create fail \n");
|
log_error("avi task create fail \n");
|
||||||
//TODO
|
goto __err;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
__err:
|
||||||
|
log_error("%s err\n", __func__);
|
||||||
|
camera_manager_stop();
|
||||||
|
camera_manager_deinit();
|
||||||
|
if (__this) {
|
||||||
|
free(__this);
|
||||||
|
__this = NULL;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------------------------------*/
|
/* ------------------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@@ -322,12 +349,11 @@ int jlcamera_video_rec_init(void)
|
|||||||
/* ------------------------------------------------------------------------------------*/
|
/* ------------------------------------------------------------------------------------*/
|
||||||
int jlcamera_video_rec_deinit(void)
|
int jlcamera_video_rec_deinit(void)
|
||||||
{
|
{
|
||||||
|
/* printf("%s %d", __func__, __LINE__); */
|
||||||
printf("%s %d", __func__, __LINE__);
|
|
||||||
/* void dma_memcpy_wait_idle(void); */
|
/* void dma_memcpy_wait_idle(void); */
|
||||||
/* dma_memcpy_wait_idle(); */
|
/* dma_memcpy_wait_idle(); */
|
||||||
|
|
||||||
camera_manager_stop();
|
camera_manager_stop();
|
||||||
|
if (__this) {
|
||||||
OS_SEM task_kill_sem;
|
OS_SEM task_kill_sem;
|
||||||
os_sem_create(&task_kill_sem, 0);
|
os_sem_create(&task_kill_sem, 0);
|
||||||
int msg = (int)&task_kill_sem;
|
int msg = (int)&task_kill_sem;
|
||||||
@@ -337,7 +363,7 @@ int jlcamera_video_rec_deinit(void)
|
|||||||
os_sem_pend(&task_kill_sem, 0);
|
os_sem_pend(&task_kill_sem, 0);
|
||||||
os_sem_del(&task_kill_sem, OS_DEL_ALWAYS);
|
os_sem_del(&task_kill_sem, OS_DEL_ALWAYS);
|
||||||
task_kill(__this->avi_task_name);
|
task_kill(__this->avi_task_name);
|
||||||
|
}
|
||||||
|
|
||||||
camera_manager_deinit();
|
camera_manager_deinit();
|
||||||
clock_unlock("camera_video");
|
clock_unlock("camera_video");
|
||||||
@@ -442,6 +468,214 @@ static void avi_task(void *priv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//基于音频时间进行补帧(音频包太大有误差)
|
||||||
|
static void avi_task_dup1(void *priv)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
int msg[8];
|
||||||
|
int frame_cnt = 0;
|
||||||
|
int cyc_time = 30; //循环录影时间,单位秒
|
||||||
|
u8 *pcm_data, *jpeg_data;
|
||||||
|
int pcm_data_len, jpeg_data_len;
|
||||||
|
|
||||||
|
char *filename = "storage/sd0/C/VID_****.AVI";
|
||||||
|
avi_t *out_fd = AVI_open_output_file(filename);
|
||||||
|
if (out_fd == NULL) {
|
||||||
|
printf("open file erro\n");
|
||||||
|
os_time_dly(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
AVI_set_video(out_fd, BF30A2_INPUT_W, BF30A2_INPUT_H, __this->video_rate, "MJPG");
|
||||||
|
AVI_set_audio(out_fd, 1, __this->sample_rate, 16, WAVE_FORMAT_PCM, 0);//默认单声道s16格式
|
||||||
|
|
||||||
|
// --- 用于补帧的统计变量 ---
|
||||||
|
u32 total_audio_bytes = 0; // 累加收到并写入的音频字节数
|
||||||
|
const int bytes_per_sample = __this->bytes_per_sample;
|
||||||
|
const int video_rate = __this->video_rate;
|
||||||
|
const int sample_rate = __this->sample_rate;
|
||||||
|
int dup_frame_cnt = 0; //调试使用
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
u8 read_data = 0;
|
||||||
|
|
||||||
|
if (os_taskq_accept(ARRAY_SIZE(msg), msg) == OS_TASKQ) {
|
||||||
|
if (msg[0] == Q_AVI_TASK_KILL) {
|
||||||
|
if (out_fd) {
|
||||||
|
AVI_close(out_fd);
|
||||||
|
}
|
||||||
|
printf("avi task exit !\n");
|
||||||
|
os_sem_post((OS_SEM *)msg[1]);
|
||||||
|
os_time_dly(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pcm_data_read(__this->pcm_hdl, &pcm_data, &pcm_data_len) == 0) {
|
||||||
|
read_data = 1;
|
||||||
|
AVI_write_audio(out_fd, (char *)pcm_data, pcm_data_len);
|
||||||
|
|
||||||
|
// 累加已写入的音频字节(用于推算应该产生的视频帧数)
|
||||||
|
total_audio_bytes += pcm_data_len;
|
||||||
|
|
||||||
|
pcm_data_read_done(__this->pcm_hdl, pcm_data);
|
||||||
|
}
|
||||||
|
if (bf30a2_camera_data_read(&jpeg_data, &jpeg_data_len) == 0) {
|
||||||
|
read_data = 1;
|
||||||
|
frame_cnt ++;
|
||||||
|
|
||||||
|
AVI_write_frame(out_fd, (char *)jpeg_data, jpeg_data_len, 1);
|
||||||
|
bf30a2_camera_read_done(jpeg_data);
|
||||||
|
|
||||||
|
// 基于音频进度推算并补帧
|
||||||
|
if (total_audio_bytes >= sample_rate * bytes_per_sample) {
|
||||||
|
u32 total_audio_samples = total_audio_bytes / bytes_per_sample; // 整数
|
||||||
|
u32 expected_frames = (total_audio_samples * video_rate) / sample_rate;
|
||||||
|
|
||||||
|
if (expected_frames > frame_cnt) {
|
||||||
|
ret = AVI_dup_frame(out_fd);
|
||||||
|
if (!ret) {
|
||||||
|
dup_frame_cnt++;
|
||||||
|
frame_cnt++;
|
||||||
|
printf("avi dup video frame :%d cur frame:%d \n", dup_frame_cnt, frame_cnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (frame_cnt >= __this->video_rate * cyc_time) {
|
||||||
|
ret = AVI_close(out_fd);
|
||||||
|
if (ret) {
|
||||||
|
printf("bf30a2 avi close err :%d \n", ret);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
printf("avi write success \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
out_fd = AVI_open_output_file(filename);
|
||||||
|
if (out_fd == NULL) {
|
||||||
|
printf("open file erro\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AVI_set_video(out_fd, BF30A2_INPUT_W, BF30A2_INPUT_H, __this->video_rate, "MJPG");
|
||||||
|
AVI_set_audio(out_fd, 1, __this->sample_rate, 16, WAVE_FORMAT_PCM, 0);//默认单声道s16格式
|
||||||
|
frame_cnt = 0;
|
||||||
|
dup_frame_cnt = 0;
|
||||||
|
total_audio_bytes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//没有读到数据
|
||||||
|
if (!read_data) {
|
||||||
|
//根据音频包计算延时
|
||||||
|
u32 delay_ms = ((float)__this->aframe_size / (__this->sample_rate * 2)) * 1000;
|
||||||
|
u32 tick = delay_ms / 10;
|
||||||
|
os_time_dly(tick + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//基于系统时间进行补帧
|
||||||
|
static void avi_task_dup2(void *priv)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
int msg[8];
|
||||||
|
int frame_cnt = 0;
|
||||||
|
int cyc_time = 30; //循环录影时间,单位秒
|
||||||
|
u8 *pcm_data, *jpeg_data;
|
||||||
|
int pcm_data_len, jpeg_data_len;
|
||||||
|
|
||||||
|
char *filename = "storage/sd0/C/VID_****.AVI";
|
||||||
|
avi_t *out_fd = AVI_open_output_file(filename);
|
||||||
|
if (out_fd == NULL) {
|
||||||
|
printf("open file erro\n");
|
||||||
|
os_time_dly(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
AVI_set_video(out_fd, BF30A2_INPUT_W, BF30A2_INPUT_H, __this->video_rate, "MJPG");
|
||||||
|
AVI_set_audio(out_fd, 1, __this->sample_rate, 16, WAVE_FORMAT_PCM, 0);//默认单声道s16格式
|
||||||
|
|
||||||
|
// --- 用于补帧的统计变量 ---
|
||||||
|
const int video_rate = __this->video_rate;
|
||||||
|
u32 start_ms = timer_get_ms(); // 每次 open file 时重置
|
||||||
|
int dup_frame_cnt = 0; // 调试使用
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
u8 read_data = 0;
|
||||||
|
|
||||||
|
if (os_taskq_accept(ARRAY_SIZE(msg), msg) == OS_TASKQ) {
|
||||||
|
if (msg[0] == Q_AVI_TASK_KILL) {
|
||||||
|
if (out_fd) {
|
||||||
|
AVI_close(out_fd);
|
||||||
|
}
|
||||||
|
printf("avi task exit !\n");
|
||||||
|
os_sem_post((OS_SEM *)msg[1]);
|
||||||
|
os_time_dly(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pcm_data_read(__this->pcm_hdl, &pcm_data, &pcm_data_len) == 0) {
|
||||||
|
read_data = 1;
|
||||||
|
AVI_write_audio(out_fd, (char *)pcm_data, pcm_data_len);
|
||||||
|
pcm_data_read_done(__this->pcm_hdl, pcm_data);
|
||||||
|
}
|
||||||
|
if (bf30a2_camera_data_read(&jpeg_data, &jpeg_data_len) == 0) {
|
||||||
|
read_data = 1;
|
||||||
|
frame_cnt ++;
|
||||||
|
AVI_write_frame(out_fd, (char *)jpeg_data, jpeg_data_len, 1);
|
||||||
|
bf30a2_camera_read_done(jpeg_data);
|
||||||
|
|
||||||
|
// --------- 基于系统时钟检查是否需要补帧 ---------
|
||||||
|
u32 now = timer_get_ms();
|
||||||
|
u32 elapsed_ms = now - start_ms;
|
||||||
|
u32 expected_frames = (elapsed_ms * video_rate) / 1000;
|
||||||
|
if (expected_frames > frame_cnt) {
|
||||||
|
ret = AVI_dup_frame(out_fd);
|
||||||
|
if (!ret) {
|
||||||
|
dup_frame_cnt++;
|
||||||
|
frame_cnt++;
|
||||||
|
printf("avi dup video frame :%d cur frame:%d \n", dup_frame_cnt, frame_cnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frame_cnt >= __this->video_rate * cyc_time) {
|
||||||
|
ret = AVI_close(out_fd);
|
||||||
|
if (ret) {
|
||||||
|
printf("bf30a2 avi close err :%d \n", ret);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
printf("avi write success \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
out_fd = AVI_open_output_file(filename);
|
||||||
|
if (out_fd == NULL) {
|
||||||
|
printf("open file erro\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AVI_set_video(out_fd, BF30A2_INPUT_W, BF30A2_INPUT_H, __this->video_rate, "MJPG");
|
||||||
|
AVI_set_audio(out_fd, 1, __this->sample_rate, 16, WAVE_FORMAT_PCM, 0);//默认单声道s16格式
|
||||||
|
frame_cnt = 0;
|
||||||
|
dup_frame_cnt = 0;
|
||||||
|
start_ms = timer_get_ms();
|
||||||
|
}
|
||||||
|
|
||||||
|
//没有读到数据
|
||||||
|
if (!read_data) {
|
||||||
|
//根据音频包计算延时
|
||||||
|
u32 delay_ms = ((float)__this->aframe_size / (__this->sample_rate * 2)) * 1000;
|
||||||
|
u32 tick = delay_ms / 10;
|
||||||
|
os_time_dly(tick + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int video_rec_start_demo(void)
|
int video_rec_start_demo(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -459,6 +693,7 @@ int video_rec_start_demo(void)
|
|||||||
__this->video_rate = BF30A2_INPUT_FPS / 2; //视频帧率
|
__this->video_rate = BF30A2_INPUT_FPS / 2; //视频帧率
|
||||||
|
|
||||||
__this->sample_rate = 8000; //音频采样率
|
__this->sample_rate = 8000; //音频采样率
|
||||||
|
__this->bytes_per_sample = 2; // 单声道 s16 -> 每采样 2 字节
|
||||||
__this->aframe_size = 4096;
|
__this->aframe_size = 4096;
|
||||||
__this->pcm_hdl = pcm_data_init(__this->sample_rate, __this->aframe_size, __this->aframe_size * 10);
|
__this->pcm_hdl = pcm_data_init(__this->sample_rate, __this->aframe_size, __this->aframe_size * 10);
|
||||||
if (!__this->pcm_hdl) {
|
if (!__this->pcm_hdl) {
|
||||||
@@ -473,6 +708,14 @@ int video_rec_start_demo(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* __this->video_rate = 20; //可配置一个摄像头达不到的帧率,模拟需要补帧的情况 */
|
||||||
|
/* //根据系统时间进行补帧 */
|
||||||
|
/* if (os_task_create(avi_task_dup2, __this, 8, 1024, 1024, __this->avi_task_name)) { */
|
||||||
|
/* printf("avi task create fail \n"); */
|
||||||
|
/* //TODO */
|
||||||
|
/* return -1; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -631,6 +631,7 @@ c_SRC_FILES := \
|
|||||||
apps/watch/mode/music/music_key_msg_table.c \
|
apps/watch/mode/music/music_key_msg_table.c \
|
||||||
apps/watch/mode/power_on/power_on.c \
|
apps/watch/mode/power_on/power_on.c \
|
||||||
apps/watch/mode/update/update.c \
|
apps/watch/mode/update/update.c \
|
||||||
|
apps/watch/mode/video/video.c \
|
||||||
apps/watch/net/net_event.c \
|
apps/watch/net/net_event.c \
|
||||||
apps/watch/product_test/product_test.c \
|
apps/watch/product_test/product_test.c \
|
||||||
apps/watch/product_test/pt_gpio.c \
|
apps/watch/product_test/pt_gpio.c \
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -562,6 +562,7 @@
|
|||||||
#define BASEFORM_1355 0XA61000
|
#define BASEFORM_1355 0XA61000
|
||||||
#define BASEFORM_1356 0XA60C00
|
#define BASEFORM_1356 0XA60C00
|
||||||
#define BASEFORM_1357 0XA63000
|
#define BASEFORM_1357 0XA63000
|
||||||
|
#define BASEFORM_1358 0XA83002
|
||||||
#define BASEFORM_1359 0X7C0C0D
|
#define BASEFORM_1359 0X7C0C0D
|
||||||
#define BASEFORM_136 0X4A3C12
|
#define BASEFORM_136 0X4A3C12
|
||||||
#define BASEFORM_1360 0X7C3002
|
#define BASEFORM_1360 0X7C3002
|
||||||
@@ -1724,6 +1725,17 @@
|
|||||||
#define DISCONN_QR_BUTTON 0X303004
|
#define DISCONN_QR_BUTTON 0X303004
|
||||||
#define DISCONN_QR_LAYOUT 0X300C01
|
#define DISCONN_QR_LAYOUT 0X300C01
|
||||||
#define DISCONN_YES_BUTTON 0X302001
|
#define DISCONN_YES_BUTTON 0X302001
|
||||||
|
#define DUER_BASEFORM_ERROR 0XA80C00
|
||||||
|
#define DUER_BASEFORM_RECORD 0XA80C03
|
||||||
|
#define DUER_BASEFORM_RESPONSE 0XA80C01
|
||||||
|
#define DUER_BASEFORM_THINK 0XA80C02
|
||||||
|
#define DUER_ERROR_NOTE 0XA83000
|
||||||
|
#define DUER_RECORD_BUTTON 0XA81C00
|
||||||
|
#define DUER_RECORD_TIME 0XA83C00
|
||||||
|
#define DUER_RECORD_TXT 0XA83003
|
||||||
|
#define DUER_RESPONSE_TTS 0XA82000
|
||||||
|
#define DUER_RESPONSE_TXT 0XA83001
|
||||||
|
#define DUER_THINKING 0XA82001
|
||||||
#define ENGINEERING_MODE_VLIST 0X8A1400
|
#define ENGINEERING_MODE_VLIST 0X8A1400
|
||||||
#define FACE_INDEX 0X803C00
|
#define FACE_INDEX 0X803C00
|
||||||
#define FINDMY_BINDING 0X942002
|
#define FINDMY_BINDING 0X942002
|
||||||
@@ -1767,6 +1779,7 @@
|
|||||||
#define IFLY_TIME_VAD 0XA03C00
|
#define IFLY_TIME_VAD 0XA03C00
|
||||||
#define INDOOR_SPORT_LAYOUT 0X580C00
|
#define INDOOR_SPORT_LAYOUT 0X580C00
|
||||||
#define INDOOR_SPORT_LIST 0X581400
|
#define INDOOR_SPORT_LIST 0X581400
|
||||||
|
#define INTELLIGENT_DUER_LAYER 0XA81000
|
||||||
#define LAYER_WOMEN_HEALTH 0X4A1000
|
#define LAYER_WOMEN_HEALTH 0X4A1000
|
||||||
#define LAYOUT_MENU_WATERFALL 0X480C00
|
#define LAYOUT_MENU_WATERFALL 0X480C00
|
||||||
#define LAYOUT_UVC_SHOW 0XA20C00
|
#define LAYOUT_UVC_SHOW 0XA20C00
|
||||||
@@ -2000,6 +2013,7 @@
|
|||||||
#define PAGE_81 0XA20851
|
#define PAGE_81 0XA20851
|
||||||
#define PAGE_82 0XA40852
|
#define PAGE_82 0XA40852
|
||||||
#define PAGE_83 0XA60853
|
#define PAGE_83 0XA60853
|
||||||
|
#define PAGE_84 0XA80854
|
||||||
#define PAGE_9 0X120809
|
#define PAGE_9 0X120809
|
||||||
#define PASSWORD_0_BUTTON 0X162010
|
#define PASSWORD_0_BUTTON 0X162010
|
||||||
#define PASSWORD_1_BUTTON 0X162007
|
#define PASSWORD_1_BUTTON 0X162007
|
||||||
@@ -2554,7 +2568,7 @@
|
|||||||
#define TIME_UNDISTURB_MODE_START_TIME 0X102800
|
#define TIME_UNDISTURB_MODE_START_TIME 0X102800
|
||||||
#define TRANSIT_LOADING_PIC 0X22200C
|
#define TRANSIT_LOADING_PIC 0X22200C
|
||||||
#define UI_ROTATE 0X0
|
#define UI_ROTATE 0X0
|
||||||
#define UI_VERSION 0X3E18F271
|
#define UI_VERSION 0X74A92D3
|
||||||
#define UNDISTURB_MODE_ESETTING_BACK_BUTTON 0X102004
|
#define UNDISTURB_MODE_ESETTING_BACK_BUTTON 0X102004
|
||||||
#define UNDISTURB_MODE_ESETTING_HOUR_VLIST 0X101401
|
#define UNDISTURB_MODE_ESETTING_HOUR_VLIST 0X101401
|
||||||
#define UNDISTURB_MODE_ESETTING_LAYOUT 0X100C05
|
#define UNDISTURB_MODE_ESETTING_LAYOUT 0X100C05
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2608,6 +2608,9 @@ struct image_unit {
|
|||||||
struct image_file image; // 图片信息
|
struct image_file image; // 图片信息
|
||||||
struct flash_file_info flash; // flash信息
|
struct flash_file_info flash; // flash信息
|
||||||
struct image_unit *next;
|
struct image_unit *next;
|
||||||
|
|
||||||
|
u32 mmu_clut_offset; //颜色表偏移
|
||||||
|
u32 mmu_clut_tab; //颜色表地址
|
||||||
};
|
};
|
||||||
|
|
||||||
struct image_list {
|
struct image_list {
|
||||||
@@ -3550,6 +3553,9 @@ static int jlui_show_image_text(struct draw_context *dc, struct ui_text_attrs *t
|
|||||||
|| (img->image.format == PIXEL_FMT_A2)
|
|| (img->image.format == PIXEL_FMT_A2)
|
||||||
|| (img->image.format == PIXEL_FMT_A1)
|
|| (img->image.format == PIXEL_FMT_A1)
|
||||||
) {
|
) {
|
||||||
|
ui_res_get_image_flash_info(&img->flash, &ui_load_info_table[dc->prj].image_file_info, &img->image);
|
||||||
|
img->mmu_clut_offset = img->flash.offset;
|
||||||
|
img->mmu_clut_tab = (u32)img->flash.tab;
|
||||||
int tab_size = get_clut_format_tabsize(img->image.format, img->image.clut_format);
|
int tab_size = get_clut_format_tabsize(img->image.format, img->image.clut_format);
|
||||||
img->image.offset += tab_size;
|
img->image.offset += tab_size;
|
||||||
img->image.len -= tab_size;
|
img->image.len -= tab_size;
|
||||||
@@ -3733,6 +3739,22 @@ __strpic_with_text: // 如果多国语言用编码模式,则在这里用字库
|
|||||||
task_param.gpu_free_data = dc->gpu_free_data;
|
task_param.gpu_free_data = dc->gpu_free_data;
|
||||||
/* task_param.task_id = GPU_TASK_ID(dc->page, dc->elm->id, elm_index); */
|
/* task_param.task_id = GPU_TASK_ID(dc->page, dc->elm->id, elm_index); */
|
||||||
/* task_param.element_id = dc->elm->id; */
|
/* task_param.element_id = dc->elm->id; */
|
||||||
|
if ((UI_TEXT_ENCODE_IMAGE == text->format)
|
||||||
|
&& ((img->image.format == PIXEL_FMT_AL88)
|
||||||
|
|| (img->image.format == PIXEL_FMT_AL44)
|
||||||
|
|| (img->image.format == PIXEL_FMT_AL22)
|
||||||
|
|| (img->image.format == PIXEL_FMT_L8)
|
||||||
|
|| (img->image.format == PIXEL_FMT_L4)
|
||||||
|
|| (img->image.format == PIXEL_FMT_L2)
|
||||||
|
|| (img->image.format == PIXEL_FMT_L1)
|
||||||
|
|| (img->image.format == PIXEL_FMT_A8)
|
||||||
|
|| (img->image.format == PIXEL_FMT_A4)
|
||||||
|
|| (img->image.format == PIXEL_FMT_A2)
|
||||||
|
|| (img->image.format == PIXEL_FMT_A1)
|
||||||
|
)) {
|
||||||
|
task_param.texture.mmu_clut_offset = img->mmu_clut_offset;
|
||||||
|
task_param.texture.mmu_clut_tab = (u8 *)img->mmu_clut_tab;
|
||||||
|
}
|
||||||
task_param.clut_format = task_param.image.clut_format;
|
task_param.clut_format = task_param.image.clut_format;
|
||||||
task_param.has_clut = task_param.image.has_clut;
|
task_param.has_clut = task_param.image.has_clut;
|
||||||
task_param.format = res_format_to_gpu(task_param.image.format);
|
task_param.format = res_format_to_gpu(task_param.image.format);
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
#ifndef __USER_P11_EVENT_IRQ_H__
|
|
||||||
#define __USER_P11_EVENT_IRQ_H__
|
|
||||||
|
|
||||||
|
|
||||||
struct p11_event_handler {
|
|
||||||
int event_type;
|
|
||||||
int (*handler)(int event_type, u16 len, u8 *data);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define P11_IRQ_EVENT_HANDLER(type, fn) \
|
|
||||||
static const struct p11_event_handler __event_handler_##fn sec(.p11_irq_handler) __attribute__((used)) = { \
|
|
||||||
.event_type = type, \
|
|
||||||
.handler = fn, \
|
|
||||||
}
|
|
||||||
|
|
||||||
extern struct p11_event_handler p11_event_handler_begin[];
|
|
||||||
extern struct p11_event_handler p11_event_handler_end[];
|
|
||||||
|
|
||||||
#define list_for_each_p11_event_handler(p) \
|
|
||||||
for (p = p11_event_handler_begin; p < p11_event_handler_end; p++)
|
|
||||||
|
|
||||||
//数据最大数据长度在p11 系统配置,用户可以灵活配置
|
|
||||||
//当前配置512 字节
|
|
||||||
extern void user_main_post_to_p11_system(u8 cmd, u16 len, u8 *data, u8 wait);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -117,6 +117,7 @@ static u8 rdec_enter_deepsleep(void)
|
|||||||
for (u32 i = 0; i < RDEC_MAX_NUM; i++) {
|
for (u32 i = 0; i < RDEC_MAX_NUM; i++) {
|
||||||
RDEC *RDECx = (RDEC *)rdec_id2rdec(i);
|
RDEC *RDECx = (RDEC *)rdec_id2rdec(i);
|
||||||
if (RDECx->CON == 0) {
|
if (RDECx->CON == 0) {
|
||||||
|
rdec_reg[i].con = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
rdec_reg[i].con = RDECx->CON;
|
rdec_reg[i].con = RDECx->CON;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ u8 ntp_client_get_time_status(void);
|
|||||||
When it succeed, it will post the net_event NET_NTP_GET_TIME_SUCC and set the ntp_client_time_status to 1.
|
When it succeed, it will post the net_event NET_NTP_GET_TIME_SUCC and set the ntp_client_time_status to 1.
|
||||||
*/
|
*/
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
void ntp_client_get_time(const char *host);
|
int ntp_client_get_time(const char *host);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -144,9 +144,6 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
/* For size_t */
|
/* For size_t */
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
extern void *mbedtls_calloc(size_t n, size_t size);
|
|
||||||
extern void mbedtls_free(void *ptr);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function dynamically sets the memory-management
|
* \brief This function dynamically sets the memory-management
|
||||||
* functions used by the library, during runtime.
|
* functions used by the library, during runtime.
|
||||||
@@ -161,8 +158,25 @@ int mbedtls_platform_set_calloc_free(void *(*calloc_func)(size_t, size_t),
|
|||||||
#endif /* MBEDTLS_PLATFORM_FREE_MACRO && MBEDTLS_PLATFORM_CALLOC_MACRO */
|
#endif /* MBEDTLS_PLATFORM_FREE_MACRO && MBEDTLS_PLATFORM_CALLOC_MACRO */
|
||||||
#else /* !MBEDTLS_PLATFORM_MEMORY */
|
#else /* !MBEDTLS_PLATFORM_MEMORY */
|
||||||
|
|
||||||
extern void *jl_mbedtls_calloc(unsigned long count, unsigned long size);
|
__attribute__((weak))
|
||||||
extern void jl_mbedtls_free(void *pv);
|
void jl_mbedtls_free(void *pv)
|
||||||
|
{
|
||||||
|
if (pv != NULL) {
|
||||||
|
free(pv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((weak))
|
||||||
|
void *jl_mbedtls_calloc(unsigned long count, unsigned long size)
|
||||||
|
{
|
||||||
|
size_t total = count * size;
|
||||||
|
void *p = malloc(total);
|
||||||
|
if (p) {
|
||||||
|
memset(p, 0, total);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
#define mbedtls_free jl_mbedtls_free
|
#define mbedtls_free jl_mbedtls_free
|
||||||
#define mbedtls_calloc jl_mbedtls_calloc
|
#define mbedtls_calloc jl_mbedtls_calloc
|
||||||
#endif /* MBEDTLS_PLATFORM_MEMORY && !MBEDTLS_PLATFORM_{FREE,CALLOC}_MACRO */
|
#endif /* MBEDTLS_PLATFORM_MEMORY && !MBEDTLS_PLATFORM_{FREE,CALLOC}_MACRO */
|
||||||
|
|||||||
@@ -166,5 +166,18 @@ int websockets_serv_socket_hanshack(struct websocket_struct *websockets_info);
|
|||||||
int websockets_serv_socket_init(struct websocket_struct *websockets_info);
|
int websockets_serv_socket_init(struct websocket_struct *websockets_info);
|
||||||
int websockets_struct_check(int sizeof_struct);
|
int websockets_struct_check(int sizeof_struct);
|
||||||
|
|
||||||
|
void __attribute__((weak))jl_websocket_api_free(void *pv);
|
||||||
|
|
||||||
|
void __attribute__((weak)) *jl_websocket_api_malloc(size_t size);
|
||||||
|
|
||||||
|
void __attribute__((weak)) *jl_websocket_api_zalloc(size_t size);
|
||||||
|
|
||||||
|
void __attribute__((weak)) *jl_websocket_api_realloc(void *ptr, size_t size);
|
||||||
|
|
||||||
|
#define websocket_api_free jl_websocket_api_free
|
||||||
|
#define websocket_api_malloc jl_websocket_api_malloc
|
||||||
|
#define websocket_api_zalloc jl_websocket_api_zalloc
|
||||||
|
#define websocket_api_realloc jl_websocket_api_realloc
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ extern "C" {
|
|||||||
/* 当上层触发解码动作的速度比解码速度慢时,使用 2 个buff即保证每次来取数据都有已经解码完成的内容,改大没有意义 */
|
/* 当上层触发解码动作的速度比解码速度慢时,使用 2 个buff即保证每次来取数据都有已经解码完成的内容,改大没有意义 */
|
||||||
|
|
||||||
//#define BIT_BUFF_NUM 1
|
//#define BIT_BUFF_NUM 1
|
||||||
#ifndef BIT_BUFF_NUM
|
// #ifndef BIT_BUFF_NUM
|
||||||
#define BIT_BUFF_NUM 1
|
// #define BIT_BUFF_NUM 1
|
||||||
#endif
|
// #endif
|
||||||
/* Allow the number of cached MUC blocks , Default to 2 , 双buff乒乓或者单buff阻塞使用 */
|
/* Allow the number of cached MUC blocks , Default to 2 , 双buff乒乓或者单buff阻塞使用 */
|
||||||
/* 大致情况和 MCU 类似,主要考虑到输入bit流需要时32位对齐的地址空间,原始 bit 流需要从 flash 或者 SD 卡之中进行拷贝到RAM中,因此建议乒乓操作, 更多的 buff 没有意义,因为取 bit 流的动作会比解码动作慢 */
|
/* 大致情况和 MCU 类似,主要考虑到输入bit流需要时32位对齐的地址空间,原始 bit 流需要从 flash 或者 SD 卡之中进行拷贝到RAM中,因此建议乒乓操作, 更多的 buff 没有意义,因为取 bit 流的动作会比解码动作慢 */
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ typedef struct _jdec_opj {
|
|||||||
u16 *std_huffman_table;
|
u16 *std_huffman_table;
|
||||||
u32 *huffman;
|
u32 *huffman;
|
||||||
jdec_mcu_buff mcu_buff[MCU_BUFF_NUM]; /* MCU_BUFF_NUM mcu block buffers: 这些 buff 负责暂存解码后的 MCU 块数据和 MCU 块信息 */
|
jdec_mcu_buff mcu_buff[MCU_BUFF_NUM]; /* MCU_BUFF_NUM mcu block buffers: 这些 buff 负责暂存解码后的 MCU 块数据和 MCU 块信息 */
|
||||||
jdec_bit_buff bit_buff[BIT_BUFF_NUM]; /* BIT_BUFF_NUM bit stream buffers: 这些 buff 负责暂存原始的 JPEG 数据或者 JPEG 段信息 */
|
jdec_bit_buff *bit_buff; /* BIT_BUFF_NUM bit stream buffers: 这些 buff 负责暂存原始的 JPEG 数据或者 JPEG 段信息 */
|
||||||
u8 *line_buf; /*mcu解码后数据先暂存到linebuf再统一变换输出,同时缓存部分数据给下一次解码使用,避免重复*/
|
u8 *line_buf; /*mcu解码后数据先暂存到linebuf再统一变换输出,同时缓存部分数据给下一次解码使用,避免重复*/
|
||||||
struct rect draw_rect; /*jpeg在屏幕的绘制区域*/
|
struct rect draw_rect; /*jpeg在屏幕的绘制区域*/
|
||||||
struct rect jpeg_rect; /*在jpeg解码的相对位置*/
|
struct rect jpeg_rect; /*在jpeg解码的相对位置*/
|
||||||
|
|||||||
Reference in New Issue
Block a user