资源简介
HI35xx平台MPEG解码实例源码是一个样例,演示了如何使用HIMPP提供的API进行MPEG视频解码的程序设计。
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “sample_comm.h“
#define hidebug(mesg args...) fprintf(stderr “[HiSample print:%s:%d:] “ mesg “\n“ __FILE__ __LINE__ ##args)
/*
**函数描述:linux标准信号捕捉函数
**函数功用:退出HIMPP调用,销毁缓冲
*/
HI_VOID SAMPLE_VDEC_HandleSig(HI_S32 signo)
{
HI_S32 i;
if (SIGINT == signo || SIGTSTP == signo || SIGTERM == signo)
{
HI_MPI_SYS_Exit();
for(i=0;i {
HI_MPI_VB_ExitModCommPool(i);
}
for(i=0; i {
HI_MPI_VB_DestroyPool(i);
}
HI_MPI_VB_Exit();
printf(“\033[0;31mprogram exit abnormally!\033[0;39m\n“);
}
exit(0);
}
/*
**函数描述:用于音视频文件读写推流
**函数功用:用fread等文件操作函数读取音视频文件,并解析后推送HIMPP进行解码
*/
int SAMPLE_COMM_VDEC_JPEG_SendStream( VdecThreadParam *pArgs)
{
VdecThreadParam *pstVdecThreadParam =pArgs;
FILE *fpStrm=NULL;
HI_U8 *pu8Buf = NULL;
VDEC_STREAM_S stStream;
HI_BOOL bFindStart bFindEnd;
HI_S32 s32Ret i start = 0;
HI_S32 s32UsedBytes = 0 s32ReadLen = 0;
HI_U64 u64pts = 0;
HI_S32 len;
HI_BOOL sHasReadStream = HI_FALSE;
// prctl(PR_SET_NAME “hi_SendStream“ 0 0 0);
if(pstVdecThreadParam->cFileName != 0)//打开文件
{
fpStrm = fopen(pstVdecThreadParam->cFileName “rb“);
if(fpStrm == NULL)
{
printf(“SAMPLE_TEST:can‘t open file %s in send stream thread:%d\n“pstVdecThreadParam->cFileName pstVdecThreadParam->s32ChnId);
return HI_FAILURE;
}
}
//printf(“SAMPLE_TEST:chn %d stream file:%s bufsize: %d\n“
//pstVdecThreadParam->s32ChnId pstVdecThreadParam->cFileName pstVdecThreadParam->s32MinBufSize);
pu8Buf = malloc(pstVdecThreadParam->s32MinBufSize);//开辟缓冲区
if(pu8Buf == NULL)
{
printf(“SAMPLE_TEST:can‘t alloc %d in send stream thread:%d\n“ pstVdecThreadParam->s32MinBufSize pstVdecThreadParam->s32ChnId);
fclose(fpStrm);
return HI_FAILURE;
}
fflush(stdout);
u64pts = pstVdecThreadParam->u64PtsInit;
while (1)
{
if (pstVdecThreadParam->eCtrlSinal == VDEC_CTRL_STOP)
{
break;
}
else if (pstVdecThreadParam->eCtrlSinal == VDEC_CTRL_PAUSE)
{
sleep(MIN2(pstVdecThreadParam->s32IntervalTime1000));
continue;
}
if ( (pstVdecThreadParam->s32StreamMode==VIDEO_MODE_frame) && (pstVdecThreadParam->enType == PT_MP4VIDEO) )
{
bFindStart = HI_FALSE;
bFindEnd = HI_FALSE;
fseek(fpStrm s32UsedBytes SEEK_SET);
s32ReadLen = fread(pu8Buf 1 pstVdecThreadParam->s32MinBufSize fpStrm);//读取文件
if (s32ReadLen == 0)
{
if (pstVdecThreadParam->bLoopSend)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8341 2017-11-24 14:12 mpeg\include\aacdec.h
文件 5967 2017-11-24 14:12 mpeg\include\aacenc.h
文件 13788 2017-11-24 14:12 mpeg\include\hifb.h
文件 9268 2017-11-24 14:12 mpeg\include\hi_common.h
文件 5463 2017-11-24 14:12 mpeg\include\hi_comm_adec.h
文件 4876 2017-11-24 14:12 mpeg\include\hi_comm_aenc.h
文件 879 2017-11-24 14:12 mpeg\include\hi_comm_ai.h
文件 22042 2017-11-24 14:12 mpeg\include\hi_comm_aio.h
文件 881 2017-11-24 14:12 mpeg\include\hi_comm_ao.h
文件 56331 2017-11-24 14:12 mpeg\include\hi_comm_hdmi.h
文件 13734 2017-11-24 14:12 mpeg\include\hi_comm_ive.h
文件 9316 2017-11-24 14:12 mpeg\include\hi_comm_pciv.h
文件 15289 2017-11-24 14:12 mpeg\include\hi_comm_rc.h
文件 10019 2017-11-24 14:12 mpeg\include\hi_comm_region.h
文件 3934 2017-11-24 14:12 mpeg\include\hi_comm_sys.h
文件 3891 2017-11-24 14:12 mpeg\include\hi_comm_vb.h
文件 9675 2017-11-24 14:12 mpeg\include\hi_comm_vda.h
文件 9631 2017-11-24 14:12 mpeg\include\hi_comm_vdec.h
文件 33488 2017-11-24 14:12 mpeg\include\hi_comm_venc.h
文件 4905 2017-11-24 14:12 mpeg\include\hi_comm_vgs.h
文件 21043 2017-11-24 14:12 mpeg\include\hi_comm_vi.h
文件 9743 2017-11-24 14:12 mpeg\include\hi_comm_video.h
文件 22985 2017-11-24 14:12 mpeg\include\hi_comm_vo.h
文件 7384 2017-11-24 14:12 mpeg\include\hi_comm_vpss.h
文件 4621 2017-11-24 14:12 mpeg\include\hi_debug.h
文件 15794 2017-11-24 14:12 mpeg\include\hi_defines.h
文件 5072 2017-11-24 14:12 mpeg\include\hi_errno.h
文件 2790 2017-11-24 14:12 mpeg\include\hi_io.h
文件 24639 2017-11-24 14:12 mpeg\include\hi_ive.h
文件 13913 2017-11-24 14:12 mpeg\include\hi_jpeg_api.h
............此处省略51个文件信息
相关资源
- 海思HI35xx平台h265解码
- Hi3521 SDK 中文文档
- Hi3531_V100R001C02SPC080_中文文档.rar
- Hi3516 SDK 中文文档.rar
- 从零开始学习音视频编程技术41 H.26
- Vue全家桶之Vuex代码
- FFmpeg解码
- Linux Qt、大华摄像机SDK模式、ffmpeg解码
- TCP接收264码流,使用ffmpeg解码
- lpc1768+FreeRTOS+Keil
- Hi35xx Huawei LiteOS 开发环境用户指南.
- 海思HI35xx平台CPU芯片温度监控驱动及
- 海思芯片Hi35xx系列配置对比.xlsx
- 海思Hi35xx系列运行YoloV3以及YoloV3-tin
- ftp客户端 实例源码下载24903
- MUI项目实战源码
- 海思HI35xx平台h264解码
评论
共有 条评论