-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d439ed8
Showing
224 changed files
with
13,865 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// AVCWindowController.h | ||
// Vidi | ||
// | ||
// Created by Mitz Pettel on Mar 28 2003. | ||
// Copyright (c) 2003 Mitz Pettel. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
|
||
@interface AVCWindowController : NSWindowController | ||
{ | ||
IBOutlet NSButton *checkbox; | ||
IBOutlet NSTextField *cmd0; | ||
IBOutlet NSTextField *cmd1; | ||
IBOutlet NSTextField *cmd2; | ||
IBOutlet NSTextField *cmd3; | ||
IBOutlet NSTextField *cmd4; | ||
IBOutlet NSTextField *cmd5; | ||
IBOutlet NSTextField *cmd6; | ||
IBOutlet NSTextField *cmd7; | ||
IBOutlet NSTextField *response; | ||
} | ||
|
||
- (IBAction)send:(id)sender; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// AVCWindowController.m | ||
// Vidi | ||
// | ||
// Created by Mitz Pettel on Mar 28 2003. | ||
// Copyright (c) 2003 Mitz Pettel. All rights reserved. | ||
// | ||
|
||
#import "AVCWindowController.h" | ||
#import "DBVidi.h" | ||
|
||
@implementation AVCWindowController | ||
|
||
- (int)valueFromField:(NSTextField *)field | ||
{ | ||
int value; | ||
NSString *string = [field stringValue]; | ||
sscanf( [string cString], "%x", &value ); | ||
return value; | ||
} | ||
|
||
- (IBAction)send:(id)sender | ||
{ | ||
DBDVGrabber *grabber = [(DBVidi *)[NSApp delegate] grabber]; | ||
UInt8 cmd[8]; | ||
UInt8 rsp[8]; | ||
int size = 8; | ||
int len = ([checkbox state] ? 8 : 4); | ||
cmd[0] = [self valueFromField:cmd0]; | ||
cmd[1] = [self valueFromField:cmd1]; | ||
cmd[2] = [self valueFromField:cmd2]; | ||
cmd[3] = [self valueFromField:cmd3]; | ||
cmd[4] = [self valueFromField:cmd4]; | ||
cmd[5] = [self valueFromField:cmd5]; | ||
cmd[6] = [self valueFromField:cmd6]; | ||
cmd[7] = [self valueFromField:cmd7]; | ||
[grabber doAVCCommand:cmd length:len response:rsp size:&size]; | ||
[response setStringValue:[NSString stringWithFormat:@"%x %x %x %x", rsp[0], rsp[1], rsp[2], rsp[3]]]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// DBAudioCompression.h | ||
// Vidi | ||
// | ||
// Created by Mitz Pettel on Sat Jul 26 2003. | ||
// Copyright (c) 2003 Mitz Pettel. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@interface DBAudioCompression : NSObject { | ||
|
||
} | ||
|
||
+ (NSDictionary *)runStandardSoundCompressionDialogWithFormat:(NSDictionary *)initialFormat; | ||
|
||
+ (NSString *)descriptionOfFormat:(NSDictionary *)audioFormat; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
// | ||
// DBAudioCompression.m | ||
// Vidi | ||
// | ||
// Created by Mitz Pettel on Sat Jul 26 2003. | ||
// Copyright (c) 2003 Mitz Pettel. All rights reserved. | ||
// | ||
|
||
#import "DBAudioCompression.h" | ||
#import "NSDictionary-DBVidiJobAdditions.h" | ||
#import <QuickTime/QuickTimeComponents.h> | ||
|
||
@implementation DBAudioCompression | ||
|
||
+ (NSDictionary *)runStandardSoundCompressionDialogWithFormat:(NSDictionary *)initialFormat | ||
{ | ||
ComponentInstance stdComp = OpenDefaultComponent( StandardCompressionType, StandardCompressionSubTypeSound ); | ||
NSMutableDictionary *result = nil; | ||
OSStatus err; | ||
OSType compressionType; | ||
short numChannels; | ||
short sampleSize; | ||
UnsignedFixed sampleRate; | ||
Handle params; | ||
|
||
if ( initialFormat ) | ||
{ | ||
compressionType = [initialFormat audioCompression]; | ||
if ( compressionType==k16BitBigEndianFormat || compressionType==kSoundNotCompressed ) | ||
compressionType = k8BitOffsetBinaryFormat; | ||
err = SCSetInfo( stdComp, scSoundCompressionType, &compressionType ); | ||
|
||
numChannels = [initialFormat audioChannels]; | ||
err = SCSetInfo( stdComp, scSoundChannelCountType, &numChannels ); | ||
|
||
sampleSize = [initialFormat audioSampleSize]; | ||
err = SCSetInfo( stdComp, scSoundSampleSizeType, &sampleSize ); | ||
|
||
sampleRate = [initialFormat audioSampleRate]; | ||
err = SCSetInfo( stdComp, scSoundSampleRateType, &sampleRate ); | ||
|
||
if ( [initialFormat audioCompressionParameters] ) | ||
{ | ||
err = PtrToHand( | ||
[[initialFormat audioCompressionParameters] bytes], | ||
¶ms, | ||
[[initialFormat audioCompressionParameters] length] | ||
); | ||
HLock( params ); | ||
err = SCSetInfo( stdComp, scCodecSettingsType, ¶ms ); | ||
HUnlock( params ); | ||
DisposeHandle( params ); | ||
} | ||
} | ||
|
||
err = SCRequestImageSettings( stdComp ); | ||
if ( err ) | ||
return nil; | ||
|
||
err = SCGetInfo( stdComp, scSoundCompressionType, &compressionType ); | ||
err = SCGetInfo( stdComp, scSoundChannelCountType, &numChannels ); | ||
err = SCGetInfo( stdComp, scSoundSampleSizeType, &sampleSize ); | ||
err = SCGetInfo( stdComp, scSoundSampleRateType, &sampleRate ); | ||
err = SCGetInfo( stdComp, scCodecSettingsType, ¶ms ); | ||
|
||
err = CloseComponent( stdComp ); | ||
|
||
if ( compressionType==k8BitOffsetBinaryFormat ) { | ||
if ( sampleSize > 8 ) | ||
compressionType = k16BitBigEndianFormat; | ||
else | ||
compressionType = kSoundNotCompressed; | ||
} | ||
|
||
result = [NSMutableDictionary dictionaryWithObjectsAndKeys: | ||
[NSNumber numberWithUnsignedLong:sampleRate], DBVidiJobAudioSampleRateKey, | ||
[NSNumber numberWithInt:sampleSize], DBVidiJobAudioSampleSizeKey, | ||
[NSNumber numberWithInt:numChannels], DBVidiJobAudioChannelsKey, | ||
[NSNumber numberWithUnsignedLong:compressionType], DBVidiJobAudioCompressionKey, | ||
nil | ||
]; | ||
|
||
if ( params ) | ||
{ | ||
HLock( params ); | ||
[result | ||
setObject:[NSData dataWithBytes:*params length:GetHandleSize( params )] | ||
forKey:DBVidiJobAudioCompressionParamsKey | ||
]; | ||
HUnlock( params ); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
+ (NSString *)descriptionOfFormat:(NSDictionary *)audioFormat | ||
{ | ||
Str255 compressionNamePStr; | ||
NSString *compressionName; | ||
|
||
if ( [audioFormat audioCompression]!=kSoundNotCompressed && [audioFormat audioCompression]!=k16BitBigEndianFormat ) | ||
{ | ||
GetCompressionName( | ||
[audioFormat audioCompression], | ||
compressionNamePStr | ||
); | ||
p2cstrcpy((char *)compressionNamePStr, compressionNamePStr); | ||
compressionName = [NSString stringWithCString:(char *)compressionNamePStr]; | ||
} | ||
else | ||
compressionName = NSLocalizedString( @"Uncompressed", @"uncompressed audio" ); | ||
|
||
return [NSString | ||
stringWithFormat:NSLocalizedString( @"%@, %@, %.2f kHz, %d bits", @"audio format string: compression, 'mono' or 'stereo', sample rate, sample size" ), | ||
compressionName, | ||
( [audioFormat audioChannels]==2 ? | ||
NSLocalizedString( @"Stereo", @"" ) | ||
: NSLocalizedString( @"Mono", @"" ) | ||
), | ||
[audioFormat audioSampleRate]/65536000.0, | ||
[audioFormat audioSampleSize] | ||
]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// DBButton.h | ||
// Vidi | ||
// | ||
// Created by Mitz Pettel on Tue Jan 28 2003. | ||
// Copyright (c) 2002, 2003 Mitz Pettel. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
|
||
@interface DBButton : NSButton { | ||
|
||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// DBButton.m | ||
// Vidi | ||
// | ||
// Created by Mitz Pettel on Tue Jan 28 2003. | ||
// Copyright (c) 2002, 2003 Mitz Pettel. All rights reserved. | ||
// | ||
|
||
#import "DBButton.h" | ||
|
||
|
||
@implementation DBButton | ||
|
||
- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent | ||
{ | ||
return YES; | ||
} | ||
|
||
- (void)mouseDown:(NSEvent *)theEvent; | ||
{ | ||
[NSApp preventWindowOrdering]; | ||
[super mouseDown:theEvent]; | ||
} | ||
|
||
@end |
Oops, something went wrong.