Changeset 574

Show
Ignore:
Timestamp:
06/13/07 08:43:23 (1 year ago)
Author:
gbooker
Message:

My multi-channel output test. This should work, but that is the point of a beta (to test it).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CPFPerianPrefPaneController.h

    r404 r574  
    5757        //AC3 Settings in General Pane 
    5858        IBOutlet NSPopUpButton                          *popup_ac3DynamicRangeType; 
    59         IBOutlet NSPopUpButton                          *popup_2ChannelMode; 
     59        IBOutlet NSPopUpButton                          *popup_outputMode; 
    6060         
    6161        IBOutlet NSWindow                                       *window_dynRangeSheet; 
  • trunk/CPFPerianPrefPaneController.m

    r559 r574  
    44 
    55#define AC3DynamicRangeKey CFSTR("dynamicRange") 
     6#define LastInstalledVersionKey CFSTR("LastInstalledVersion") 
     7#define AC3TwoChannelModeKey CFSTR("twoChannelMode") 
     8 
     9//Old 
    610#define AC3StereoOverDolbyKey CFSTR("useStereoOverDolby") 
    711#define AC3ProLogicIIKey CFSTR("useDolbyProLogicII") 
    8 #define LastInstalledVersionKey CFSTR("LastInstalledVersion") 
     12 
     13//A52 Constants 
     14#define A52_STEREO 2 
     15#define A52_DOLBY 10 
     16#define A52_CHANNEL_MASK 15 
     17#define A52_LFE 16 
     18#define A52_ADJUST_LEVEL 32 
     19#define A52_USE_DPLII 64 
    920 
    1021@interface NSString (VersionStringCompare) 
     
    6879} 
    6980 
    70 - (void)setKey:(CFStringRef)key forAppID:(CFStringRef)appID fromString:(NSString *)value 
    71 
    72         CFPreferencesSetAppValue(key, value, appID); 
     81- (void)setKey:(CFStringRef)key forAppID:(CFStringRef)appID fromFloat:(float)value 
     82
     83        CFNumberRef numRef = CFNumberCreate(NULL, kCFNumberFloatType, &value); 
     84        CFPreferencesSetAppValue(key, numRef, appID); 
     85        CFRelease(numRef); 
     86
     87 
     88- (int)getIntFromKey:(CFStringRef)key forAppID:(CFStringRef)appID withDefault:(int)defaultValue 
     89
     90        CFPropertyListRef value; 
     91        int ret = defaultValue; 
     92         
     93        value = CFPreferencesCopyAppValue(key, appID); 
     94        if(value && CFGetTypeID(value) == CFNumberGetTypeID()) 
     95                CFNumberGetValue(value, kCFNumberIntType, &ret); 
     96         
     97        if(value) 
     98                CFRelease(value); 
     99         
     100        return ret; 
     101
     102 
     103- (void)setKey:(CFStringRef)key forAppID:(CFStringRef)appID fromInt:(int)value 
     104
     105        CFNumberRef numRef = CFNumberCreate(NULL, kCFNumberIntType, &value); 
     106        CFPreferencesSetAppValue(key, numRef, appID); 
     107        CFRelease(numRef); 
    73108} 
    74109 
     
    88123} 
    89124 
    90 - (void)setKey:(CFStringRef)key forAppID:(CFStringRef)appID fromFloat:(float)value 
    91 
    92         CFNumberRef numRef = CFNumberCreate(NULL, kCFNumberFloatType, &value); 
    93         CFPreferencesSetAppValue(key, numRef, appID); 
    94         CFRelease(numRef); 
     125- (void)setKey:(CFStringRef)key forAppID:(CFStringRef)appID fromString:(NSString *)value 
     126
     127        CFPreferencesSetAppValue(key, value, appID); 
    95128} 
    96129 
     
    271304} 
    272305 
     306- (int)upgradeA52Prefs 
     307{ 
     308        int twoChannelMode; 
     309        if([self getBoolFromKey:AC3StereoOverDolbyKey forAppID:a52AppID withDefault:NO]) 
     310                twoChannelMode = A52_STEREO; 
     311        else if([self getBoolFromKey:AC3ProLogicIIKey forAppID:a52AppID withDefault:NO]) 
     312                twoChannelMode = A52_DOLBY | A52_USE_DPLII; 
     313        else 
     314                twoChannelMode = A52_DOLBY; 
     315         
     316        [self setKey:AC3TwoChannelModeKey forAppID:a52AppID fromInt:twoChannelMode]; 
     317        return twoChannelMode; 
     318} 
     319 
    273320- (void)didSelect 
    274321{ 
     
    311358         
    312359        /* A52 Prefs */ 
    313         if([self getBoolFromKey:AC3StereoOverDolbyKey forAppID:a52AppID withDefault:NO]) 
    314         { 
    315                 [popup_2ChannelMode selectItemAtIndex:0]; 
    316         } 
    317         else if([self getBoolFromKey:AC3ProLogicIIKey forAppID:a52AppID withDefault:NO]) 
    318         { 
    319                 [popup_2ChannelMode selectItemAtIndex:2]; 
    320         } 
    321         else 
    322         { 
    323                 [popup_2ChannelMode selectItemAtIndex:1];                
    324         }        
     360        int twoChannelMode = [self getIntFromKey:AC3TwoChannelModeKey forAppID:a52AppID withDefault:0xffffffff]; 
     361        if(twoChannelMode != 0xffffffff) 
     362        { 
     363                /* sanity checks */ 
     364                if(twoChannelMode & A52_CHANNEL_MASK & 0xf7 != 2) 
     365                { 
     366                        /* matches 2 and 10, which is Stereo and Dolby */ 
     367                        twoChannelMode = A52_DOLBY; 
     368                } 
     369                twoChannelMode &= ~A52_ADJUST_LEVEL & ~A52_LFE;          
     370        } 
     371        else 
     372                twoChannelMode = [self upgradeA52Prefs]; 
     373        CFPreferencesSetAppValue(AC3StereoOverDolbyKey, NULL, a52AppID); 
     374        CFPreferencesSetAppValue(AC3ProLogicIIKey, NULL, a52AppID); 
     375        switch(twoChannelMode) 
     376        { 
     377                case A52_STEREO: 
     378                        [popup_outputMode selectItemAtIndex:0]; 
     379                        break; 
     380                case A52_DOLBY: 
     381                        [popup_outputMode selectItemAtIndex:1]; 
     382                        break; 
     383                case A52_DOLBY | A52_USE_DPLII: 
     384                        [popup_outputMode selectItemAtIndex:2]; 
     385                        break; 
     386                default: 
     387                        [popup_outputMode selectItemAtIndex:3]; 
     388                        break;                   
     389        } 
     390         
    325391        [self setAC3DynamicRange:[self getFloatFromKey:AC3DynamicRangeKey forAppID:a52AppID withDefault:1.0]]; 
    326392} 
     
    676742- (IBAction)set2ChannelModePopup:(id)sender; 
    677743{ 
    678         int selected = [popup_2ChannelMode indexOfSelectedItem]; 
     744        int selected = [popup_outputMode indexOfSelectedItem]; 
    679745        switch(selected) 
    680746        { 
    681747                case 0: 
    682                         [self setKey:AC3StereoOverDolbyKey forAppID:a52AppID fromBool:YES]; 
    683                         [self setKey:AC3ProLogicIIKey forAppID:a52AppID fromBool:NO]; 
     748                        [self setKey:AC3TwoChannelModeKey forAppID:a52AppID fromInt:A52_STEREO]; 
    684749                        break; 
    685750                case 1: 
    686                         [self setKey:AC3StereoOverDolbyKey forAppID:a52AppID fromBool:NO]; 
    687                         [self setKey:AC3ProLogicIIKey forAppID:a52AppID fromBool:NO]; 
     751                        [self setKey:AC3TwoChannelModeKey forAppID:a52AppID fromInt:A52_DOLBY]; 
    688752                        break; 
    689753                case 2: 
    690                         [self setKey:AC3StereoOverDolbyKey forAppID:a52AppID fromBool:NO]; 
    691                         [self setKey:AC3ProLogicIIKey forAppID:a52AppID fromBool:YES]; 
     754                        [self setKey:AC3TwoChannelModeKey forAppID:a52AppID fromInt:A52_DOLBY | A52_USE_DPLII]; 
     755                        break; 
     756                case 3: 
     757                        [self setKey:AC3TwoChannelModeKey forAppID:a52AppID fromInt:0]; 
    692758                        break; 
    693759                default: 
  • trunk/PerianPrefPane.nib/classes.nib

    r404 r574  
    2525                "button_updateCheck" = NSButton;  
    2626                "button_website" = NSButton;  
    27                 "popup_2ChannelMode" = NSPopUpButton;  
    2827                "popup_ac3DynamicRangeType" = NSPopUpButton;  
     28                "popup_outputMode" = NSPopUpButton;  
    2929                "progress_install" = NSProgressIndicator;  
    3030                "progress_updateCheck" = NSProgressIndicator;  
  • trunk/PerianPrefPane.nib/info.nib

    r559 r574  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>112 62 356 240 0 0 1440 878 </string> 
     6        <string>137 77 356 240 0 0 1680 1028 </string> 
    77        <key>IBFramework Version</key> 
    88        <string>446.1</string> 
     
    1313        </array> 
    1414        <key>IBSystem Version</key> 
    15         <string>8P2137</string> 
     15        <string>8P135</string> 
    1616</dict> 
    1717</plist> 
  • trunk/bitstream_info.c

    r463 r574  
    6868{ 
    6969        int offset = ac3_synchronize(buffer, buff_size); 
    70         int passthrough = 0; 
    7170        if(offset == -1) 
    7271                return 0; 
     
    7473        if(buff_size < offset + 7) 
    7574                return 0; 
    76         CFTypeRef pass = CFPreferencesCopyAppValue(CFSTR("attemptPassthrough"), CFSTR("com.cod3r.a52codec")); 
    77         if(pass != NULL) 
    78         { 
    79                 CFTypeID type = CFGetTypeID(pass); 
    80                 if(type == CFStringGetTypeID()) 
    81                         passthrough = CFStringGetIntValue((CFStringRef)pass); 
    82                 else if(type == CFNumberGetTypeID()) 
    83                         CFNumberGetValue((CFNumberRef)pass, kCFNumberIntType, &passthrough); 
    84                 CFRelease(pass); 
    85         } 
    8675         
    8776        uint8_t fscod_and_frmsizecod = buffer[offset + 4]; 
     
    114103                shift = bsid - 8; 
    115104         
    116         if(passthrough) 
    117         { 
    118                 if(acmod > 2) 
    119                         acmod = 0; 
    120                 lfe = 0; 
    121         } 
    122105        /* Setup the AudioStreamBasicDescription and AudioChannelLayout */ 
    123106        memset(asbd, 0, sizeof(AudioStreamBasicDescription));