Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

FAQs

In this section:

How can I debug my plug-in?
How can I retrieve resource files from my plug-in bundle?
Copying and pasting UUIDs from Terminal is tedious. How can I simplify this step?
How can I determine if an input frame is interlaced?
How can I access a single field from an interlaced frame?
How can I determine what application my plug-in is running in?
How can I specify another clip as input?
How can I get the current time?
Can I define multiple plug-in bundles that populate the same group?


How can I debug my plug-in?

To test your plug-in code in a target application, you can choose Project > New Custom Executable in Xcode and select Final Cut or Motion. Then choose Run > Debug to launch the selected host in the Xcode debugger.

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 does 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];

Copying and pasting UUIDs from Terminal is tedious. How can I simplify this step?

You can create an Xcode script to speed this up. To do this in Xcode 3.0, follow these steps:

  1. Select Edit User Scripts from the User Scripts menu (identified by the script icon in the Xcode menu bar).

  2. Select Code from the list of script types.

  3. Click the Add button and select Shell Script.

  4. Double click the name Shell Script and revise it to GenUUID or some other appropriate name.

  5. Add the line echo -n `uuidgen` to the script .

  6. Change the Output option to Replace Selection.

  7. Close the Edit User Scripts window.

You can now generate a UUID in Xcode by choosing your new script from the Code submenu of the User Scripts menu.

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 is not interlaced, then 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’s bundle identifier is com.apple.motion; Final Cut Pro’s is com.apple.finalcutpro.

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 on-screen 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 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.



< Previous PageNext Page > Hide TOC


Last updated: 2008-07-04




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice