aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_thread.c (unfollow)
Commit message (Collapse)AuthorFilesLines
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).
2008-10-26input_stream: no CamelCaseMax Kellermann1-5/+5
Renamed all functions and variables.
2008-10-20path: removed pathcpy_trunc()Max Kellermann1-5/+2
There was only one user of pathcpy_trunc(), which can be eliminated.
2008-10-17input: declare struct input_streamMax Kellermann1-1/+1
Provide a struct type which can be forward-declared. The typedef InputStream is deprecated now.
2008-10-17decoder: notify player after entering decodeStart()Max Kellermann1-0/+1
Wake up the player as soon as the decoder thread has entered its loop. This fixes a dead lock when the input is blocking.
2008-10-14mapper: new song-to-filesystem mapper libraryMax Kellermann1-10/+11
The mapper library maps directory and song objects to file system paths. With this central library, the code mixture in path.c should be cleaned up, and we will be able to add neat features like aliasing.
2008-10-08song: don't allow calling song_get_url(NULL)Max Kellermann1-4/+1
The runtime check suggests that the author has somehow thought song_get_url(NULL) might be valid. It should not be. Replace it with an assertion.
2008-10-08song: removed CamelCaseMax Kellermann1-1/+1
CamelCase is ugly... rename all functions.
2008-10-08use the "bool" data type instead of "int"Max Kellermann1-3/+3
"bool" should be used in C99 programs for boolean values.
2008-10-08song: converted typedef Song to struct songMax Kellermann1-0/+1
Again, a data type which can be forward-declared.
2008-09-29decoder: renamed plugin methodsMax Kellermann1-19/+19
Why have a "_func" prefix on all method names? Also don't typedef the methods, there is no advantage in that.
2008-09-26notify: protect notify->pending with the mutexMax Kellermann1-2/+0
There was a known deadlocking bug in the notify library: when the other thread set notify->pending after the according check in notify_wait(), the latter thread was deadlocked. Resolve this by synchronizing all accesses to notify->pending with the notify object's mutex. Since notify_signal_sync() was never used, we can remove it. As a consequence, we don't need notify_enter() and notify_leave() anymore; eliminate them, too.
2008-08-26renamed player.c to player_control.cMax Kellermann1-1/+1
Give player.c a better name, meaning that the code is used to control the player thread.
2008-08-26renamed decoderInit() to decoder_thread_start()Max Kellermann1-1/+1
2008-08-26renamed decode.h to decoder_control.hMax Kellermann1-1/+1
2008-08-26renamed decode.c to decoder_thread.cMax Kellermann1-0/+2
It should be obvious in which thread or context a function is being executed at runtime. The code which was left in decode.c is for the decoder thread itself; give the file a better name.
2008-08-26moved global variable "pc" to player.hMax Kellermann1-1/+1
This is the last of the three variables. Now we don't need playerData.h anymore in most sources.
2008-08-26added flag "decoder.seeking"Max Kellermann1-0/+2
This flag is used internally; it is set by decoder_seek_where(), and indicates that the decoder plugin has begun the seek process. It is used for the case that the decoder plugin has to read data during the seek process. Before this patch, that was impossible, because decoder_read() would refuse to read data unless dc->command is NONE. This patch is kind of a dirty workaround, and needs to be redesigned later.
2008-08-26added InputStream.readyMax Kellermann1-0/+12
The flag "ready" indicates whether the input stream is ready and it has parsed all meta data. Previously, it was impossible for decodeStart() to see the content type of HTTP input streams, because at that time, the HTTP response wasn't parsed yet.
2008-08-26moved code to player_thread.cMax Kellermann1-394/+0
Move code which runs in the player thread to player_thread.c. Having a lot of player thread code in decode.c isn't easy to understand.
2008-08-26moved code to crossfade.cMax Kellermann1-49/+10
decode.c should be a lot smaller; start by moving all code which handles cross-fading to crossfade.c. Also includes camelCase conversion.
2008-08-26added inline function audio_format_time_to_size()Max Kellermann1-1/+1
Make the code more readable by hiding big formulas in an inline function with a nice name.
2008-08-26pass max_chunks to calculateCrossFadeChunks()Max Kellermann1-7/+8
Make calculateCrossFadeChunks() more generic and portable by eliminating global variable access.
2008-08-26renamed functions in decoder_list.hMax Kellermann1-4/+4
InputPlugin to decoder_plugin, and no camelCase.
2008-08-26no camel case in struct decoder_pluginMax Kellermann1-20/+22
2008-08-26renamed InputPlugin to struct decoder_pluginMax Kellermann1-1/+1
"decoder plugin" is a better name than "input plugin", since the plugin does not actually do the input - InputStream does. Also don't use typedef, so we can forward-declare it if required.
2008-08-26added PlayerControl.commandMax Kellermann1-21/+26
PlayerControl.command replaces the old attributes play, stop, pause, closeAudio, lockQueue, unlockQueue, seek. The main thread waits for each command synchronously, so there can only be one command enabled at a time anyway.