I’ve been working on Commander, and the first tiny bit of usable functionality is now working.

Update: 27/06/2013 – I’ve uploaded the Commander application: Commander App

The project is on git hub and can be viewed at: https://github.com/SheffieldKevin/Commander

The first bit done is the command line tool which exports movies. The movie exporter command line tool is included in the Commander application package. The first Commander window implemented which can be accessed from the Commands menu is Export Movie… and provides a UI for configuring all the options for the movie export command line tool. My next task will be a way to configure options for the frame grabber command line tool. The frame grabber command line tool can be built using the project but it is currently not built into the Commander application. The Commander application is not codesigned.

For information about which various bits of cocoa and objective-c have been used see over…

NSApplication

• Use of NSApp runModalForWindow in file YVSAppDelegate.m
• The ending of the modal loop in windowWillClose method in file YVSMovieExporterWindowController.m

AVURLAsset and AVAssetExportSession

• Used in YVSMovieExporterWindowController.m to determine list of possible presets, and export file types.
• Used in run method in file avexporter.m to do movie export.
• Used in run method in file avframegrabber.m as source asset for AVAssetImageGenerator.

AVAssetTrack

• Used in in method doListTracks in avexporter.m for avexporter to list track information.

AVAssetImageGenerator

• Used in run method in file avframegrabber.m to create CGImages for saving to disk.

Blocks

• Used in the run methods in both avframegrabber.m, and avexporter.m.

KVO – Adding and removing observers

• Used in YVSMovieExporterWindowController for observing various values connected to controls.

Delegates

• Used in YVSAppDelegate.
• Used for the the various controls in YVSMovieExporterWindowController.xib which specify the controller class as their delegate. The export filename text field is dynamically handled by implementation of the delegate method controlTextDidChange.

Copy string to Clipboard/Pasteboard

• The class method copyStringToClipboard shows how to copy a string to the clipboard.

NSNumberFormatter

• Used in class method convertHoursMiSecondsToSeconds in file YVSMovieExporterWindowController.m.

Populating a NSPopUpButton menu from an NSArray

• I find doing this to be non-obvious. This is what worked for me in the end.
• You need to add an array controller in the nib/xib file.
• You need to connect that array controller to a property in you class.
• In code you need to assign an array of the menu item names to the to the array controller using setContent.
• If the list of menu items changes, the new array needs to be assigned to the array controller using setContent.
• In the bindings inspector of the NSPopUpButton Content needs to be bound to the array controller.
• The Controller key needs to be arrangedObjects. Model key path is empty.
• In the bindings inspector of the NSPopUpButton Content Values needs to be bound to the array controller.
• The Controller key needs to be arrangedObjects.
• If the array of menu items is just an array of NSString objects then model key path is empty otherwise
• Model Key Path is the member name of the object that is the menu item name & is a NSString.
• In the bindings inspector of the NSPopUpButton the Selected Object should be a NSString property of an object that is referenced in the nib/xib file.