HDCD Decoder: Only process lossless tracks
parent
0c4d5002f6
commit
9d1fd08574
|
@ -62,8 +62,10 @@
|
|||
|
||||
if (![inputNode openWithSource:source])
|
||||
return NO;
|
||||
|
||||
NSDictionary * properties = [inputNode properties];
|
||||
|
||||
if (![converterNode setupWithInputFormat:(inputFormat = propertiesToASBD([inputNode properties])) outputFormat:outputFormat])
|
||||
if (![converterNode setupWithInputFormat:(inputFormat = propertiesToASBD(properties)) outputFormat:outputFormat isLossless:[[properties valueForKey:@"encoding"] isEqualToString:@"lossless"]])
|
||||
return NO;
|
||||
|
||||
[self setRGInfo:rgi];
|
||||
|
@ -81,8 +83,10 @@
|
|||
if (![inputNode openWithDecoder:[i decoder]])
|
||||
return NO;
|
||||
|
||||
DLog(@"Input Properties: %@", [inputNode properties]);
|
||||
if (![converterNode setupWithInputFormat:(inputFormat = propertiesToASBD([inputNode properties])) outputFormat:outputFormat])
|
||||
NSDictionary * properties = [inputNode properties];
|
||||
|
||||
DLog(@"Input Properties: %@", properties);
|
||||
if (![converterNode setupWithInputFormat:(inputFormat = propertiesToASBD(properties)) outputFormat:outputFormat isLossless:[[properties objectForKey:@"encoding"] isEqualToString:@"lossless"]])
|
||||
return NO;
|
||||
|
||||
[self setRGInfo:rgi];
|
||||
|
@ -100,8 +104,10 @@
|
|||
if (![inputNode openWithDecoder:decoder])
|
||||
return NO;
|
||||
|
||||
DLog(@"Input Properties: %@", [inputNode properties]);
|
||||
if (![converterNode setupWithInputFormat:(inputFormat = propertiesToASBD([inputNode properties])) outputFormat:outputFormat])
|
||||
NSDictionary * properties = [inputNode properties];
|
||||
|
||||
DLog(@"Input Properties: %@", properties);
|
||||
if (![converterNode setupWithInputFormat:(inputFormat = propertiesToASBD(properties)) outputFormat:outputFormat isLossless:[[properties objectForKey:@"encoding"] isEqualToString:@"lossless"]])
|
||||
return NO;
|
||||
|
||||
[self setRGInfo:rgi];
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
size_t dsd2pcmCount;
|
||||
int dsd2pcmLatency;
|
||||
int dsdLatencyEaten;
|
||||
|
||||
BOOL rememberedLossless;
|
||||
|
||||
AudioStreamBasicDescription inputFormat;
|
||||
AudioStreamBasicDescription floatFormat;
|
||||
|
@ -79,7 +81,7 @@
|
|||
|
||||
- (id)initWithController:(id)c previous:(id)p;
|
||||
|
||||
- (BOOL)setupWithInputFormat:(AudioStreamBasicDescription)inputFormat outputFormat:(AudioStreamBasicDescription)outputFormat;
|
||||
- (BOOL)setupWithInputFormat:(AudioStreamBasicDescription)inputFormat outputFormat:(AudioStreamBasicDescription)outputFormat isLossless:(BOOL)lossless;
|
||||
- (void)cleanUp;
|
||||
|
||||
- (void)process;
|
||||
|
|
|
@ -709,7 +709,7 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes
|
|||
[self setShouldContinue:YES];
|
||||
refillNode = nil;
|
||||
[self cleanUp];
|
||||
[self setupWithInputFormat:rememberedInputFormat outputFormat:outputFormat];
|
||||
[self setupWithInputFormat:rememberedInputFormat outputFormat:outputFormat isLossless:rememberedLossless];
|
||||
continue;
|
||||
}
|
||||
else break;
|
||||
|
@ -1153,12 +1153,14 @@ static float db_to_scale(float db)
|
|||
}
|
||||
|
||||
|
||||
- (BOOL)setupWithInputFormat:(AudioStreamBasicDescription)inf outputFormat:(AudioStreamBasicDescription)outf
|
||||
- (BOOL)setupWithInputFormat:(AudioStreamBasicDescription)inf outputFormat:(AudioStreamBasicDescription)outf isLossless:(BOOL)lossless
|
||||
{
|
||||
//Make the converter
|
||||
inputFormat = inf;
|
||||
outputFormat = outf;
|
||||
|
||||
rememberedLossless = lossless;
|
||||
|
||||
// These are the only sample formats we support translating
|
||||
BOOL isFloat = !!(inputFormat.mFormatFlags & kAudioFormatFlagIsFloat);
|
||||
if ((!isFloat && !(inputFormat.mBitsPerChannel >= 1 && inputFormat.mBitsPerChannel <= 32))
|
||||
|
@ -1166,7 +1168,8 @@ static float db_to_scale(float db)
|
|||
return NO;
|
||||
|
||||
// These are really placeholders, as we're doing everything internally now
|
||||
if (inputFormat.mBitsPerChannel == 16 &&
|
||||
if (lossless &&
|
||||
inputFormat.mBitsPerChannel == 16 &&
|
||||
inputFormat.mChannelsPerFrame == 2 &&
|
||||
inputFormat.mSampleRate == 44100) {
|
||||
// possibly HDCD, run through decoder
|
||||
|
@ -1315,11 +1318,11 @@ static float db_to_scale(float db)
|
|||
break;
|
||||
}
|
||||
|
||||
[self setupWithInputFormat:previousOutputFormat outputFormat:outputFormat];
|
||||
[self setupWithInputFormat:previousOutputFormat outputFormat:outputFormat isLossless:rememberedLossless];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setupWithInputFormat:format outputFormat:outputFormat];
|
||||
[self setupWithInputFormat:format outputFormat:outputFormat isLossless:rememberedLossless];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue