播放器使用ffmpeg读取视频文件,packet发给cuda解码,解码后OpenGL直接映射给pbo,pbo绑定texture,然后显示出来
流程读取文件,判断packet,丢到CUDA那
if (av_read_frame(m_pFormatContext, &packet) >= 0)
{if (packet.stream_index ==m_VideoStreamIndex)
{if(m_UseGPUDecode)
{//MiniConsole::getInstance().Output("ThreadDecodeVideoGPU begin \n");
ThreadDecodeVideoGPU(packet);//MiniConsole::getInstance().Output("ThreadDecodeVideoGPU end \n");
}else{
ThreadDecodeVideoCPU(packet);
}
}else if (packet.stream_index ==m_AudioStreamIndex)
{
ThreadDecodeAudio(packet);
}else{
av_free_packet(&packet);
}
}
数据丢给cuvidParseVideoData
CUVIDSOURCEDATAPACKET cudaPkt;
CUresult oResult;if (pData ==NULL)
{
cudaPkt.flags=