aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_thread.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2010-01-17decoder_thread: don't fall back to "mad" unless no plugin matchesMax Kellermann1-1/+2
When all plugins have failed, MPD used to fall back to the "mad" decoder plugin, to handle those radio streams without a Content-Type response header. This however leads to unexpected results (garbage being played) when the stream isn't really mp3. Since we care little about "bad" streams, we shouldn't have hacks which have bad side effects. Let's get rid of this hack now! Only try to "mad" plugin if there was no match at all (Content-Type, path suffix) and no other plugin has been tried.
2010-01-17decoder_thread: don't try a plugin twice (MIME type & suffix)Max Kellermann1-10/+56
Manage a linked list of plugins which were already tried.
2010-01-16decoder_thread: fix CUE track playbackMax Kellermann1-5/+10
The patch "input/file: don't fall back to parent directory" introduced a regression: when trying to play a CUE track, decoder_run_song() tries to open the file as a stream first, but this fails, because the path is virtual. This patch fixes decoder_run_song() (instead of reverting the previous patch) to accept input_stream_open() failures if the song is a local file. It passes the responsibility to handle non-existing files to the decoder's file_decode() method.
2010-01-04replay_gain: moved code to replay_gain_config.cMax Kellermann1-1/+1
2010-01-04replay_gain: moved code to replay_gain_info.cMax Kellermann1-0/+1
2010-01-04replay_gain: refactor API, move code to replay_gain_state.cMax Kellermann1-3/+4
The replay_gain_state struct holds the precalculated scale factor, which is removed from struct replay_gain_info.
2010-01-04decoder_api: added function decoder_replay_gain()Max Kellermann1-0/+5
This function replaces the replay_gain_info parameter for decoder_data(). This allows the decoder to announce replay gain changes, instead of having to pass the same object over and over.
2010-01-01input_stream: return allocated input_stream objectsMax Kellermann1-20/+22
Major API redesign: don't let the caller allocate the input_stream object. Let each input plugin allocate its own (derived/extended) input_stream pointer. The "data" attribute can now be removed, and all input plugins simply cast the input_stream pointer to their own structure (with an "struct input_stream base" as the first attribute).
2009-12-31Update copyright notices.Avuton Olrich1-1/+1
2009-12-26decoder_api: added function decoder_timestamp()Max Kellermann1-0/+1
Remove the data_time parameter from decoder_data(). This patch eliminates the timestamp counting in most decoder plugins, because the MPD core will do it automatically by default.
2009-12-15input_stream: return errors with GErrorMax Kellermann1-3/+13
2009-11-12include config.h in all sourcesMax Kellermann1-0/+1
After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue.
2009-11-07decoder_thread: close input fileMax Kellermann1-3/+10
An input_stream_close() call was missing after today's code reorganization.
2009-11-07decoder_thread: check for STOP before calling the pluginMax Kellermann1-0/+6
Before calling the plugin's decode method, we should ensure that we didn't receive a STOP command during initialization.
2009-11-07decoder_thread: moved code to decoder_input_stream_open()Max Kellermann1-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().
2009-11-07decoder_thread: added local variable "dc" in decoder_run_file()Max Kellermann1-6/+7
Simplify the expressions.
2009-11-07decoder_list: pass previous plugin pointer to lookup functionsMax Kellermann1-6/+4
Remove the static integer hack, that's not thread safe and sucks.
2009-11-07decoder_thread: open input stream on demandMax Kellermann1-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.
2009-11-07decoder_thread: moved plugin loops to separate functionsMax Kellermann1-82/+127
Tame the large decoder_run_song() function.
2009-11-04decoder_thread: initialize decoder_control.quitMax Kellermann1-0/+2
If left uninitialized, then the decoder thread quits spuriously.
2009-11-03decoder_control: merge next_song and current_songMax Kellermann1-2/+3
These two variables are redundant, we need only one of them.
2009-11-03decoder_thread: unlock the decoder while checking the streamMax Kellermann1-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.
2009-11-03decoder_thread: open input stream after command finishedMax Kellermann1-5/+10
Return the result to the caller more quickly. This unifies error handling: no error can be reported before the command is finished.
2009-11-03decoder_control: make the song objects constMax Kellermann1-1/+1
They are just informational.
2009-10-31decoder_control: removed the global variable "dc"Max Kellermann1-58/+67
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-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.
2009-10-20mapper, update, ...: use g_build_filename(), G_DIR_SEPARATOR, ...Max Kellermann1-1/+1
Try to be as portable as possible, use GLib path name functions and macros.
2009-10-11decoder_thread: removed redundant NULL assignmentsMax Kellermann1-2/+1
The while() clause resets the "plugin" variable. We don't need to reset it at the end of the loop body.
2009-10-11decoder_thread: change the fallback decoder name to "mad"Max Kellermann1-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.
2009-08-13decoder_control: protect command, state with a mutexMax Kellermann1-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.
2009-06-19decoder_thread: reopen the stream after file_decode() has failedMax Kellermann1-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.
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