| Commit message (Collapse) | Author | Files | Lines |
|
Define the special value "-1" as "unknown size". Previously, there
was no indicator for streams with unknown size, which might confuse
some decoders.
|
|
The stream_decode() and file_decode() methods returned a boolean,
indicating whether they were able to decode the song. This is
redundant, since we already know that: if decoder_initialized() has
been called (and dc.state==DECODE), the plugin succeeded. Change both
methods to return void.
|
|
Renamed functions and variables.
|
|
Instead of having a seprate try_decode() method, let the
stream_decode() and file_decode() methods decide whether they are able
to decode the song.
|
|
The flac plugin wasn't initialized properly when an OGG file was being
decoded. For some reason, flac_process_metadata() was explicitly not
called for OGG files. Since that seems to fix the issue, make it
always call flac_process_metadata().
|
|
Since decoder_list.c does not include the libflac headers, it cannot
know whether to add the oggflac plugin to the decoder list. Solve
this by always enabling the oggflac sub-plugin, even with older
libflac versions. When the libflac API cannot support oggflac,
disable the plugin at runtime by returning "false" from its init()
method.
|
|
Disable flac's "oggflac" sub-plugin when libflac does not support
ogg-flac files.
|
|
Instead of checking the stream_types bit set, we can simply check
whether the methods stream_decode() and file_decode() are implemented.
|
|
Don't pass the "seekable" flag with every decoder_data() invocation.
Since that flag won't change within the file, it is enough to pass it
to decoder_initialized() once per file.
|
|
The strings were constant, but the pointers weren't. C syntax is
somewhat tricky..
|
|
All decoder_plugin structs are initialized at compile time, and must
never change.
|
|
|
|
Don't return 0/-1 on success/error, but true/false. Instead of int,
use bool for storing flags.
|
|
Call ob_clear() in decoder_command_finished() instead of implementing
that call in every decoder plugin.
|
|
For boolean values and success flags, use bool instead of integer (1/0
for true/false, 0/-1 for success/failure).
|
|
Renamed all functions and variables.
|
|
Everybody should use struct input_stream.
|
|
These plugins are not input plugins, they are decoder plugins. No
CamelCase in the directory name.
|
|
Don't compile the sources of disabled decoder plugins at all, and
don't attempt to register these.
|
|
The last bit of CamelCase in audio_format.h. Additionally, rename a
bunch of local variables.
|
|
"bool" should be used in C99 programs for boolean values.
|
|
When there are standardized headers, use these instead of the bloated
os_compat.h.
|
|
The old struct initializers are error prone and don't allow moving
elements around. Since we are going to overhaul some of the APIs
soon, it's easier to have all implementations use C99 initializers.
|
|
Why have a "_func" prefix on all method names? Also don't typedef the
methods, there is no advantage in that.
|
|
There is still a lot of duplicated code in flac_plugin.c and
oggflac_plugin.c. Move code from flac_plugin.c to _flac_common.c, and
use the new function flac_common_write() also in oggflac_plugin.c,
porting lots of optimizations over to it.
|
|
The previous patch on this topic was incomplete: it still added
data->chunk_length when calling flac_convert(). Remove this, too.
|
|
The inline function audio_format_sample_size() calculates how many
bytes each sample consumes. This function already takes into account
that 24 bit samples are 4 bytes long, not 3.
|
|
|
|
Getting rid of CamelCase; not having typedefs also allows us to
forward-declare the structures.
|
|
It was possible for the decoder thread to go into an endless loop
(flac and oggflac decoders): when a "STOP" command arrived, the Read()
callback would return 0, but the EOF() callback returned false. Fix:
when decoder_get_command()!=NONE, return EOF==true.
|
|
When we introduced decoder_read(), we added code which aborts the read
operation when a decoder command arrives. Several plugins however did
not expect that when they were converted to decoder_read(). Add
proper checks to the mp3 and flac decoder plugins.
|
|
The code said "decoder_command==STOP" because that was a conversion
from the old "dc->stop" test. As we can now check for all commands in
one test, we can simply rewrite that to decoder_command!=NONE.
|
|
On our way to stabilize the decoder API, we will one day remove the
input stream functions. The most basic function, read() will be
provided by decoder_api.h with this patch. It already contains a loop
(still with manual polling), error/eof handling and decoder command
checks. This kind of code used to be duplicated in all decoder
plugins.
|
|
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.
|
|
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".
|
|
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.
|
|
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.
|