decoder/faad: move code to faad_decoder_new()
Merge some duplicate code.
This commit is contained in:
parent
47e8fcf37e
commit
18787ebe8f
@ -217,6 +217,21 @@ faad_song_duration(DecoderBuffer *buffer, InputStream &is)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NeAACDecHandle
|
||||||
|
faad_decoder_new()
|
||||||
|
{
|
||||||
|
const NeAACDecHandle decoder = NeAACDecOpen();
|
||||||
|
|
||||||
|
NeAACDecConfigurationPtr config =
|
||||||
|
NeAACDecGetCurrentConfiguration(decoder);
|
||||||
|
config->outputFormat = FAAD_FMT_16BIT;
|
||||||
|
config->downMatrix = 1;
|
||||||
|
config->dontUpSampleImplicitSBR = 0;
|
||||||
|
NeAACDecSetConfiguration(decoder, config);
|
||||||
|
|
||||||
|
return decoder;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for NeAACDecInit() which works around some API
|
* Wrapper for NeAACDecInit() which works around some API
|
||||||
* inconsistencies in libfaad.
|
* inconsistencies in libfaad.
|
||||||
@ -297,12 +312,7 @@ faad_get_file_time_float(InputStream &is)
|
|||||||
if (length < 0) {
|
if (length < 0) {
|
||||||
AudioFormat audio_format;
|
AudioFormat audio_format;
|
||||||
|
|
||||||
NeAACDecHandle decoder = NeAACDecOpen();
|
NeAACDecHandle decoder = faad_decoder_new();
|
||||||
|
|
||||||
NeAACDecConfigurationPtr config =
|
|
||||||
NeAACDecGetCurrentConfiguration(decoder);
|
|
||||||
config->outputFormat = FAAD_FMT_16BIT;
|
|
||||||
NeAACDecSetConfiguration(decoder, config);
|
|
||||||
|
|
||||||
decoder_buffer_fill(buffer);
|
decoder_buffer_fill(buffer);
|
||||||
|
|
||||||
@ -344,14 +354,7 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
|
|||||||
|
|
||||||
/* create the libfaad decoder */
|
/* create the libfaad decoder */
|
||||||
|
|
||||||
const NeAACDecHandle decoder = NeAACDecOpen();
|
const NeAACDecHandle decoder = faad_decoder_new();
|
||||||
|
|
||||||
NeAACDecConfigurationPtr config =
|
|
||||||
NeAACDecGetCurrentConfiguration(decoder);
|
|
||||||
config->outputFormat = FAAD_FMT_16BIT;
|
|
||||||
config->downMatrix = 1;
|
|
||||||
config->dontUpSampleImplicitSBR = 0;
|
|
||||||
NeAACDecSetConfiguration(decoder, config);
|
|
||||||
|
|
||||||
while (!decoder_buffer_is_full(buffer) && !is.LockIsEOF() &&
|
while (!decoder_buffer_is_full(buffer) && !is.LockIsEOF() &&
|
||||||
decoder_get_command(mpd_decoder) == DecoderCommand::NONE) {
|
decoder_get_command(mpd_decoder) == DecoderCommand::NONE) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user