Merge branch 'master' of ssh://g.hz.netease.com:22222/IoT/PV2/SmartAudioPV2
update
This commit is contained in:
commit
ec4dc47be6
|
@ -49,6 +49,8 @@ ifdef CONFIG_SUNXI_MULITCORE_BOOT
|
||||||
obj-y += secondary_main.o
|
obj-y += secondary_main.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
obj-$(CONFIG_NETEASE_OTA) += netease_ota.o
|
||||||
|
|
||||||
obj-y += board_common.o
|
obj-y += board_common.o
|
||||||
|
|
||||||
subdir-ccflags-$(CONFIG_SUNXI_FINS_FUNC_BOARD_DIR) += -finstrument-functions
|
subdir-ccflags-$(CONFIG_SUNXI_FINS_FUNC_BOARD_DIR) += -finstrument-functions
|
||||||
|
|
|
@ -0,0 +1,445 @@
|
||||||
|
#include <common.h>
|
||||||
|
#include <sunxi_mbr.h>
|
||||||
|
#include <boot_type.h>
|
||||||
|
#include <sys_partition.h>
|
||||||
|
#include <sys_config.h>
|
||||||
|
#include <mmc.h>
|
||||||
|
#include <power/sunxi/axp.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
#include <power/sunxi/pmu.h>
|
||||||
|
#include <asm/arch/ccmu.h>
|
||||||
|
#include <fs.h>
|
||||||
|
#include <u-boot/md5.h>
|
||||||
|
|
||||||
|
#define MBR_PAGE_SIZE (512)
|
||||||
|
#define MD5_CHKSUM_LEN (16)
|
||||||
|
|
||||||
|
#define OTA_PARAMS_TAG ("OTAPARAM")
|
||||||
|
#define MD5_STR_LEN (32 + 4)
|
||||||
|
|
||||||
|
#define OTA_PARTITION_DEV ("sunxi_flash")
|
||||||
|
#define OTA_PARTITION_NAME ("0:0")
|
||||||
|
|
||||||
|
#define READ_OTA_PARAMS_ADDR (0x40007800)
|
||||||
|
#define READ_BOOT_ADDR (READ_OTA_PARAMS_ADDR + (1024 * 1024))
|
||||||
|
#define READ_ROOTFS_ADDR (READ_BOOT_ADDR + (1024 * 1024 * 4))
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char tags[8];
|
||||||
|
int otaStatus;
|
||||||
|
char otaVer[MD5_STR_LEN];
|
||||||
|
char bootChksum[MD5_STR_LEN];
|
||||||
|
unsigned int bootfileSize;
|
||||||
|
char rootfsChksum[MD5_STR_LEN];
|
||||||
|
unsigned int rootfsfileSize;
|
||||||
|
char paramsChksum[MD5_STR_LEN];
|
||||||
|
} OTA_PARAMS, *POTA_PARAMS;
|
||||||
|
|
||||||
|
static const char hex_asc[] = "0123456789abcdef";
|
||||||
|
|
||||||
|
static char* __bin2hex(char *p, unsigned char *cp, int count)
|
||||||
|
{
|
||||||
|
while (count) {
|
||||||
|
unsigned char c = *cp++;
|
||||||
|
/* put lowercase hex digits */
|
||||||
|
*p++ = 0x20 | hex_asc[c >> 4];
|
||||||
|
*p++ = 0x20 | hex_asc[c & 0xf];
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ota_print_params(POTA_PARAMS pInfo)
|
||||||
|
{
|
||||||
|
printf("tags: %s\n", pInfo->tags);
|
||||||
|
printf("status: 0x%08X\n", pInfo->otaStatus);
|
||||||
|
printf("version: %s\n", pInfo->otaVer);
|
||||||
|
printf("boot_ver: %s\n", pInfo->bootChksum);
|
||||||
|
printf("boot_size: %u\n", pInfo->bootfileSize);
|
||||||
|
printf("rootfs_ver: %s\n", pInfo->rootfsChksum);
|
||||||
|
printf("rootfs_size: %u\n", pInfo->rootfsfileSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_load_boot_partition(POTA_PARAMS pInfo)
|
||||||
|
{
|
||||||
|
unsigned char md5sum[MD5_CHKSUM_LEN];
|
||||||
|
char cmdBuf[128];
|
||||||
|
int iSize = sunxi_partition_get_size_byname("boot");
|
||||||
|
//u32 start_block = sunxi_partition_get_offset_byname("boot");
|
||||||
|
|
||||||
|
memset(cmdBuf, 0, 128);
|
||||||
|
sprintf(cmdBuf, "sunxi_flash read 0x%x boot", READ_BOOT_ADDR);
|
||||||
|
run_command(cmdBuf, 0);
|
||||||
|
|
||||||
|
if(pInfo->bootfileSize == 0)
|
||||||
|
pInfo->bootfileSize = iSize * MBR_PAGE_SIZE;
|
||||||
|
|
||||||
|
md5((unsigned char*)READ_BOOT_ADDR, (int)pInfo->bootfileSize, md5sum);
|
||||||
|
__bin2hex(pInfo->bootChksum, md5sum, MD5_CHKSUM_LEN);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_load_rootfs_partition(POTA_PARAMS pInfo)
|
||||||
|
{
|
||||||
|
unsigned char md5sum[MD5_CHKSUM_LEN];
|
||||||
|
char cmdBuf[128];
|
||||||
|
int iSize = sunxi_partition_get_size_byname("rootfs");
|
||||||
|
//u32 start_block = sunxi_partition_get_offset_byname("boot");
|
||||||
|
|
||||||
|
memset(cmdBuf, 0, 128);
|
||||||
|
sprintf(cmdBuf, "sunxi_flash read 0x%x rootfs", READ_ROOTFS_ADDR);
|
||||||
|
run_command(cmdBuf, 0);
|
||||||
|
|
||||||
|
if(pInfo->rootfsfileSize == 0)
|
||||||
|
pInfo->rootfsfileSize = iSize * MBR_PAGE_SIZE;
|
||||||
|
|
||||||
|
md5((unsigned char*)READ_ROOTFS_ADDR, (int)pInfo->rootfsfileSize, md5sum);
|
||||||
|
__bin2hex(pInfo->rootfsChksum, md5sum, MD5_CHKSUM_LEN);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_calc_params_checksum(POTA_PARAMS pInfo)
|
||||||
|
{
|
||||||
|
unsigned char md5sum[MD5_CHKSUM_LEN];
|
||||||
|
md5((unsigned char*)pInfo, sizeof(OTA_PARAMS) - MD5_STR_LEN, md5sum);
|
||||||
|
__bin2hex(pInfo->paramsChksum, md5sum, MD5_CHKSUM_LEN);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_verify_params_checksum(POTA_PARAMS pInfo)
|
||||||
|
{
|
||||||
|
unsigned char md5sum[MD5_CHKSUM_LEN];
|
||||||
|
char md5str[MD5_STR_LEN];
|
||||||
|
|
||||||
|
memset(md5str, 0, MD5_STR_LEN);
|
||||||
|
|
||||||
|
md5((unsigned char*)pInfo, sizeof(OTA_PARAMS) - MD5_STR_LEN, md5sum);
|
||||||
|
__bin2hex(md5str, md5sum, MD5_CHKSUM_LEN);
|
||||||
|
|
||||||
|
return strcmp(md5str, pInfo->paramsChksum);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_save_params(POTA_PARAMS pInfo)
|
||||||
|
{
|
||||||
|
int iSize = (sizeof(OTA_PARAMS) + MBR_PAGE_SIZE - 1) / MBR_PAGE_SIZE;
|
||||||
|
u32 start_block = sunxi_partition_get_offset_byname("ota_info");
|
||||||
|
|
||||||
|
sunxi_flash_write(start_block, iSize, pInfo);
|
||||||
|
sunxi_flash_flush();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_erase_partition(const char* pPart)
|
||||||
|
{
|
||||||
|
char cmdBuf[128];
|
||||||
|
|
||||||
|
printf("erase partition %s ......\n", pPart);
|
||||||
|
memset(cmdBuf, 0, 128);
|
||||||
|
sprintf(cmdBuf, "sunxi_flash write 0x%x %s", READ_OTA_PARAMS_ADDR, pPart);
|
||||||
|
run_command(cmdBuf, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_read_params(POTA_PARAMS pInfo)
|
||||||
|
{
|
||||||
|
char cmdBuf[128];
|
||||||
|
int init_params = 0;
|
||||||
|
|
||||||
|
memset(cmdBuf, 0, 128);
|
||||||
|
sprintf(cmdBuf, "sunxi_flash read 0x%x ota_info", READ_OTA_PARAMS_ADDR);
|
||||||
|
run_command(cmdBuf, 0);
|
||||||
|
|
||||||
|
memcpy(pInfo, (unsigned char*)READ_OTA_PARAMS_ADDR, sizeof(OTA_PARAMS));
|
||||||
|
|
||||||
|
if(strncmp(pInfo->tags, OTA_PARAMS_TAG, 7) == 0)
|
||||||
|
{
|
||||||
|
ota_print_params(pInfo);
|
||||||
|
|
||||||
|
if(ota_verify_params_checksum(pInfo) != 0)
|
||||||
|
{
|
||||||
|
init_params = 1;
|
||||||
|
printf("verify ota information error\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("found ota information\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
init_params = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(init_params)
|
||||||
|
{
|
||||||
|
printf("ota system init.....\n");
|
||||||
|
memset(pInfo, 0, sizeof(OTA_PARAMS));
|
||||||
|
strcpy(pInfo->tags, OTA_PARAMS_TAG);
|
||||||
|
pInfo->otaStatus = 0;
|
||||||
|
ota_load_boot_partition(pInfo);
|
||||||
|
ota_load_rootfs_partition(pInfo);
|
||||||
|
ota_calc_params_checksum(pInfo);
|
||||||
|
ota_print_params(pInfo);
|
||||||
|
ota_save_params(pInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_read_boot_image(void)
|
||||||
|
{
|
||||||
|
int read_bytes = 0;
|
||||||
|
|
||||||
|
if (fs_set_blk_dev("sunxi_flash", "0", FS_TYPE_EXT))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
read_bytes = fs_read("ota/boot.img", READ_BOOT_ADDR, 0, 0);
|
||||||
|
|
||||||
|
printf("Read boot image to 0x%08X total %d(0x%X) bytes\n", READ_BOOT_ADDR, read_bytes, read_bytes);
|
||||||
|
|
||||||
|
return read_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_read_rootfs_image(void)
|
||||||
|
{
|
||||||
|
int read_bytes = 0;
|
||||||
|
|
||||||
|
if (fs_set_blk_dev("sunxi_flash", "0", FS_TYPE_EXT))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
read_bytes = fs_read("ota/rootfs.img", READ_ROOTFS_ADDR, 0, 0);
|
||||||
|
|
||||||
|
printf("Read rootfs image to 0x%08X total %d(0x%X) bytes\n", READ_ROOTFS_ADDR, read_bytes, read_bytes);
|
||||||
|
|
||||||
|
return read_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_calc_image_chksum(unsigned char* addr, int iSize, char* pChksm)
|
||||||
|
{
|
||||||
|
unsigned char md5sum[MD5_CHKSUM_LEN];
|
||||||
|
|
||||||
|
md5(addr, iSize, md5sum);
|
||||||
|
__bin2hex(pChksm, md5sum, MD5_CHKSUM_LEN);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_upgrade_boot_image(void)
|
||||||
|
{
|
||||||
|
char cmdBuf[128];
|
||||||
|
|
||||||
|
memset(cmdBuf, 0, 128);
|
||||||
|
sprintf(cmdBuf, "sunxi_flash write 0x%x boot", READ_BOOT_ADDR);
|
||||||
|
run_command(cmdBuf, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ota_upgrade_rootfs_image(void)
|
||||||
|
{
|
||||||
|
char cmdBuf[128];
|
||||||
|
|
||||||
|
memset(cmdBuf, 0, 128);
|
||||||
|
sprintf(cmdBuf, "sunxi_flash write 0x%x rootfs", READ_ROOTFS_ADDR);
|
||||||
|
run_command(cmdBuf, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static int ota_read_file(const char* pDev, const char* pPart, const char* pFile)
|
||||||
|
{
|
||||||
|
OTA_PARAMS otaInfo;
|
||||||
|
int read_bytes = 0;
|
||||||
|
|
||||||
|
if (fs_set_blk_dev(pDev, pPart, FS_TYPE_EXT))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
read_bytes = fs_read(pFile, READ_BOOT_ADDR, 0, 0);
|
||||||
|
|
||||||
|
printf("Read %s to 0x%08X total 0x%X bytes\n", pFile, READ_BOOT_ADDR, read_bytes);
|
||||||
|
|
||||||
|
ota_read_params(&otaInfo);
|
||||||
|
return read_bytes;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
int do_ota(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||||
|
char *const argv[])
|
||||||
|
{
|
||||||
|
static int read_boot_size = 0, read_rootfs_size = 0;
|
||||||
|
|
||||||
|
printf("ota cmd: argc = %d\n", argc);
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
|
if(strncmp(argv[1], "erase", strlen("erase")) == 0)
|
||||||
|
{
|
||||||
|
if(argc != 3)
|
||||||
|
{
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strncmp(argv[2], "boot", strlen("boot")) == 0
|
||||||
|
|| strncmp(argv[2], "rootfs", strlen("rootfs")) == 0
|
||||||
|
|| strncmp(argv[2], "ota_info", strlen("ota_info")) == 0
|
||||||
|
|| strncmp(argv[2], "rootfs_data", strlen("rootfs_data")) == 0
|
||||||
|
|| strncmp(argv[2], "UDISK", strlen("UDISK")) == 0)
|
||||||
|
{
|
||||||
|
ota_erase_partition(argv[2]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strncmp(argv[1], "readimg", strlen("readimg")) == 0)
|
||||||
|
{
|
||||||
|
if(argc != 3)
|
||||||
|
{
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strncmp(argv[2], "boot", strlen("boot")) == 0)
|
||||||
|
{
|
||||||
|
read_boot_size = ota_read_boot_image();
|
||||||
|
printf("Read %d\n", read_boot_size);
|
||||||
|
}
|
||||||
|
else if(strncmp(argv[2], "rootfs", strlen("rootfs")) == 0)
|
||||||
|
{
|
||||||
|
read_rootfs_size = ota_read_rootfs_image();
|
||||||
|
printf("Read %d\n", read_rootfs_size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(strncmp(argv[1], "show_params", strlen("readimg")) == 0)
|
||||||
|
{
|
||||||
|
OTA_PARAMS otaInfo;
|
||||||
|
ota_read_params(&otaInfo);
|
||||||
|
}
|
||||||
|
else if(strncmp(argv[1], "upgrade", strlen("upgrade")) == 0)
|
||||||
|
{
|
||||||
|
int force = 0, flag = 0;
|
||||||
|
OTA_PARAMS otaInfo, upgInfo;
|
||||||
|
|
||||||
|
if(argc == 2)
|
||||||
|
{
|
||||||
|
flag = (1 << 0) | (1 << 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(argc == 4)
|
||||||
|
{
|
||||||
|
force = simple_strtoul(argv[3], NULL, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strncmp(argv[2], "boot", strlen("boot")) == 0)
|
||||||
|
{
|
||||||
|
flag |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strncmp(argv[2], "rootfs", strlen("rootfs")) == 0)
|
||||||
|
{
|
||||||
|
flag |= (1 << 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strncmp(argv[2], "all", strlen("all")) == 0)
|
||||||
|
{
|
||||||
|
flag = (1 << 0) | (1 << 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(flag == 0)
|
||||||
|
{
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ota_read_params(&otaInfo);
|
||||||
|
memset(&upgInfo, 0, sizeof(OTA_PARAMS));
|
||||||
|
|
||||||
|
if(flag & (1 << 0))
|
||||||
|
{
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
|
||||||
|
upgInfo.bootfileSize = ota_read_boot_image();
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
ota_calc_image_chksum((unsigned char*)READ_BOOT_ADDR,
|
||||||
|
upgInfo.bootfileSize, upgInfo.bootChksum);
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
if(strcmp(upgInfo.bootChksum, otaInfo.bootChksum) != 0
|
||||||
|
|| upgInfo.bootfileSize != otaInfo.bootfileSize)
|
||||||
|
{
|
||||||
|
printf("Upgrade boot image maybe error:\n\t%s --> %s\n\t%u-%u\n",
|
||||||
|
upgInfo.bootChksum, otaInfo.bootChksum,
|
||||||
|
upgInfo.bootfileSize, otaInfo.bootfileSize);
|
||||||
|
|
||||||
|
if(force == 0)
|
||||||
|
{
|
||||||
|
return CMD_RET_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
ota_upgrade_boot_image();
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(flag & (1 << 1))
|
||||||
|
{
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
upgInfo.rootfsfileSize = ota_read_rootfs_image();
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
ota_calc_image_chksum((unsigned char*)READ_ROOTFS_ADDR,
|
||||||
|
upgInfo.rootfsfileSize, upgInfo.rootfsChksum);
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
if(strcmp(upgInfo.rootfsChksum, otaInfo.rootfsChksum) != 0
|
||||||
|
|| upgInfo.rootfsfileSize != otaInfo.rootfsfileSize)
|
||||||
|
{
|
||||||
|
printf("Upgrade rootfs image maybe error:\n\t%s --> %s\n\t%u-%u\n",
|
||||||
|
upgInfo.rootfsChksum, otaInfo.rootfsChksum,
|
||||||
|
upgInfo.rootfsfileSize, otaInfo.rootfsfileSize);
|
||||||
|
|
||||||
|
if(force == 0)
|
||||||
|
{
|
||||||
|
return CMD_RET_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ota_upgrade_rootfs_image();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return CMD_RET_USAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//return do_load(cmdtp, flag, argc, argv, FS_TYPE_EXT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
U_BOOT_CMD(ota, 5, 0, do_ota,
|
||||||
|
"netease OTA command:",
|
||||||
|
"<command> <parmeters>\n"
|
||||||
|
" erase <partiton name>\n"
|
||||||
|
" - erase mtd partiton\n"
|
||||||
|
" read <boot/rootfs>\n"
|
||||||
|
" - read ota image form UDISK file system\n"
|
||||||
|
" upgrade <boot/rootfs/all> [0/1(skip verify chksum)]\n"
|
||||||
|
" - read ota image form UDISK file system and upgrade nand partiton\n"
|
||||||
|
" show_params\n"
|
||||||
|
" - show ota params information\n"
|
||||||
|
" - *********************************************");
|
|
@ -17,6 +17,7 @@
|
||||||
#define __KERNEL__
|
#define __KERNEL__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define CONFIG_NETEASE_OTA
|
||||||
/* #define DEBUG */
|
/* #define DEBUG */
|
||||||
/*#define FPGA_PLATFORM*/
|
/*#define FPGA_PLATFORM*/
|
||||||
|
|
||||||
|
@ -169,6 +170,11 @@
|
||||||
#define CONFIG_CMD_SUNXI_PMU
|
#define CONFIG_CMD_SUNXI_PMU
|
||||||
#define CONFIG_CMD_SUNXI_SYSCFG
|
#define CONFIG_CMD_SUNXI_SYSCFG
|
||||||
|
|
||||||
|
#define CONFIG_CMD_EXT4
|
||||||
|
#define CONFIG_CMD_MD5SUM
|
||||||
|
#define CONFIG_MD5
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_SUNXI_DMA
|
#ifdef CONFIG_SUNXI_DMA
|
||||||
#define CONFIG_SUNXI_CMD_DMA
|
#define CONFIG_SUNXI_CMD_DMA
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -84,6 +84,8 @@ extern void early_paging_init(const struct machine_desc *);
|
||||||
extern void adjust_lowmem_bounds(void);
|
extern void adjust_lowmem_bounds(void);
|
||||||
extern enum reboot_mode reboot_mode;
|
extern enum reboot_mode reboot_mode;
|
||||||
extern void setup_dma_zone(const struct machine_desc *desc);
|
extern void setup_dma_zone(const struct machine_desc *desc);
|
||||||
|
extern int sunxi_get_serial(u8 *serial);
|
||||||
|
extern int sunxi_get_soc_chipid(u8 *chipid);
|
||||||
|
|
||||||
unsigned int processor_id;
|
unsigned int processor_id;
|
||||||
EXPORT_SYMBOL(processor_id);
|
EXPORT_SYMBOL(processor_id);
|
||||||
|
@ -1216,6 +1218,14 @@ static int c_show(struct seq_file *m, void *v)
|
||||||
int i, j;
|
int i, j;
|
||||||
u32 cpuid;
|
u32 cpuid;
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_SUNXI)
|
||||||
|
u32 serial[4];
|
||||||
|
u32 chip_id[4] = {0};
|
||||||
|
int ret;
|
||||||
|
memset(serial, 0, sizeof(serial));
|
||||||
|
ret = sunxi_get_serial((u8 *)serial);
|
||||||
|
ret = sunxi_get_soc_chipid((u8 *)chip_id);
|
||||||
|
#endif
|
||||||
for_each_online_cpu(i) {
|
for_each_online_cpu(i) {
|
||||||
/*
|
/*
|
||||||
* glibc reads /proc/cpuinfo to determine the number of
|
* glibc reads /proc/cpuinfo to determine the number of
|
||||||
|
@ -1272,8 +1282,14 @@ static int c_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
seq_printf(m, "Hardware\t: %s\n", machine_name);
|
seq_printf(m, "Hardware\t: %s\n", machine_name);
|
||||||
seq_printf(m, "Revision\t: %04x\n", system_rev);
|
seq_printf(m, "Revision\t: %04x\n", system_rev);
|
||||||
|
#if defined(CONFIG_ARCH_SUNXI)
|
||||||
|
seq_printf(m, "Serial\t\t: %04x%08x%08x\n",
|
||||||
|
serial[2], serial[1], serial[0]);
|
||||||
|
seq_printf(m, "Chipid\t\t: %08x%08x%08x%08x\n",
|
||||||
|
chip_id[3],chip_id[2], chip_id[1], chip_id[0]);
|
||||||
|
#else
|
||||||
seq_printf(m, "Serial\t\t: %s\n", system_serial);
|
seq_printf(m, "Serial\t\t: %s\n", system_serial);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,7 @@ static ssize_t sys_info_show(struct class *class,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int databuf[4] = {0};
|
int databuf[4] = {0};
|
||||||
|
int serial[4];
|
||||||
char tmpbuf[129] = {0};
|
char tmpbuf[129] = {0};
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
|
@ -105,12 +106,18 @@ static ssize_t sys_info_show(struct class *class,
|
||||||
size += sprintf(buf + size, "%s\n", "normal");
|
size += sprintf(buf + size, "%s\n", "normal");
|
||||||
|
|
||||||
/* chipid */
|
/* chipid */
|
||||||
sunxi_get_serial((u8 *)databuf);
|
sunxi_get_soc_chipid((u8 *)databuf);
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
sprintf(tmpbuf + i*8, "%08x", databuf[i]);
|
sprintf(tmpbuf + i*8, "%08x", databuf[i]);
|
||||||
tmpbuf[128] = 0;
|
tmpbuf[128] = 0;
|
||||||
size += sprintf(buf + size, "sunxi_chipid : %s\n", tmpbuf);
|
size += sprintf(buf + size, "sunxi_chipid : %s\n", tmpbuf);
|
||||||
|
|
||||||
|
/* serial */
|
||||||
|
memset(serial, 0, sizeof(serial));
|
||||||
|
sunxi_get_serial((u8 *)serial);
|
||||||
|
sprintf(tmpbuf, "%04x%08x%08x", serial[2], serial[1], serial[0]);
|
||||||
|
size += sprintf(buf+size, "sunxi_serial : %s\n", tmpbuf);
|
||||||
|
|
||||||
/* chiptype */
|
/* chiptype */
|
||||||
sunxi_get_soc_chipid_str(tmpbuf);
|
sunxi_get_soc_chipid_str(tmpbuf);
|
||||||
size += sprintf(buf + size, "sunxi_chiptype : %s\n", tmpbuf);
|
size += sprintf(buf + size, "sunxi_chiptype : %s\n", tmpbuf);
|
||||||
|
|
|
@ -11,4 +11,9 @@
|
||||||
#ifndef CDX_CONFIG_H
|
#ifndef CDX_CONFIG_H
|
||||||
#define CDX_CONFIG_H
|
#define CDX_CONFIG_H
|
||||||
|
|
||||||
|
/* wk */
|
||||||
|
#define DEFAULT_GAIN_IHW 1.0
|
||||||
|
#define ERR_THRESHOLD 0.000001
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -55,6 +55,8 @@ struct AudioRenderComp {
|
||||||
CdxPlaybkCfg cfg;
|
CdxPlaybkCfg cfg;
|
||||||
|
|
||||||
RenderThreadCtx *threadCtx;
|
RenderThreadCtx *threadCtx;
|
||||||
|
|
||||||
|
float gain;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void handleStart(AwMessage *msg, void *arg);
|
static void handleStart(AwMessage *msg, void *arg);
|
||||||
|
@ -136,9 +138,19 @@ int AudioRenderCompDestroy(AudioRenderComp* p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioRenderComp* AudioRenderCompSetGain(AudioRenderComp* a, float gain){
|
||||||
|
AudioRenderComp* p = (AudioRenderComp*)a;
|
||||||
|
|
||||||
|
p->gain = gain;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int AudioRenderCompStart(AudioRenderComp* p)
|
int AudioRenderCompStart(AudioRenderComp* p)
|
||||||
{
|
{
|
||||||
return BaseCompStart(&p->base, NULL, NULL);
|
//return BaseCompStart(&p->base, NULL, NULL);
|
||||||
|
return BaseCompStart(&p->base, NULL, &p->gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioRenderCompStop(AudioRenderComp* p)
|
int AudioRenderCompStop(AudioRenderComp* p)
|
||||||
|
@ -276,6 +288,7 @@ static void* AudioRenderThread(void* arg)
|
||||||
};
|
};
|
||||||
|
|
||||||
p->threadCtx = &threadCtx;
|
p->threadCtx = &threadCtx;
|
||||||
|
p->gain = DEFAULT_GAIN_IHW;
|
||||||
|
|
||||||
while (AwMessageQueueGetMessage(p->mq, &msg) == 0)
|
while (AwMessageQueueGetMessage(p->mq, &msg) == 0)
|
||||||
{
|
{
|
||||||
|
@ -294,6 +307,11 @@ static void handleStart(AwMessage *msg, void *arg)
|
||||||
|
|
||||||
logi("audio render process start message.");
|
logi("audio render process start message.");
|
||||||
|
|
||||||
|
float gainTmp = msg->gain;
|
||||||
|
//WK_PRINT("begin to process MESSAGE_ID_START, gainIn:%f", *gainTmp);
|
||||||
|
p->gain = gainTmp;
|
||||||
|
//WK_PRINT("gain:%f",p->gain);
|
||||||
|
|
||||||
if (p->eStatus == PLAYER_STATUS_STARTED)
|
if (p->eStatus == PLAYER_STATUS_STARTED)
|
||||||
{
|
{
|
||||||
logw("already in started status.");
|
logw("already in started status.");
|
||||||
|
@ -719,6 +737,37 @@ static inline int notifyAudioPts(AudioRenderComp *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pcmDataTransByGain(unsigned char* data, unsigned int len, float gain, unsigned int nBitsPerSample)
|
||||||
|
{
|
||||||
|
if(fabs(gain-DEFAULT_GAIN_IHW) < ERR_THRESHOLD){
|
||||||
|
//WK_PRINT("gain :%f..............", gain);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(16 != nBitsPerSample){
|
||||||
|
//WK_PRINT("nBitsPerSample err :%d..............", nBitsPerSample);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((len % 4) != 0){
|
||||||
|
//WK_PRINT("len info of pcm data:%d..............\n", len);
|
||||||
|
}
|
||||||
|
int dataByGain;
|
||||||
|
|
||||||
|
short* pcm16Bit;
|
||||||
|
unsigned char * tmp;
|
||||||
|
unsigned char * dataMax = &data[len];
|
||||||
|
for (tmp = data; tmp < dataMax; ++tmp){
|
||||||
|
pcm16Bit = (short*)tmp;
|
||||||
|
dataByGain = (*pcm16Bit) * gain;
|
||||||
|
if(dataByGain > 32767 || dataByGain < -32768){
|
||||||
|
//WK_PRINT("%d out of range to %d by gain of %f..............", *pcm16Bit, dataByGain, gain);
|
||||||
|
}
|
||||||
|
*tmp = dataByGain & 0xff;
|
||||||
|
*++tmp = (dataByGain & 0xff00) >> 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline int writeToSoundDevice(AudioRenderComp *p)
|
static inline int writeToSoundDevice(AudioRenderComp *p)
|
||||||
{
|
{
|
||||||
RenderThreadCtx *threadCtx = p->threadCtx;
|
RenderThreadCtx *threadCtx = p->threadCtx;
|
||||||
|
@ -745,6 +794,8 @@ static inline int writeToSoundDevice(AudioRenderComp *p)
|
||||||
if(p->bForceWriteToDeviceFlag == 1)
|
if(p->bForceWriteToDeviceFlag == 1)
|
||||||
memset(pPcmData, 0, nPcmDataLen);
|
memset(pPcmData, 0, nPcmDataLen);
|
||||||
|
|
||||||
|
pcmDataTransByGain(pPcmData, nPcmDataLen, p->gain, p->threadCtx->nSampleRate);
|
||||||
|
|
||||||
while(nPcmDataLen > 0)
|
while(nPcmDataLen > 0)
|
||||||
{
|
{
|
||||||
nWritten = SoundDeviceWrite(p->pSoundCtrl,
|
nWritten = SoundDeviceWrite(p->pSoundCtrl,
|
||||||
|
|
|
@ -21,6 +21,8 @@ AudioRenderComp* AudioRenderCompCreate(void);
|
||||||
|
|
||||||
int AudioRenderCompDestroy(AudioRenderComp* a);
|
int AudioRenderCompDestroy(AudioRenderComp* a);
|
||||||
|
|
||||||
|
AudioRenderComp* AudioRenderCompSetGain(AudioRenderComp* a, float gain);
|
||||||
|
|
||||||
int AudioRenderCompStart(AudioRenderComp* a);
|
int AudioRenderCompStart(AudioRenderComp* a);
|
||||||
|
|
||||||
int AudioRenderCompStop(AudioRenderComp* a);
|
int AudioRenderCompStop(AudioRenderComp* a);
|
||||||
|
|
|
@ -86,6 +86,7 @@ int BaseCompStart(BaseCompCtx *p, task_t afterPostBeforeWait, void *arg)
|
||||||
.execute = p->handler.start,
|
.execute = p->handler.start,
|
||||||
.replySem = &p->replySem[MESSAGE_ID_START],
|
.replySem = &p->replySem[MESSAGE_ID_START],
|
||||||
.result = &reply,
|
.result = &reply,
|
||||||
|
.gain = *((float*)arg),
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseCompPostAndWait(p, &msg, afterPostBeforeWait, arg);
|
BaseCompPostAndWait(p, &msg, afterPostBeforeWait, arg);
|
||||||
|
|
1
package/allwinner/tina_multimedia/libcedarx/libcore/playback/baseComponent.h
Normal file → Executable file
1
package/allwinner/tina_multimedia/libcedarx/libcore/playback/baseComponent.h
Normal file → Executable file
|
@ -25,6 +25,7 @@ struct AwMessage {
|
||||||
int64_t seekTime;
|
int64_t seekTime;
|
||||||
void *opaque;
|
void *opaque;
|
||||||
int64_t int64Value;
|
int64_t int64Value;
|
||||||
|
float gain;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,8 @@ int PlayerSetCallback(Player* pl, PlayerCallback callback, void* pUserData);
|
||||||
//** Play Control APIs.
|
//** Play Control APIs.
|
||||||
//**
|
//**
|
||||||
|
|
||||||
|
Player* PlayerGainSet(Player* pl, float gain);
|
||||||
|
|
||||||
int PlayerStart(Player* pl);
|
int PlayerStart(Player* pl);
|
||||||
|
|
||||||
int PlayerStop(Player* pl); //* media stream information is still kept by the player.
|
int PlayerStop(Player* pl); //* media stream information is still kept by the player.
|
||||||
|
|
|
@ -131,7 +131,7 @@ typedef struct PlayerContext
|
||||||
int nUnSurpportVideoBufferSize;
|
int nUnSurpportVideoBufferSize;
|
||||||
|
|
||||||
int bDiscardAudio;
|
int bDiscardAudio;
|
||||||
|
float mGain;
|
||||||
}PlayerContext;
|
}PlayerContext;
|
||||||
|
|
||||||
static int CallbackProcess(void* pSelf, int eMessageId, void* param);
|
static int CallbackProcess(void* pSelf, int eMessageId, void* param);
|
||||||
|
@ -721,6 +721,13 @@ int PlayerHasAudio(Player* pl)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player* PlayerGainSet(Player* pl, float gain){
|
||||||
|
PlayerContext* p;
|
||||||
|
p = (PlayerContext*)pl;
|
||||||
|
p->mGain = gain;
|
||||||
|
return (Player*)p;
|
||||||
|
}
|
||||||
|
|
||||||
int PlayerStart(Player* pl)
|
int PlayerStart(Player* pl)
|
||||||
{
|
{
|
||||||
PlayerContext* p;
|
PlayerContext* p;
|
||||||
|
@ -760,8 +767,10 @@ int PlayerStart(Player* pl)
|
||||||
SubtitleDecCompStart(p->pSubtitleDecComp);
|
SubtitleDecCompStart(p->pSubtitleDecComp);
|
||||||
if(p->pVideoRender != NULL)
|
if(p->pVideoRender != NULL)
|
||||||
VideoRenderCompStart(p->pVideoRender);
|
VideoRenderCompStart(p->pVideoRender);
|
||||||
if(p->pAudioRender != NULL)
|
if(p->pAudioRender != NULL){
|
||||||
|
p->pAudioRender = AudioRenderCompSetGain(p->pAudioRender, p->mGain);
|
||||||
AudioRenderCompStart(p->pAudioRender);
|
AudioRenderCompStart(p->pAudioRender);
|
||||||
|
}
|
||||||
if(p->pSubtitleRender != NULL)
|
if(p->pSubtitleRender != NULL)
|
||||||
SubtitleRenderCompStart(p->pSubtitleRender);
|
SubtitleRenderCompStart(p->pSubtitleRender);
|
||||||
}
|
}
|
||||||
|
@ -824,8 +833,10 @@ int PlayerStart(Player* pl)
|
||||||
SubtitleDecCompStart(p->pSubtitleDecComp);
|
SubtitleDecCompStart(p->pSubtitleDecComp);
|
||||||
if(p->pVideoRender != NULL)
|
if(p->pVideoRender != NULL)
|
||||||
VideoRenderCompStart(p->pVideoRender);
|
VideoRenderCompStart(p->pVideoRender);
|
||||||
if(p->pAudioRender != NULL)
|
if(p->pAudioRender != NULL){
|
||||||
|
p->pAudioRender = AudioRenderCompSetGain(p->pAudioRender, p->mGain);
|
||||||
AudioRenderCompStart(p->pAudioRender);
|
AudioRenderCompStart(p->pAudioRender);
|
||||||
|
}
|
||||||
if(p->pSubtitleRender != NULL)
|
if(p->pSubtitleRender != NULL)
|
||||||
SubtitleRenderCompStart(p->pSubtitleRender);
|
SubtitleRenderCompStart(p->pSubtitleRender);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,8 @@ int XPlayerPrepareAsync(XPlayer* p);
|
||||||
|
|
||||||
int XPlayerStart(XPlayer* p);
|
int XPlayerStart(XPlayer* p);
|
||||||
|
|
||||||
|
int XPlayerStartWithGain(XPlayer* p, float gain);
|
||||||
|
|
||||||
int XPlayerStop(XPlayer* p);
|
int XPlayerStop(XPlayer* p);
|
||||||
|
|
||||||
int XPlayerPause(XPlayer* p);
|
int XPlayerPause(XPlayer* p);
|
||||||
|
|
|
@ -187,6 +187,7 @@ typedef struct PlayerContext
|
||||||
|
|
||||||
XPlayerNotifyCallback mCallback;
|
XPlayerNotifyCallback mCallback;
|
||||||
void* pUser;
|
void* pUser;
|
||||||
|
float gain;
|
||||||
}PlayerContext;
|
}PlayerContext;
|
||||||
|
|
||||||
static void* XPlayerThread(void* arg);
|
static void* XPlayerThread(void* arg);
|
||||||
|
@ -233,6 +234,8 @@ XPlayer* XPlayerCreate()
|
||||||
mPriData->mSeekTobug = 0;
|
mPriData->mSeekTobug = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mPriData->gain = DEFAULT_GAIN_IHW;
|
||||||
|
|
||||||
pthread_mutex_init(&mPriData->mMutexMediaInfo, NULL);
|
pthread_mutex_init(&mPriData->mMutexMediaInfo, NULL);
|
||||||
pthread_mutex_init(&mPriData->mMutexStatus, NULL);
|
pthread_mutex_init(&mPriData->mMutexStatus, NULL);
|
||||||
sem_init(&mPriData->mSemSetDataSource, 0, 0);
|
sem_init(&mPriData->mSemSetDataSource, 0, 0);
|
||||||
|
@ -744,11 +747,18 @@ int XPlayerStart(XPlayer* p)
|
||||||
msg.messageId = XPLAYER_COMMAND_START;
|
msg.messageId = XPLAYER_COMMAND_START;
|
||||||
msg.params[0] = (uintptr_t)&mPriData->mSemStart;
|
msg.params[0] = (uintptr_t)&mPriData->mSemStart;
|
||||||
msg.params[1] = (uintptr_t)&mPriData->mStartReply;
|
msg.params[1] = (uintptr_t)&mPriData->mStartReply;
|
||||||
|
msg.params[2] = (uintptr_t)&mPriData->gain;
|
||||||
AwMessageQueuePostMessage(mPriData->mMessageQueue, &msg);
|
AwMessageQueuePostMessage(mPriData->mMessageQueue, &msg);
|
||||||
SemTimedWait(&mPriData->mSemStart, -1);
|
SemTimedWait(&mPriData->mSemStart, -1);
|
||||||
return mPriData->mStartReply;
|
return mPriData->mStartReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int XPlayerStartWithGain(XPlayer * p, float gain)
|
||||||
|
{
|
||||||
|
PlayerContext* mPriData = (PlayerContext*)p;
|
||||||
|
mPriData->gain = gain;
|
||||||
|
XPlayerStart(p);
|
||||||
|
}
|
||||||
|
|
||||||
int XPlayerStop(XPlayer* p)
|
int XPlayerStop(XPlayer* p)
|
||||||
{
|
{
|
||||||
|
@ -1972,6 +1982,15 @@ static void* XPlayerThread(void* arg)
|
||||||
else if(msg.messageId == XPLAYER_COMMAND_START)
|
else if(msg.messageId == XPLAYER_COMMAND_START)
|
||||||
{
|
{
|
||||||
logd("process message XPLAYER_COMMAND_START.");
|
logd("process message XPLAYER_COMMAND_START.");
|
||||||
|
|
||||||
|
mPriData->gain = *(float*)msg.params[2];
|
||||||
|
//WK_PRINT("gain_ihw orginal:%f",gain_ihw);
|
||||||
|
if(mPriData->gain > 0){
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mPriData->gain = DEFAULT_GAIN_IHW;
|
||||||
|
}
|
||||||
|
|
||||||
if(mPriData->mStatus != XPLAYER_STATUS_PREPARED &&
|
if(mPriData->mStatus != XPLAYER_STATUS_PREPARED &&
|
||||||
mPriData->mStatus != XPLAYER_STATUS_STARTED &&
|
mPriData->mStatus != XPLAYER_STATUS_STARTED &&
|
||||||
mPriData->mStatus != XPLAYER_STATUS_PAUSED &&
|
mPriData->mStatus != XPLAYER_STATUS_PAUSED &&
|
||||||
|
@ -2070,6 +2089,9 @@ static void* XPlayerThread(void* arg)
|
||||||
//* post a start message.
|
//* post a start message.
|
||||||
memset(&newMsg, 0, sizeof(AwMessage));
|
memset(&newMsg, 0, sizeof(AwMessage));
|
||||||
newMsg.messageId = XPLAYER_COMMAND_START;
|
newMsg.messageId = XPLAYER_COMMAND_START;
|
||||||
|
newMsg.params[0] = 0;
|
||||||
|
newMsg.params[1] = 0;
|
||||||
|
newMsg.params[2] = (unsigned int)&mPriData->gain;
|
||||||
AwMessageQueuePostMessage(mPriData->mMessageQueue, &newMsg);
|
AwMessageQueuePostMessage(mPriData->mMessageQueue, &newMsg);
|
||||||
|
|
||||||
//* should I reply 0 to the user at this moment?
|
//* should I reply 0 to the user at this moment?
|
||||||
|
@ -2086,6 +2108,8 @@ static void* XPlayerThread(void* arg)
|
||||||
|
|
||||||
pthread_mutex_unlock(&mPriData->mMutexStatus);
|
pthread_mutex_unlock(&mPriData->mMutexStatus);
|
||||||
|
|
||||||
|
mPriData->mPlayer = PlayerGainSet(mPriData->mPlayer, mPriData->gain);
|
||||||
|
|
||||||
if(mPriData->mApplicationType == APP_STREAMING)
|
if(mPriData->mApplicationType == APP_STREAMING)
|
||||||
{
|
{
|
||||||
PlayerFast(mPriData->mPlayer, 0);
|
PlayerFast(mPriData->mPlayer, 0);
|
||||||
|
|
|
@ -291,6 +291,13 @@ int TPlayerStart(TPlayer* p){
|
||||||
return XPlayerStart(p->mXPlayer);
|
return XPlayerStart(p->mXPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TPlayerStartWithGain(TPlayer * p, float gain)
|
||||||
|
{
|
||||||
|
TP_CHECK(p);
|
||||||
|
TP_CHECK(p->mXPlayer);
|
||||||
|
return XPlayerStartWithGain(p->mXPlayer, gain);
|
||||||
|
}
|
||||||
|
|
||||||
int TPlayerPause(TPlayer* p){
|
int TPlayerPause(TPlayer* p){
|
||||||
TP_CHECK(p);
|
TP_CHECK(p);
|
||||||
TP_CHECK(p->mXPlayer);
|
TP_CHECK(p->mXPlayer);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef TPLAYER_H
|
#ifndef TPLAYER_H
|
||||||
#define TAPLAYER_H
|
#define TPLAYER_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <xplayer.h>
|
#include <xplayer.h>
|
||||||
|
@ -145,6 +145,8 @@ int TPlayerPrepareAsync(TPlayer* p);
|
||||||
|
|
||||||
int TPlayerStart(TPlayer* p);
|
int TPlayerStart(TPlayer* p);
|
||||||
|
|
||||||
|
int TPlayerStartWithGain(TPlayer* p, float gain);
|
||||||
|
|
||||||
int TPlayerPause(TPlayer* p);
|
int TPlayerPause(TPlayer* p);
|
||||||
|
|
||||||
int TPlayerStop(TPlayer* p);
|
int TPlayerStop(TPlayer* p);
|
||||||
|
|
Binary file not shown.
|
@ -16,12 +16,14 @@ define Package/$(PKG_NAME)
|
||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Netease
|
CATEGORY:=Netease
|
||||||
TITLE:=$(PKG_NAME) app
|
TITLE:=$(PKG_NAME) app
|
||||||
DEPENDS:=+netease_voice +liballwinner +libmad +libjson-c +cppunit +libuws +libspeech $(MAKE_COMMON_DEPEND)
|
DEPENDS:=+netease_voice +libmad +libjson-c +cppunit +libuws +libspeech +libcedarx2.7 +alsa-utils +libuapi $(MAKE_COMMON_DEPEND)
|
||||||
ifeq ('$(CONFIG_XUNFEI_TTS_SDK)_$(CONFIG_TTS_TEXT_XUNFEI)', 'y_y')
|
ifeq ('$(CONFIG_XUNFEI_TTS_SDK)_$(CONFIG_TTS_TEXT_XUNFEI)', 'y_y')
|
||||||
DEPENDS+=+libmsc
|
DEPENDS+=+libmsc
|
||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
#+liballwinner
|
||||||
|
|
||||||
ifeq ('$(CONFIG_XUNFEI_TTS_SDK)_$(CONFIG_TTS_TEXT_XUNFEI)', 'y_y')
|
ifeq ('$(CONFIG_XUNFEI_TTS_SDK)_$(CONFIG_TTS_TEXT_XUNFEI)', 'y_y')
|
||||||
TARGET_LDFLAGS += -lmsc
|
TARGET_LDFLAGS += -lmsc
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -11,10 +11,13 @@ CppFiles = $(shell find $(MK_PWD) -name "*.cpp" ! -name "cppunit.cpp")
|
||||||
CFiles = $(shell find $(MK_PWD) -name "*.c")
|
CFiles = $(shell find $(MK_PWD) -name "*.c")
|
||||||
CFilesForUint = $(shell find $(MK_PWD) -name "*.c" ! -name "ihwplayer.c")
|
CFilesForUint = $(shell find $(MK_PWD) -name "*.c" ! -name "ihwplayer.c")
|
||||||
|
|
||||||
|
SourceIncludePath := -I$(STAGING_DIR)/usr/include/allwinner/include -I$(STAGING_DIR)/usr/include/allwinner
|
||||||
|
|
||||||
# 依赖的第3方库
|
# 依赖的第3方库
|
||||||
LoadLibs += -ltinaplayer -lxplayer -lcdc_vdecoder -lcdc_adecoder -lcdc_sdecoder -lcdc_base -lcdc_ve -lcdc_memory \
|
LoadLibs += -ltplayer -lxplayer -lcdc_vdecoder -ladecoder -lcdc_sdecoder -lcdc_base -lcdc_ve -lcdc_memory \
|
||||||
-lcdx_parser -lplayer -lcdx_stream -lcdx_base -lpostprocess \
|
-lcdx_parser -lcdx_playback -lcdx_stream -lcdx_base -luapi \
|
||||||
-law_plugin -ldl -lstdc++ -lrt -lm -lc -lasound -lmad -ljson-c -lspeech -luWS -lcrypto -lssl $(BUILD_COMMON_LIB)
|
-lpthread -ldl -lstdc++ -lrt -lm -lc -lz -lasound -lmad -ljson-c -lspeech -luWS -lcrypto -lssl $(BUILD_COMMON_LIB)
|
||||||
|
|
||||||
# 依赖文件
|
# 依赖文件
|
||||||
CppObject = $(CppFiles:%.cpp=%.o)
|
CppObject = $(CppFiles:%.cpp=%.o)
|
||||||
CObject = $(CFiles:%.c=%.o)
|
CObject = $(CFiles:%.c=%.o)
|
||||||
|
@ -25,19 +28,19 @@ StlNeed = -std=c++11
|
||||||
# 链接
|
# 链接
|
||||||
$(Target): $(CppObject) $(CObject)
|
$(Target): $(CppObject) $(CObject)
|
||||||
@echo "Begin link.............."
|
@echo "Begin link.............."
|
||||||
$(CC) -Wall -o $@ $^ $(CFLAGS) $(LDFLAGS) $(LoadLibs)
|
$(CC) -Wall -o $@ $^ $(CFLAGS) $(SourceIncludePath) $(LDFLAGS) $(LoadLibs)
|
||||||
# 编译
|
# 编译
|
||||||
$(CppObject): %.o : %.cpp
|
$(CppObject): %.o : %.cpp
|
||||||
@echo "Begin bulid cpp.............."
|
@echo "Begin bulid cpp.............."
|
||||||
$(CXX) -c $< $(CXXFLAGS) $(Include) -o $@ $(StlNeed)
|
$(CXX) -c $< $(CXXFLAGS) $(SourceIncludePath) $(Include) -o $@ $(StlNeed)
|
||||||
|
|
||||||
$(CObject): %.o : %.c
|
$(CObject): %.o : %.c
|
||||||
@echo "Begin bulid c.............."
|
@echo "Begin bulid c.............."
|
||||||
$(CXX) -c $< $(CFLAGS) $(Include) -o $@ $(StlNeed)
|
$(CXX) -c $< $(CFLAGS) $(SourceIncludePath) $(Include) -o $@ $(StlNeed)
|
||||||
|
|
||||||
# 编译单元测试
|
# 编译单元测试
|
||||||
@echo "Begin bulid unittest.............."
|
@echo "Begin bulid unittest.............."
|
||||||
$(CXX) $(CXXFLAGS) $(Include) -lcppunit -ldl $(LoadLibs) $(LDFLAGS) \
|
$(CXX) $(CXXFLAGS) $(SourceIncludePath) $(Include) -lcppunit -ldl $(LoadLibs) $(LDFLAGS) \
|
||||||
./unit/cppunit.cpp $(CppFiles) $(CFilesForUint) $(StlNeed) -o unitIhwplayer
|
./unit/cppunit.cpp $(CppFiles) $(CFilesForUint) $(StlNeed) -o unitIhwplayer
|
||||||
|
|
||||||
# 伪目标
|
# 伪目标
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
2017/07/13 wk Initially created
|
2017/07/13 wk Initially created
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "readCmd.h"
|
#include "readCmd.h"
|
||||||
#include "updatelist.h"
|
#include "updatelist.h"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#ifndef _JSON_C_H_
|
#ifndef _JSON_C_H_
|
||||||
#define _JSON_C_H_
|
#define _JSON_C_H_
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
#include <json-c/json.h>
|
#include <json-c/json.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
#ifndef _LU_PLAYER_H_
|
||||||
|
#define _LU_PLAYER_H_
|
||||||
|
|
||||||
|
#include <semaphore.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <asm/types.h>
|
||||||
|
#include <allwinner/tplayer.h>
|
||||||
|
#include <uvdbus/log.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
namespace aw{
|
||||||
|
|
||||||
|
#define POINT_CHECK_NULL(a, ret) {do{if(a == NULL){ \
|
||||||
|
LOG_EX(LOG_Error ,"point is null!\n"); \
|
||||||
|
return ret; \
|
||||||
|
}}while(0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class LuPlayer{
|
||||||
|
public:
|
||||||
|
LuPlayer()
|
||||||
|
{
|
||||||
|
tplayer = TPlayerCreate(CEDARX_PLAYER);
|
||||||
|
}
|
||||||
|
~LuPlayer()
|
||||||
|
{
|
||||||
|
TPlayerDestroy(tplayer);
|
||||||
|
tplayer = NULL;
|
||||||
|
}
|
||||||
|
int setDebugFlag(bool debugFlag)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerSetDebugFlag(tplayer, debugFlag);
|
||||||
|
}
|
||||||
|
int setNotifyCallback(TPlayerNotifyCallback notifier, void* pUserData)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerSetNotifyCallback(tplayer, notifier, pUserData);
|
||||||
|
}
|
||||||
|
int setDataSource(const char* pUrl, const CdxKeyedVectorT* pHeaders)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
POINT_CHECK_NULL(pUrl, -1);
|
||||||
|
return TPlayerSetDataSource(tplayer, pUrl, pHeaders);
|
||||||
|
}
|
||||||
|
int prepare()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerPrepare(tplayer);
|
||||||
|
}
|
||||||
|
int prepareAsync()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerPrepareAsync(tplayer);
|
||||||
|
}
|
||||||
|
int start()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerStart(tplayer);
|
||||||
|
}
|
||||||
|
int start(float gain)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerStartWithGain(tplayer, gain);
|
||||||
|
}
|
||||||
|
int stop()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerStop(tplayer);
|
||||||
|
}
|
||||||
|
int pause()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerPause(tplayer);
|
||||||
|
}
|
||||||
|
int reset()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerReset(tplayer);
|
||||||
|
}
|
||||||
|
int isPlaying()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -2);
|
||||||
|
return TPlayerIsPlaying(tplayer);
|
||||||
|
}
|
||||||
|
int seekTo(int msec)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
if(msec < 0) msec = 0;
|
||||||
|
return TPlayerSeekTo(tplayer, msec);
|
||||||
|
}
|
||||||
|
int getCurrentPosition(int* msec)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerGetCurrentPosition(tplayer, msec);
|
||||||
|
}
|
||||||
|
int getDuration(int* msec)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerGetDuration(tplayer, msec);
|
||||||
|
}
|
||||||
|
MediaInfo* getMediaInfo()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, NULL);
|
||||||
|
return TPlayerGetMediaInfo(tplayer);
|
||||||
|
}
|
||||||
|
int setLooping(int bLoop)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerSetLooping(tplayer, bLoop);
|
||||||
|
}
|
||||||
|
int setVolume(int volume)
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerSetVolume(tplayer, volume);
|
||||||
|
}
|
||||||
|
int getVolume()
|
||||||
|
{
|
||||||
|
POINT_CHECK_NULL(tplayer, -1);
|
||||||
|
return TPlayerGetVolume(tplayer);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
TPlayer *tplayer;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -10,7 +10,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -98,7 +98,8 @@ typedef enum{
|
||||||
// 非tts的audio播放
|
// 非tts的audio播放
|
||||||
#define STOP_ERR_TYR_TIMES 3
|
#define STOP_ERR_TYR_TIMES 3
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TinaPlayer *nTinaplayer;
|
//TinaPlayer *nTinaplayer;
|
||||||
|
LuPlayer *nTinaplayer;
|
||||||
volatile PlayerStatus nStatus;
|
volatile PlayerStatus nStatus;
|
||||||
u8 nError;
|
u8 nError;
|
||||||
#if LOCK_ENABLE
|
#if LOCK_ENABLE
|
||||||
|
@ -791,20 +792,23 @@ static void audioPlayerPlayThreadFun(void){
|
||||||
|
|
||||||
RETURNED VALUES: void
|
RETURNED VALUES: void
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
//static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
||||||
|
static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
||||||
{
|
{
|
||||||
AudioPlayer* mAudioPlayer = (AudioPlayer*)pUserData;
|
AudioPlayer* mAudioPlayer = (AudioPlayer*)pUserData;
|
||||||
|
|
||||||
//LOG_EX(LOG_Debug, "callbackForTinaPlayer:%d\n", msg);
|
//LOG_EX(LOG_Debug, "callbackForTinaPlayer:%d\n", msg);
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
case TINA_NOTIFY_NOT_SEEKABLE:
|
//case TINA_NOTIFY_NOT_SEEKABLE:
|
||||||
|
case TPLAYER_NOTIFY_NOT_SEEKABLE:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_NOT_SEEKABLE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_NOT_SEEKABLE\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_ERROR:
|
//case TINA_NOTIFY_ERROR:
|
||||||
|
case TPLAYER_NOTIFY_MEDIA_ERROR:
|
||||||
{
|
{
|
||||||
PlayerStatus audioSt;
|
PlayerStatus audioSt;
|
||||||
if(param0 == NOTIFY_ERROR_TYPE_IO)
|
if(param0 == NOTIFY_ERROR_TYPE_IO)
|
||||||
|
@ -832,7 +836,8 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_PREPARED:
|
//case TINA_NOTIFY_PREPARED:
|
||||||
|
case TPLAYER_NOTIFY_PREPARED:
|
||||||
{
|
{
|
||||||
#if LOCK_ENABLE
|
#if LOCK_ENABLE
|
||||||
pthread_mutex_lock(&mAudioPlayer->nMutex);
|
pthread_mutex_lock(&mAudioPlayer->nMutex);
|
||||||
|
@ -850,7 +855,7 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
pthread_mutex_unlock(&mutexPlay);
|
pthread_mutex_unlock(&mutexPlay);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case TINA_NOTIFY_BUFFERRING_UPDATE:
|
case TINA_NOTIFY_BUFFERRING_UPDATE:
|
||||||
{
|
{
|
||||||
int nBufferedFilePos;
|
int nBufferedFilePos;
|
||||||
|
@ -861,9 +866,10 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_BUFFERRING_UPDATE: buffer %d percent of the media file, buffer fullness = %d percent.\n",
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_BUFFERRING_UPDATE: buffer %d percent of the media file, buffer fullness = %d percent.\n",
|
||||||
nBufferedFilePos, nBufferFullness);
|
nBufferedFilePos, nBufferFullness);
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
case TINA_NOTIFY_PLAYBACK_COMPLETE:
|
//case TINA_NOTIFY_PLAYBACK_COMPLETE:
|
||||||
|
case TPLAYER_NOTIFY_PLAYBACK_COMPLETE:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_PLAYBACK_COMPLETE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_PLAYBACK_COMPLETE\n");
|
||||||
#if LOCK_ENABLE
|
#if LOCK_ENABLE
|
||||||
|
@ -877,7 +883,8 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_SEEK_COMPLETE:
|
//case TINA_NOTIFY_SEEK_COMPLETE:
|
||||||
|
case TPLAYER_NOTIFY_SEEK_COMPLETE:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
||||||
break;
|
break;
|
||||||
|
@ -892,7 +899,7 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -920,7 +927,8 @@ bool audioPlayerInit(AudioPlayerCallback callback){
|
||||||
#if LOCK_ENABLE
|
#if LOCK_ENABLE
|
||||||
pthread_mutex_init(&mAudioPlayer.nMutex, NULL);
|
pthread_mutex_init(&mAudioPlayer.nMutex, NULL);
|
||||||
#endif
|
#endif
|
||||||
mAudioPlayer.nTinaplayer = new TinaPlayer();
|
//mAudioPlayer.nTinaplayer = new TinaPlayer();
|
||||||
|
mAudioPlayer.nTinaplayer = new LuPlayer();
|
||||||
|
|
||||||
if(NULL == mAudioPlayer.nTinaplayer){
|
if(NULL == mAudioPlayer.nTinaplayer){
|
||||||
LOG_EX(LOG_Error, "can not create tinaplayer, quit.\n");
|
LOG_EX(LOG_Error, "can not create tinaplayer, quit.\n");
|
||||||
|
@ -935,12 +943,12 @@ bool audioPlayerInit(AudioPlayerCallback callback){
|
||||||
goto ErrRet;
|
goto ErrRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(mAudioPlayer.nTinaplayer->initCheck() != 0){
|
if(mAudioPlayer.nTinaplayer->initCheck() != 0){
|
||||||
LOG_EX(LOG_Error, "initCheck of tinaplayer fail, quit.\n");
|
LOG_EX(LOG_Error, "initCheck of tinaplayer fail, quit.\n");
|
||||||
notifyCallback(0, AUDIO_ST_ERR);
|
notifyCallback(0, AUDIO_ST_ERR);
|
||||||
goto ErrRet;
|
goto ErrRet;
|
||||||
}
|
}*/
|
||||||
mAudioPlayer.nStatus = AUDIO_ST_IDLE;
|
mAudioPlayer.nStatus = AUDIO_ST_IDLE;
|
||||||
LOG_EX(LOG_Debug, "mAudioPlayer Create successfully.\n");
|
LOG_EX(LOG_Debug, "mAudioPlayer Create successfully.\n");
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ typedef enum
|
||||||
} BackGrondIndex;
|
} BackGrondIndex;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TinaPlayer *nTinaplayer[BG_TINA_PLAYER_NUM];
|
//TinaPlayer *nTinaplayer[BG_TINA_PLAYER_NUM];
|
||||||
|
LuPlayer *nTinaplayer[BG_TINA_PLAYER_NUM];
|
||||||
BackGrondIndex Index;
|
BackGrondIndex Index;
|
||||||
PlayerStatus nStatus[BG_TINA_PLAYER_NUM];
|
PlayerStatus nStatus[BG_TINA_PLAYER_NUM];
|
||||||
u8 nError;
|
u8 nError;
|
||||||
|
@ -46,7 +47,8 @@ static uint32 nonMusicPlayerId;
|
||||||
|
|
||||||
RETURNED VALUES: void
|
RETURNED VALUES: void
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
//static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
||||||
|
static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
||||||
{
|
{
|
||||||
BackGroundPlayer* mBackGroundPlayer = (BackGroundPlayer*)pUserData;
|
BackGroundPlayer* mBackGroundPlayer = (BackGroundPlayer*)pUserData;
|
||||||
|
|
||||||
|
@ -55,13 +57,15 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
//LOG_EX(LOG_Debug, "callbackForTinaPlayer:%d\n", msg);
|
//LOG_EX(LOG_Debug, "callbackForTinaPlayer:%d\n", msg);
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
case TINA_NOTIFY_NOT_SEEKABLE:
|
//case TINA_NOTIFY_NOT_SEEKABLE:
|
||||||
|
case TPLAYER_NOTIFY_NOT_SEEKABLE:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_NOT_SEEKABLE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_NOT_SEEKABLE\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_ERROR:
|
//case TINA_NOTIFY_ERROR:
|
||||||
|
case TPLAYER_NOTIFY_MEDIA_ERROR:
|
||||||
{
|
{
|
||||||
for(int i = 0; i < BG_TINA_PLAYER_NUM ; i++){
|
for(int i = 0; i < BG_TINA_PLAYER_NUM ; i++){
|
||||||
pthread_mutex_lock(&mBackGroundPlayer->nMutex[i]);
|
pthread_mutex_lock(&mBackGroundPlayer->nMutex[i]);
|
||||||
|
@ -74,7 +78,8 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_PREPARED:
|
//case TINA_NOTIFY_PREPARED:
|
||||||
|
case TPLAYER_NOTIFY_PREPARED:
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&mBackGroundPlayer->nMutex[mBackGroundPlayer->Index]);
|
pthread_mutex_lock(&mBackGroundPlayer->nMutex[mBackGroundPlayer->Index]);
|
||||||
mBackGroundPlayer->nStatus[mBackGroundPlayer->Index] = BG_ST_PREPARED;
|
mBackGroundPlayer->nStatus[mBackGroundPlayer->Index] = BG_ST_PREPARED;
|
||||||
|
@ -88,7 +93,7 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case TINA_NOTIFY_BUFFERRING_UPDATE:
|
case TINA_NOTIFY_BUFFERRING_UPDATE:
|
||||||
{
|
{
|
||||||
int nBufferedFilePos;
|
int nBufferedFilePos;
|
||||||
|
@ -100,9 +105,10 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
nBufferedFilePos, nBufferFullness);
|
nBufferedFilePos, nBufferFullness);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
case TINA_NOTIFY_PLAYBACK_COMPLETE:
|
//case TINA_NOTIFY_PLAYBACK_COMPLETE:
|
||||||
|
case TPLAYER_NOTIFY_PLAYBACK_COMPLETE:
|
||||||
{
|
{
|
||||||
//* stop the player.
|
//* stop the player.
|
||||||
//* TODO
|
//* TODO
|
||||||
|
@ -110,7 +116,8 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_SEEK_COMPLETE:
|
//case TINA_NOTIFY_SEEK_COMPLETE:
|
||||||
|
case TPLAYER_NOTIFY_SEEK_COMPLETE:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
||||||
|
|
||||||
|
@ -124,7 +131,7 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
FUNCTION NAME: soundEffectInit
|
FUNCTION NAME: soundEffectInit
|
||||||
|
@ -143,7 +150,8 @@ bool backGroundPlayerInit(bgPlayerCallback callback){
|
||||||
memset(&mBackGroundPlayer, 0, sizeof(BackGroundPlayer));
|
memset(&mBackGroundPlayer, 0, sizeof(BackGroundPlayer));
|
||||||
pthread_mutex_init(&mBackGroundPlayer.nMutex[0], NULL);
|
pthread_mutex_init(&mBackGroundPlayer.nMutex[0], NULL);
|
||||||
|
|
||||||
mBackGroundPlayer.nTinaplayer[0] = new TinaPlayer();
|
//mBackGroundPlayer.nTinaplayer[0] = new TinaPlayer();
|
||||||
|
mBackGroundPlayer.nTinaplayer[0] = new LuPlayer();
|
||||||
mBackGroundPlayer.Index = BG_TINA_PLAYER_1;
|
mBackGroundPlayer.Index = BG_TINA_PLAYER_1;
|
||||||
bgPlayerInited = true;
|
bgPlayerInited = true;
|
||||||
mBackGroundPlayer.needResetTinaplay[mBackGroundPlayer.Index] = FALSE;
|
mBackGroundPlayer.needResetTinaplay[mBackGroundPlayer.Index] = FALSE;
|
||||||
|
@ -161,12 +169,12 @@ bool backGroundPlayerInit(bgPlayerCallback callback){
|
||||||
goto ErrRet;
|
goto ErrRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(mBackGroundPlayer.nTinaplayer[0]->initCheck() != 0){
|
if(mBackGroundPlayer.nTinaplayer[0]->initCheck() != 0){
|
||||||
LOG_EX(LOG_Error, "initCheck of tinaplayer fail, quit.\n");
|
LOG_EX(LOG_Error, "initCheck of tinaplayer fail, quit.\n");
|
||||||
notifyCallback(0, PLAYER_ERR_TINA_INIT);
|
notifyCallback(0, PLAYER_ERR_TINA_INIT);
|
||||||
goto ErrRet;
|
goto ErrRet;
|
||||||
}
|
}*/
|
||||||
mBackGroundPlayer.nStatus[0] = BG_ST_IDLE;
|
mBackGroundPlayer.nStatus[0] = BG_ST_IDLE;
|
||||||
|
|
||||||
LOG_EX(LOG_Debug, "backGroundPlayerInit successfully.\n");
|
LOG_EX(LOG_Debug, "backGroundPlayerInit successfully.\n");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
|
|
@ -15,9 +15,10 @@
|
||||||
#ifndef __AUDIO_PLAYER_H__
|
#ifndef __AUDIO_PLAYER_H__
|
||||||
#define __AUDIO_PLAYER_H__
|
#define __AUDIO_PLAYER_H__
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
|
|
||||||
#include <allwinner/tinaplayer.h>
|
//#include <allwinner/tinaplayer.h>
|
||||||
|
#include <luplayer.h>
|
||||||
#include "alsa_interface.h"
|
#include "alsa_interface.h"
|
||||||
/*
|
/*
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|
|
@ -22,12 +22,13 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
||||||
#include <allwinner/tinaplayer.h>
|
//#include <allwinner/tinaplayer.h>
|
||||||
|
#include <luplayer.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <tina_log.h>
|
#include <tina_log.h>
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
|
|
||||||
using namespace aw;
|
using namespace aw;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -24,12 +24,14 @@
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <allwinner/tinaplayer.h>
|
//#include <allwinner/tinaplayer.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <tina_log.h>
|
#include <tina_log.h>
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
|
|
||||||
|
#include "luplayer.h"
|
||||||
|
|
||||||
using namespace aw;
|
using namespace aw;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#ifndef __PCM_PLAYER_H__
|
#ifndef __PCM_PLAYER_H__
|
||||||
#define __PCM_PLAYER_H__
|
#define __PCM_PLAYER_H__
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
#include "alsa_interface.h"
|
#include "alsa_interface.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
|
|
||||||
|
|
4
package/netease/ihw_player/src/libplayer/include/player.h → package/netease/ihw_player/src/libplayer/include/playerapi.h
Normal file → Executable file
4
package/netease/ihw_player/src/libplayer/include/player.h → package/netease/ihw_player/src/libplayer/include/playerapi.h
Normal file → Executable file
|
@ -293,8 +293,8 @@ typedef struct{
|
||||||
#define DBUS_UV_MSG
|
#define DBUS_UV_MSG
|
||||||
|
|
||||||
#ifdef CALLBACK_MSG
|
#ifdef CALLBACK_MSG
|
||||||
typedef void (* PlayerCallback)(uint32, PlayerStatus, char *, int);
|
typedef void (* IhwPlayerCallback)(uint32, PlayerStatus, char *, int);
|
||||||
bool playerInit(PlayerCallback);
|
bool playerInit(IhwPlayerCallback);
|
||||||
#else
|
#else
|
||||||
bool playerInit(void);
|
bool playerInit(void);
|
||||||
#endif
|
#endif
|
|
@ -23,12 +23,13 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
||||||
#include <allwinner/tinaplayer.h>
|
//#include <allwinner/tinaplayer.h>
|
||||||
|
#include <luplayer.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <tina_log.h>
|
#include <tina_log.h>
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
|
|
||||||
using namespace aw;
|
using namespace aw;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "musicplayer.h"
|
#include "musicplayer.h"
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
|
|
||||||
#define NET_PLAYER_DEBUG
|
#define NET_PLAYER_DEBUG
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ TinaPlayerPrepareSt tinaPlayerPrepareSt = MUSIC_TINA_NOTIFY_NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TinaPlayer *nTinaplayer[MUSIC_TINA_PALYER_NUM];
|
//TinaPlayer *nTinaplayer[MUSIC_TINA_PALYER_NUM];
|
||||||
|
LuPlayer *nTinaplayer[MUSIC_TINA_PALYER_NUM];
|
||||||
MusicPlayerIndex nPlayerIndex;
|
MusicPlayerIndex nPlayerIndex;
|
||||||
u8 nPreStatus[MUSIC_TINA_PALYER_NUM];
|
u8 nPreStatus[MUSIC_TINA_PALYER_NUM];
|
||||||
PlayerStatus nStatus[MUSIC_TINA_PALYER_NUM];
|
PlayerStatus nStatus[MUSIC_TINA_PALYER_NUM];
|
||||||
|
@ -560,7 +561,8 @@ static void threadMainFun(void){
|
||||||
|
|
||||||
RETURNED VALUES: void
|
RETURNED VALUES: void
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
//static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
||||||
|
static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
||||||
{
|
{
|
||||||
MusicPlayer* pMusicPlayer = (MusicPlayer*)pUserData;
|
MusicPlayer* pMusicPlayer = (MusicPlayer*)pUserData;
|
||||||
|
|
||||||
|
@ -570,14 +572,16 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
|
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
case TINA_NOTIFY_NOT_SEEKABLE:
|
//case TINA_NOTIFY_NOT_SEEKABLE:
|
||||||
|
case TPLAYER_NOTIFY_NOT_SEEKABLE:
|
||||||
{
|
{
|
||||||
pMusicPlayer->nSeekable = 0;
|
pMusicPlayer->nSeekable = 0;
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_NOT_SEEKABLE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_NOT_SEEKABLE\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_ERROR:
|
//case TINA_NOTIFY_ERROR:
|
||||||
|
case TPLAYER_NOTIFY_MEDIA_ERROR:
|
||||||
{
|
{
|
||||||
for(int i = 0; i < MUSIC_TINA_PALYER_NUM ; i++){
|
for(int i = 0; i < MUSIC_TINA_PALYER_NUM ; i++){
|
||||||
pthread_mutex_lock(&pMusicPlayer->nMutex[i]);
|
pthread_mutex_lock(&pMusicPlayer->nMutex[i]);
|
||||||
|
@ -592,7 +596,8 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_PREPARED:
|
//case TINA_NOTIFY_PREPARED:
|
||||||
|
case TPLAYER_NOTIFY_PREPARED:
|
||||||
{
|
{
|
||||||
MusicPlayerIndex musicPlayerindex;
|
MusicPlayerIndex musicPlayerindex;
|
||||||
bool isPrepareNext = false;
|
bool isPrepareNext = false;
|
||||||
|
@ -635,7 +640,7 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case TINA_NOTIFY_BUFFERRING_UPDATE:
|
case TINA_NOTIFY_BUFFERRING_UPDATE:
|
||||||
{
|
{
|
||||||
int nBufferedFilePos;
|
int nBufferedFilePos;
|
||||||
|
@ -647,9 +652,10 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
nBufferedFilePos, nBufferFullness);
|
nBufferedFilePos, nBufferFullness);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
case TINA_NOTIFY_PLAYBACK_COMPLETE:
|
//case TINA_NOTIFY_PLAYBACK_COMPLETE:
|
||||||
|
case TPLAYER_NOTIFY_PLAYBACK_COMPLETE:
|
||||||
{
|
{
|
||||||
//* stop the player.
|
//* stop the player.
|
||||||
//* TODO
|
//* TODO
|
||||||
|
@ -677,17 +683,20 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_SEEK_COMPLETE:
|
//case TINA_NOTIFY_SEEK_COMPLETE:
|
||||||
|
case TPLAYER_NOTIFY_SEEK_COMPLETE:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TINA_NOTIFY_BUFFER_START:
|
//case TINA_NOTIFY_BUFFER_START:
|
||||||
|
case TPLAYER_NOTIFY_BUFFER_START:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_BUFFER_START\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_BUFFER_START\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TINA_NOTIFY_BUFFER_END:
|
//case TINA_NOTIFY_BUFFER_END:
|
||||||
|
case TPLAYER_NOTIFY_BUFFER_END:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_BUFFER_END\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_BUFFER_END\n");
|
||||||
break;
|
break;
|
||||||
|
@ -700,7 +709,7 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -754,8 +763,10 @@ bool musicPlayerInit(MusicPlayerCallback callback){
|
||||||
memset(&musicplayer, 0, sizeof(MusicPlayer));
|
memset(&musicplayer, 0, sizeof(MusicPlayer));
|
||||||
pthread_mutex_init(&musicplayer.nMutex[0], NULL);
|
pthread_mutex_init(&musicplayer.nMutex[0], NULL);
|
||||||
pthread_mutex_init(&musicplayer.nMutex[1], NULL);
|
pthread_mutex_init(&musicplayer.nMutex[1], NULL);
|
||||||
musicplayer.nTinaplayer[0] = new TinaPlayer();
|
//musicplayer.nTinaplayer[0] = new TinaPlayer();
|
||||||
musicplayer.nTinaplayer[1] = new TinaPlayer();
|
//musicplayer.nTinaplayer[1] = new TinaPlayer();
|
||||||
|
musicplayer.nTinaplayer[0] = new LuPlayer();
|
||||||
|
musicplayer.nTinaplayer[1] = new LuPlayer();
|
||||||
musicplayer.needResetTinaplay[0] = false;
|
musicplayer.needResetTinaplay[0] = false;
|
||||||
musicplayer.needResetTinaplay[1] = false;
|
musicplayer.needResetTinaplay[1] = false;
|
||||||
|
|
||||||
|
@ -776,11 +787,11 @@ bool musicPlayerInit(MusicPlayerCallback callback){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(musicplayer.nTinaplayer[0]->initCheck() != 0 || musicplayer.nTinaplayer[1]->initCheck() != 0){
|
/*if(musicplayer.nTinaplayer[0]->initCheck() != 0 || musicplayer.nTinaplayer[1]->initCheck() != 0){
|
||||||
LOG_EX(LOG_Error, "initCheck of tinaplayer fail, quit.\n");
|
LOG_EX(LOG_Error, "initCheck of tinaplayer fail, quit.\n");
|
||||||
notifyCallback(0, PLAYER_ERR_TINA_INIT);
|
notifyCallback(0, PLAYER_ERR_TINA_INIT);
|
||||||
goto ErrRet;
|
goto ErrRet;
|
||||||
}
|
}*/
|
||||||
musicplayer.nStatus[0] = MUSIC_ST_IDLE;
|
musicplayer.nStatus[0] = MUSIC_ST_IDLE;
|
||||||
musicplayer.nStatus[1] = MUSIC_ST_IDLE;
|
musicplayer.nStatus[1] = MUSIC_ST_IDLE;
|
||||||
|
|
||||||
|
|
6
package/netease/ihw_player/src/libplayer/player.cpp → package/netease/ihw_player/src/libplayer/playerapi.cpp
Normal file → Executable file
6
package/netease/ihw_player/src/libplayer/player.cpp → package/netease/ihw_player/src/libplayer/playerapi.cpp
Normal file → Executable file
|
@ -14,7 +14,7 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "player.h"
|
#include "playerapi.h"
|
||||||
#include "musicplayer.h"
|
#include "musicplayer.h"
|
||||||
#include "dlist.h"
|
#include "dlist.h"
|
||||||
#include "audioplayer.h"
|
#include "audioplayer.h"
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
#define TIMER_UINT 1
|
#define TIMER_UINT 1
|
||||||
|
|
||||||
#ifdef CALLBACK_MSG
|
#ifdef CALLBACK_MSG
|
||||||
PlayerCallback playerCallback;
|
IhwPlayerCallback playerCallback;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SEPlayerStateCallback seplayerStateCb;
|
static SEPlayerStateCallback seplayerStateCb;
|
||||||
|
@ -861,7 +861,7 @@ bool uvTimerInit(uv_loop_t *loop){
|
||||||
|
|
||||||
RETURNED VALUES: bool of init status
|
RETURNED VALUES: bool of init status
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
bool playerInit(PlayerCallback callback){
|
bool playerInit(IhwPlayerCallback callback){
|
||||||
playerCallback = callback;
|
playerCallback = callback;
|
||||||
return playerInitInter();
|
return playerInitInter();
|
||||||
}
|
}
|
|
@ -19,7 +19,8 @@ typedef enum
|
||||||
} SoundEffectIndex;
|
} SoundEffectIndex;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TinaPlayer *nTinaplayer[SE_TINA_PALYER_NUM];
|
//TinaPlayer *nTinaplayer[SE_TINA_PALYER_NUM];
|
||||||
|
LuPlayer *nTinaplayer[SE_TINA_PALYER_NUM];
|
||||||
SoundEffectIndex Index;
|
SoundEffectIndex Index;
|
||||||
volatile PlayerStatus nStatus[SE_TINA_PALYER_NUM];
|
volatile PlayerStatus nStatus[SE_TINA_PALYER_NUM];
|
||||||
u8 nError;
|
u8 nError;
|
||||||
|
@ -53,7 +54,7 @@ static char *sourceRec = NULL;
|
||||||
|
|
||||||
RETURNED VALUES: void
|
RETURNED VALUES: void
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
static int callbackForTinaPlayer(void* pUserData, int msg, int param0, void* param1)
|
||||||
{
|
{
|
||||||
SoundEffect* mSEplayer = (SoundEffect*)pUserData;
|
SoundEffect* mSEplayer = (SoundEffect*)pUserData;
|
||||||
|
|
||||||
|
@ -63,13 +64,15 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
|
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
case TINA_NOTIFY_NOT_SEEKABLE:
|
//case TINA_NOTIFY_NOT_SEEKABLE:
|
||||||
|
case TPLAYER_NOTIFY_NOT_SEEKABLE:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_NOT_SEEKABLE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_NOT_SEEKABLE\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_ERROR:
|
//case TINA_NOTIFY_ERROR:
|
||||||
|
case TPLAYER_NOTIFY_MEDIA_ERROR:
|
||||||
{
|
{
|
||||||
for(int i = 0; i < SE_TINA_PALYER_NUM ; i++){
|
for(int i = 0; i < SE_TINA_PALYER_NUM ; i++){
|
||||||
#if LOCK_ENABLE
|
#if LOCK_ENABLE
|
||||||
|
@ -91,7 +94,8 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_PREPARED:
|
//case TINA_NOTIFY_PREPARED:
|
||||||
|
case TPLAYER_NOTIFY_PREPARED:
|
||||||
{
|
{
|
||||||
#if LOCK_ENABLE
|
#if LOCK_ENABLE
|
||||||
pthread_mutex_lock(&mSEplayer->nMutex[mSEplayer->Index]);
|
pthread_mutex_lock(&mSEplayer->nMutex[mSEplayer->Index]);
|
||||||
|
@ -111,7 +115,7 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
pthread_mutex_unlock(&mutexWaitPrepared);
|
pthread_mutex_unlock(&mutexWaitPrepared);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case TINA_NOTIFY_BUFFERRING_UPDATE:
|
case TINA_NOTIFY_BUFFERRING_UPDATE:
|
||||||
{
|
{
|
||||||
int nBufferedFilePos;
|
int nBufferedFilePos;
|
||||||
|
@ -123,9 +127,10 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
nBufferedFilePos, nBufferFullness);
|
nBufferedFilePos, nBufferFullness);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
case TINA_NOTIFY_PLAYBACK_COMPLETE:
|
//case TINA_NOTIFY_PLAYBACK_COMPLETE:
|
||||||
|
case TPLAYER_NOTIFY_PLAYBACK_COMPLETE:
|
||||||
{
|
{
|
||||||
//* stop the player.
|
//* stop the player.
|
||||||
//* TODO
|
//* TODO
|
||||||
|
@ -141,7 +146,8 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TINA_NOTIFY_SEEK_COMPLETE:
|
//case TINA_NOTIFY_SEEK_COMPLETE:
|
||||||
|
case TPLAYER_NOTIFY_SEEK_COMPLETE:
|
||||||
{
|
{
|
||||||
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
LOG_EX(LOG_Debug, "TINA_NOTIFY_SEEK_COMPLETE\n");
|
||||||
break;
|
break;
|
||||||
|
@ -154,7 +160,7 @@ static void callbackForTinaPlayer(void* pUserData, int msg, int param0, void* pa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
FUNCTION NAME: soundEffectInit
|
FUNCTION NAME: soundEffectInit
|
||||||
|
@ -175,7 +181,8 @@ bool soundEffectInit(SEPlayerCallback callback){
|
||||||
pthread_mutex_init(&mSEplayer.nMutex[0], NULL);
|
pthread_mutex_init(&mSEplayer.nMutex[0], NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mSEplayer.nTinaplayer[0] = new TinaPlayer();
|
//mSEplayer.nTinaplayer[0] = new TinaPlayer();
|
||||||
|
mSEplayer.nTinaplayer[0] = new LuPlayer();
|
||||||
mSEplayer.Index = SE_TINA_PLAYER_1;
|
mSEplayer.Index = SE_TINA_PLAYER_1;
|
||||||
sePlayerInited = true;
|
sePlayerInited = true;
|
||||||
mSEplayer.needResetTinaplay[mSEplayer.Index] = FALSE;
|
mSEplayer.needResetTinaplay[mSEplayer.Index] = FALSE;
|
||||||
|
@ -193,12 +200,12 @@ bool soundEffectInit(SEPlayerCallback callback){
|
||||||
goto ErrRet;
|
goto ErrRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(mSEplayer.nTinaplayer[0]->initCheck() != 0){
|
if(mSEplayer.nTinaplayer[0]->initCheck() != 0){
|
||||||
LOG_EX(LOG_Error, "initCheck of tinaplayer fail, quit.\n");
|
LOG_EX(LOG_Error, "initCheck of tinaplayer fail, quit.\n");
|
||||||
notifyCallback(0, PLAYER_ERR_TINA_INIT);
|
notifyCallback(0, PLAYER_ERR_TINA_INIT);
|
||||||
goto ErrRet;
|
goto ErrRet;
|
||||||
}
|
}*/
|
||||||
mSEplayer.nStatus[0] = SE_ST_IDLE;
|
mSEplayer.nStatus[0] = SE_ST_IDLE;
|
||||||
|
|
||||||
LOG_EX(LOG_Debug, "mSEplayerCreate successfully.\n");
|
LOG_EX(LOG_Debug, "mSEplayerCreate successfully.\n");
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <musicplayer.h>
|
#include <musicplayer.h>
|
||||||
#include <player.h>
|
#include <playerapi.h>
|
||||||
#include <audioplayer.h>
|
#include <audioplayer.h>
|
||||||
|
|
||||||
#define AUDIO_MP3_URL "/mnt/SDCARD/netplay/audio/audio.mp3"
|
#define AUDIO_MP3_URL "/mnt/SDCARD/netplay/audio/audio.mp3"
|
||||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
||||||
//__FUNCTION__, __LINE__))
|
//__FUNCTION__, __LINE__))
|
||||||
|
|
||||||
#define USED_NETEASE_AI (1) // netease MSC library
|
#define USED_NETEASE_AI (1) // netease MSC library
|
||||||
#define USED_NETEASE_DC (1) // netease data collection library
|
#define USED_NETEASE_DC (0) // netease data collection library
|
||||||
#define USED_NETEASE_FMAE (0) // netease CAE library
|
#define USED_NETEASE_FMAE (0) // netease CAE library
|
||||||
#define USED_NETEASE_DUILITE (1)
|
#define USED_NETEASE_DUILITE (1)
|
||||||
#define USED_NETEASE_DUILITE_VAD (1)
|
#define USED_NETEASE_DUILITE_VAD (1)
|
||||||
|
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
bootdelay=0
|
bootdelay=3
|
||||||
#default bootcmd, will change at runtime according to key press
|
#default bootcmd, will change at runtime according to key press
|
||||||
bootcmd=run setargs_nand boot_normal#default nand boot
|
bootcmd=run setargs_nand boot_normal#default nand boot
|
||||||
#kernel command arguments
|
#kernel command arguments
|
||||||
|
@ -8,7 +8,7 @@ nand_root=/dev/nandd
|
||||||
mmc_root=/dev/mmcblk0p7
|
mmc_root=/dev/mmcblk0p7
|
||||||
root_partition=rootfs
|
root_partition=rootfs
|
||||||
init=/sbin/init
|
init=/sbin/init
|
||||||
loglevel=8
|
loglevel=0
|
||||||
boot_partition=boot
|
boot_partition=boot
|
||||||
cma=64M
|
cma=64M
|
||||||
|
|
||||||
|
@ -32,3 +32,9 @@ recovery_key_value_min=0x10
|
||||||
#fastboot key
|
#fastboot key
|
||||||
fastboot_key_value_max=0x8
|
fastboot_key_value_max=0x8
|
||||||
fastboot_key_value_min=0x2
|
fastboot_key_value_min=0x2
|
||||||
|
#ota cmd
|
||||||
|
boot_cache=0x40007800
|
||||||
|
rootfs_cache=0x40407800
|
||||||
|
loadkernel=ext4load sunxi_flash 0:0 ${boot_cache} ota/boot.img
|
||||||
|
loadrootfs=ext4load sunxi_flash 0:0 ${rootfs_cache} ota/rootfs.img
|
||||||
|
|
||||||
|
|
|
@ -58,14 +58,13 @@ size = 512
|
||||||
user_type = 0x8000
|
user_type = 0x8000
|
||||||
|
|
||||||
[partition]
|
[partition]
|
||||||
name = rootfs_data
|
name = rootfs_data
|
||||||
;size = 61440
|
|
||||||
size = 8192
|
size = 8192
|
||||||
user_type = 0x8000
|
user_type = 0x8000
|
||||||
|
|
||||||
[partition]
|
[partition]
|
||||||
name = private
|
name = ota_info
|
||||||
size = 1024
|
size = 512
|
||||||
user_type = 0x8000
|
user_type = 0x8000
|
||||||
|
|
||||||
; recovery分区说明
|
; recovery分区说明
|
||||||
|
|
|
@ -137,8 +137,7 @@ CONFIG_KERNEL_KALLSYMS=y
|
||||||
# CONFIG_KERNEL_FANOTIFY is not set
|
# CONFIG_KERNEL_FANOTIFY is not set
|
||||||
# CONFIG_KERNEL_BLK_DEV_BSG is not set
|
# CONFIG_KERNEL_BLK_DEV_BSG is not set
|
||||||
CONFIG_KERNEL_MAGIC_SYSRQ=y
|
CONFIG_KERNEL_MAGIC_SYSRQ=y
|
||||||
CONFIG_KERNEL_COREDUMP=y
|
# CONFIG_KERNEL_ELF_CORE is not set
|
||||||
CONFIG_KERNEL_ELF_CORE=y
|
|
||||||
# CONFIG_KERNEL_PROVE_LOCKING is not set
|
# CONFIG_KERNEL_PROVE_LOCKING is not set
|
||||||
CONFIG_KERNEL_PRINTK_TIME=y
|
CONFIG_KERNEL_PRINTK_TIME=y
|
||||||
# CONFIG_KERNEL_SLABINFO is not set
|
# CONFIG_KERNEL_SLABINFO is not set
|
||||||
|
@ -1529,7 +1528,7 @@ CONFIG_PACKAGE_wifimanager-smartaudio=y
|
||||||
# CONFIG_PACKAGE_zlib-dev is not set
|
# CONFIG_PACKAGE_zlib-dev is not set
|
||||||
# CONFIG_PACKAGE_ar is not set
|
# CONFIG_PACKAGE_ar is not set
|
||||||
# CONFIG_PACKAGE_binutils is not set
|
# CONFIG_PACKAGE_binutils is not set
|
||||||
# CONFIG_PACKAGE_cppunit is not set
|
CONFIG_PACKAGE_cppunit=y
|
||||||
# CONFIG_PACKAGE_gdb is not set
|
# CONFIG_PACKAGE_gdb is not set
|
||||||
# CONFIG_PACKAGE_gdbserver is not set
|
# CONFIG_PACKAGE_gdbserver is not set
|
||||||
# CONFIG_PACKAGE_objdump is not set
|
# CONFIG_PACKAGE_objdump is not set
|
||||||
|
@ -2552,7 +2551,7 @@ CONFIG_PACKAGE_libs2json=y
|
||||||
# CONFIG_PACKAGE_libsocks is not set
|
# CONFIG_PACKAGE_libsocks is not set
|
||||||
# CONFIG_PACKAGE_libsodium is not set
|
# CONFIG_PACKAGE_libsodium is not set
|
||||||
# CONFIG_PACKAGE_libsoxr is not set
|
# CONFIG_PACKAGE_libsoxr is not set
|
||||||
# CONFIG_PACKAGE_libspeech is not set
|
CONFIG_PACKAGE_libspeech=y
|
||||||
CONFIG_PACKAGE_libspeex=y
|
CONFIG_PACKAGE_libspeex=y
|
||||||
# CONFIG_PACKAGE_libspeexdsp is not set
|
# CONFIG_PACKAGE_libspeexdsp is not set
|
||||||
# CONFIG_PACKAGE_libtalloc is not set
|
# CONFIG_PACKAGE_libtalloc is not set
|
||||||
|
@ -2821,7 +2820,14 @@ CONFIG_PACKAGE_SPlayer-demo=y
|
||||||
# CONFIG_PACKAGE_config_server is not set
|
# CONFIG_PACKAGE_config_server is not set
|
||||||
# CONFIG_PACKAGE_factoryTest is not set
|
# CONFIG_PACKAGE_factoryTest is not set
|
||||||
# CONFIG_PACKAGE_golangtest is not set
|
# CONFIG_PACKAGE_golangtest is not set
|
||||||
# CONFIG_PACKAGE_ihwplayer is not set
|
CONFIG_PACKAGE_ihwplayer=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# ttsText Mode Select
|
||||||
|
#
|
||||||
|
# CONFIG_TTS_TEXT_XUNFEI is not set
|
||||||
|
# CONFIG_TTS_TEXT_ROKID is not set
|
||||||
|
CONFIG_TTS_TEXT_NIL=y
|
||||||
CONFIG_PACKAGE_libuvdbus=y
|
CONFIG_PACKAGE_libuvdbus=y
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -2845,8 +2851,8 @@ CONFIG_XUNFEI_CAE_SDK=y
|
||||||
CONFIG_NETEASE_DUILITE_SDK=y
|
CONFIG_NETEASE_DUILITE_SDK=y
|
||||||
# CONFIG_NETEASE_TTS_SDK is not set
|
# CONFIG_NETEASE_TTS_SDK is not set
|
||||||
CONFIG_XUNFEI_TTS_SDK=y
|
CONFIG_XUNFEI_TTS_SDK=y
|
||||||
# CONFIG_USED_NONE is not set
|
CONFIG_USED_NONE=y
|
||||||
CONFIG_USED_DC_SDK=y
|
# CONFIG_USED_DC_SDK is not set
|
||||||
CONFIG_PACKAGE_ntes_record=y
|
CONFIG_PACKAGE_ntes_record=y
|
||||||
# CONFIG_PACKAGE_ota is not set
|
# CONFIG_PACKAGE_ota is not set
|
||||||
# CONFIG_PACKAGE_pv1res is not set
|
# CONFIG_PACKAGE_pv1res is not set
|
||||||
|
|
Loading…
Reference in New Issue