3648
- 收藏
- 点赞
- 分享
- 举报
[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
-
2016-07-27 17:46:37
-
2018-08-30 11:17:58
-
2016-01-06 15:36:03
-
2023-09-01 18:03:46
-
2024-07-27 09:00:24
-
2018-07-03 21:19:50
-
2013-08-24 00:10:16
-
2020-08-27 11:15:52
-
2016-01-12 11:08:09
-
2016-06-23 09:48:58
-
2015-05-13 14:11:14
-
2019-08-29 15:26:57
-
2013-01-04 20:05:05
-
2024-03-12 18:36:53
-
2018-12-14 17:01:15
-
2019-05-10 18:39:05
-
2015-05-26 19:26:57
-
2018-01-28 15:07:35
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5SS928的emmc有32GB,bootargs设置使用16GB,但是为啥能用的只有rootfs的大小
-
33SS928怎样烧写ubuntu系统
-
10ToolPlatform下载rootfs提示网络失败
-
10谁有GK7205V500的SDK
-
5Hi3516CV610 烧录不进去
-
10Hi3559AV100 芯片硬解码h265编码格式的视频时出现视频播放错误,解码错误信息 s32PackErr:码流有错
-
5海思SS928 / SD3403的sample_venc.c摄像头编码Demo中,采集到的摄像头的YUV数据在哪个相关的函数中?
-
5海鸥派openEuler无法启动网卡,连接WIFI存在问题
-
66有没有ISP相关的巨佬帮忙看看SS928对接IMX347的图像问题
-
50求助hi3559与FPGA通过SLVS-EC接口对接问题
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认