This code in the CS4 SDK was written for the initial 4.0 release, where GetExportSourceInfo(kExportInfo_VideoFrameRate) originally returned a float value. In 4.0.1, this was changed (to be simpler for developers) to return a PrTime value. So in the CS5 SDK release, the code now looks like this:
frameRateValues.value.timeValue = seqFrameRate.mInt64;
So it now uses the mInt64 member of the union, because PrTime is a 64-bit int.
To convert PrTime to a float, the SDK Guide, chapter 3, section on Time, reads: "When a frame rate is represented as a PrTime, the frame rate is the number of ticks in a frame duration. The current number of ticks per second must be retrieved using the callback in the Time Suite." So just divide the PrTime value by the ticks per second returned by GetTicksPerSecond().
Thanks for ur reply.
I just want to confirm what i have understood.
timeSuite->GetTicksPerSecond (&ticksPerSecond); // gives ticks/sec
&seqFrameRate); // gives ticks/frame
Instead of using seqFrameRate.mFloat64, i should use seqFrameRate.mInt64
So both, ticksPerSecond and seqFrameRate.mInt64 are 64 bit int which are
ticks/sec and ticks/frame respectively.
Now, i can get fps(frames per second) as following
seqFrameRateTicks = (ticks/sec)/(ticks/frame) = ticksPerSecond/seqFrameRate.mInt64
which is a 64 bit int(PrTime).
Also, if seqFrameRate.mInt64 is required, why is seqFrameRate.mFloat64 still used in the code?
1 person found this helpful
Yes, your summary is correct.
The CS4 SDK sample code uses mFloat64 because it was written during the development of CS4. At that time, I requested that we change the time value returned by GetExportSourceInfo(kExportInfo_VideoFrameRate) to be a PrTime rather than a float, since it simplifies the code in most cases. This change to GetExportSourceInfo() wasn't made until 4.0.1, and I didn't update the SDK sample code until after releasing the CS4 SDK.
So go ahead and use the mInt64 member, and make sure the plug-in is running in 4.0.1 or later, not 4.0. You can check this by looking in exportStdParms.interfaceVer. If that value is prExportVersion100, that means it is PPro 4.0. On exSelStartup, you could just display a message that the user should update to 4.0.1 or later.
I did use that and it worked.