aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/_flac_common.c2
-rw-r--r--src/decoder/aac_plugin.c9
-rw-r--r--src/decoder/audiofile_plugin.c4
-rw-r--r--src/decoder/ffmpeg_plugin.c5
-rw-r--r--src/decoder/flac_plugin.c3
-rw-r--r--src/decoder/mod_plugin.c4
-rw-r--r--src/decoder/mp3_plugin.c4
-rw-r--r--src/decoder/mp4_plugin.c4
-rw-r--r--src/decoder/mpc_plugin.c4
-rw-r--r--src/decoder/oggflac_plugin.c3
-rw-r--r--src/decoder/oggvorbis_plugin.c4
-rw-r--r--src/decoder/wavpack_plugin.c4
-rw-r--r--src/decoder_api.c24
-rw-r--r--src/decoder_api.h4
-rw-r--r--src/decoder_thread.c3
15 files changed, 37 insertions, 44 deletions
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c
index 5c160c103..a8a856755 100644
--- a/src/decoder/_flac_common.c
+++ b/src/decoder/_flac_common.c
@@ -300,7 +300,7 @@ flac_common_write(FlacData *data, const FLAC__Frame * frame,
c_samp, c_samp + num_samples);
cmd = decoder_data(data->decoder, data->inStream,
- 1, data->chunk,
+ data->chunk,
num_samples * bytes_per_channel,
data->time, data->bitRate,
data->replayGainInfo);
diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c
index bf4879a19..66c2d11be 100644
--- a/src/decoder/aac_plugin.c
+++ b/src/decoder/aac_plugin.c
@@ -391,7 +391,8 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
if (!initialized) {
audio_format.channels = frameInfo.channels;
audio_format.sample_rate = sample_rate;
- decoder_initialized(mpd_decoder, &audio_format, totalTime);
+ decoder_initialized(mpd_decoder, &audio_format,
+ false, totalTime);
initialized = true;
}
@@ -410,7 +411,7 @@ aac_stream_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
sampleBufferLen = sampleCount * 2;
- decoder_data(mpd_decoder, NULL, 0, sampleBuffer,
+ decoder_data(mpd_decoder, NULL, sampleBuffer,
sampleBufferLen, file_time,
bitRate, NULL);
if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) {
@@ -527,7 +528,7 @@ aac_decode(struct decoder *mpd_decoder, const char *path)
audio_format.channels = frameInfo.channels;
audio_format.sample_rate = sample_rate;
decoder_initialized(mpd_decoder, &audio_format,
- totalTime);
+ false, totalTime);
initialized = true;
}
@@ -546,7 +547,7 @@ aac_decode(struct decoder *mpd_decoder, const char *path)
sampleBufferLen = sampleCount * 2;
- decoder_data(mpd_decoder, NULL, 0, sampleBuffer,
+ decoder_data(mpd_decoder, NULL, sampleBuffer,
sampleBufferLen, file_time,
bitRate, NULL);
if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) {
diff --git a/src/decoder/audiofile_plugin.c b/src/decoder/audiofile_plugin.c
index 51e1559ce..3c702efe6 100644
--- a/src/decoder/audiofile_plugin.c
+++ b/src/decoder/audiofile_plugin.c
@@ -89,7 +89,7 @@ audiofile_decode(struct decoder *decoder, const char *path)
fs = (int)afGetVirtualFrameSize(af_fp, AF_DEFAULT_TRACK, 1);
- decoder_initialized(decoder, &audio_format, total_time);
+ decoder_initialized(decoder, &audio_format, true, total_time);
do {
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
@@ -105,7 +105,7 @@ audiofile_decode(struct decoder *decoder, const char *path)
break;
current += ret;
- decoder_data(decoder, NULL, 1,
+ decoder_data(decoder, NULL,
chunk, ret * fs,
(float)current / (float)audio_format.sample_rate,
bitRate, NULL);
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index 6f7b2e1e1..5137d412f 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -239,7 +239,7 @@ ffmpeg_send_packet(struct decoder *decoder, struct input_stream *is,
assert(audio_size >= 0);
- return decoder_data(decoder, is, is->seekable,
+ return decoder_data(decoder, is,
audio_buf, audio_size,
position,
codec_context->bit_rate / 1000, NULL);
@@ -271,7 +271,8 @@ ffmpeg_decode_internal(BasePtrs *base)
total_time = pFormatCtx->duration / AV_TIME_BASE;
}
- decoder_initialized(decoder, &audio_format, total_time);
+ decoder_initialized(decoder, &audio_format,
+ base->input->seekable, total_time);
do {
if (av_read_frame(pFormatCtx, &packet) < 0)
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 05517db27..f3aaf42c6 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -341,7 +341,8 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
}
}
- decoder_initialized(decoder, &data.audio_format, data.total_time);
+ decoder_initialized(decoder, &data.audio_format,
+ inStream->seekable, data.total_time);
while (true) {
if (!flac_process_single(flacDec))
diff --git a/src/decoder/mod_plugin.c b/src/decoder/mod_plugin.c
index d927f0da4..3d1c8ccaa 100644
--- a/src/decoder/mod_plugin.c
+++ b/src/decoder/mod_plugin.c
@@ -197,7 +197,7 @@ mod_decode(struct decoder *decoder, const char *path)
1.0 / ((audio_format.bits * audio_format.channels / 8.0) *
(float)audio_format.sample_rate);
- decoder_initialized(decoder, &audio_format, 0);
+ decoder_initialized(decoder, &audio_format, false, 0);
while (true) {
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
@@ -212,7 +212,7 @@ mod_decode(struct decoder *decoder, const char *path)
ret = VC_WriteBytes(data->audio_buffer, MIKMOD_FRAME_SIZE);
total_time += ret * secPerByte;
- decoder_data(decoder, NULL, 0,
+ decoder_data(decoder, NULL,
(char *)data->audio_buffer, ret,
total_time, 0, NULL);
}
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index 528911f3d..7f742361d 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -900,7 +900,6 @@ mp3_send_pcm(struct mp3_data *data, unsigned i, unsigned pcm_length,
num_samples *= MAD_NCHANNELS(&(data->frame).header);
cmd = decoder_data(data->decoder, data->input_stream,
- data->input_stream->seekable,
data->output_buffer,
sizeof(data->output_buffer[0]) * num_samples,
data->elapsed_time,
@@ -1108,7 +1107,8 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
tag_free(tag);
}
- decoder_initialized(decoder, &audio_format, data.total_time);
+ decoder_initialized(decoder, &audio_format,
+ data.input_stream->seekable, data.total_time);
while (mp3_read(&data, &replay_gain_info)) ;
diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c
index eeeac8177..25ca912ca 100644
--- a/src/decoder/mp4_plugin.c
+++ b/src/decoder/mp4_plugin.c
@@ -258,7 +258,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
audio_format.sample_rate = scale;
audio_format.channels = frameInfo.channels;
decoder_initialized(mpd_decoder, &audio_format,
- total_time);
+ inStream->seekable, total_time);
initialized = true;
}
@@ -280,7 +280,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
sampleBuffer += offset * channels * 2;
- decoder_data(mpd_decoder, inStream, 1, sampleBuffer,
+ decoder_data(mpd_decoder, inStream, sampleBuffer,
sampleBufferLen, file_time,
bitRate, NULL);
if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP)
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c
index 9181c4388..510433d13 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -163,6 +163,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
replayGainInfo->trackPeak = info.peak_title / 32767.0;
decoder_initialized(mpd_decoder, &audio_format,
+ inStream->seekable,
mpc_streaminfo_get_length(&info));
while (!eof) {
@@ -204,7 +205,6 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
audio_format.sample_rate / 1152 / 1000;
decoder_data(mpd_decoder, inStream,
- inStream->seekable,
chunk, chunkpos,
total_time,
bitRate, replayGainInfo);
@@ -226,7 +226,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
bitRate =
vbrUpdateBits * audio_format.sample_rate / 1152 / 1000;
- decoder_data(mpd_decoder, NULL, inStream->seekable,
+ decoder_data(mpd_decoder, NULL,
chunk, chunkpos, total_time, bitRate,
replayGainInfo);
}
diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c
index 4ac82c554..506f93f08 100644
--- a/src/decoder/oggflac_plugin.c
+++ b/src/decoder/oggflac_plugin.c
@@ -303,7 +303,8 @@ oggflac_decode(struct decoder * mpd_decoder, struct input_stream *inStream)
goto fail;
}
- decoder_initialized(mpd_decoder, &data.audio_format, data.total_time);
+ decoder_initialized(mpd_decoder, &data.audio_format,
+ inStream->seekable, data.total_time);
while (true) {
OggFLAC__seekable_stream_decoder_process_single(decoder);
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index 14cb48278..d950c4e1d 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -279,6 +279,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
if (total_time < 0)
total_time = 0;
decoder_initialized(decoder, &audio_format,
+ inStream->seekable,
total_time);
initialized = true;
}
@@ -304,7 +305,6 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
bitRate = test / 1000;
}
decoder_data(decoder, inStream,
- inStream->seekable,
chunk, chunkpos,
ov_pcm_tell(&vf) / audio_format.sample_rate,
bitRate, replayGainInfo);
@@ -316,7 +316,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
if (decoder_get_command(decoder) == DECODE_COMMAND_NONE &&
chunkpos > 0) {
- decoder_data(decoder, NULL, inStream->seekable,
+ decoder_data(decoder, NULL,
chunk, chunkpos,
ov_time_tell(&vf), bitRate,
replayGainInfo);
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index ef2ea6a99..663bc1f2b 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -164,7 +164,7 @@ static void wavpack_decode(struct decoder * decoder,
samplesreq = sizeof(chunk) / (4 * audio_format.channels);
- decoder_initialized(decoder, &audio_format,
+ decoder_initialized(decoder, &audio_format, false,
(float)allsamples / audio_format.sample_rate);
position = 0;
@@ -200,7 +200,7 @@ static void wavpack_decode(struct decoder * decoder,
format_samples(Bps, chunk,
samplesgot * audio_format.channels);
- decoder_data(decoder, NULL, 0, chunk,
+ decoder_data(decoder, NULL, chunk,
samplesgot * outsamplesize,
file_time, bitrate,
replayGainInfo);
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 73b5d23f6..e2879808d 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -32,7 +32,7 @@
void decoder_initialized(struct decoder * decoder,
const struct audio_format *audio_format,
- float total_time)
+ bool seekable, float total_time)
{
assert(dc.state == DECODE_STATE_START);
assert(audio_format != NULL);
@@ -42,6 +42,7 @@ void decoder_initialized(struct decoder * decoder,
dc.in_audio_format = *audio_format;
getOutputAudioFormat(audio_format, &dc.out_audio_format);
+ dc.seekable = seekable;
dc.totalTime = total_time;
dc.state = DECODE_STATE_DECODE;
@@ -121,19 +122,11 @@ size_t decoder_read(struct decoder *decoder,
* one.
*/
static enum decoder_command
-need_chunks(struct decoder *decoder,
- struct input_stream *inStream, int seekable)
+need_chunks(struct input_stream *inStream)
{
- if (dc.command == DECODE_COMMAND_STOP)
- return DECODE_COMMAND_STOP;
-
- if (dc.command == DECODE_COMMAND_SEEK) {
- if (seekable) {
- return DECODE_COMMAND_SEEK;
- } else {
- decoder_seek_error(decoder);
- }
- }
+ if (dc.command == DECODE_COMMAND_STOP ||
+ dc.command == DECODE_COMMAND_SEEK)
+ return dc.command;
if (!inStream ||
input_stream_buffer(inStream) <= 0) {
@@ -146,7 +139,7 @@ need_chunks(struct decoder *decoder,
enum decoder_command
decoder_data(struct decoder *decoder,
- struct input_stream *inStream, int seekable,
+ struct input_stream *inStream,
void *dataIn, size_t dataInLen,
float data_time, uint16_t bitRate,
ReplayGainInfo * replayGainInfo)
@@ -189,8 +182,7 @@ decoder_data(struct decoder *decoder,
data += nbytes;
if (datalen > 0) {
- enum decoder_command cmd =
- need_chunks(decoder, inStream, seekable);
+ enum decoder_command cmd = need_chunks(inStream);
if (cmd != DECODE_COMMAND_NONE)
return cmd;
}
diff --git a/src/decoder_api.h b/src/decoder_api.h
index 911a4e3eb..a755dd3c9 100644
--- a/src/decoder_api.h
+++ b/src/decoder_api.h
@@ -116,7 +116,7 @@ struct decoder;
*/
void decoder_initialized(struct decoder * decoder,
const struct audio_format *audio_format,
- float total_time);
+ bool seekable, float total_time);
const char *decoder_get_url(struct decoder * decoder, char * buffer);
@@ -151,7 +151,7 @@ size_t decoder_read(struct decoder *decoder,
*/
enum decoder_command
decoder_data(struct decoder *decoder,
- struct input_stream *inStream, int seekable,
+ struct input_stream *inStream,
void *data, size_t datalen, float data_time, uint16_t bitRate,
ReplayGainInfo * replayGainInfo);
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index a05783a62..43db36311 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -76,9 +76,6 @@ static void decodeStart(void)
}
}
- /* for http streams, seekable is determined in input_stream_buffer */
- dc.seekable = inStream.seekable;
-
if (dc.command == DECODE_COMMAND_STOP) {
input_stream_close(&inStream);
return;