Seeking key frames using IMediaSample DirectShow.Net
As far as I know, inorder to check if a frame is a key frame or not, I have to check the IMediaSample::IsSyncPoint() method, which returns 0 (S_OK) if the frame is a key frame, or false in the other case.
But the IsSyncPoint() method is simply returning 0 in every frame that is grabbed and passed to the ISampleGrabberCB::SampleCB() callback method.
The code that my callback include is simple :
public int SampleCB ( double sampleTime, IMediaSample mediaSample )
{
Console.WriteLine ( "SampleCB Callback" );
Console.WriteLine ( mediaSample.IsSyncPoint ( ) + " " );
Marsh开发者_Python百科al.ReleaseComObject ( mediaSample );
return 0;
}
What am I missing here?
What is your media type? If the sample grabber is receiving uncompressed video frames, then every frame is a sync point.
精彩评论