| Commit message (Collapse) | Author | Files | Lines |
|
initAacBuffer() should really only initialize the buffer; currently,
it also reads data from the input stream and parses the header. All
of the AAC buffer code should probably be moved to a separate library
anyway.
|
|
The AAC plugin sometimes does not check the length of available data
when checking for magic prefixes. Add length checks.
|
|
Eliminate some duplicated code by using fillAacBuffer().
|
|
Find AAC frames in the input and skip invalid data. This prepares AAC
streaming.
|
|
adts_check_frame() checks whether the buffer head is an AAC frame, and
returns the frame length.
|
|
Shifting from the buffer queue is a common operation, and should be
provided as a separate function. Move code to aac_buffer_shift() and
add a bunch of assertions.
|
|
When checking for EOF, we should not check whether the read request
has been fully satisified. The InputStream API does not guarantee
that readFromInputStream() always fills the whole buffer, if EOF is
not reached. Since there is the function inputStreamAtEOF() dedicated
for this purpose, we should use it for EOF checking after
readFromInputStream()==0.
|
|
Fill the AacBuffer even when nothing has been consumed yet. The
function should not check for consumed data, but for free space at the
end of the buffer.
|
|
Return instead of putting all the code into a if-closure. That saves
one level of indentation.
|
|
adtsParse() always returns 1, and its caller does not use the return
value.
|
|
|
|
Since we eliminated the parameters retFileread and retTagsize in all
callers, we can now safely remove it from the function prototype.
|
|
|
|
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.
|
|
With the functions decoder_plugin_register() and
decoder_plugin_unregister(), decoder plugins can register a
"secondary" plugin, like the flac input plugin does this for
"oggflac".
|
|
To make the code more consistent, call quitDecode() only at the end of
decodeParent().
|
|
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.
|
|
decode.c should be a lot smaller; start by moving all code which
handles cross-fading to crossfade.c. Also includes camelCase
conversion.
|
|
Make the code more readable by hiding big formulas in an inline
function with a nice name.
|
|
Make calculateCrossFadeChunks() more generic and portable by
eliminating global variable access.
|
|
Don't use CPP macros when you can use C enum... this also allows
better type checking.
|
|
InputPlugin to decoder_plugin, and no camelCase.
|
|
|
|
Continuing the effort to rename InputPlugin to decoder_plugin...
|
|
Since inputPlugin.c manages the list of registered decoders, we should
rename the source file.
|
|
The decoder_plugin instances are only used inputPlugin.c, so move them
from the header file.
|
|
"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.
|
|
The function player_command() inherited the busy-waiting algorithm
from the old code; throw in a wait_main_task() to do idle waiting.
|
|
Don't write CPP when you can express the same in C... macros vs enum
is a good example for that.
|
|
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.
|
|
(Ab)use the decoder_command enumeration, which has nearly the same
values and the same meaning.
|
|
The wavpack decoder plugin implements a hack, and it needs the song
URL for that. This API (and the hack) should be revised later, but
add that function for now.
|
|
dc->seekable is already set by decodeStart().
|
|
Since we want to hide mpd internals from the decoder plugins, the
plugins should not check dc->state whether they have already called
decoder_initialized(). Use a local variable to track that.
|
|
Provide access to seeking for the decoder plugins; they have to know
where to seek, and they need a way to tell us that seeking has failed.
|
|
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().
|
|
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.
|
|
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.
|
|
We want to expose the AudioFormat structure to plugins; remove some
clutter by moving its declaration to a separate header file.
|
|
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".
|
|
Anonymous code blocks just to declare variables look ugly. Move the
variable declarations up and disband the code block.
|
|
Similar to previous patch: eliminate one variable by using "break".
This also simplifies the code since we can remove one level of indent.
|
|
"break" is so much easier than "eof=1; continue;", when "!eof" is the
loop condition.
|
|
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".
|
|
Similar to the previous patch: pass total_time instead of manipulating
dc->totalTime directly.
|
|
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().
|
|
We are now beginning to remove direct structure accesses from the
decoder plugins. decoder_clear() and decoder_flush() mask two very
common buffer functions.
|
|
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.
|
|
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.
|
|
Moved all of the player-waiting code to decoder_data(), to make
OutputBuffer more generic.
|