3619
- 收藏
- 点赞
- 分享
- 举报
[his3516A]JPEG 编码第二帧失败
hi3516平台
单独创建一个编码通道,需要抓拍时才把数据送入编码通道,结果发现第二次送入时就出现了a0088003的错误。
向懂的人请教
流程如下:
SAMPLE_PRT("%s %d\n",__FUNCTION__,__LINE__);
stRecvParam.s32RecvPicNum = 1;
s32Ret = HI_MPI_VENC_StartRecvPicEx(gpOsdJpegObj->JpegChn, &stRecvParam);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_StartRecvPic faild with%#x!\n", s32Ret);
return HI_FAILURE;
}
SAMPLE_PRT("Jpeg Enc Wid %d hei %d \n",pSrc->frameIn.frame.stVFrame.u32Width,pSrc->frameIn.frame.stVFrame.u32Height);
s32Ret = HI_MPI_VENC_SendFrame(gpOsdJpegObj->JpegChn,&(pSrc->frameIn.frame),-1);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_SendFrame faild with%#x!\n", s32Ret);
s32Ret = HI_MPI_VENC_StopRecvPic(gpOsdJpegObj->JpegChn);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_StopRecvPic faild with%#x!\n", s32Ret);
}
return HI_FAILURE;
}
s32VencFd = HI_MPI_VENC_GetFd(gpOsdJpegObj->JpegChn);
if (s32VencFd < 0)
{
SAMPLE_PRT("HI_MPI_VENC_GetFd faild with%#x!\n", s32VencFd);
return HI_FAILURE;
}
SAMPLE_PRT("%s %d\n",__FUNCTION__,__LINE__);
FD_ZERO(&read_fds);
FD_SET(s32VencFd, &read_fds);
TimeoutVal.tv_sec = 60;
TimeoutVal.tv_usec = 0;
s32Ret = select(s32VencFd + 1, &read_fds, NULL, NULL, &TimeoutVal);
if (s32Ret < 0)
{
SAMPLE_PRT("snap select failed!\n");
return HI_FAILURE;
}
else if (0 == s32Ret)
{
SAMPLE_PRT("snap time out!\n");
return HI_FAILURE;
}
else
{
if (FD_ISSET(s32VencFd, &read_fds))
{
s32Ret = HI_MPI_VENC_Query(gpOsdJpegObj->JpegChn, &stStat);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VENC_Query failed with %#x!\n", s32Ret);
return HI_FAILURE;
}
/*******************************************************
suggest to check both u32CurPacks and u32LeftStreamFrames at the same time,for example:
if(0 == stStat.u32CurPacks || 0 == stStat.u32LeftStreamFrames)
{ SAMPLE_PRT("NOTE: Current frame is NULL!\n");
return HI_SUCCESS;
}
*******************************************************/
if (0 == stStat.u32CurPacks)
{
SAMPLE_PRT("NOTE: Current frame is NULL!\n");
return HI_SUCCESS;
}
stStream.pstPack = (VENC_PACK_S*)malloc(sizeof(VENC_PACK_S) * stStat.u32CurPacks);
if (NULL == stStream.pstPack)
{
SAMPLE_PRT("malloc memory failed!\n");
return HI_FAILURE;
}
stStream.u32PackCount = stStat.u32CurPacks;
s32Ret = HI_MPI_VENC_GetStream(gpOsdJpegObj->JpegChn, &stStream, -1);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_GetStream failed with %#x!\n", s32Ret);
free(stStream.pstPack);
stStream.pstPack = NULL;
return HI_FAILURE;
}
u32JpegLen = 0;
for ( s32PackIdx = 0 ; s32PackIdx < stStream.u32PackCount ; s32PackIdx ++ )
{
u32JpegLen += (stStream.pstPack[s32PackIdx].u32Len - stStream.pstPack[s32PackIdx].u32Offset);
}
if (u32JpegLen + sizeof(JPEG_HEADER) + sizeof(VEHICLE_DETECT_HEADER) < gpOsdJpegObj->u32MaxJpegLen )
{
gpOsdJpegObj->u32JpegLen = sizeof(JPEG_HEADER) + sizeof(VEHICLE_DETECT_HEADER) ;
for ( s32PackIdx = 0 ; s32PackIdx < stStream.u32PackCount ; s32PackIdx ++ )
{
memcpy(gpOsdJpegObj->pJpegBuf + gpOsdJpegObj->u32JpegLen,\
stStream.pstPack[s32PackIdx].pu8Addr + stStream.pstPack[s32PackIdx].u32Offset,\
stStream.pstPack[s32PackIdx].u32Len - stStream.pstPack[s32PackIdx].u32Offset);
gpOsdJpegObj->u32JpegLen += (stStream.pstPack[s32PackIdx].u32Len - stStream.pstPack[s32PackIdx].u32Offset);
}
}
s32Ret = HI_MPI_VENC_ReleaseStream(gpOsdJpegObj->JpegChn, &stStream);
if (s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_ReleaseStream failed with %#x!\n", s32Ret);
free(stStream.pstPack);
stStream.pstPack = NULL;
return HI_FAILURE;
}
free(stStream.pstPack);
stStream.pstPack = NULL;
}
}
/******************************************
step 4: stop recv picture
******************************************/
s32Ret = HI_MPI_VENC_StopRecvPic(gpOsdJpegObj->JpegChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VENC_StopRecvPic failed with %#x!\n", s32Ret);
return HI_FAILURE;
}
return HI_SUCCESS;
单独创建一个编码通道,需要抓拍时才把数据送入编码通道,结果发现第二次送入时就出现了a0088003的错误。
向懂的人请教
流程如下:
SAMPLE_PRT("%s %d\n",__FUNCTION__,__LINE__);
stRecvParam.s32RecvPicNum = 1;
s32Ret = HI_MPI_VENC_StartRecvPicEx(gpOsdJpegObj->JpegChn, &stRecvParam);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_StartRecvPic faild with%#x!\n", s32Ret);
return HI_FAILURE;
}
SAMPLE_PRT("Jpeg Enc Wid %d hei %d \n",pSrc->frameIn.frame.stVFrame.u32Width,pSrc->frameIn.frame.stVFrame.u32Height);
s32Ret = HI_MPI_VENC_SendFrame(gpOsdJpegObj->JpegChn,&(pSrc->frameIn.frame),-1);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_SendFrame faild with%#x!\n", s32Ret);
s32Ret = HI_MPI_VENC_StopRecvPic(gpOsdJpegObj->JpegChn);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_StopRecvPic faild with%#x!\n", s32Ret);
}
return HI_FAILURE;
}
s32VencFd = HI_MPI_VENC_GetFd(gpOsdJpegObj->JpegChn);
if (s32VencFd < 0)
{
SAMPLE_PRT("HI_MPI_VENC_GetFd faild with%#x!\n", s32VencFd);
return HI_FAILURE;
}
SAMPLE_PRT("%s %d\n",__FUNCTION__,__LINE__);
FD_ZERO(&read_fds);
FD_SET(s32VencFd, &read_fds);
TimeoutVal.tv_sec = 60;
TimeoutVal.tv_usec = 0;
s32Ret = select(s32VencFd + 1, &read_fds, NULL, NULL, &TimeoutVal);
if (s32Ret < 0)
{
SAMPLE_PRT("snap select failed!\n");
return HI_FAILURE;
}
else if (0 == s32Ret)
{
SAMPLE_PRT("snap time out!\n");
return HI_FAILURE;
}
else
{
if (FD_ISSET(s32VencFd, &read_fds))
{
s32Ret = HI_MPI_VENC_Query(gpOsdJpegObj->JpegChn, &stStat);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VENC_Query failed with %#x!\n", s32Ret);
return HI_FAILURE;
}
/*******************************************************
suggest to check both u32CurPacks and u32LeftStreamFrames at the same time,for example:
if(0 == stStat.u32CurPacks || 0 == stStat.u32LeftStreamFrames)
{ SAMPLE_PRT("NOTE: Current frame is NULL!\n");
return HI_SUCCESS;
}
*******************************************************/
if (0 == stStat.u32CurPacks)
{
SAMPLE_PRT("NOTE: Current frame is NULL!\n");
return HI_SUCCESS;
}
stStream.pstPack = (VENC_PACK_S*)malloc(sizeof(VENC_PACK_S) * stStat.u32CurPacks);
if (NULL == stStream.pstPack)
{
SAMPLE_PRT("malloc memory failed!\n");
return HI_FAILURE;
}
stStream.u32PackCount = stStat.u32CurPacks;
s32Ret = HI_MPI_VENC_GetStream(gpOsdJpegObj->JpegChn, &stStream, -1);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_GetStream failed with %#x!\n", s32Ret);
free(stStream.pstPack);
stStream.pstPack = NULL;
return HI_FAILURE;
}
u32JpegLen = 0;
for ( s32PackIdx = 0 ; s32PackIdx < stStream.u32PackCount ; s32PackIdx ++ )
{
u32JpegLen += (stStream.pstPack[s32PackIdx].u32Len - stStream.pstPack[s32PackIdx].u32Offset);
}
if (u32JpegLen + sizeof(JPEG_HEADER) + sizeof(VEHICLE_DETECT_HEADER) < gpOsdJpegObj->u32MaxJpegLen )
{
gpOsdJpegObj->u32JpegLen = sizeof(JPEG_HEADER) + sizeof(VEHICLE_DETECT_HEADER) ;
for ( s32PackIdx = 0 ; s32PackIdx < stStream.u32PackCount ; s32PackIdx ++ )
{
memcpy(gpOsdJpegObj->pJpegBuf + gpOsdJpegObj->u32JpegLen,\
stStream.pstPack[s32PackIdx].pu8Addr + stStream.pstPack[s32PackIdx].u32Offset,\
stStream.pstPack[s32PackIdx].u32Len - stStream.pstPack[s32PackIdx].u32Offset);
gpOsdJpegObj->u32JpegLen += (stStream.pstPack[s32PackIdx].u32Len - stStream.pstPack[s32PackIdx].u32Offset);
}
}
s32Ret = HI_MPI_VENC_ReleaseStream(gpOsdJpegObj->JpegChn, &stStream);
if (s32Ret)
{
SAMPLE_PRT("HI_MPI_VENC_ReleaseStream failed with %#x!\n", s32Ret);
free(stStream.pstPack);
stStream.pstPack = NULL;
return HI_FAILURE;
}
free(stStream.pstPack);
stStream.pstPack = NULL;
}
}
/******************************************
step 4: stop recv picture
******************************************/
s32Ret = HI_MPI_VENC_StopRecvPic(gpOsdJpegObj->JpegChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("HI_MPI_VENC_StopRecvPic failed with %#x!\n", s32Ret);
return HI_FAILURE;
}
return HI_SUCCESS;
我来回答
回答7个
时间排序
认可量排序
认可0
认可0
认可0
认可0
认可0
认可0
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2015-02-11 10:11:18
-
2018-08-30 11:17:58
-
2016-07-27 17:46:37
-
2016-01-06 15:36:03
-
2024-07-27 09:00:24
-
2013-08-24 00:10:16
-
2013-01-04 20:05:05
-
2015-05-13 14:11:14
-
2019-08-29 15:26:57
-
2023-09-01 18:03:46
-
2020-08-27 11:15:52
-
2018-07-03 21:19:50
-
2018-12-14 17:01:15
-
2016-01-12 11:08:09
-
2016-06-23 09:48:58
-
2018-12-13 09:01:44
-
2013-05-16 10:47:23
-
2013-08-24 09:27:11
-
2024-03-12 18:36:53
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认