我想应该用IMediaSeeking SetPositions来完成,但我不知道如何在内部定义参数。
发布于 2012-02-15 06:48:08
在DirectShow中没有专用的后退方法(因此存在用于前进的方法)。是的,您可以使用IMediaSeeking::SetPositions,但是请注意,实现它的不是DirectShow本身,而是实际的底层筛选器,因此对重新定位的支持取决于筛选器和实现,并且可能仅限于单步执行关键帧(拼接点)。DirectShow.NET是DirectShow之上的一个包装器,它也没有在DirectShow提供的单步执行之上添加任何东西。
发布于 2012-02-21 23:03:16
IBasicVideo *pBasicVideo=NULL;//Interface to the Ibasic Video
HRESULT hr;
REFTIME pavgfrt=0;//Get the reftime variable
REFERENCE_TIME pnowrt=0;//Get the reference time variable
pBasicVideo->get_AvgTimePerFrame(&pavgfrt);
pBasicVideo->get_AvgTimePerFrame(&pavgfrt);//Get the avg time per frame in seconds
pSeek->GetCurrentPosition(&pnowrt);//Get the current time in the unit of 100 nanoseconds
REFERENCE_TIME temp=pnowrt;//store it in a temp variable
REFERENCE_TIME temp1=(REFERENCE_TIME)(pavgfrt*10000000);//convert avg time into the format of current time
pnowrt=temp+temp1;//Add to framestep forward and subtract to framestep backward
pSeek->SetPositions(&pnowrt,AM_SEEKING_AbsolutePositioning, NULL,AM_SEEKING_NoPositioning);//Set the seeking position to the new time
pnowrt=0;//Reset the time variable这对我在C++中很有效。用C#包装这段代码对您来说可能并不困难。希望这能有所帮助。
https://stackoverflow.com/questions/9284097
复制相似问题