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