| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
The "decoder" object reference will be used by another patch.
|
|
|
|
|
|
|
|
|
| |
If the input stream is not seekable, the try_decode() function
consumes valuable data, which is not available to the decode()
function anymore. This means that the decode() function does not
parse the header correctly. Better skip the detection if we cannot
seek. Or implement better buffering, something like unread() or
buffered rewind().
|
|
|
|
|
|
| |
We need the decoder object at several places in the AAC plugin. Add
it to mp3DecodeData, so we don't have to pass it around in every
function.
|
|
|
|
|
|
| |
We need the decoder object at several places in the mp3 plugin. Add
it to mp3DecodeData, so we don't have to pass it around in every
function.
|
|
|
|
|
|
| |
The return value of audio_linear_dither() is always casted to
mpd_sint16. Returning long does not make sense, and consumed 8 bytes
on a 64 bit platform.
|
|
|
|
|
| |
The output buffer always contains mpd_sint16; declaring it with that
type saves several casts.
|
|
|
|
|
| |
The previous patch removed all loop specific dependencies from the
num_samples formula; we can now calculate it before entering the loop.
|
|
|
|
|
|
| |
The output buffer is always flushed after being appended to, which
allows us to assume it is always empty. Always start writing at
outputBuffer, don't remember outputPtr.
|
|
|
|
|
|
| |
The previous patch made mp3Read() flush the output buffer in every
iteration, which means we can eliminate the flush check after invoking
mp3Read().
|
|
|
|
|
| |
Since we try to fill the buffer in every iteration, we assume that we
should flush the output buffer at the end of each iteration.
|
|
|
|
|
|
| |
Fill the whole output buffer at a time by using dither_buffer()'s
ability to decode blocks. Calculate how many samples fit into the
output buffer before each invocation.
|
|
|
|
|
|
|
| |
Simplifying loops for performance: why check dropSamplesAtEnd in every
iteration, when we could modify the loop boundary? The (writable)
variable samplesLeft can be eliminated; add a write-once variable
pcm_length instead, which is used for the loop condition.
|
|
|
|
|
|
| |
The variable samplesPerFrame is used only in one single closure. Make
it local to this closure. The compiler will probably convert it to a
register anyway.
|
| |
|
|
|
|
|
| |
cmd has already been checked before, it cannot have changed meanwhile
because it is a local variable.
|
|
|
|
|
|
|
|
| |
Preparing for simplifying and thus speeding up the dithering code:
moved dithering to a separate function which contains a trivial loop.
With this patch, only one sample is dithered at a time, but the
following patches will allow us to dither a whole block at a time,
without complicated buffer length checks.
|
|
|
|
|
| |
Performance improvement by moving stuff out of a loop: skip part of
the first frame before entering the loop.
|
| |
|
|
|
|
|
|
| |
Copy some code from aac_decode() to aac_stream_decode() and apply
necessary changes to allow streaming audio data. Both functions might
be merged later.
|
|
|
|
|
|
|
| |
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.
|