FFDShow-tryout 调试与源代码研读(二)

Posted on 2011-04-12 16:35  Teddy Yan  阅读(615)  评论(0编辑  收藏  举报

FFDShow tryout 把ffmpeg和DirectX 结合起来并封装在几个类里面。类图见我的google doc

swxv0iDx3tZYCZgqIeufMsg

sfAgmPRENawqO5eIoSd7wbA

代码路径分析:

//------------------Construct FFshow decoder--------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------

TffdshowBase::Constructor //配置类创建,初始化

TffdshowDecVideo::Constructor      //TffdshowDecVideo 是双重继承Decoder和Video的

TffdshowDecVideoOutputPin::Constructor
Join filter graph //HRESULT TffdshowBase::onGraphJoin(IFilterGraph *pGraph) 查询 检查是dec是否在graph里


//------------------Connect Input Pin--------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------
TffdshowVideoInputPin::ReceiveConnection
//STDMETHODIMP TffdshowVideoInputPin::ReceiveConnection(IPin* pConnector, const // AM_MEDIA_TYPE* pmt) 
//由pin可以得到filter,取得是哪个splitter

TffdshowVideoInputPin::CheckMediaType: MPG2, 640, 480
// ReceiveConnection 自我调用的
// 检查mediaType的BMI图片的压缩类型
// getVideoCodecId() 在TffDecoder_com.cpp里实现的,是Video的一个方法

TinputPin::SetMediaType
// graph 开始调用TinputPin::SetMediaType(const CMediaType* mt)

TffdshowDecVideo::SetMediaType Input
//  graph 父类调用 子类的

TffdshowVideoInputPin::init
TffdshowVideoInputPin::initVideo: MPG2, width:640, height:480, aspectX:4, aspectY:3
TffdshowVideoInputPin::initVideo Codec detected : libmpeg2

//codec=video=TvideoCodecDec::initDec(fv->deci,fv->sink,codecId,biIn.bmiHeader.biCompression,mt);
//        else if (codecId==CODEC_ID_LIBMPEG2  ) movie=new TvideoCodecLibmpeg2(deci,sink);
//               dll=new Tdll(dllname,config);
//               dll->loadFunction(mpeg2_set_accel,"mpeg2_set_accel");
//               dll->loadFunction(mpeg2_accel,"mpeg2_accel");
//                       class TvideoCodecLibmpeg2 :public TvideoCodecDec

// 此时的beginDecompress是libmpeg2的方法
//if (!video->beginDecompress(pictIn,
//                                        biIn.bmiHeader.biCompression,mt,
//                                        (dont_use_rtStop_from_upper_stream ? TvideoCodecDec::SOURCE_NEROAVC : 0) | (truncated ? TvideoCodecDec::SOURCE_TRUNCATED : 0))) {
//                delete video;codec=video=NULL;
//                return false;
//            }


initPreset     //  CTransformOutputPin::DecideBufferSize ->TffdshowDecVideo::DecideBufferSize ->TffdshowDec::initPreset

ModLoad: 032b0000 0337b000 D:/opensources/ffshow-tryouts/trunk/bin/libmpeg2_ff.dll

TffdshowDecVideo::CompleteConnect input


//---------------Connect Output Pin---------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------

//父类调用 CTransformInputPin::CompleteConnect
TffdshowDecVideoOutputPin::Connect
TffdshowDecVideo::ConnectCompatibleFilter. Connect FFDShow
//检验输出格式,TffdshowDecVideoOutputPin::Connect 调用 this->fdv->ConnectCompatibleFilter();

TffdshowDecVideo::CheckTransform
//父类调用 CTransformOutputPin::CheckMediaType(const CMediaType* pmtOut)
TffdshowDecVideo::CheckTransform
TffdshowDecVideo::SetMediaType Output
//父类调用 CTransformOutputPin::SetMediaType(const CMediaType* pmtOut)
TffdshowDecVideo::setOutputMediaType
TffdshowDecVideo::setOutputMediaType: colorspace:YV12,adj, biWidth:640, dstStride:640, Bpp:1, dstSize:460800
TffdshowDecVideo::GetMediaType
//父类调用 CTransformOutputPin::GetMediaType
ModLoad: 6fac0000 7022d000 D:/opensources/ffshow-tryouts/trunk/bin/libavcodec.dll
TffdshowDecVideo::GetMediaType
TffdshowDecVideo::GetMediaType
TffdshowDecVideo::GetMediaType
TffdshowDecVideo::GetMediaType
TffdshowDecVideo::GetMediaType
TffdshowDecVideo::GetMediaType
TffdshowDecVideo::GetMediaType
TffdshowDecVideo::GetMediaType
TffdshowDecVideoOutputPin::CompleteConnect
TffdshowDecVideoDXVA::CompleteConnect output
TffdshowDecVideo::DecideBufferSize
//父类调用 CTransformOutputPin::DecideBufferSize(
TffdshowDecVideo::CheckTransform
TffdshowDecVideo::CheckTransform
//父类调用 CTransformOutputPin::CheckMediaType
TffOutputQueue::Constructor
//父类调用 CTransformOutputPin::CompleteConnect(IPin *pReceivePin) TffdshowDecVideoOutputPin::CompleteConnect
Connection succeeded

//------------Begin to Run------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------------------------
(454.1164): Break instruction exception - code 80000003 (first chance)
eax=7ffde000 ebx=00000001 ecx=00000002 edx=00000003 esi=00000004 edi=00000005
eip=7c90120e esp=014affcc ebp=014afff4 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246
ntdll!DbgBreakPoint:
7c90120e cc int 3
0:006> g
TffdshowDecVideo::Run thread=1908
TffdshowVideoInputPin::NewSegment
TffdshowDecVideo::NewSegment thread=4812
TffdshowDecVideoOutputPin::DeliverNewSegment tStart 0, tStop 922337203685478
m_Connected->NewSegment
ModLoad: 5e760000 5e76a000 C:/WINDOWS/system32/perfos.dll
Output format change /*means we must wait for a keyframe*/
TffdshowDecVideo::setOutputMediaType
TffdshowDecVideo::setOutputMediaType: colorspace:YV12,adj, biWidth:640, dstStride:640, Bpp:1, dstSize:460800
colorspace conversion: YV12,interlaced -> YV12,interlaced,adj (xvidImage_output)
TimgFilterOutput::process V-RAM access is Direct, t_indirect = 800000, t_direct = 450000
TffdshowDecVideo::Run thread=1908
TffdshowVideoInputPin::NewSegment
TffdshowDecVideo::NewSegment thread=4812
TffdshowDecVideoOutputPin::DeliverNewSegment tStart 0, tStop 922337203685478
m_Connected->NewSegment
TffdshowDecVideo::Run thread=1908
TffdshowVideoInputPin::NewSegment
TffdshowDecVideo::NewSegment thread=4812
TffdshowDecVideoOutputPin::DeliverNewSegment tStart 3933, tStop 922337203685478
m_Connected->NewSegment
TffdshowDecVideo::Run thread=1908
TffdshowVideoInputPin::NewSegment
TffdshowDecVideo::NewSegment thread=4812
TffdshowDecVideoOutputPin::DeliverNewSegment tStart 8537, tStop 922337203685478
m_Connected->NewSegment
TffdshowDecVideo::Run thread=1908
TffdshowVideoInputPin::NewSegment
TffdshowDecVideo::NewSegment thread=4812
TffdshowDecVideoOutputPin::DeliverNewSegment tStart 8537, tStop 922337203685478
m_Connected->NewSegment
TffdshowDecVideo::Run thread=1908
(454.774): C++ EH exception - code e06d7363 (first chance)
(454.774): C++ EH exception - code e06d7363 (first chance)
(454.774): C++ EH exception - code e06d7363 (first chance)
(454.774): C++ EH exception - code e06d7363 (first chance)
ModLoad: 1c800000 1c852000 D:/DXSDK/Utilities/proppage.dll
(454.774): C++ EH exception - code e06d7363 (first chance)
(454.774): C++ EH exception - code e06d7363 (first chance)
TffdshowDecVideo::Stop thread=1908
TffdshowDecVideoOutputPin::Inactive
Removed from filter graph
TffdshowDecVideo::Destructor
TffdshowDecVideoOutputPin::Destructor
eax=00000001 ebx=00000000 ecx=0006fcf8 edx=7c90e514 esi=7c90de6e edi=00000000
eip=7c90e514 esp=0006fde8 ebp=0006fee4 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
ntdll!KiFastSystemCallRet:
7c90e514 c3 ret

Copyright © 2024 Teddy Yan
Powered by .NET 8.0 on Kubernetes