I wrote following code to find the 5. video frame (assume no IndexTable in the file, so I do not use it):
Code:
...
   theFile->Seek(0);
   KLVObjectPtr anElement;
   int FrameCount = 0;
   int mFrame = 5; // I want the 5. video frame
   while (FrameCount != mFrame)
   {
      anElement = theFile->ReadKLV();
      if (anElement->GetGCTrackNumber() == TrackNumber_v)
         FrameCount++;
      if ( theFile->Eof() )
      {
         cout<<"End of file!"<<endl;
         return -1;
      }
   }
   //Do what I want with this KLV
   //...
But it takes too long (minutes) to find it. It seems that it’s not a good way to do it. How can I do it better?
If I use Index Table which converts time offset to byte offset in the essence container (not from the beginning of the file), how can I locate the video frame in the file?