4 Replies Latest reply on Jul 15, 2010 9:29 AM by AgamSarup

    SDK_Exporter_params.cpp in SDK Exporter plugin for premiere pro cs4

    AgamSarup

      This question is regarding the code in

      exSDKGenerateDefaultParams(exportStdParms                *stdParms,
                                               exGenerateDefaultParamRec    *generateDefaultParamRec) function

       

      The below function is called in the above function's code

      exportInfoSuite->GetExportSourceInfo(    exporterPluginID,
                                                      kExportInfo_VideoFrameRate,
                                                      &seqFrameRate);

      to get info for videoframerate in seqFrameRate

       

      Then seqFrameRate.mFloat64 is compared with different values in the code segment

      if(timeSuite)

      {

           timeSuite->GetTicksPerSecond (&ticksPerSecond);

           if (seqFrameRate.mFloat64 > 29.97f &&
                  seqFrameRate.mFloat64 < 29.98f ||
                  seqFrameRate.mFloat64 < 0.1f ||
                  seqFrameRate.mFloat64 > 60.0f) // Strange values fall into this case
              {
                  timeSuite->GetTicksPerVideoFrame(kVideoFrameRate_NTSC, &seqFrameRateTicks);

              }

      }

      for assigning the appropriate value to seqFrameRateTicks

       

      The problem i m facing is that the value of seqFrameRate.mFloat64

      is coming out to be zero(why?).

       

      Also, since the type of ticksPerSecond and seqFrameRateTicks

      is PrTime(which is a 64 bit int), i want to know what will be the best way

      to convert them into other 32 bit values(int, float etc).

       

      Thank You

      Agam

        • 1. Re: SDK_Exporter_params.cpp in SDK Exporter plugin for premiere pro cs4
          Zac Lam Adobe Employee

          Hi Agam,

           

          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:

           

          exportInfoSuite->GetExportSourceInfo(

              exporterPluginID,
            kExportInfo_VideoFrameRate,
            &seqFrameRate);

          ...

          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().

           

          Cheers

          • 2. Re: SDK_Exporter_params.cpp in SDK Exporter plugin for premiere pro cs4
            AgamSarup Level 1

            Hi Zac

            Thanks for ur reply.

            I just want to confirm what i have understood.

             

            timeSuite->GetTicksPerSecond (&ticksPerSecond); // gives ticks/sec

             

             

            exportInfoSuite->GetExportSourceInfo(    exporterPluginID,
                                                            kExportInfo_VideoFrameRate,
                                                            &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?

             

            Thanks

            Agam

            • 3. Re: SDK_Exporter_params.cpp in SDK Exporter plugin for premiere pro cs4
              Zac Lam Adobe Employee

              Hi Agam,

               

              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.

               

              Regards,

               

              Zac

              1 person found this helpful
              • 4. Re: SDK_Exporter_params.cpp in SDK Exporter plugin for premiere pro cs4
                AgamSarup Level 1

                Hi Zac,

                 

                I did use that and it worked.

                 

                Thanks again.

                Agam