Max Kellermann
14e121af90
flac, mpc, ogg, wavpack: include unistd.h for SEEK_SET
...
SEEK_SET is defined by unistd.h. Explicitly include it.
2008-11-24 10:33:08 +01:00
Max Kellermann
976d5045c6
decoder: check audio_format_valid() in all decoders
...
Refuse to play audio formats which are not supported by MPD.
2008-11-21 20:27:30 +01:00
Max Kellermann
eff21067f0
mpc: assume the result fo of mpc_decoder_decode() is unsigned
...
According to the documentation, mpc_decoder_decode() returns an
mpc_uint32_t. Since the special return value (mpc_uint32_t)-1
translates to a very large long integer, this may cause segmentation
faults if not interpreted properly.
2008-11-12 07:14:18 +01:00
Max Kellermann
0a6f4048d0
mpc: don't assume the stream is stereo
...
Don't hard-code the factor "2".
2008-11-12 07:07:40 +01:00
Max Kellermann
8d1ffb1684
mpc: get decoder command from decoder_data()
...
Removed 3 superfluous decoder_get_command() invocations.
2008-11-12 07:07:12 +01:00
Max Kellermann
731e99c26e
mpc: moved code to mpc_to_mpd_buffer()
...
mpc_to_mpd_buffer() converts a whole chunk at a time. This eliminates
3 local variables in mpc_decode().
2008-11-12 07:06:47 +01:00
Max Kellermann
975d5cd77e
mpc: make the buffer large enough for one mpc frame
...
Don't split the buffer conversion loop. When libmpcdec returns a
chunk, convert and send the whole chunk at a time. This moves several
checks out of the loop, and greatly improves performance.
2008-11-12 07:03:44 +01:00
Max Kellermann
865757835e
mpc: use GLib instead of utils.h/log.h
...
Don't use deprecated MPD libraries.
2008-11-12 07:02:29 +01:00
Max Kellermann
1414a3de4c
mpc: declare buffer as int32_t[]
...
The buffer is always casted to int32_t* anyway; declare it as int32_t
array, and remove the cast.
2008-11-12 07:02:06 +01:00
Max Kellermann
06c60888dc
mpc: eliminated the local variable "eof"
...
Since each "eof=true" is followed by "break", the variable is
superfluous.
2008-11-11 21:39:50 +01:00
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
5ddde0aac7
replay_gain: converted struct replay_gain_info elements to an array
...
Having an array instead of individual variables allows the use of the
replay_gain_mode enum as an array index.
2008-11-11 16:24:27 +01:00
Max Kellermann
114b3c1e78
replay_gain: no CamelCase
...
Renamed functions and variables.
2008-11-11 15:55:34 +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
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
4c1b96c307
decoder: make the suffixes and mime_types arrays really const
...
The strings were constant, but the pointers weren't. C syntax is
somewhat tricky..
2008-11-01 14:55:23 +01:00
Max Kellermann
0b614fbaae
decoder: make all decoder_plugin structs const
...
All decoder_plugin structs are initialized at compile time, and must
never change.
2008-11-01 14:54:09 +01:00
Max Kellermann
78448fe1a5
decoder_api: pass constant path pointers
2008-10-31 15:56:43 +01:00
Max Kellermann
5f6383d68c
mpc: provide 24 bit samples
...
Similar to libmad, libmpcdec provides samples with higher quality than
16 bit. Send 24 bit samples to MPD, which allows MPD to apply
dithering just in case the output devices are only 16 bit capable.
2008-10-30 08:45:00 +01:00
Max Kellermann
0db07a920e
mpc: moved sample size into a constant
...
Don't hard-code the "16 bits" or "2 bytes" in multiple locations.
2008-10-30 08:44:51 +01:00
Max Kellermann
6773dea5b0
mpc: renamed variable "s16" to "dest"
...
The name "s16" implies 16 bit integers. To make the code more
generic, rename it to "dest".
2008-10-30 08:44:43 +01:00
Max Kellermann
51348d6992
mpc: fix broken integer sample conversion
...
The conversion of integer samples was completely broken, which
presumably didn't annoy anybody because libmpcdec provides float
samples on most installations.
2008-10-30 08:44:28 +01:00
Max Kellermann
ecd485acbd
mpc: fix boolean interpretation of input_stream_seek()
...
When input_stream_seek() was converted to return a bool, this wasn't
adjusted in the musepack plugin.
2008-10-30 08:42:18 +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
5c19776f2f
input_stream: use "bool" instead of "int"
...
For boolean values and success flags, use bool instead of integer (1/0
for true/false, 0/-1 for success/failure).
2008-10-26 20:56:46 +01:00
Max Kellermann
dbc7e9ba2f
input_stream: no CamelCase
...
Renamed all functions and variables.
2008-10-26 20:34:47 +01:00
Max Kellermann
21b8590b53
input_stream: removed the InputStream typedef
...
Everybody should use struct input_stream.
2008-10-26 19:54:57 +01:00
Max Kellermann
e11355f47d
renamed src/inputPlugins/ to src/decoder/
...
These plugins are not input plugins, they are decoder plugins. No
CamelCase in the directory name.
2008-10-26 11:29:25 +01:00