Hi, I have rebased my git branch on the official git repository. I have merged everything up to f9f70860. Although I still believe it is a very bad idea, I have also merged the patches which create the global variables "dc", "pc", "ob", but I will revert them as soon as there is a real need for more flexible code.
What follows after f9f70860 is the huge monolithic patch 44d9f62f, which is very difficult to merge, since much of it had already been addressed by my patches. I havn't bothered to merge 44d9f62f yet, but I believe it does not provide advantages over my (small and self-documenting) patch series. This patch set contains all of the old patches which have not been merged to Eric's branch yet, plus some more cleanups. I have tried to sort the code into several sources: there is now decoder_thread.c (the core of the decoder thread) decoder_control.c (controlling the decoder thread) decoder_api.c (public API for decoder plugins) For the player thread, it's similar. Note that I have also merged Eric's HTTP client patches, although they contain a critical regression. I will address this bug later. HTTP streaming does work, but in some error conditions, MPD hangs forever. I'm not sure if it's worth it to hack the HTTP client code at all, we would be better off with linking against libcurl or any other HTTP library. HTTP is more complex than it should be, and our code contains huge amounts of bugs, iow: it only works for the special case it has been tested with.. As usual, you can pull my branch from repo.or.cz: git://repo.or.cz/mpd-mk.git http://repo.or.cz/w/mpd-mk.git Eric, please tell me the local path for git+ssh access on git.musicpd.org, so I can push it over there, too. Max --- Max Kellermann (134): moved player_command_finished() to player_thread.c moved code to pc_init(), dc_init() renamed player.c to player_control.c no commandError() in playerSeek() don't initialize "i" if we overwrite it anyway renamed decoderInit() to decoder_thread_start() renamed decode.h to decoder_control.h renamed decode.c to decoder_thread.c moved global variable "pc" to player.h moved global variable "ob" to outputBuffer.h moved enum decoder_command to decoder_api.h moved variable "dc" to decode.h player_thread: removed decode(), renamed decodeParent() hide DecoderControl accesses in inline functions check for decoder error before state!=START don't reset dc->command in quitDecode() added decoder_control.c removed the "queue" parameter from syncPlaylistWithQueue() merge the playlist lock functions into clearPlayerQueue() use switch/case in syncPlaylistWithQueue() don't call playerStop() before playerPlay() assert locked/unlocked in queue lock functions don't unlock player queue in playerStop(), playerWait() queueSong() cannot fail fix a comment regarding the player queue document the PLAYER_QUEUE_ constants added enum player_queue_state rewrote playerKill() player: don't call STOP before CLOSE_AUDIO playlist: eliminate unused fd parameters player: no "fd" and no return value flac: decoder command means EOF made "sample_size" static const moved jack configuration to the JackData struct jack: removed unused macros jack: don't set audioOutput->data=NULL jack: initialize JackData in jack_initDriver() jack: added freeJackClient() jack: initialize jd->client after !jd check jack: eliminate superfluous freeJackData() calls mp3, flac: check for seek command after decoder_read() check decoder_command!=NONE instead of decoder_command==STOP mp3: converted the MUTEFRAME_ macros to an enum mp3: converted the DECODE_ constants to an enum added flag "decoder.seeking" wavpack: don't use "isp" before initialization wavpack: moved code to wavpack_open_wvc() simplified code in the ogg decoder plugin added decoder_read() wavpack: added InputStreamPlus.decoder oggvorbis: don't detect OGG header if stream is not seekable added AacBuffer.decoder mp3: added mp3DecodeData.decoder mp3: audio_linear_dither() returns mpd_sint16 mp3: changed outputBuffer's type to mpd_sint16[] mp3: moved num_samples calculation out of the loop mp3: eliminated outputPtr mp3: don't do a second flush in mp3_decode() mp3: always flush directly after decoding/dithering mp3: dither a whole block at a time mp3: moved dropSamplesAtEnd check out of the loop mp3: make samplesPerFrame more local mp3: unsigned integers mp3: removed double cmd==STOP check mp3: moved code to dither_buffer() mp3: don't check dropSamplesAtStart in the loop assert song->url != NULL aac: support decoding AAC streams aac: splitted aac_parse_header() from initAacBuffer() aac: check buffer lengths aac: use fillAacBuffer() instead of manual reading find AAC frames aac: moved code to adts_check_frame() aac: moved code to aac_buffer_shift() aac: use inputStreamAtEOF() aac: don't depend on consumed data in fillAacBuffer() aac: simplified fillAacBuffer() aac: make adtsParse() void aac: use size_t aac: removed unused initAacBuffer() parameters eliminate unused variables in the AAC decoder added InputStream.ready added decoder_plugin_register() don't call quitDecode() in waitOnDecode() moved code to player_thread.c moved code to crossfade.c added inline function audio_format_time_to_size() pass max_chunks to calculateCrossFadeChunks() converted MpdTagItem.type to an enum renamed functions in decoder_list.h no camel case in struct decoder_plugin renamed the InputPlugin function types renamed inputPlugin.* to decoder_list.* moved decoder externs to inputPlugin.c renamed InputPlugin to struct decoder_plugin no busy-waiting for the player process converted PlayerControl.state to enum added PlayerControl.command eliminate OUTPUT_BUFFER_DC_STOP, OUTPUT_BUFFER_DC_SEEK added decoder_get_url() don't set dc->seekable in wavpack plugin use a local "initialized" flag instead of dc->state added decoder_seek_where() and decoder_seek_error() added decoder_command_finished() to decoder_api.h added decoder_get_command() moved convState to struct decoder moved struct AudioFormat to audio_format.h moved InputPlugin to decoder_api.h remove one indent level from audiofile plugin use break instead of local variable "eof" removed local variable "eof" because it is unused simplify several dc->command checks added parameter total_time to decoder_initialized() added audio_format parameter to decoder_initialized() added decoder_clear() and decoder_flush() tail_chunk() returns ob_chunk pointer added OutputBuffer.notify added decoder_data() use the notify library in main_notify.c do not sleep after openAudioDevice() added decoder_initialized() added struct decoder invoke the notify API directly removed "else" added dc_command_finished() don't busy wait for the decoder thread merged start, stop, seek into DecoderControl.command don't set pc->errored_song in decodeStart() added dc.next_song, renamed pc.current_song clean up CPP includes enable -Wpointer-arith, -Wstrict-prototypes quote "=" in the CFLAGS check fix warnings in the HTTP client fixed ringbuf.c warnings configure.ac | 3 m4/mpd_check_cflag.m4 | 2 src/Makefile.am | 21 + src/audio.c | 1 src/audio.h | 13 - src/audioOutput.c | 1 src/audioOutput.h | 2 src/audioOutputs/audioOutput_ao.c | 2 src/audioOutputs/audioOutput_jack.c | 185 +++++----- src/audioOutputs/audioOutput_null.c | 5 src/audioOutputs/audioOutput_oss.c | 3 src/audioOutputs/audioOutput_shout.c | 2 src/audio_format.h | 40 ++ src/command.c | 220 ++++++++---- src/crossfade.c | 62 +++ src/crossfade.h | 34 ++ src/dbUtils.c | 24 + src/decode.c | 607 ---------------------------------- src/decode.h | 64 ---- src/decoder_api.c | 211 ++++++++++++ src/decoder_api.h | 157 +++++++++ src/decoder_control.c | 91 +++++ src/decoder_control.h | 92 +++++ src/decoder_internal.h | 33 ++ src/decoder_list.c | 169 +++++++++ src/decoder_list.h | 48 +++ src/decoder_thread.c | 199 +++++++++++ src/decoder_thread.h | 25 + src/inputPlugin.c | 154 --------- src/inputPlugin.h | 106 ------ src/inputPlugins/_flac_common.c | 25 + src/inputPlugins/_flac_common.h | 23 + src/inputPlugins/_ogg_common.c | 13 - src/inputPlugins/_ogg_common.h | 2 src/inputPlugins/aac_plugin.c | 418 ++++++++++++++++------- src/inputPlugins/audiofile_plugin.c | 94 ++--- src/inputPlugins/flac_plugin.c | 105 +++--- src/inputPlugins/mod_plugin.c | 44 +- src/inputPlugins/mp3_plugin.c | 338 ++++++++++--------- src/inputPlugins/mp4_plugin.c | 86 ++--- src/inputPlugins/mpc_plugin.c | 91 ++--- src/inputPlugins/oggflac_plugin.c | 67 ++-- src/inputPlugins/oggvorbis_plugin.c | 147 ++++---- src/inputPlugins/wavpack_plugin.c | 239 ++++++------- src/inputStream.c | 1 src/inputStream.h | 2 src/inputStream_file.c | 4 src/inputStream_http.c | 11 - src/locate.c | 4 src/ls.c | 11 - src/ls.h | 7 src/main.c | 28 +- src/main_notify.c | 17 - src/normalize.h | 2 src/outputBuffer.c | 97 +---- src/outputBuffer.h | 37 +- src/pcm_utils.c | 6 src/pcm_utils.h | 2 src/player.c | 345 ------------------- src/player.h | 139 -------- src/playerData.c | 24 - src/playerData.h | 10 - src/player_control.c | 266 +++++++++++++++ src/player_control.h | 164 +++++++++ src/player_thread.c | 439 +++++++++++++++++++++++++ src/player_thread.h | 24 + src/playlist.c | 198 +++++------ src/playlist.h | 8 src/replayGain.h | 2 src/ringbuf.c | 8 src/ringbuf.h | 2 src/sig_handlers.c | 4 src/song.c | 14 + src/stats.c | 2 src/tag.c | 8 src/tag.h | 34 +- src/timer.h | 4 src/tree.c | 14 - src/volume.c | 4 src/zeroconf.c | 9 - 80 files changed, 3461 insertions(+), 2758 deletions(-) create mode 100644 src/audio_format.h create mode 100644 src/crossfade.c create mode 100644 src/crossfade.h delete mode 100644 src/decode.c delete mode 100644 src/decode.h create mode 100644 src/decoder_api.c create mode 100644 src/decoder_api.h create mode 100644 src/decoder_control.c create mode 100644 src/decoder_control.h create mode 100644 src/decoder_internal.h create mode 100644 src/decoder_list.c create mode 100644 src/decoder_list.h create mode 100644 src/decoder_thread.c create mode 100644 src/decoder_thread.h delete mode 100644 src/inputPlugin.c delete mode 100644 src/inputPlugin.h delete mode 100644 src/player.c delete mode 100644 src/player.h create mode 100644 src/player_control.c create mode 100644 src/player_control.h create mode 100644 src/player_thread.c create mode 100644 src/player_thread.h ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team