1. 26 Aug, 2008 28 commits
    • 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
      added decoder_get_command() · 817a68b2
      Max Kellermann authored
      Another big patch which hides internal mpd APIs from decoder plugins:
      decoder plugins regularly poll dc->command; expose it with a
      decoder_api.h function.
      817a68b2
    • Max Kellermann's avatar
      moved convState to struct decoder · 2e9169de
      Max Kellermann authored
      Since we moved all PCM conversions to decoder_data(), the attribute
      convState isn't being used anymore by the OutputBuffer code.  Move it
      to struct decoder.
      2e9169de
    • 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
      moved InputPlugin to decoder_api.h · 08bdb43b
      Max Kellermann authored
      InputPlugin is the API which is implemented by a decoder plugin.  This
      belongs to the public API/ABI, so move it to decoder_api.h.  It will
      later be renamed to something like "decoder_plugin".
      08bdb43b
    • Max Kellermann's avatar
      remove one indent level from audiofile plugin · 4a87f1e8
      Max Kellermann authored
      Anonymous code blocks just to declare variables look ugly.  Move the
      variable declarations up and disband the code block.
      4a87f1e8
    • Max Kellermann's avatar
      use break instead of local variable "eof" · d1862600
      Max Kellermann authored
      Similar to previous patch: eliminate one variable by using "break".
      This also simplifies the code since we can remove one level of indent.
      d1862600
    • Max Kellermann's avatar
      removed local variable "eof" because it is unused · 4c066249
      Max Kellermann authored
      "break" is so much easier than "eof=1; continue;", when "!eof" is the
      loop condition.
      4c066249
    • Max Kellermann's avatar
      simplify several dc->command checks · ee3bbb50
      Max Kellermann authored
      Since we have merged dc->stop, dc->seek into one variable, we don't
      have to check both conditions at a time; we can replace "!stop &&
      !seek" with "none".
      ee3bbb50
    • Max Kellermann's avatar
      added parameter total_time to decoder_initialized() · 0d8b551c
      Max Kellermann authored
      Similar to the previous patch: pass total_time instead of manipulating
      dc->totalTime directly.
      0d8b551c
    • Max Kellermann's avatar
      added audio_format parameter to decoder_initialized() · 4590a98f
      Max Kellermann authored
      dc->audioFormat is set once by the decoder plugins before invoking
      decoder_initialized(); hide dc->audioFormat and let the decoder pass
      an AudioFormat pointer to decoder_initialized().
      4590a98f
    • Max Kellermann's avatar
      added decoder_clear() and decoder_flush() · 0d45870c
      Max Kellermann authored
      We are now beginning to remove direct structure accesses from the
      decoder plugins.  decoder_clear() and decoder_flush() mask two very
      common buffer functions.
      0d45870c
    • Max Kellermann's avatar
      tail_chunk() returns ob_chunk pointer · ea51f732
      Max Kellermann authored
      Code simplification: since we are not using in-band signalling with
      the chunk index anymore, we can just return a pointer to the tail
      chunk instead of the index.
      ea51f732
    • Max Kellermann's avatar
      added OutputBuffer.notify · 5df6ff8d
      Max Kellermann authored
      OutputBuffer should be a more generic low-level library, without
      dependencies to the other headers.  This patch adds the field
      "notify", which is used to signal the player thread.  It is passed in
      the constructor, and removes the need to compile with the decode.h
      header.
      5df6ff8d
    • Max Kellermann's avatar
      added decoder_data() · 2a83ccdb
      Max Kellermann authored
      Moved all of the player-waiting code to decoder_data(), to make
      OutputBuffer more generic.
      2a83ccdb
    • Max Kellermann's avatar
      use the notify library in main_notify.c · 8814c0c8
      Max Kellermann authored
      Avoid some duplicated code in main_notify.c.
      8814c0c8
    • Max Kellermann's avatar
      do not sleep after openAudioDevice() · 4f80f53c
      Max Kellermann authored
      After the decoder has been initialized and the audio device has been
      opened, don't sleep.  The decoder plugin won't do anything special nor
      will it care to wake us up for some reason.
      4f80f53c
    • Max Kellermann's avatar
      added decoder_initialized() · 2bf7ec4f
      Max Kellermann authored
      decoder_initialized() sets the state to DECODE_STATE_DECODE and wakes
      up the player thread.  It is called by the decoder plugin after its
      internal initialization is finished.  More arguments will be added
      later to prevent direct accesses to the DecoderControl struct.
      2bf7ec4f
    • Max Kellermann's avatar
      added struct decoder · 154aa496
      Max Kellermann authored
      The decoder struct should later be made opaque to the decoder plugin,
      because maintaining a stable struct ABI is quite difficult.  The ABI
      should only consist of a small number of stable functions.
      154aa496
    • 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
      removed "else" · 87beded4
      Max Kellermann authored
      The "if" block breaked out of the loop.  That means we can move the
      code out of the "else" block.
      87beded4
    • 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
      don't busy wait for the decoder thread · 726c6e86
      Max Kellermann authored
      Busy wait loops are a bad thing, especially when the response time can
      be very long - busy waits eat a lot of CPU, and thus slow down the
      other thread.  Since the other thread will notify us when it's ready,
      we can use notify_wait() instead.
      726c6e86
    • 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
      don't set pc->errored_song in decodeStart() · 180d78a8
      Max Kellermann authored
      pc->errored_song is already set by decodeParent() in the player thread
      when we set dc->error; no need to set it in the decoder thread.
      180d78a8
    • 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
    • Max Kellermann's avatar
      clean up CPP includes · b6909da7
      Max Kellermann authored
      Include only headers which are really required.  This speeds up
      compilation and helps detect cross-layer accesses.
      b6909da7
    • Max Kellermann's avatar
      enable -Wpointer-arith, -Wstrict-prototypes · a383f451
      Max Kellermann authored
      Also enable -Wunused-parameter - this forces us to add the gcc
      "unused" attribute to a lot of parameters (mostly library callback
      functions), but it's worth it during code refactorizations.
      a383f451
  2. 25 Aug, 2008 3 commits
  3. 16 Aug, 2008 1 commit
  4. 30 Jun, 2008 8 commits