Bhoot
Bhoot

Reputation: 1541

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 ( ) + " " );

   Marshal.ReleaseComObject ( mediaSample );
   return 0;
  }

What am I missing here?

Upvotes: 0

Views: 1227

Answers (1)

Mike W
Mike W

Reputation: 11

What is your media type? If the sample grabber is receiving uncompressed video frames, then every frame is a sync point.

Upvotes: 1

Related Questions