Skip to content

Commit

Permalink
Vidi-0-4-7
Browse files Browse the repository at this point in the history
  • Loading branch information
mitzpettel committed Jul 3, 2010
0 parents commit d439ed8
Show file tree
Hide file tree
Showing 224 changed files with 13,865 additions and 0 deletions.
24 changes: 24 additions & 0 deletions AVCCommander.nib/classes.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions AVCCommander.nib/info.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added AVCCommander.nib/objects.nib
Binary file not shown.
28 changes: 28 additions & 0 deletions AVCWindowController.h
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
41 changes: 41 additions & 0 deletions AVCWindowController.m
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
20 changes: 20 additions & 0 deletions DBAudioCompression.h
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
125 changes: 125 additions & 0 deletions DBAudioCompression.m
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],
&params,
[[initialFormat audioCompressionParameters] length]
);
HLock( params );
err = SCSetInfo( stdComp, scCodecSettingsType, &params );
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, &params );

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
16 changes: 16 additions & 0 deletions DBButton.h
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
25 changes: 25 additions & 0 deletions DBButton.m
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
Loading

0 comments on commit d439ed8

Please sign in to comment.