Changeset 50
- Timestamp:
- 06/13/07 08:48:53 (1 year ago)
- Files:
-
- trunk/A52/ACShepA52Codec.cpp (modified) (1 diff)
- trunk/A52/ACShepA52Decoder.cpp (modified) (6 diffs)
- trunk/A52/ACShepA52Decoder.h (modified) (1 diff)
- trunk/A52Preferences/A52Preferences.h (modified) (2 diffs)
- trunk/A52Preferences/A52Preferences.m (modified) (4 diffs)
- trunk/A52Preferences/English.lproj/A52CodecPreferences.nib/classes.nib (modified) (1 diff)
- trunk/A52Preferences/English.lproj/A52CodecPreferences.nib/info.nib (modified) (2 diffs)
- trunk/A52Preferences/English.lproj/A52CodecPreferences.nib/keyedobjects.nib (modified) (previous)
- trunk/A52Preferences/Preferences-Info.plist (modified) (1 diff)
- trunk/Info-A52Codec__Upgraded_.plist (modified) (2 diffs)
- trunk/Info-AC3MovieImport.plist (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/A52/ACShepA52Codec.cpp
r1 r50 41 41 // make sure the sample rate and number of channels match between the input format and the output format 42 42 43 if( (mInputFormat.mSampleRate != mOutputFormat.mSampleRate) || 44 (mInputFormat.mChannelsPerFrame != mOutputFormat.mChannelsPerFrame)) 43 if( (mInputFormat.mSampleRate != mOutputFormat.mSampleRate)) 45 44 { 46 45 CODEC_THROW(kAudioCodecUnsupportedFormatError); trunk/A52/ACShepA52Decoder.cpp
r43 r50 21 21 22 22 #define kAudioFormatAVIAC3 0x6D732000 23 23 #define MY_APP_DOMAIN CFSTR("com.cod3r.a52codec") 24 25 //Old 26 #define USE_STEREO_KEY CFSTR("useStereoOverDolby") 27 #define USE_DPLII_KEY CFSTR("useDolbyProLogicII") 28 29 #define DYNAMIC_RANGE_KEY CFSTR("dynamicRange") 30 #define PASSTHROUGH_KEY CFSTR("attemptPassthrough") 31 #define TWO_CHANNEL_KEY CFSTR("twoChannelMode") 32 33 void ACShepA52Decoder::UpgradeOldPrefs() 34 { 35 CFStringRef myApp = MY_APP_DOMAIN; 36 int useStereoOverDolby = 0; 37 CFTypeRef stereo = CFPreferencesCopyAppValue(USE_STEREO_KEY, myApp); 38 if(stereo != NULL) 39 { 40 CFTypeID type = CFGetTypeID(stereo); 41 if(type == CFStringGetTypeID()) 42 useStereoOverDolby = CFStringGetIntValue((CFStringRef)stereo); 43 else if(type == CFNumberGetTypeID()) 44 CFNumberGetValue((CFNumberRef)stereo, kCFNumberIntType, &useStereoOverDolby); 45 else if(type == CFBooleanGetTypeID()) 46 useStereoOverDolby = CFBooleanGetValue((CFBooleanRef)stereo); 47 CFRelease(stereo); 48 } 49 50 int useDPL2 = 0; 51 CFTypeRef dpl2 = CFPreferencesCopyAppValue(USE_DPLII_KEY, myApp); 52 if(dpl2 != NULL) 53 { 54 CFTypeID type = CFGetTypeID(dpl2); 55 if(type == CFStringGetTypeID()) 56 useDPL2 = CFStringGetIntValue((CFStringRef)dpl2); 57 else if(type == CFNumberGetTypeID()) 58 CFNumberGetValue((CFNumberRef)dpl2, kCFNumberIntType, &useDPL2); 59 else if(type == CFBooleanGetTypeID()) 60 useDPL2 = CFBooleanGetValue((CFBooleanRef)dpl2); 61 CFRelease(dpl2); 62 } 63 64 if(useStereoOverDolby) 65 TwoChannelMode = A52_STEREO; 66 else if(useDPL2) 67 TwoChannelMode = A52_DOLBY | A52_USE_DPLII; 68 else 69 TwoChannelMode = A52_DOLBY; 70 71 CFNumberRef resultingMode = CFNumberCreate(NULL, kCFNumberIntType, &TwoChannelMode); 72 CFPreferencesSetAppValue(TWO_CHANNEL_KEY, resultingMode, myApp); 73 CFRelease(resultingMode); 74 CFPreferencesAppSynchronize(myApp); 75 } 24 76 25 77 ACShepA52Decoder::ACShepA52Decoder(UInt32 inInputBufferByteSize) : ACShepA52Codec(inInputBufferByteSize) { … … 56 108 kFloatPCMOutFormatFlag = kLinearPCMFormatFlagIsFloat | kLinearPCMFormatFlagIsPacked; 57 109 #endif 58 59 CFPreferencesAppSynchronize(CFSTR("com.cod3r.a52codec")); 60 CFTypeRef dynRange = CFPreferencesCopyAppValue(CFSTR("dynamicRange"), CFSTR("com.cod3r.a52codec")); 110 CFStringRef myApp = MY_APP_DOMAIN; 111 112 CFPreferencesAppSynchronize(myApp); 113 CFTypeRef dynRange = CFPreferencesCopyAppValue(DYNAMIC_RANGE_KEY, myApp); 61 114 if(dynRange != NULL) 62 115 { … … 73 126 dynamicRangeCompression = 1; //no compression 74 127 75 int useStereoOverDolby = 0; 76 CFTypeRef stereo = CFPreferencesCopyAppValue(CFSTR("useStereoOverDolby"), CFSTR("com.cod3r.a52codec")); 77 if(stereo != NULL) 78 { 79 CFTypeID type = CFGetTypeID(stereo); 80 if(type == CFStringGetTypeID()) 81 useStereoOverDolby = CFStringGetIntValue((CFStringRef)stereo); 82 else if(type == CFNumberGetTypeID()) 83 CFNumberGetValue((CFNumberRef)stereo, kCFNumberIntType, &useStereoOverDolby); 84 else if(type == CFBooleanGetTypeID()) 85 useStereoOverDolby = CFBooleanGetValue((CFBooleanRef)stereo); 86 CFRelease(stereo); 87 } 88 89 int useDPL2 = 0; 90 CFTypeRef dpl2 = CFPreferencesCopyAppValue(CFSTR("useDolbyProLogicII"), CFSTR("com.cod3r.a52codec")); 91 if(dpl2 != NULL) 92 { 93 CFTypeID type = CFGetTypeID(dpl2); 94 if(type == CFStringGetTypeID()) 95 useDPL2 = CFStringGetIntValue((CFStringRef)dpl2); 96 else if(type == CFNumberGetTypeID()) 97 CFNumberGetValue((CFNumberRef)dpl2, kCFNumberIntType, &useDPL2); 98 else if(type == CFBooleanGetTypeID()) 99 useDPL2 = CFBooleanGetValue((CFBooleanRef)dpl2); 100 CFRelease(dpl2); 101 } 102 103 if(useStereoOverDolby) 104 TwoChannelMode = A52_STEREO; 105 else if(useDPL2) 106 TwoChannelMode = A52_DOLBY | A52_USE_DPLII; 107 else 108 TwoChannelMode = A52_DOLBY; 109 110 CFTypeRef pass = CFPreferencesCopyAppValue(CFSTR("attemptPassthrough"), CFSTR("com.cod3r.a52codec")); 128 CFTypeRef pass = CFPreferencesCopyAppValue(PASSTHROUGH_KEY, myApp); 111 129 if(pass != NULL) 112 130 { … … 123 141 passthrough = 0; 124 142 125 if(passthrough) 143 CFTypeRef twochan = CFPreferencesCopyAppValue(TWO_CHANNEL_KEY, myApp); 144 if(twochan != NULL) 145 { 146 CFTypeID type = CFGetTypeID(twochan); 147 if(type == CFStringGetTypeID()) 148 TwoChannelMode = CFStringGetIntValue((CFStringRef)twochan); 149 else if(type == CFNumberGetTypeID()) 150 CFNumberGetValue((CFNumberRef)twochan, kCFNumberIntType, &TwoChannelMode); 151 else 152 TwoChannelMode = 0; 153 /* sanity checks */ 154 if(TwoChannelMode & A52_CHANNEL_MASK & 0xf7 != 2) 155 { 156 /* matches 2 and 10, which is Stereo and Dolby */ 157 TwoChannelMode = A52_DOLBY; 158 } 159 TwoChannelMode &= ~A52_ADJUST_LEVEL & ~A52_LFE; 160 CFRelease(twochan); 161 } 162 else 163 UpgradeOldPrefs(); 164 CFPreferencesSetAppValue(USE_STEREO_KEY, NULL, myApp); 165 CFPreferencesSetAppValue(USE_DPLII_KEY, NULL, myApp); 166 167 if(passthrough || TwoChannelMode) 126 168 { 127 169 //begin our passthrough hack … … 129 171 for (int sample_index = 0; sample_index < 12; sample_index ++) 130 172 { 131 for (int channels = 1; channels <= 2; channels++) { 132 CAStreamBasicDescription theOutputFormat(sample_rates[sample_index], kAudioFormatLinearPCM, 0, 1, 0, channels, 16, kIntPCMOutFormatFlag); 133 AddOutputFormat(theOutputFormat); 173 CAStreamBasicDescription theOutputFormat(sample_rates[sample_index], kAudioFormatLinearPCM, 0, 1, 0, 2, 16, kIntPCMOutFormatFlag); 174 AddOutputFormat(theOutputFormat); 175 if(!passthrough) 176 { 177 // 32 bit int 178 CAStreamBasicDescription theOutputFormat1(sample_rates[sample_index], kAudioFormatLinearPCM, 0, 1, 0, 2, 32, kIntPCMOutFormatFlag); 179 AddOutputFormat(theOutputFormat1); 180 // 32 bit float 181 CAStreamBasicDescription theOutputFormat2(sample_rates[sample_index], kAudioFormatLinearPCM, 0, 1, 0, 2, 32, kFloatPCMOutFormatFlag); 182 AddOutputFormat(theOutputFormat2); 183 } 184 for (int channels = 1; channels <= 6; channels++) { 134 185 // This decoder only takes an A/52 or AC-3 stream as it's input 135 186 CAStreamBasicDescription theInputFormat1(sample_rates[sample_index], kAudioFormatAC3, 0, 256*6, 0, channels, 0, 0); … … 139 190 } 140 191 } 141 142 192 } 143 193 else trunk/A52/ACShepA52Decoder.h
r43 r50 57 57 // Implementation 58 58 private: 59 void ACShepA52Decoder::UpgradeOldPrefs(); 59 60 void DetermineStreamParameters(); 60 61 UInt32 SyncA52Stream(UInt32 &bytes_to_read, Byte *input_data, int &a52_flags, int &a52_samplerate, int &a52_bitrate, bool shouldResync); trunk/A52Preferences/A52Preferences.h
r43 r50 7 7 IBOutlet NSWindow *window_mainWindow; 8 8 IBOutlet NSPopUpButton *popup_ac3DynamicRangeType; 9 IBOutlet NSPopUpButton *popup_ 2ChannelMode;9 IBOutlet NSPopUpButton *popup_OutputMode; 10 10 11 11 IBOutlet NSWindow *window_dynRangeSheet; … … 16 16 float dynValue; 17 17 float savedDynValue; 18 BOOL useStereo; 19 BOOL useDPL2; 18 int twoChannelMode; 20 19 } 21 20 trunk/A52Preferences/A52Preferences.m
r44 r50 1 1 #import "A52Preferences.h" 2 3 #include "a52.h" 4 5 //Old 6 #define USE_STEREO_KEY @"useStereoOverDolby" 7 #define USE_DPLII_KEY @"useDolbyProLogicII" 8 9 #define DYNAMIC_RANGE_KEY @"dynamicRange" 10 #define PASSTHROUGH_KEY @"attemptPassthrough" 11 #define TWO_CHANNEL_KEY @"twoChannelMode" 2 12 3 13 @interface A52Preferences (private) … … 17 27 } 18 28 29 - (void)upgradeOldPrefs 30 { 31 if([defaults boolForKey:USE_STEREO_KEY]) 32 twoChannelMode = A52_STEREO; 33 else if([defaults boolForKey:USE_DPLII_KEY]) 34 twoChannelMode = A52_DOLBY | A52_USE_DPLII; 35 else 36 twoChannelMode = A52_DOLBY; 37 38 [defaults setInteger:twoChannelMode forKey:TWO_CHANNEL_KEY]; 39 } 40 19 41 - (void)awakeFromNib 20 42 { 21 if([defaults objectForKey: @"dynamicRange"] != nil)22 [self setAC3DynamicRange:[defaults floatForKey: @"dynamicRange"]];43 if([defaults objectForKey:DYNAMIC_RANGE_KEY] != nil) 44 [self setAC3DynamicRange:[defaults floatForKey:DYNAMIC_RANGE_KEY]]; 23 45 else 24 46 [self setAC3DynamicRange:1.0]; 25 if([defaults boolForKey:@"useStereoOverDolby"])47 if([defaults objectForKey:TWO_CHANNEL_KEY] != nil) 26 48 { 27 useStereo = YES;28 useDPL2 = NO; 29 [popup_2ChannelMode selectItemAtIndex:0];30 }31 else if([defaults boolForKey:@"useDolbyProLogicII"])32 {33 useStereo = NO;34 useDPL2 = YES;35 [popup_2ChannelMode selectItemAtIndex:2];49 twoChannelMode = [defaults integerForKey:TWO_CHANNEL_KEY]; 50 51 /* sanity checks */ 52 if(twoChannelMode & A52_CHANNEL_MASK & 0xf7 != 2) 53 { 54 /* matches 2 and 10, which is Stereo and Dolby */ 55 twoChannelMode = A52_DOLBY; 56 } 57 twoChannelMode &= ~A52_ADJUST_LEVEL & ~A52_LFE; 36 58 } 37 59 else 38 60 { 39 useStereo = NO; 40 useDPL2 = NO; 41 [popup_2ChannelMode selectItemAtIndex:1]; 61 [self upgradeOldPrefs]; 62 } 63 [defaults removeObjectForKey:USE_STEREO_KEY]; 64 [defaults removeObjectForKey:USE_DPLII_KEY]; 65 switch(twoChannelMode) 66 { 67 case A52_STEREO: 68 [popup_OutputMode selectItemAtIndex:0]; 69 break; 70 case A52_DOLBY: 71 [popup_OutputMode selectItemAtIndex:1]; 72 break; 73 case A52_DOLBY | A52_USE_DPLII: 74 [popup_OutputMode selectItemAtIndex:2]; 75 break; 76 default: 77 [popup_OutputMode selectItemAtIndex:3]; 78 break; 42 79 } 43 80 } … … 71 108 - (IBAction)set2ChannelModePopup:(id)sender; 72 109 { 73 int selected = [popup_ 2ChannelMode indexOfSelectedItem];110 int selected = [popup_OutputMode indexOfSelectedItem]; 74 111 switch(selected) 75 112 { 76 113 case 0: 77 useStereo = YES; 78 useDPL2 = NO; 114 twoChannelMode = A52_STEREO; 79 115 break; 80 116 case 1: 81 useStereo = NO; 82 useDPL2 = NO; 117 twoChannelMode = A52_DOLBY; 83 118 break; 84 119 case 2: 85 useStereo = NO; 86 useDPL2 = YES; 120 twoChannelMode = A52_DOLBY | A52_USE_DPLII; 87 121 break; 122 case 3: 123 twoChannelMode = 0; 88 124 default: 89 125 break; … … 143 179 - (IBAction)save:(id)sender 144 180 { 145 [defaults setFloat:dynValue forKey:@"dynamicRange"]; 146 [defaults setBool:useStereo forKey:@"useStereoOverDolby"]; 147 [defaults setBool:useDPL2 forKey:@"useDolbyProLogicII"]; 181 [defaults setFloat:dynValue forKey:DYNAMIC_RANGE_KEY]; 182 [defaults setInteger:twoChannelMode forKey:TWO_CHANNEL_KEY]; 148 183 [defaults synchronize]; 149 184 [[NSApplication sharedApplication] terminate:nil]; trunk/A52Preferences/English.lproj/A52CodecPreferences.nib/classes.nib
r43 r50 15 15 LANGUAGE = ObjC; 16 16 OUTLETS = { 17 "popup_ 2ChannelMode" = NSPopUpButton;17 "popup_OutputMode" = NSPopUpButton; 18 18 "popup_ac3DynamicRangeType" = NSPopUpButton; 19 19 "slider_ac3DynamicRangeSlider" = NSSlider; trunk/A52Preferences/English.lproj/A52CodecPreferences.nib/info.nib
r44 r50 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string> 56 11 356 240 0 0 1440 878 </string>6 <string>69 14 356 240 0 0 1680 1028 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> 9 9 <key>29</key> 10 <string> 58 220 185 44 0 0 1440 878 </string>10 <string>69 259 185 44 0 0 1680 1028 </string> 11 11 </dict> 12 12 <key>IBFramework Version</key> … … 14 14 <key>IBOpenObjects</key> 15 15 <array> 16 <integer>286</integer> 17 <integer>29</integer> 16 18 <integer>21</integer> 17 <integer>29</integer>18 19 </array> 19 20 <key>IBSystem Version</key> 20 <string>8P 2137</string>21 <string>8P135</string> 21 22 </dict> 22 23 </plist> trunk/A52Preferences/Preferences-Info.plist
r41 r50 16 16 <string>????</string> 17 17 <key>CFBundleVersion</key> 18 <string>1.7. 5</string>18 <string>1.7.6</string> 19 19 <key>NSMainNibFile</key> 20 20 <string>A52CodecPreferences</string> trunk/Info-A52Codec__Upgraded_.plist
r41 r50 8 8 <string>A52Codec</string> 9 9 <key>CFBundleGetInfoString</key> 10 <string>1.7. 5, CoreAudio A/52 and AC-3 Codec Component</string>10 <string>1.7.6, CoreAudio A/52 and AC-3 Codec Component</string> 11 11 <key>CFBundleIconFile</key> 12 12 <string></string> … … 20 20 <string>BNDL</string> 21 21 <key>CFBundleShortVersionString</key> 22 <string>1.7. 5</string>22 <string>1.7.6</string> 23 23 <key>CFBundleSignature</key> 24 24 <string>SHEP</string> 25 25 <key>CFBundleVersion</key> 26 <string>1.7. 5</string>26 <string>1.7.6</string> 27 27 </dict> 28 28 </plist> trunk/Info-AC3MovieImport.plist
r41 r50 16 16 <string>BNDL</string> 17 17 <key>CFBundleShortVersionString</key> 18 <string>1.7. 5</string>18 <string>1.7.6</string> 19 19 <key>CFBundleSignature</key> 20 20 <string>eat </string> 21 21 <key>CFBundleVersion</key> 22 <string>1.7. 5</string>22 <string>1.7.6</string> 23 23 <key>CSResourcesFileMapped</key> 24 24 <true/>
