decoder/flac: remove obsolete sub-song support
This is obsolete because it has been moved to the MPD core.
This commit is contained in:
parent
e6389ff5a1
commit
70367d70c8
|
@ -33,7 +33,7 @@ flac_data::flac_data(Decoder &_decoder,
|
||||||
InputStream &_input_stream)
|
InputStream &_input_stream)
|
||||||
:FlacInput(_input_stream, &_decoder),
|
:FlacInput(_input_stream, &_decoder),
|
||||||
initialized(false), unsupported(false),
|
initialized(false), unsupported(false),
|
||||||
total_frames(0), first_frame(0), next_frame(0), position(0),
|
total_frames(0), position(0),
|
||||||
decoder(_decoder), input_stream(_input_stream)
|
decoder(_decoder), input_stream(_input_stream)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,6 @@ flac_common_write(struct flac_data *data, const FLAC__Frame * frame,
|
||||||
auto cmd = decoder_data(data->decoder, data->input_stream,
|
auto cmd = decoder_data(data->decoder, data->input_stream,
|
||||||
buffer, buffer_size,
|
buffer, buffer_size,
|
||||||
bit_rate);
|
bit_rate);
|
||||||
data->next_frame += frame->header.blocksize;
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case DecoderCommand::NONE:
|
case DecoderCommand::NONE:
|
||||||
case DecoderCommand::START:
|
case DecoderCommand::START:
|
||||||
|
|
|
@ -61,17 +61,6 @@ struct flac_data : public FlacInput {
|
||||||
*/
|
*/
|
||||||
FLAC__uint64 total_frames;
|
FLAC__uint64 total_frames;
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of the first frame in this song. This is only
|
|
||||||
* non-zero if playing sub songs from a CUE sheet.
|
|
||||||
*/
|
|
||||||
FLAC__uint64 first_frame;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of the next frame which is going to be decoded.
|
|
||||||
*/
|
|
||||||
FLAC__uint64 next_frame;
|
|
||||||
|
|
||||||
FLAC__uint64 position;
|
FLAC__uint64 position;
|
||||||
|
|
||||||
Decoder &decoder;
|
Decoder &decoder;
|
||||||
|
|
|
@ -167,13 +167,10 @@ flac_decoder_initialize(struct flac_data *data, FLAC__StreamDecoder *sd,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec,
|
flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec)
|
||||||
FLAC__uint64 t_start, FLAC__uint64 t_end)
|
|
||||||
{
|
{
|
||||||
Decoder &decoder = data->decoder;
|
Decoder &decoder = data->decoder;
|
||||||
|
|
||||||
data->first_frame = t_start;
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
DecoderCommand cmd;
|
DecoderCommand cmd;
|
||||||
if (!data->tag.IsEmpty()) {
|
if (!data->tag.IsEmpty()) {
|
||||||
|
@ -184,12 +181,9 @@ flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec,
|
||||||
cmd = decoder_get_command(decoder);
|
cmd = decoder_get_command(decoder);
|
||||||
|
|
||||||
if (cmd == DecoderCommand::SEEK) {
|
if (cmd == DecoderCommand::SEEK) {
|
||||||
FLAC__uint64 seek_sample = t_start +
|
FLAC__uint64 seek_sample =
|
||||||
decoder_seek_where_frame(decoder);
|
decoder_seek_where_frame(decoder);
|
||||||
if (seek_sample >= t_start &&
|
if (FLAC__stream_decoder_seek_absolute(flac_dec, seek_sample)) {
|
||||||
(t_end == 0 || seek_sample <= t_end) &&
|
|
||||||
FLAC__stream_decoder_seek_absolute(flac_dec, seek_sample)) {
|
|
||||||
data->next_frame = seek_sample;
|
|
||||||
data->position = 0;
|
data->position = 0;
|
||||||
decoder_command_finished(decoder);
|
decoder_command_finished(decoder);
|
||||||
} else
|
} else
|
||||||
|
@ -230,10 +224,6 @@ flac_decoder_loop(struct flac_data *data, FLAC__StreamDecoder *flac_dec,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t_end != 0 && data->next_frame >= t_end)
|
|
||||||
/* end of this sub track */
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!FLAC__stream_decoder_process_single(flac_dec) &&
|
if (!FLAC__stream_decoder_process_single(flac_dec) &&
|
||||||
decoder_get_command(decoder) == DecoderCommand::NONE) {
|
decoder_get_command(decoder) == DecoderCommand::NONE) {
|
||||||
/* a failure that was not triggered by a
|
/* a failure that was not triggered by a
|
||||||
|
@ -310,7 +300,7 @@ flac_decode_internal(Decoder &decoder,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
flac_decoder_loop(&data, flac_dec, 0, 0);
|
flac_decoder_loop(&data, flac_dec);
|
||||||
|
|
||||||
FLAC__stream_decoder_finish(flac_dec);
|
FLAC__stream_decoder_finish(flac_dec);
|
||||||
FLAC__stream_decoder_delete(flac_dec);
|
FLAC__stream_decoder_delete(flac_dec);
|
||||||
|
|
Loading…
Reference in New Issue