aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_thread.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* decoder_thread: close input fileMax Kellermann2009-11-071-3/+10
| | | | | An input_stream_close() call was missing after today's code reorganization.
* decoder_thread: check for STOP before calling the pluginMax Kellermann2009-11-071-0/+6
| | | | | Before calling the plugin's decode method, we should ensure that we didn't receive a STOP command during initialization.
* decoder_thread: moved code to decoder_input_stream_open()Max Kellermann2009-11-071-27/+50
| | | | | | This function opens the stream and waits for it to become ready; meanwhile it checks for STOP commands. It is code moved from decoder_run_stream().
* decoder_thread: added local variable "dc" in decoder_run_file()Max Kellermann2009-11-071-6/+7
| | | | Simplify the expressions.
* decoder_list: pass previous plugin pointer to lookup functionsMax Kellermann2009-11-071-6/+4
| | | | Remove the static integer hack, that's not thread safe and sucks.
* decoder_thread: open input stream on demandMax Kellermann2009-11-071-72/+59
| | | | | | Moved the global input stream opener to decoder_run_stream(). decoder_run_file() now opens the input stream each time a plugin provides a stream decoder method.
* decoder_thread: moved plugin loops to separate functionsMax Kellermann2009-11-071-82/+127
| | | | Tame the large decoder_run_song() function.
* decoder_thread: initialize decoder_control.quitMax Kellermann2009-11-041-0/+2
| | | | If left uninitialized, then the decoder thread quits spuriously.
* decoder_control: merge next_song and current_songMax Kellermann2009-11-031-2/+3
| | | | These two variables are redundant, we need only one of them.
* decoder_thread: unlock the decoder while checking the streamMax Kellermann2009-11-031-4/+4
| | | | | | This is only a slight change to the previous locking behaviour: keep the decoder unlocked during the loop, and lock it only while checking decoder_control.command.
* decoder_thread: open input stream after command finishedMax Kellermann2009-11-031-5/+10
| | | | | Return the result to the caller more quickly. This unifies error handling: no error can be reported before the command is finished.
* decoder_control: make the song objects constMax Kellermann2009-11-031-1/+1
| | | | They are just informational.
* decoder_control: removed the global variable "dc"Max Kellermann2009-10-311-58/+67
| | | | | Allocate a decoder_control object where needed, and pass it around. This will allow more than one decoder thread one day.
* player_control: protect command, state, error with a mutexMax Kellermann2009-10-311-9/+3
| | | | | | 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.
* mapper, update, ...: use g_build_filename(), G_DIR_SEPARATOR, ...Max Kellermann2009-10-201-1/+1
| | | | | Try to be as portable as possible, use GLib path name functions and macros.
* decoder_thread: removed redundant NULL assignmentsMax Kellermann2009-10-111-2/+1
| | | | | The while() clause resets the "plugin" variable. We don't need to reset it at the end of the loop body.
* Merge branch 'v0.15.x'Max Kellermann2009-10-111-1/+1
|\ | | | | | | | | | | | | Conflicts: NEWS configure.ac
| * decoder_thread: change the fallback decoder name to "mad"Max Kellermann2009-10-111-1/+1
| | | | | | | | | | | | When there is no Content-Type response header, try the "mad" decoder plugin. It uesd to be named "mp3", and we forgot to change the fallback name in decoder_thread.c.
* | decoder_control: protect command, state with a mutexMax Kellermann2009-08-131-2/+45
|/ | | | | | 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.
* decoder_thread: reopen the stream after file_decode() has failedMax Kellermann2009-06-191-0/+11
| | | | | | | | | When decoding a local file, the decoder thread tries to run all matching decoders, until one succeeds. Both file_decode() and stream_decode() can decode a stream, but MPD closes the stream before calling file_decode(). Problem is: when this decoder fails, and the next's stream_decode() method is invoked, the input_stream is still closed. This patch reopens it.
* decoder_api: submit the song tag to the music pipeMax Kellermann2009-04-131-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.
* log: removed DEBUG() and FATAL()Max Kellermann2009-03-151-2/+1
| | | | Use GLib the logging functions g_debug(), g_error() instead.
* all: Update copyright header.Avuton Olrich2009-03-131-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.
* pipe: added music_buffer, rewrite music_pipeMax Kellermann2009-03-061-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.
* music_pipe: added music_pipe_push()Max Kellermann2009-03-061-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.
* ls: moved generic URI utilities to uri.cMax Kellermann2009-02-251-1/+1
| | | | | "ls" is a bad name for a library which parses URIs. We'll move the rest of the "ls" library later.
* decoder_api: moved enum decoder_command to decoder_command.hMax Kellermann2009-02-151-0/+3
| | | | Minimize header dependencies, again.
* decoder_plugin: added inline wrapper functionsMax Kellermann2009-02-151-2/+2
| | | | | Increase code readability, always use the wrapper functions instead of calling the plugin method pointers directly.
* decoder_thread: re-enable file decodersMax Kellermann2009-02-111-1/+1
| | | | | By accident, I committed a debug flag, which disallowed the decoder thread to play files locally. Undo this hunk.
* archive: replaced setup_stream() with open_stream()Max Kellermann2009-01-301-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.
* decoder_control: added decoder_control.threadMax Kellermann2009-01-251-2/+4
| | | | | decoder_control.thread contains the handle of the decoder thread, or NULL if the decoder thread isn't running.
* pcm: added pcm_convert_deinit(), pcm_resample_deinit()Max Kellermann2009-01-071-0/+4
| | | | | Free memory allocated by libsamplerate when the output or the decoder is closed.
* initialize GError pointersMax Kellermann2009-01-041-1/+1
| | | | | GLib mandates that you initialize all GError objects with NULL prior to passing it.
* song: allocate the result of song_get_url()Max Kellermann2009-01-041-5/+2
|
* ls: renamed functions, no CamelCaseMax Kellermann2009-01-041-2/+2
|
* ls: include cleanupMax Kellermann2009-01-041-0/+3
| | | | | Don't include headers which are not used. Fix some includes in decoder_thread.c.
* input_stream: added tag() methodMax Kellermann2009-01-031-3/+12
| | | | | The tag() method reads a tag from the stream. This replaces the meta_name and meta_title attributes.
* mapper: allocate the result of map_directory_child_fs(), map_song_fs()Max Kellermann2009-01-021-14/+25
| | | | Don't use fixed stack buffers.
* decoder_thread: migrate from pthread to glib threadsThomas Jansen2008-12-281-8/+5
|
* Include <pthread.h> where it is necessary onlyThomas Jansen2008-12-281-0/+1
|
* decoder: terminate decoder thread before MPD cleanupMax Kellermann2008-12-281-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.
* decoder: added missing glib.h includeMax Kellermann2008-11-251-0/+2
|
* decoder_thread.c: replaced mpd_unused by G_GNUC_UNUSEDThomas Jansen2008-11-241-1/+1
|
* decoder: ignore the SEEK command during startupMax Kellermann2008-11-201-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.
* decoder: fixed typo in assertionMax Kellermann2008-11-111-1/+1
| | | | | decoder_file_decode() should check for plugin->file_decode, not plugin->stream_decode().
* decoder: return void from decode() methodsMax Kellermann2008-11-111-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.
* decoder: removed plugin method try_decode()Max Kellermann2008-11-101-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.
* decoder: fall back to next pluginMax Kellermann2008-11-101-4/+16
| | | | When a plugin is unable to decode a song, try the other plugins.
* decoder: wrapper functions for methods stream_decode() and file_decode()Max Kellermann2008-11-101-5/+66
| | | | Added lots of assertions to the wrapper functions.
* decoder: converted dc.error to a dc.state valueMax Kellermann2008-11-081-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".