读书人

LAV Filter 源代码分析 四: LAV Vide

发布时间: 2013-10-28 11:21:45 作者: rapoo

LAV Filter 源代码分析 4: LAV Video (2)

上一篇文章分析了LAV Filter 中的LAV Video的两个主要的类:CLAVVideo和CDecodeThread。文章:LAV Filter 源代码分析 3: LAV Video (1)

在这里继续上篇文章的内容。文章中提到LAVVideo主要通过CDecodeThread这个类进行解码线程的管理,其中有一个关键的管理函数:ThreadProc(),包含了对解码线程的各种操作。函数如下所示:


该类名字叫CDecAvcodec,其继承了CDecBase。而CDecBase继承了ILAVDecoder。

//销毁解码器,各种FreeSTDMETHODIMP CDecAvcodec::DestroyDecoder(){  DbgLog((LOG_TRACE, 10, L"Shutting down ffmpeg..."));  m_pAVCodec= NULL;  if (m_pParser) {    av_parser_close(m_pParser);    m_pParser = NULL;  }  if (m_pAVCtx) {    avcodec_close(m_pAVCtx);    av_freep(&m_pAVCtx->extradata);    av_freep(&m_pAVCtx);  }  av_frame_free(&m_pFrame);  av_freep(&m_pFFBuffer);  m_nFFBufferSize = 0;  av_freep(&m_pFFBuffer2);  m_nFFBufferSize2 = 0;  if (m_pSwsContext) {    sws_freeContext(m_pSwsContext);    m_pSwsContext = NULL;  }  m_nCodecId = AV_CODEC_ID_NONE;  return S_OK;}



读书人网 >编程

热点推荐