我想应该用 来完成IMediaSeeking SetPositions
,但我不知道如何在里面定义参数。
问问题
2168 次
2 回答
2
在 DirectShow 中没有专门的后退方法(因为存在前进的方法)。是的,您可以使用IMediaSeeking::SetPositions
,但是请注意,实现它的不是 DirectShow 本身,而是实际的底层过滤器,因此对重新定位的支持取决于过滤器和实现,并且可能仅限于,例如,单步执行关键帧(拼接点)。DirectShow.NET 只是 DirectShow 的一个包装器,它也没有在 DirectShow 为步进提供的内容之上添加任何内容。
于 2012-02-14T22:48:08.097 回答
0
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# 封装这段代码对您来说可能并不困难。希望这可以帮助。
于 2012-02-21T15:03:16.277 回答