diff options
author | Max Kellermann <max@duempel.org> | 2008-11-02 17:01:51 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-02 17:01:51 +0100 |
commit | c9e15bc418d4a27305b39ccc63e631ac5e329c8b (patch) | |
tree | 0e97c8b6c829f464374d3b2cbcbc3fb01e4bebe4 /src/decoder | |
parent | c7a374bdcbe85a794b047c638e57b9358d2d095b (diff) | |
download | mpd-c9e15bc418d4a27305b39ccc63e631ac5e329c8b.tar.gz mpd-c9e15bc418d4a27305b39ccc63e631ac5e329c8b.tar.xz mpd-c9e15bc418d4a27305b39ccc63e631ac5e329c8b.zip |
decoder_api: pass "seekable" flag to decoder_initialized()
Don't pass the "seekable" flag with every decoder_data() invocation.
Since that flag won't change within the file, it is enough to pass it
to decoder_initialized() once per file.
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/_flac_common.c | 2 | ||||
-rw-r--r-- | src/decoder/aac_plugin.c | 9 | ||||
-rw-r--r-- | src/decoder/audiofile_plugin.c | 4 | ||||
-rw-r--r-- | src/decoder/ffmpeg_plugin.c | 5 | ||||
-rw-r--r-- | src/decoder/flac_plugin.c | 3 | ||||
-rw-r--r-- | src/decoder/mod_plugin.c | 4 | ||||
-rw-r--r-- | src/decoder/mp3_plugin.c | 4 | ||||
-rw-r--r-- | src/decoder/mp4_plugin.c | 4 | ||||
-rw-r--r-- | src/decoder/mpc_plugin.c | 4 | ||||
-rw-r--r-- | src/decoder/oggflac_plugin.c | 3 | ||||
-rw-r--r-- | src/decoder/oggvorbis_plugin.c | 4 | ||||
-rw-r--r-- | src/decoder/wavpack_plugin.c | 4 |
12 files changed, 27 insertions, 23 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); |