Hi, I am developing still image importer and I am confused how to compute frame number in asynchronous aiInitiateAsyncRead method. Theoretically, it should be something like imSourceVideoRec.inFrameTime / ticksPerFrame. I can use GetTicksPerVideoFrame() to figure out ticks count per some specific framerate, but how do I figure out which framerate is used? (users can change framerate that is used in "settings - media - indeterminate media timebase" and I don't want to provide incorrect frames...)
Is this information provided somewhere along lifycycle of importer and I just didn't noticed it? Or am I using completely wrong approach?
Rather than frame number, you receive a request for a frame time: imSourceVideoRec->inFrameTime
From there, you can calculate the frame number by framerate that you calculate and save in local data. For example, in SDK_Async_Import.cpp:
|csSDK_int32||theFrame = static_cast<csSDK_int32>(inSourceRec.inFrameTime / (*localRecH)->theFile.frameRate);|
One thing I will mention is that internally, all of our still importers use the synchronous model.
I forgot to explain that I am importing sequence of files, standalone images. There is no wrapper or metainformation that specifies frame rate of those files. As far as I can tell, imSourceVideoRec->inFrameTime is dependent on whatever user selected in "settings - media - indeterminate media timebase" . For example, if setting is 29.97 fps then second frame has inFrameTime 8475667200, but if setting is 30 fps, then second frame has inFrameTime 8467200000. So to correctly compute frame number I need to know what setting is used. And I weren't able to find it in any structure passed to me in any selector.
thanks for your time