aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_thread.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-04-13decoder_api: submit the song tag to the music pipeMax Kellermann1-0/+5
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-15log: removed DEBUG() and FATAL()Max Kellermann1-2/+1
Use GLib the logging functions g_debug(), g_error() instead.
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-3/+2
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-1/+5
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-02-25ls: moved generic URI utilities to uri.cMax Kellermann1-1/+1
"ls" is a bad name for a library which parses URIs. We'll move the rest of the "ls" library later.
2009-02-15decoder_api: moved enum decoder_command to decoder_command.hMax Kellermann1-0/+3
Minimize header dependencies, again.
2009-02-15decoder_plugin: added inline wrapper functionsMax Kellermann1-2/+2
Increase code readability, always use the wrapper functions instead of calling the plugin method pointers directly.
2009-02-11decoder_thread: re-enable file decodersMax Kellermann1-1/+1
By accident, I committed a debug flag, which disallowed the decoder thread to play files locally. Undo this hunk.
2009-01-30archive: replaced setup_stream() with open_stream()Max Kellermann1-1/+1
The open_stream() method opens the input_stream. This allows the archive plugin to do its own initialization, and it also allows it to use input_stream.data. We can remove input_stream.archive now, which was unnatural to have in the first place.
2009-01-25decoder_control: added decoder_control.threadMax Kellermann1-2/+4
decoder_control.thread contains the handle of the decoder thread, or NULL if the decoder thread isn't running.
2009-01-07pcm: added pcm_convert_deinit(), pcm_resample_deinit()Max Kellermann1-0/+4
Free memory allocated by libsamplerate when the output or the decoder is closed.
2009-01-04initialize GError pointersMax Kellermann1-1/+1
GLib mandates that you initialize all GError objects with NULL prior to passing it.
2009-01-04song: allocate the result of song_get_url()Max Kellermann1-5/+2
2009-01-04ls: renamed functions, no CamelCaseMax Kellermann1-2/+2
2009-01-04ls: include cleanupMax Kellermann1-0/+3
Don't include headers which are not used. Fix some includes in decoder_thread.c.
2009-01-03input_stream: added tag() methodMax Kellermann1-3/+12
The tag() method reads a tag from the stream. This replaces the meta_name and meta_title attributes.
2009-01-02mapper: allocate the result of map_directory_child_fs(), map_song_fs()Max Kellermann1-14/+25
Don't use fixed stack buffers.
2008-12-28decoder_thread: migrate from pthread to glib threadsThomas Jansen1-8/+5
2008-12-28Include <pthread.h> where it is necessary onlyThomas Jansen1-0/+1
2008-12-28decoder: terminate decoder thread before MPD cleanupMax Kellermann1-2/+2
When MPD exits, it should manually free all resources in use, to allow easy memory leak debugging. Make the decoder thread terminate during that.
2008-11-25decoder: added missing glib.h includeMax Kellermann1-0/+2
2008-11-24decoder_thread.c: replaced mpd_unused by G_GNUC_UNUSEDThomas Jansen1-1/+1
2008-11-20decoder: ignore the SEEK command during startupMax Kellermann1-1/+1
While waiting for the input stream to become ready, ignore all commands except STOP. This fixes seeking errors with (remote) songs which the decoder has already finished.
2008-11-11decoder: fixed typo in assertionMax Kellermann1-1/+1
decoder_file_decode() should check for plugin->file_decode, not plugin->stream_decode().
2008-11-11decoder: return void from decode() methodsMax Kellermann1-26/+8
The stream_decode() and file_decode() methods returned a boolean, indicating whether they were able to decode the song. This is redundant, since we already know that: if decoder_initialized() has been called (and dc.state==DECODE), the plugin succeeded. Change both methods to return void.
2008-11-10decoder: removed plugin method try_decode()Max Kellermann1-24/+0
Instead of having a seprate try_decode() method, let the stream_decode() and file_decode() methods decide whether they are able to decode the song.
2008-11-10decoder: fall back to next pluginMax Kellermann1-4/+16
When a plugin is unable to decode a song, try the other plugins.
2008-11-10decoder: wrapper functions for methods stream_decode() and file_decode()Max Kellermann1-5/+66
Added lots of assertions to the wrapper functions.
2008-11-08decoder: converted dc.error to a dc.state valueMax Kellermann1-11/+9
The player did not care about the exact error value, it only checked whether an error has occured. This could fit well into decoder_control.state - introduce a new state "DECODE_STATE_ERROR".
2008-11-08decoder: removed "plugin" from the decoder structMax Kellermann1-4/+0
decoder.plugin was a write-only attribute.
2008-11-04decoder: removed stream_typesMax Kellermann1-8/+0
Instead of checking the stream_types bit set, we can simply check whether the methods stream_decode() and file_decode() are implemented.
2008-11-03decoder: update dc.error after input stream failureMax Kellermann1-0/+1
dc.error wasn't updated when the input stream failed to initialize.
2008-11-03decoder: no CamelCaseMax Kellermann1-19/+19
Renamed variables and functions.
2008-11-03decoder_api: automatically send stream tagMax Kellermann1-0/+1
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-02decoder: rewind input stream after try_decode()Max Kellermann1-1/+8
The try_decode() method may have read some data from the stream, which is now lost. To make this data available to other methods, get it back by rewinding the input stream after each try_decode() invocation. The ogg and wavpack plugins did this manually and inconsistently; this code can now be removed.
2008-11-02decoder: moved code to decoder_try_decode()Max Kellermann1-6/+13
2008-11-02decoder_api: pass "seekable" flag to decoder_initialized()Max Kellermann1-3/+0
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-02music_pipe: renamed ob_* functions to music_pipe_*Max Kellermann1-1/+1
Rename all functions to the new prefix.
2008-11-02renamed outputBuffer.[ch] to pipe.[ch]Max Kellermann1-1/+1
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.
2008-11-01decoder: return const decoder_plugin structsMax Kellermann1-1/+1
The decoder_plugin structs must never change. Don't work with non-const pointers.
2008-10-31update: check return valuesMax Kellermann1-8/+12
Nearly all mapper functions can fail and will then return NULL. Add checks to all callers.
2008-10-31decoder: eliminate gotos in decodeStart()Max Kellermann1-7/+12
http://xkcd.com/292/
2008-10-31decoder: don't wake up player when command==NONEMax Kellermann1-1/+0
If nobody sent a command, the player isn't waiting for the decoder. Don't wake it up.
2008-10-31decoder: notify player after stopMax Kellermann1-0/+1
The player should always be woken up when the decoder quits.
2008-10-31decoder: reset state and command in decoder_task()Max Kellermann1-4/+4
Eliminate one goto in decodeStart() by moving some cleanup to decoder_task().
2008-10-31decoder: introduce switch statement in decoder_task()Max Kellermann1-4/+10
switch looks much nicer than if/elseif/... and gcc generates nice warnings when a new command is added to the enum.
2008-10-30decoder: use bool for return values and flagsMax Kellermann1-9/+8
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
2008-10-29decoder: automatically flush the output buffer after decoder exitsMax Kellermann1-0/+3
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().
2008-10-26input_stream: use "bool" instead of "int"Max Kellermann1-1/+1
For boolean values and success flags, use bool instead of integer (1/0 for true/false, 0/-1 for success/failure).