Frequently Asked Questions

Where can I download the FxPlug SDK?

You can download the FxPlug SDK from https://developer.apple.com/download/more/?=FXPlug.

How can I debug my plug-in?

To test your plug-in code in a target application, you can choose Project > Scheme > Edit Scheme, and under the Info tab for the Run action you can choose Motion or Final Cut Pro as the Executable.

How can I retrieve resource files from my plug-in bundle?

You can put the file in the Resources folder for the plug-in. Then you can access the bundle from a method of one of the classes in your plug-in, like this:

  NSBundle *bundle = [NSBundle bundleForClass:[self  class]];

(The FxPlug Xcode templates do this to get localized strings.) To get data from a file called filename.extension in your Resources folder, you can use this snippet:

NSBundle *bundle = [NSBundle bundleForClass:[  self  class]];
NSString *path = [bundle pathForResource:  @"filename"
ofType:  @"extension"  ];
 
 NSString *dataString = [NSString stringWithContentsOfFile:path];

How can I determine if an input frame is interlaced?

If a frame is interlaced, you’ll know in your -renderOutput: method, because the FxRenderInfo structure that’s passed in will have the “field” member set to either kFxField_UPPER or kFxField_LOWER. Note that it doesn’t tell you the field you have, but rather what the field order is. If a frame isn’t interlaced, the “field” member will have the value kFxField_NONE.

How can I access a single field from an interlaced frame?

First, get the FxTemporalImageAPI and call one of these two methods:

-getInputBitmap:withInfo:atTime:

or

-getInputTexture:withInfo:atTime:

For the first field of frame t, use time t, and for the second field, use time t + 0.5.

How can I determine what application my plug-in is running in?

The following code snippet returns a string, appIdentity, which specifies the host application:

CFBundleRef appBundle = CFBundleGetMainBundle();
CFStringRef appIdentity = NULL;
if ( appBundle != NULL )
    appIdentity = CFBundleGetIdentifier( appBundle );

Motion bundle identifier is com.apple.motionapp; the Final Cut Pro identifier is com.apple.FinalCut or com.apple.FinalCutTrial.

How can I specify another clip as input?

In FxPlug parlance, a reference to another clip or external media file is called an image reference. So using the FxParameterCreationAPI protocol, call the following method to create the parameter:

-addImageReferenceWithName:parmId:parmFlags:

To get the parameter’s value, use either:

-getBitmap:layerOffsetX:layerOffsetY:requestInfo:fromParm:atTime:

or

-getTexture:layerOffsetX:layerOffsetY:requestInfo:fromParm:atTime:

How can I get the current time?

In your -parameterChanged: method, and in response to an event in a custom parameter view or onscreen control, you’ll need to determine the current time. You can do this by calling the -currentTime method in the FxCustomParameterAPI protocol.

Can I define multiple plug-in bundles that populate the same group?

Yes, but the Plug-in Manager places a restriction on how you do this. If you create multiple FxPlug effects in different bundles and assign them to the same groups, the different bundles must use different group UUIDs but have the same group name. If you use the same group UUID in two bundles, the plug-ins in only one of the two bundles are loaded.