aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_api.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-11-03decoder_control: merge next_song and current_songMax Kellermann1-1/+1
These two variables are redundant, we need only one of them.
2009-11-01decoder_api: check decoder==NULL in decoder_read()Max Kellermann1-1/+2
It's legal to pass decoder=NULL to decoder_read(). Add a check.
2009-10-31decoder_control: removed the global variable "dc"Max Kellermann1-62/+80
Allocate a decoder_control object where needed, and pass it around. This will allow more than one decoder thread one day.
2009-10-31player_control: protect command, state, error with a mutexMax Kellermann1-5/+5
Use GMutex/GCond instead of the notify library. Manually lock the player_control object before accessing the protected attributes. Use the GCond object to notify the player thread and the main thread.
2009-08-13decoder_control: protect command, state with a mutexMax Kellermann1-5/+14
Replace decoder_control.notify with decoder_control.mutex and decoder_control.cond. Lock the mutex on all accesses to decoder_control.command and decoder_control.state.
2009-07-23pcm_convert: use GError for error handlingMax Kellermann1-8/+10
Don't abort the whole MPD process when the conversion fails. This has been a denial-of-service attack vector for years.
2009-06-25Preamp for missing replay-gainDaniel Seuthe1-2/+1
2009-04-26decoder_api: removed dc.pipe assertion from decoder_read()Max Kellermann1-1/+0
Database update was broken due to the dc.pipe!=NULL assertion. This assertion is only valid while MPD decodes a song, not during database update.
2009-04-25decoder: added assertions on dc.pipeMax Kellermann1-0/+11
dc.pipe must be non-NULL while the decoder thread is running. Ensure that with a load of assertions.
2009-04-13decoder_api: submit the song tag to the music pipeMax Kellermann1-6/+12
When a new song starts playing, send its tag (song->tag) to the music pipe. This allows output plugins to render tags for all songs, not only those with embedded tags understood by the decoder plugin.
2009-03-13all: Update copyright header.Avuton Olrich1-7/+7
This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
2009-03-06pipe: added music_buffer, rewrite music_pipeMax Kellermann1-16/+21
Turn the music_pipe into a simple music_chunk queue. The music_chunk allocation code is moved to music_buffer, and is now managed with a linked list instead of a ring buffer. Two separate music_pipe objects are used by the decoder for the "current" and the "next" song, which greatly simplifies the cross-fading code.
2009-03-06music_pipe: added music_pipe_push()Max Kellermann1-33/+45
Added music_pipe_allocate(), music_pipe_push() and music_pipe_cancel(). Those functions allow the caller (decoder thread in this case) to do its own chunk management. The functions music_pipe_flush() and music_pipe_tag() can now be removed.
2009-03-01decoder_api: log audio format in a debug messageMax Kellermann1-0/+14
To aid debugging, print the audio format of the decoder plugin in a debug message, and print information about PCM conversion.
2009-02-19decoder_api: fixed shadow warning, rename "wait"Max Kellermann1-2/+2
The parameter name "wait" overlaps with the POSIX wait() function. Rename it.
2009-02-19utils: use g_usleep() instead of my_usleep()Max Kellermann1-2/+1
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.
2009-02-15decoder_api: moved struct decoder_plugin to decoder_plugin.hMax Kellermann1-0/+1
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.
2009-01-17decoder_api: always notify_wait() for free chunksMax Kellermann1-2/+1
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.
2009-01-17decoder_api: pass const pointer to decoder_data()Max Kellermann1-1/+1
2009-01-17pcm_convert: return PCM buffer from pcm_convert()Max Kellermann1-20/+6
Removed yet another superfluous buffer layer: return the PCM buffer from pcm_convert() instead of copying PCM data into the caller-supplied buffer.
2009-01-17decoder_api: use music_pipe_write() instead of music_pipe_append()Max Kellermann1-14/+33
Copy PCM data to the music_pipe_write() buffer, and apply replay gain / normalization to it, instead of manipulating the source buffer.
2009-01-16decoder_api: added assertion on partial framesMax Kellermann1-0/+1
Decoder plugins must not send partial frames.
2009-01-15decoder_api: added G_GNUC_UNUSED attribute to decoder_initialized()Max Kellermann1-1/+1
In NDEBUG, the parameter "decoder" is not used.
2009-01-13decoder_api: don't ignore DECODE_COMMAND_STOPMax Kellermann1-2/+1
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.
2009-01-07pcm: added pcm_convert_deinit(), pcm_resample_deinit()Max Kellermann1-2/+0
Free memory allocated by libsamplerate when the output or the decoder is closed.
2009-01-04song: allocate the result of song_get_url()Max Kellermann1-3/+2
2009-01-03input_stream: added tag() methodMax Kellermann1-65/+59
The tag() method reads a tag from the stream. This replaces the meta_name and meta_title attributes.
2009-01-03decoder_api: moved code to do_send_tag(), free temporary tagMax Kellermann1-7/+17
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.
2009-01-03decoder_api: use GLib instead of utils.hMax Kellermann1-4/+5
2008-12-24pcm_utils: check pcm_convert()==0Max Kellermann1-0/+7
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().
2008-11-24decoder_api.c: replaced mpd_unused by G_GNUC_UNUSEDThomas Jansen1-6/+7
2008-11-21decoder: check audio_format_valid() in all decodersMax Kellermann1-0/+1
Refuse to play audio formats which are not supported by MPD.
2008-11-21decoder: ignore decoder_data() calls with length==0Max Kellermann1-1/+2
Pushing buffers with a zero length into the MPD core causes failures; don't let them pass beyond the decoder plugi API.
2008-11-18decoder: pass the correct buffer length to pcm_convert()Max Kellermann1-5/+6
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.
2008-11-15decoder: check length==0 in decoder_read()Max Kellermann1-0/+3
When the caller passes length==0, decoder_read() entered an endless loop. Check that condition before entering the "while" loop.
2008-11-13decoder: additional dc.command checks in decoder_data()Max Kellermann1-0/+3
When a command is sent while the decoder waits for a free chunk in the music pipe, it was not returned by decoder_data().
2008-11-13decoder: wait for the player only if the music pipe is fullMax Kellermann1-4/+5
Prevent superfluous wakeups and a deadlock condition.
2008-11-13decoder: check dc.command at the beginning of decoder_data()Max Kellermann1-0/+4
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().
2008-11-13decoder: ignore SEEK commands during initializationMax Kellermann1-1/+4
When the decoder receives a SEEK during initialization, it should ignore that for now. The old code made most decoders abort.
2008-11-11replay_gain: no CamelCaseMax Kellermann1-3/+3
Renamed functions and variables.
2008-11-11decoder: fixed assertion failure for decoder==NULL in decoder_read()Max Kellermann1-1/+2
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.
2008-11-10decoder: added more assertionsMax Kellermann1-0/+10
Added a lot of assertions checking the state of the decoder plugin.
2008-11-03decoder: no CamelCaseMax Kellermann1-4/+4
Renamed variables and functions.
2008-11-03decoder_api: send song tag in decoder_data()Max Kellermann1-8/+26
Before passing the first chunk to the audio output device, send the current song's tag.
2008-11-03decoder_api: automatically send stream tagMax Kellermann1-0/+51
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.
2008-11-03decoder_api: no CamelCaseMax Kellermann1-34/+32
Renamed variables.
2008-11-02decoder_api: added decoder_tag()Max Kellermann1-0/+13
Provide an API for submitting additional tags from the stream.
2008-11-02decoder_api: pass "seekable" flag to decoder_initialized()Max Kellermann1-16/+8
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.
2008-11-02decoder: replaced music_pipe.audioFormat with dc.out_audio_formatMax Kellermann1-10/+13
.. 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.
2008-11-02music_pipe: renamed ob_* functions to music_pipe_*Max Kellermann1-2/+2
Rename all functions to the new prefix.