File: programming/cocoa/UKTurboExport.zip/UKTurboExport/MyDocument.m


//
//  MyDocument.h
//  UKTurboExport
//
//  Created by Uli Kusterer on 09.02.08.
//  Copyright 2008 M. Uli Kusterer. All rights reserved.
//
 
// -----------------------------------------------------------------------------
//	Headers:
// -----------------------------------------------------------------------------
 
#import "MyDocument.h"
#import "UKTurbo264.h"	// Turbo "API".
// -----------------------------------------------------------------------------
//	init:
// -----------------------------------------------------------------------------
// Make sure we get notified when a Turbo is plugged in/removed:
		//	The call to [UKTurbo264 sharedTurbo264] causes the object to be
		//	instantiated that sends these notifications.
// -----------------------------------------------------------------------------
//	dealloc:
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	windowNibName:
// -----------------------------------------------------------------------------
"MyDocument";
}
 
 
// -----------------------------------------------------------------------------
//	windowControllerDidLoadNib:
//		Set up our UI. This assigns the movie to our movie view (I don't
//		recommend doing it like this, by referencing [self fileName] in shipping
//		code), fills the presets popup with the avaiable presets and disables
//		the "export" button if there is no Turbo device plugged in right now.
// -----------------------------------------------------------------------------
// Fill presets popup with display names of all presets:
// Enable/disable the "Export" button depending on whether we have a Turbo device right now:
// -----------------------------------------------------------------------------
//	dataRepresentationOfType:
//		Stubbed out, this is only sample code, after all.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	loadDataRepresentation:ofType:
//		Stubbed out, this is only sample code, after all.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	turboDeviceCountChanged:
//		User plugged in or unplugged a Turbo device from the USB bus. Make sure
//		The export button's enable state is set up appropriately.
//
//		Note that we currently support only one Turbo device, but these
//		notifications come in every time a device is registered/unregistered in
//		IOKit.
//
//		Also, when we upload the Firmware to a device (we don't do this until
//		the first encode after a device was plugged in), we temporarily
//		unregister a device, so you may want to coalesce these notifications
//		if you do any obvious UI feedback when the device is unplugged.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	exportMovie:
//		Action for the "Export" button that actually kicks off our export
//		in a secondary thread.
// -----------------------------------------------------------------------------
// Will be released by finishExport: - this way we ensure no thread's autorelease pool kills the movie before another thread has managed to retain it.
// Needed so we get progress messages.
"unable to detach movie from current thread"// Get settings from user:
		//	We could use -exportSettingsFromPreset: instead and build the attributes
		//	for QTMovie's writeToFile: ourselves, but for most people this method is
		//	completely sufficient.
// Make sure user immediately sees we're working:
// Start the export:
"movie""exportSettings"// -----------------------------------------------------------------------------
//	doExportOnThread:
//		This is the actual exporting code that gets run in its own thread.
// -----------------------------------------------------------------------------
"movie""exportSettings"// Export the movie:
"/tmp/exportedMovie.mov""Error during export: %@"// -----------------------------------------------------------------------------
//	finishExport:
//		Called by the export thread once it has finished, on the main thread..
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	Update the progress bar:
 

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.