1. 26 Aug, 2008 14 commits
    • Max Kellermann's avatar
      moved code to pc_init(), dc_init() · e2c8b960
      Max Kellermann authored
      e2c8b960
    • Max Kellermann's avatar
      renamed decode.h to decoder_control.h · 56cdce69
      Max Kellermann authored
      56cdce69
    • Max Kellermann's avatar
      renamed decode.c to decoder_thread.c · dff8c645
      Max Kellermann authored
      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.
      dff8c645
    • Max Kellermann's avatar
      moved enum decoder_command to decoder_api.h · 15c9352b
      Max Kellermann authored
      The decoder plugins need this type, so export it in the public API.
      This allows is to remove "decode.h" from "decoder_api.h", uncluttering
      the API namespace some more.
      15c9352b
    • Max Kellermann's avatar
      moved variable "dc" to decode.h · 1c03c721
      Max Kellermann authored
      Now that "dc" is available here, we don't have to pass it to
      decoder_is_idle() and decoder_is_starting() anymore.
      1c03c721
    • Max Kellermann's avatar
      hide DecoderControl accesses in inline functions · 70904adf
      Max Kellermann authored
      Unfortunately, we have to pass the DecoderControl pointer to these
      inline functions, because the global variable "dc" may not be
      available here.  This will be fixed later.
      70904adf
    • Max Kellermann's avatar
      added decoder_control.c · 8a4970f8
      Max Kellermann authored
      The source "decoder_control.c" provides an API for controlling the
      decoder.  This replaces various direct accesses to the DecoderControl
      struct.
      8a4970f8
    • Max Kellermann's avatar
      moved code to player_thread.c · e8bd9ddc
      Max Kellermann authored
      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.
      e8bd9ddc
    • Max Kellermann's avatar
      added decoder_command_finished() to decoder_api.h · 78c55e24
      Max Kellermann authored
      Some decoder commands are implemented in the decoder plugins, thus
      they need to have an API call to signal that their current command has
      been finished.  Let them use the new decoder_command_finished()
      instead of the internal dc_command_finished().
      78c55e24
    • Max Kellermann's avatar
      moved struct AudioFormat to audio_format.h · 1b845f94
      Max Kellermann authored
      We want to expose the AudioFormat structure to plugins; remove some
      clutter by moving its declaration to a separate header file.
      1b845f94
    • Max Kellermann's avatar
      invoke the notify API directly · 241cd043
      Max Kellermann authored
      Don't use wrappers like player_wakeup_decoder_nb().  These have been
      wrappers calling notify.c functions, for compatibility with the
      existing code when we migrated to notify.c.
      241cd043
    • Max Kellermann's avatar
      added dc_command_finished() · 9e0f7dcd
      Max Kellermann authored
      dc_command_finished() is invoked by the decoder thread when it has
      finished a command (sent by the player thread).  It resets dc.command
      and wakes up the player thread.  This combination was used at a lot of
      places, and by introducing this function, the code will be more
      readable.
      9e0f7dcd
    • Max Kellermann's avatar
      merged start, stop, seek into DecoderControl.command · 8d3942e0
      Max Kellermann authored
      Much of the existing code queries all three variables sequentially.
      Since only one of them can be set at a time, this can be optimized and
      unified by merging all of them into one enum variable.  Later, the
      "command" checks can be expressed in a "switch" statement.
      8d3942e0
    • Max Kellermann's avatar
      added dc.next_song, renamed pc.current_song · d507ff28
      Max Kellermann authored
      Since pc->current_song denotes the song which the decoder should use
      next, we should move it to DecoderControl.  This removes one internal
      PlayerControl struct access from the decoder code.
      
      Also add pc.next_song, which is manipulated by the playlist code, and
      gets copied to dc.next_song as soon as the decoder is started.
      d507ff28
  2. 01 Jun, 2008 1 commit
  3. 13 Apr, 2008 1 commit
  4. 12 Apr, 2008 6 commits
    • Max Kellermann's avatar
      pass dc to decoder_task() · 14529af7
      Max Kellermann authored
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      14529af7
    • Max Kellermann's avatar
      clean up CPP includes · c89b358c
      Max Kellermann authored
      Try to only include headers which are really needed.  We should
      particularly check all "headers including other headers".  The
      long-term goal is to have a manageable, small API for plugins
      (decoders, output) without so many mpd internals cluttering the
      namespace.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      c89b358c
    • Max Kellermann's avatar
      pass DecoderControl object to decoder_sleep() · 7642d10f
      Max Kellermann authored
      Less global variables: at any invocation of decoder_sleep(), we have a
      reference to the DecoderControl anyway, so we should pass it.  This
      costs less than having to call getPlayerData() in every tiny
      function.  Maybe some day we will be able to have multiple decoders at
      the same time...
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7316 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      7642d10f
    • Max Kellermann's avatar
      use the notify API in the decoder · 701cf688
      Max Kellermann authored
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7281 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      701cf688
    • Eric Wong's avatar
      Start using song pointers in core data structures · efa46423
      Eric Wong authored
      Instead of copying URLs everywhere...
      
      [merged r7186 from branches/ew]
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7244 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      efa46423
    • Eric Wong's avatar
      Initial cut of fork() => pthreads() for decoder and player · 9cf66d0e
      Eric Wong authored
      I initially started to do a heavy rewrite that changed the way processes
      communicated, but that was too much to do at once.  So this change only
      focuses on replacing the player and decode processes with threads and
      using condition variables instead of polling in loops; so the changeset
      itself is quiet small.
      
      * The shared output buffer variables will still need locking
      to guard against race conditions.  So in this effect, we're probably
      just as buggy as before.  The reduced context-switching overhead of
      using threads instead of processes may even make bugs show up more or
      less often...
      
      * Basic functionality appears to be working for playing local (and NFS)
      audio, including:
      play, pause, stop, seek, previous, next, and main playlist editing
      
      * I haven't tested HTTP streams yet, they should work.
      
      * I've only tested ALSA and Icecast.  ALSA works fine, Icecast
      metadata seems to get screwy at times and breaks song
      advancement in the playlist at times.
      
      * state file loading works, too (after some last-minute hacks with
      non-blocking wakeup functions)
      
      * The non-blocking (*_nb) variants of the task management functions are
      probably overused.  They're more lenient and easier to use because
      much of our code is still based on our previous polling-based system.
      
      * It currently segfaults on exit.  I haven't paid much attention
      to the exit/signal-handling routines other than ensuring it
      compiles.  At least the state file seems to work.  We don't
      do any cleanups of the threads on exit, yet.
      
      * Update is still done in a child process and not in a thread.
      To do this in a thread, we'll need to ensure it does proper
      locking and communication with the main thread; but should
      require less memory in the end because we'll be updating
      the database "in-place" rather than updating a copy and
      then bulk-loading when done.
      
      * We're more sensitive to bugs in 3rd party libraries now.
      My plan is to eventually use a master process which forks()
      and restarts the child when it dies:
      locking and communication with the main thread; but should
      require less memory in the end because we'll be updating
      the database "in-place" rather than updating a copy and
      then bulk-loading when done.
      
      * We're more sensitive to bugs in 3rd party libraries now.
      My plan is to eventually use a master process which forks()
      and restarts the child when it dies:
      
      master - just does waitpid() + fork() in a loop
      \- main thread
      \- decoder thread
      \- player thread
      
      At the beginning of every song, the main thread will set
      a dirty flag and update the state file.  This way, if we
      encounter a song that triggers a segfault killing the
      main thread, the master will start the replacement main
      on the next song.
      
      * The main thread still wakes up every second on select()
      to check for signals; which affects power management.
      
      [merged r7138 from branches/ew]
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7240 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      9cf66d0e
  5. 03 Jan, 2008 1 commit
    • Eric Wong's avatar
      Cleanup #includes of standard system headers and put them in one place · cb8f1af3
      Eric Wong authored
      This will make refactoring features easier, especially now that
      pthreads support and larger refactorings are on the horizon.
      
      Hopefully, this will make porting to other platforms (even
      non-UNIX-like ones for masochists) easier, too.
      
      os_compat.h will house all the #includes for system headers
      considered to be the "core" of MPD.  Headers for optional
      features will be left to individual source files.
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      cb8f1af3
  6. 28 Dec, 2007 1 commit
    • Eric Wong's avatar
      Merge branches/ew r7104 · b79f6b88
      Eric Wong authored
      thread-safety work in preparation for rewrite to use pthreads
      
      Expect no regressions against trunk (r7078), possibly minor
      performance improvements in update (due to fewer heap
      allocations), but increased stack usage.
      
      Applied the following patches:
      
      * maxpath_str for reentrancy (temporary fix, reverted)
      * path: start working on thread-safe variants of these methods
      * Re-entrancy work on path/character-set conversions
      * directory.c: exploreDirectory() use reentrant functions here
      * directory/update: more use of reentrant functions + cleanups
      * string_toupper: a strdup-less version of strDupToUpper
      * get_song_url: a static-variable-free version of getSongUrl()
      * Use reentrant/thread-safe get_song_url everywhere
      * replace rmp2amp with the reentrant version, rmp2amp_r
      * Get rid of the non-reentrant/non-thread-safe rpp2app, too.
      * buffer2array: assert strdup() returns a usable value in unit tests
      * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants
      * fix storing playlists w/o absolute paths
      * parent_path(), a reentrant version of parentPath()
      * parentPath => parent_path for reentrancy and thread-safety
      * allow "make test" to automatically run embedded unit tests
      * remove convStrDup() and maxpath_str()
      * use MPD_PATH_MAX everywhere instead of MAXPATHLEN
      * path: get rid of appendSlash, pfx_path and just use pfx_dir
      * get_song_url: fix the ability to play songs in the top-level music_directory
      
      git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
      b79f6b88
  7. 07 Sep, 2007 1 commit
  8. 05 Apr, 2007 1 commit
  9. 20 Aug, 2006 1 commit
  10. 20 Jul, 2006 1 commit
  11. 14 Jul, 2006 1 commit
  12. 13 Jul, 2006 1 commit
  13. 08 Mar, 2005 1 commit
  14. 03 Nov, 2004 1 commit
  15. 06 Jun, 2004 2 commits
  16. 01 Jun, 2004 1 commit
  17. 31 May, 2004 1 commit
  18. 30 May, 2004 1 commit
  19. 20 May, 2004 1 commit
  20. 19 May, 2004 2 commits