注册 登录
编程论坛 VC++/MFC

sdk接入摄像机,回调函数的使用,怎样保证每次打开视频后,调用回调函数传递的参数vtoePassiveModeHandle改变。

华仔在听歌 发布于 2019-04-02 13:41, 1915 次点击
void CALLBACK Decoder_Application::CameraRealDataCallBack(LONG lRealHandle, DWORD dwDataType, BYTE *pBuffer, DWORD dwBufSize, DWORD dwUser){
    Decoder_Application* pThis = (Decoder_Application*)dwUser;
    vtoePassiveModeHandle = vtoelPassiveModeHandle;
    DWORD dwTemp = 0;
    PVCM2008_H264_AV_FILE_MEDIA_UNIT_HEAD    pHead = (PVCM2008_H264_AV_FILE_MEDIA_UNIT_HEAD)pBuffer;
    if (dwDataType == VS2008_NET_VIDEO)
    {
        if (temptime == pHead->dwTimeStamp){
            m_pPacker->s64CurPts = m_pPacker->s64CurPts;
        }
        else{
            //VS2008_NET_RequestKeyFrame(g_RealHandle);
            m_pPacker->s64CurPts = m_pPacker->s64CurPts + 3600;
        }
        temptime = pHead->dwTimeStamp;
        m_pPacker->IFrame = pHead->wKeyFrameFlag;
        char * pData = NULL;
        pData = new char[dwBufSize + PES_HDR_LEN];
        memcpy(pData + PES_HDR_LEN, (char*)pBuffer, dwBufSize);
        m_28181PS->gb28181_streampackageForH264(pData, dwBufSize, m_pPacker, 0);
        if (pData != NULL)
        {
            delete[]pData;
        }
        while (dwBufSize > 0)
        {
            dwTemp = min(512, dwBufSize);
            WTOE_NET_MatrixSendData(vtoePassiveModeHandle, (char *)pBuffer, dwTemp);
            dwBufSize -= dwTemp;
            pBuffer += dwTemp;
        }
        TRACE("dwFrameSerialNo:%d,dwTimeStamp:%d\n", pHead->dwFrameSerialNo, pHead->dwTimeStamp);
    }
}
0 回复
1