IMediaSeeking SetPositions
으로 처리해야한다고 가정합니다. 그러나 매개 변수를 내부적으로 정의하는 방법을 모르겠습니다.DirectShow.NET에서 프레임을 뒤로 이동하는 방법은 무엇입니까?
1
A
답변
2
DirectShow에서 전진하기위한 전용 방법은 없습니다 (앞으로 나아갈 수있는 기존 방식). 예, IMediaSeeking::SetPositions
을 사용할 수는 있지만 DirectShow 자체는 구현하지 않지만 실제 기본 필터는 필터 및 구현에 따라 다시 위치 지정을 지원하므로 키 프레임을 단계별로 실행할 수 있습니다 (예 : 스플 라이스 포인트). DirectShow.NET은 DirectShow를 감싸는 래퍼이며, DirectShow가 스테핑을 위해 제공하는 것의 맨 위에 아무것도 추가하지 않습니다.
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#에서이 코드를 감싸는 것은 어렵지 않을 수도 있습니다. 희망이 도움이됩니다.
좋아, 나도 알아,하지만 앞뒤로 탐색하는 데 좋은 예제가 있습니까? – Saint
당신은'IVideoFrameStep :: Step'을 찾을 수 있습니다. 이것은 꽤 잘 작동합니다. 역으로 단계별로, 쉬운 방법은 현재보다 몇 밀리 초 앞선 시간 위치를 찾는 것입니다. 캐싱 필터를 파이프 라인에 삽입하여 프레임을 유지하고 정확하게 후진하는 데 도움을 줄 수도 있지만, 복잡한 항목처럼 들리지만 단순한 작업을 수행 할 수 있습니다. –
Windows SDK에는 C#에 대한 예제가 없으므로 샘플을 찾는 데 가장 좋은 곳은 http://directshownet.sourceforge.net/입니다. –