// // MPT_VideoServerPlugin.m // MPT_VideoServerPlugin // // Created by Andrew Salamon on 6/19/08. // Copyright 2008 Machine Perception Laboratory, University of California San Diego.. All rights reserved. // #import "MPT_VideoServerPlugin.h" #import @implementation MPT_VideoServerPlugin - (id)initWithBundle:(NSBundle *)_bundle { if( self = [super initWithBundle:_bundle] ) { videoServer = [[ImageServerWrapper alloc] init]; if( ![NSBundle loadNibNamed:@"VideoServerPrefView" owner:self] ) NSLog( @"Unable to load pref pane for MPT_VideoServerPlugin plugin." ); } return self; } - (void)dealloc { [videoServer release]; [super dealloc]; } // It's not OK to copy this plugin, so return nil. - (id)copyWithZone:(NSZone *)zone { return nil; } - (NSString *)pluginID { NSString *ident = [super pluginID]; if( [ident length] > 0 ) return ident; return @"edu.ucsd.mplab.plugins.VideoServer"; } - (NSString *)localizedName { return NSLocalizedStringFromTableInBundle(@"Video Server", nil, [self bundle], @""); } - (NSString *)internalName { return @"videoserver"; } - (NSString *)step { return MPT_PluginStep_Results; } - (NSView *)prefPane { return prefView; } - (NSMutableDictionary *)processResults:(NSDictionary *)results usingController:(id)controller { return nil; } - (NSString *)serverName { id serverName = [self getPrefForKey:@"videoServerName"]; if( ![serverName isKindOfClass:[NSString class]] || (0 == [serverName length]) ) return @"CERTserver"; return serverName; } - (void)setServerName:(NSString *)value { [self setPrefForKey:@"videoServerName" to:value]; } - (ImageServerWrapper *)videoServer { return videoServer; } - (BOOL)startWithSize:(NSSize)frameSize { if( 0 == [[self serverName] length] ) return NO; [videoServer setName:[self serverName]]; return [videoServer startWithSize:frameSize]; } - (void)stop { [videoServer stop]; } - (void)setName:(NSString *)value { [videoServer setName:value]; } - (void)setRowBytes:(int)value { [videoServer setRowBytes:value]; } - (void)copyFrameToBuffer:(unsigned char *)pixels { [videoServer copyFrameToBuffer:pixels]; } - (void)addAudioChunkToCurrentFrame:(AudioStreamBasicDescription)asbd:(Ptr)audioData:(long)audioLen { [videoServer addAudioChunkToCurrentFrame:asbd:audioData:audioLen]; } @end