开发者

Seeking key frames using IMediaSample DirectShow.Net

开发者 https://www.devze.com 2023-02-06 15:29 出处:网络
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 c

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消