aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2011-07-20pipe: lock the mutex in music_pipe_size()Max Kellermann1-1/+4
2009-12-31Update copyright notices.Avuton Olrich1-1/+1
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-05-11music_pipe: added assertion on chunk->audio_formatMax Kellermann1-0/+1
Always assert that the audio format of the new chunk is valid.
2009-03-13all: Update copyright header.Avuton Olrich1-6/+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-09music_pipe: added music_pipe_contains()Max Kellermann1-0/+21
2009-03-08music_chunk: added assertions on the audio formatMax Kellermann1-0/+33
In !NDEBUG, remember which audio_format is stored in every chunk and every pipe. Check the audio_format of every new data block appended to the music_chunk, and the format of every new chunk appended to the music_pipe.
2009-03-07music_pipe: refuse to push empty chunksMax Kellermann1-0/+4
Added two assertions.
2009-03-07music_pipe: poison music_chunk.nextMax Kellermann1-0/+5
The value of music_chunk.next is undefined for a chunk returned by music_pipe_shift(). For more pedantic debugging, poison the reference before returning the chunk.
2009-03-07music_pipe: added music_pipe_peek()Max Kellermann1-0/+6
music_pipe_peek() is similar to music_pipe_shift(), but doesn't remove the chunk. This allows it to be used with a "const" music_pipe.
2009-03-06pipe: added music_buffer, rewrite music_pipeMax Kellermann1-163/+58
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-86/+18
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-03-05music_chunk: added music_chunk_write(), music_chunk_expand()Max Kellermann1-16/+5
Moved some code from music_pipe_write() and music_pipe_expand(). Only music_chunk.c should access the music_chunk internals.
2009-03-03music_pipe: moved struct music_chunk to chunk.hMax Kellermann1-14/+1
2009-01-17music_pipe: removed music_pipe_append()Max Kellermann1-30/+0
The function is unused, since decoder_api() uses music_pipe_write() / music_pipe_expand() now.
2009-01-17music_pipe: added functions music_pipe_write() and music_pipe_expand()Max Kellermann1-32/+46
This new API gives the caller a writable buffer to the music pipe chunk. This may allow the caller to eliminate several buffer copies, because it may manipulate the returned buffer, until it calls music_pipe_expand().
2008-11-18music_pipe: narrowed assertion on chunk indexMax Kellermann1-1/+1
The chunk index passed to successor() must be valid, i.e. it must be smaller than num_chunks.
2008-11-13player: chop the tail of the music pipe after CANCELMax Kellermann1-0/+12
When a CANCEL command is received, the player should drop all chunks of the next song. Added new funciton music_pipe_chop() which is used for that.
2008-11-13music_pipe: continuously check the sample format of all chunksMax Kellermann1-0/+18
Provide a debug function which asserts on the sample format of all chunks. Call this function in each iteration of the player main loop.
2008-11-13music_pipe: check for partial frames in appended chunkMax Kellermann1-0/+2
Added an additional assertion which checks partial frames in the existing tail chunk.
2008-11-02music_pipe: add tag pointer to the music_chunk structMax Kellermann1-1/+27
Each music chunk can now carry a tag object. Decoder plugins which support it (e.g. oggvorbis) may use this to inject decoded tags into their output.
2008-11-02music_pipe: added functions chunk_init() and chunk_free()Max Kellermann1-10/+38
These two functions will care about memory allocation and deallocation in the future.
2008-11-02music_pipe: renamed "size" to "num_chunks"Max Kellermann1-10/+10
The name "num_chunks" expresses the meaning of the variable better.
2008-11-02music_pipe: no CamelCaseMax Kellermann1-14/+14
Rename all variables and struct members.
2008-11-02music_pipe: set bit_rate and time in music_pipe_append()Max Kellermann1-10/+10
Don't bother to pass these values as parameters to tail_chunk().
2008-11-02music_pipe: moved code to music_chunk_append()Max Kellermann1-13/+28
2008-11-02music_pipe: renamed "ob" to "music_pipe"Max Kellermann1-43/+43
Last music_pipe rename patch: renamed the global variable (singleton).
2008-11-02music_pipe: use GLib instead of utils.hMax Kellermann1-3/+3
Eliminate the deprecated utils.h memory allocation functions.
2008-11-02decoder: replaced music_pipe.audioFormat with dc.out_audio_formatMax Kellermann1-1/+3
.. and rename dc.audioFormat to dc.in_audio_format. The music pipe does not need to know the audio format, and its former "audioFormat" property indicated the format of the most recently added chunk, which might be confusing when you are reading the oldest chunks.
2008-11-02music_pipe: pass frame size to tail_chunk()Max Kellermann1-3/+2
Don't make tail_chunk() calculate the frame size again.
2008-11-02music_pipe: renamed ob_* functions to music_pipe_*Max Kellermann1-20/+20
Rename all functions to the new prefix.
2008-11-02music_pipe: renamed struct output_buffer to struct music_pipeMax Kellermann1-6/+8
.. and rename ob_chunk to struct music_chunk.
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-10-23output_buffer: don't split framesMax Kellermann1-1/+10
Splitting a frame between two buffer chunks causes distortion in the output. MPD used to assume that the chunk size 1020 would never cause splitted frames, but that isn't the case for 24 bit stereo (127.5 frames), and even less for files with even more channels.
2008-10-12output_buffer: converted ob_is_empty() to inlineMax Kellermann1-5/+0
The function ob_is_empty() is called very often. It's worth it to convert it to an inline function.
2008-10-08use the "bool" data type instead of "int"Max Kellermann1-2/+2
"bool" should be used in C99 programs for boolean values.
2008-10-08don't include os_compat.hMax Kellermann1-0/+3
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-10-08notify: removed the "Notify" typedefMax Kellermann1-2/+3
Typedefs shouldn't be used, use the bare struct names instead.
2008-09-29switch to C99 types, part IIMax Kellermann1-2/+2
Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
2008-08-26moved global variable "ob" to outputBuffer.hMax Kellermann1-1/+2
This releases several include file dependencies. As a side effect, "CHUNK_SIZE" isn't defined by decoder_api.h anymore, so we have to define it directly in the plugins which need it. It just isn't worth it to add it to the decoder plugin API.
2008-08-26moved convState to struct decoderMax Kellermann1-1/+0
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.
2008-08-26tail_chunk() returns ob_chunk pointerMax Kellermann1-8/+6
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.
2008-08-26added OutputBuffer.notifyMax Kellermann1-3/+4
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.
2008-08-26added decoder_data()Max Kellermann1-66/+16
Moved all of the player-waiting code to decoder_data(), to make OutputBuffer more generic.
2008-08-26invoke the notify API directlyMax Kellermann1-2/+3
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.
2008-08-26added dc_command_finished()Max Kellermann1-2/+1
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.
2008-08-26merged start, stop, seek into DecoderControl.commandMax Kellermann1-3/+3
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.
2008-04-15added ob_set_lazy()Max Kellermann1-1/+7
In lazy mode (previously the default), outputBuffer.c only wakes up the player when it was previously empty. That caused a deadlock when the player was waiting for buffered_before_play, since the decoder wouldn't wake up the player when buffered_before_play was reached. In non-lazy mode, always wake up the player when a new chunk was decoded. git-svn-id: https://svn.musicpd.org/mpd/trunk@7364 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13Make the OutputBuffer API more consistentEric Wong1-65/+65
We had functions names varied between outputBufferFoo, fooOutputBuffer, and output_buffer_foo That was too confusing for my little brain to handle. And the global variable was somehow named 'cb' instead of the more obvious 'ob'... git-svn-id: https://svn.musicpd.org/mpd/trunk@7355 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-13Stop passing our single OutputBuffer object everywhereEric Wong1-69/+69
All of our main singleton data structures are implicitly shared, so there's no reason to keep passing them around and around in the stack and making our internal API harder to deal with. git-svn-id: https://svn.musicpd.org/mpd/trunk@7354 09075e82-0dd4-0310-85a5-a0d7c8717e4f