2012-02-14 16 views

答えて

2

DirectShowに戻るための専用の方法はありません。はい、IMediaSeeking::SetPositionsを使用できますが、実装するDirectShow自体ではなく、実際の基になるフィルタなので、再配置のサポートはフィルタや実装に依存します。たとえば、キーフレームをステップ実行するスプライスポイント)のみ。 DirectShow.NETはDirectShow上のラッパーであり、DirectShowがステッピング用に提供するものの上に何も追加しません。

+0

私は知っていますが、前進と後退を模索するための良い例がありますか? – Saint

+0

あなたは 'IVideoFrameStep :: Step'で前進することができます。これはかなりうまくいきます。後方に歩むことについては、簡単な方法は、現在の数ミリ秒前に特定の時間位置を探すことです。おそらくキャッシングフィルタをパイプラインに配置してフレームを保持し、後ろに正確に踏み込むのを助けることも可能ですが、複雑なアイテムのように聞こえるように思えます。 –

+0

Windows SDKにはC#のサンプルがありませんので、サンプルを探すのに最適な場所はhttp://directshownet.sourceforge.net/です –

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#でラップすることは難しくありません。お役に立てれば。

関連する問題