0

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?

bhootjb
  • 1,501
  • 1
  • 21
  • 33

1 Answers1

1

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

Mike W
  • 11
  • 1
  • The MediaType that I had set is RGB24. And I think it gives the uncompressed frames as you are saying. But then which other MediaType could I use? I tried other types, but it didnt work. Oh yes and the graph that I had built is : Video Source --> Sample Grabber --> VideoRenderer Also suggest any changes in this. – bhootjb Jan 31 '11 at 07:52
  • If you are getting uncompressed frames, then every frame is a sync point, and there is no way (at that point) to tell if the original compressed frame was a key frame. (The IsSyncPoint method does not strictly test for key frames, it tests for sync points. For compressed video, a sync point is a key frame). So then it depends why you need to find key frames. If you need to get uncompressed video *and* check for key frames, you might need a pass-thru filter upstream of the decoder. – Mike W Feb 01 '11 at 00:45