| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
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".
|
|
|
|
| |
InputPlugin to decoder_plugin, and no camelCase.
|
| |
|
|
|
|
|
| |
Since inputPlugin.c manages the list of registered decoders, we should
rename the source 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.
|
|
|
|
|
| |
(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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Moved all of the player-waiting code to decoder_data(), to make
OutputBuffer more generic.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Include only headers which are really required. This speeds up
compilation and helps detect cross-layer accesses.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
If nothing has been read from the input stream, we don't have to
rewind it.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7397 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
| |
The variable "to_read" is never modified except in the last iteration
of the while loop. This means the while condition will never become
false, as the body will break before that may be checked.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7396 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
| |
This patch was taken from
http://bugzilla.livna.org/show_bug.cgi?id=1987 and addresses bug
0001693[1]
[1] - http://musicpd.org/mantis/view.php?id=1693
git-svn-id: https://svn.musicpd.org/mpd/trunk@7374 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
| |
git-svn-id: https://svn.musicpd.org/mpd/trunk@7370 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
| |
When we are in an input plugin, dc.current_song should already be
set. Use it instead of pc.current_song.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7363 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
This at least makes the argument list to a lot of our plugin
functions shorter and removes a good amount of line nois^W^Wcode,
hopefully making things easier to read and follow.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
|
|
|
|
|
|
|
|
|
|
| |
It actually increases our image size a small bit and may even
hurt performance a very small bit, but makes the code less
verbose and easier to manage.
I don't see a reason for mpd to ever support playing multiple
files at the same time (users can run multiple instances of mpd
if they really want to play Zaireeka, but that's such an edge
case it's not worth ever supporting in our code).
git-svn-id: https://svn.musicpd.org/mpd/trunk@7352 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|