|
线程还没有开,但有个问题,调试时发现pCodec->eCodecID一直是SAVCODEC_ID_H264。我在else里int i=1处打断点,程序不会跳到断点处。根据网上的资料,H264是只有视频数据没有音频数据的。这是什么情况?
开线程可以在Browse里面开吗?pFrame和pCodec是全局的吗?
BVCU_Result CMLibBVCU::afterDecode(BVCU_HDialog hDialog, SAVCodec_Context* pCodec, SAV_Frame* pFrame)
{
static int count = 0;
if (count >= 0)//用于丢帧,count>=n,每n+1帧丢n帧
{
count = 0;
//thread t(AVDataAcquire, pCodec, pFrame);
if ((*pCodec).eCodecID == SAVCODEC_ID_H264)
{
int height = (*pCodec).stVideoParam.iHeight, width = (*pCodec).stVideoParam.iWidth;
int yStride = (*pFrame).iDataSize[0];
//YUV420p
Mat frame(height * 3 / 2, width, CV_8UC1);
for (int i = 0; i < height; i++)
{
memcpy_s(frame.ptr(i), width, (*pFrame).ppData[0] + i * yStride, yStride);
}
for (int i = 0; i < height / 4; i++)
{
memcpy_s(frame.ptr(i + height), width, (*pFrame).ppData[1] + i * yStride, yStride);
}
for (int i = 0; i < height / 4; i++)
{
memcpy_s(frame.ptr(i + height * 5 / 4), width, (*pFrame).ppData[2] + i * yStride, yStride);
}
cvtColor(frame, frame, COLOR_YUV420p2RGB);
imshow("camera", frame);
waitKey(1);
}
else
{
int i = 1;
}
}
else
{
count++;
}
return BVCU_RESULT_S_OK;
} |
|