Commit Graph

41 Commits

Author SHA1 Message Date
Max Kellermann
9eed41911f decoder: return void from decode() methods
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.
2008-11-11 17:13:44 +01:00
Max Kellermann
114b3c1e78 replay_gain: no CamelCase
Renamed functions and variables.
2008-11-11 15:55:34 +01:00
Max Kellermann
54ad08ab37 replay_gain: renamed sources to replay_gain.c, replay_gain.h
No CamelCase file names.
2008-11-11 15:55:34 +01:00
Max Kellermann
ff1acefb21 decoder: removed plugin method try_decode()
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.
2008-11-10 15:07:01 +01:00
Max Kellermann
c9c7dc6e00 decoder: updated API documentation
Updated documentation on the stream_decode() and file_decode() return
values.
2008-11-09 22:10:48 +01:00
Max Kellermann
85a7d1a148 decoder: removed stream_types
Instead of checking the stream_types bit set, we can simply check
whether the methods stream_decode() and file_decode() are implemented.
2008-11-04 17:10:19 +01:00
Max Kellermann
020c04e702 decoder_api: added decoder_tag()
Provide an API for submitting additional tags from the stream.
2008-11-02 17:02:28 +01:00
Max Kellermann
c9e15bc418 decoder_api: pass "seekable" flag to decoder_initialized()
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.
2008-11-02 17:01:51 +01:00
Max Kellermann
1a4a3e1f1f decoder: manage decoder list in a static array
Currently, there is no way to dynamically load decoder plugins, thus
we don't need a dynamic list to manage them.
2008-11-01 14:53:30 +01:00
Max Kellermann
78448fe1a5 decoder_api: pass constant path pointers 2008-10-31 15:56:43 +01:00
Max Kellermann
ea515494cb added prefix to header macros
"LOG_H" is a macro which is also used by ffmpeg/log.h.  This is
ffmpeg's fault, because short macros should be reserved for
applications, but since it's always a good idea to choose prefixed
macro names, even for applications, we are going to do that in MPD.
2008-10-31 09:19:53 +01:00
Max Kellermann
62d4fa9306 decoder: use bool for return values and flags
Don't return 0/-1 on success/error, but true/false.  Instead of int,
use bool for storing flags.
2008-10-30 08:38:54 +01:00
Max Kellermann
528b7c3f5e decoder: automatically flush the output buffer after decoder exits
A decoder_flush() invocation was missing in the FLAC plugin, resulting
in casual assertion failures due to a wrong assumption about the last
chunk's audio format.  It's much easier to remove that decoder_flush()
function and make the decoder thread call ob_flush().
2008-10-29 17:29:06 +01:00
Max Kellermann
be90199c5a decoder_api: removed decoder_clear()
Call ob_clear() in decoder_command_finished() instead of implementing
that call in every decoder plugin.
2008-10-29 17:28:47 +01:00
Max Kellermann
bbaedb17d5 input_stream: renamed sources, no CamelCase
Renamed inputStream.c and inputStream_file.c.
2008-10-26 19:38:50 +01:00
Max Kellermann
b73ecbb073 input: declare struct input_stream
Provide a struct type which can be forward-declared.  The typedef
InputStream is deprecated now.
2008-10-17 17:53:48 +02:00
Max Kellermann
b084bc28ed use the "bool" data type instead of "int"
"bool" should be used in C99 programs for boolean values.
2008-10-08 11:03:39 +02:00
Max Kellermann
21d3d300fd decoder: renamed plugin methods
Why have a "_func" prefix on all method names?  Also don't typedef the
methods, there is no advantage in that.
2008-09-29 15:54:27 +02:00
Max Kellermann
226d52b36f switch to C99 types, part II
Do full C99 integer type conversion in all modules which were not
touched by Eric's merged patch.
2008-09-29 15:49:29 +02:00
Max Kellermann
f1dd9c209c audio_format: converted typedef AudioFormat to struct audio_format
Get rid of CamelCase, and don't use a typedef, so we can
forward-declare it, and unclutter the include dependencies.
2008-09-07 19:19:55 +02:00
Max Kellermann
6f72fe3ecf tag: moved code to tag_id3.c
The ID3 code uses only the public tag API, but is otherwise
unrelated.  Move it to a separate source file.
2008-08-29 09:38:27 +02:00
Max Kellermann
d0556dc983 tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_item
Getting rid of CamelCase; not having typedefs also allows us to
forward-declare the structures.
2008-08-29 09:38:11 +02:00
Max Kellermann
15c9352bb6 moved enum decoder_command to decoder_api.h
The decoder plugins need this type, so export it in the public API.
This allows is to remove "decode.h" from "decoder_api.h", uncluttering
the API namespace some more.
2008-08-26 08:41:05 +02:00
Max Kellermann
1c03c721ea moved variable "dc" to decode.h
Now that "dc" is available here, we don't have to pass it to
decoder_is_idle() and decoder_is_starting() anymore.
2008-08-26 08:40:47 +02:00
Max Kellermann
940ecf5345 added decoder_read()
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.
2008-08-26 08:27:14 +02:00
Max Kellermann
6120635f06 added decoder_plugin_register()
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".
2008-08-26 08:27:09 +02:00
Max Kellermann
772d3da98a no camel case in struct decoder_plugin 2008-08-26 08:27:08 +02:00
Max Kellermann
f1a014d094 renamed the InputPlugin function types
Continuing the effort to rename InputPlugin to decoder_plugin...
2008-08-26 08:27:08 +02:00
Max Kellermann
e41be362a1 renamed InputPlugin to struct decoder_plugin
"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.
2008-08-26 08:27:08 +02:00
Max Kellermann
c7384b65ac eliminate OUTPUT_BUFFER_DC_STOP, OUTPUT_BUFFER_DC_SEEK
(Ab)use the decoder_command enumeration, which has nearly the same
values and the same meaning.
2008-08-26 08:27:07 +02:00
Max Kellermann
67bf4b448d added decoder_get_url()
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.
2008-08-26 08:27:07 +02:00
Max Kellermann
17e9cc84c5 added decoder_seek_where() and decoder_seek_error()
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.
2008-08-26 08:27:07 +02:00
Max Kellermann
78c55e2432 added decoder_command_finished() to decoder_api.h
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().
2008-08-26 08:27:07 +02:00
Max Kellermann
817a68b2b2 added decoder_get_command()
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.
2008-08-26 08:27:07 +02:00
Max Kellermann
08bdb43bef moved InputPlugin to decoder_api.h
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".
2008-08-26 08:27:06 +02:00
Max Kellermann
0d8b551c5a added parameter total_time to decoder_initialized()
Similar to the previous patch: pass total_time instead of manipulating
dc->totalTime directly.
2008-08-26 08:27:05 +02:00
Max Kellermann
4590a98f0e added audio_format parameter to decoder_initialized()
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().
2008-08-26 08:27:05 +02:00
Max Kellermann
0d45870cea added decoder_clear() and decoder_flush()
We are now beginning to remove direct structure accesses from the
decoder plugins.  decoder_clear() and decoder_flush() mask two very
common buffer functions.
2008-08-26 08:27:05 +02:00
Max Kellermann
2a83ccdb8f added decoder_data()
Moved all of the player-waiting code to decoder_data(), to make
OutputBuffer more generic.
2008-08-26 08:27:05 +02:00
Max Kellermann
2bf7ec4f39 added decoder_initialized()
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.
2008-08-26 08:27:04 +02:00
Max Kellermann
154aa496e8 added struct decoder
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.
2008-08-26 08:27:04 +02:00