| Commit message (Collapse) | Author | Files | Lines |
|
The parameter name "wait" overlaps with the POSIX wait() function.
Rename it.
|
|
Now that I've found this nice function in the GLib docs, we can
finally remove our custom sleep function. Still all those callers of
g_usleep() have to be migrated one day to use events, instead of
regular polling.
|
|
The decoder_plugin struct is used by both the MPD core and the decoder
plugin implementations. Move it to a shared header file, to minimize
header dependencies.
|
|
One of the previous patches made MPD consume 100% CPU in a busy wait:
when the music_pipe was full, it did not wait (with notify_wait()) for
free chunks, because a variable has a different meaning now. Always
pass "true" as the "wait" parameter.
|
|
|
|
Removed yet another superfluous buffer layer: return the PCM buffer
from pcm_convert() instead of copying PCM data into the
caller-supplied buffer.
|
|
Copy PCM data to the music_pipe_write() buffer, and apply replay gain
/ normalization to it, instead of manipulating the source buffer.
|
|
Decoder plugins must not send partial frames.
|
|
In NDEBUG, the parameter "decoder" is not used.
|
|
When the decoder thread is waiting for free chunks in the music pipe,
don't ignore the STOP command. Just return dc.command without further
checks.
|
|
Free memory allocated by libsamplerate when the output or the decoder
is closed.
|
|
|
|
The tag() method reads a tag from the stream. This replaces the
meta_name and meta_title attributes.
|
|
This patch fixes a minor memory leak: when decoder_tag() attempted to
send a merged tag object (created by tag_add_stream_tags()), and was
interrupted by a decoder command, it did not free the temporary merged
tag object.
|
|
|
|
It is illegal to pass an empty audio buffer around. pcm_resample()
sometimes seems to result in 0 samples, maybe related to
libsamplerate. To work around that problem, add special checks after
both pcm_convert() invocations. Removed the pcm_resample()==0 checks
from pcm_convert().
|
|
|
|
Refuse to play audio formats which are not supported by MPD.
|
|
Pushing buffers with a zero length into the MPD core causes failures;
don't let them pass beyond the decoder plugi API.
|
|
When a global audio format is configured (setting
"audio_output_format"), decoder_data() overwrote the "length"
parameter with the size of the output buffer (result of
pcm_convert_size()). Declare a separate variable for the output
buffer length.
|
|
When the caller passes length==0, decoder_read() entered an endless
loop. Check that condition before entering the "while" loop.
|
|
When a command is sent while the decoder waits for a free chunk in the
music pipe, it was not returned by decoder_data().
|
|
Prevent superfluous wakeups and a deadlock condition.
|
|
Seeking was somewhat broken in some decoder plugins because they sent
empty chunks, and never got a command. Check the decoder command
before doing anything else in decoder_data().
|
|
When the decoder receives a SEEK during initialization, it should
ignore that for now. The old code made most decoders abort.
|
|
Renamed functions and variables.
|
|
The assertion on dc.state in decoder_read() was too strict: when a
decoder tried to call decoder_read() from tag_dup(), the decoder state
was NONE. Allow this special case.
|
|
Added a lot of assertions checking the state of the decoder plugin.
|
|
Renamed variables and functions.
|
|
Before passing the first chunk to the audio output device, send the
current song's tag.
|
|
If an input stream provides tags (e.g. from an icecast server), send
them in the decoder_data() and decoder_tag() methods. Removed the
according code from the mp3 and oggvorbis plugins - decoders shouldn't
have to care about stream tags.
This patch also adds the missing decoder_tag() invocation to the mp3
plugin.
|
|
Renamed variables.
|
|
Provide an API for submitting additional tags from the stream.
|
|
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.
|
|
.. and rename dc.audioFormat to dc.in_audio_format. The music pipe
does not need to know the audio format, and its former "audioFormat"
property indicated the format of the most recently added chunk, which
might be confusing when you are reading the oldest chunks.
|
|
Rename all functions to the new prefix.
|
|
No CamelCase in the file name. The output_buffer struct is going to
be renamed to music_pipe. There are so many buffer levels in MPD, and
calling this one "output buffer" is wrong, because it's not the last
buffer before the music reaches the output devices.
|
|
Currently, there is no way to dynamically load decoder plugins, thus
we don't need a dynamic list to manage them.
|
|
Don't return 0/-1 on success/error, but true/false. Instead of int,
use bool for storing flags.
|
|
A decoder_flush() invocation was missing in the FLAC plugin, resulting
in casual assertion failures due to a wrong assumption about the last
chunk's audio format. It's much easier to remove that decoder_flush()
function and make the decoder thread call ob_flush().
|
|
There are no callers which pass audio_format==NULL, and it shouldn't
be allowed.
|
|
Call ob_clear() in decoder_command_finished() instead of implementing
that call in every decoder plugin.
|
|
need_chunks() returns a decoder_command enum. Store its return value
as this type.
|
|
Renamed all functions and variables.
|
|
Instead of manually calling memset(0) on the pcm_convert_state struct,
client code should use a library function from pcm_utils.c. This way,
we can change the semantics of the struct easily.
|
|
Renamed all functions which were still in CamelCase.
|
|
The nmemb argument isn't actually useful, and one of nmemb and size
was always passed as 1. Remove it.
|
|
Provide a struct type which can be forward-declared. The typedef
InputStream is deprecated now.
|
|
CamelCase is ugly... rename all functions.
|
|
"bool" should be used in C99 programs for boolean values.
|