Max Kellermann
fed719197c
song: allocate the result of song_get_url()
2009-01-04 19:09:34 +01:00
Max Kellermann
38bf81285f
utils: removed unused functions
...
Removed all allocation functions, xwrite(), xread(), ARRAY_SIZE().
Those have been superseded by GLib.
2009-01-03 14:53:42 +01:00
Max Kellermann
17bdcc8bae
decoder plugins: don't include gcc.h
...
Use GLib's G_GNUC_UNUSED instead of gcc.h's mpd_unused.
2009-01-01 18:09:24 +01:00
Max Kellermann
95b3430f52
removed os_compat.h
...
Only include headers which are really needed. os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
2008-12-29 17:28:32 +01:00
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
Laszlo Ashin
a493aafe02
wavpack: use assert_static()
2008-11-22 14:28:11 +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
Laszlo Ashin
05f4629fa3
wavpack: redo using audio_format_frame_size()
...
Somehow we lost 600e1322
after renaming some variables in ed6f6046
.
2008-11-19 00:02:06 +01:00
Max Kellermann
7591403566
input_stream: size==-1 means unknown size
...
Define the special value "-1" as "unknown size". Previously, there
was no indicator for streams with unknown size, which might confuse
some decoders.
2008-11-16 20:42:08 +01:00
László Áshin
440b1ea3ea
wavpack: be more robust if the underlying stream is not seekable
...
The wavpack open function gives us an option called OPEN_STREAMING. This
provides more robust and error tolerant playback, but it automatically
disables seeking. (More exactly the wavpack lib will not return the
length information.) So, if the stream is already not seekable we can
use this option safely.
2008-11-14 15:23:18 +01:00
László Áshin
c495c6f5af
wavpack: tolerate less decoded data than requested
...
Wavpack plugin doesn't stop decoding if a block couldn't be fully
decoded, rather it tries to go on.
2008-11-14 15:23:13 +01:00
László Áshin
ed6f60460d
wavpack: renamed variables and modified coding style slightly
2008-11-14 15:21:44 +01:00
Max Kellermann
93f488f034
wavpack: remove commented debug messages
2008-11-12 21:25:08 +01:00
Max Kellermann
600e132280
wavpack: calculate outsamplesize with audio_format_frame_size()
2008-11-12 21:25:02 +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
5e686add91
wavpack: added wavpack_tag_float()
...
The function simplifies wavpack_replaygain(), because it already
contains the float parser, and it works with a fixed buffer instead of
doing expensive heap allocations.
2008-11-11 16:21:09 +01:00
Max Kellermann
c883d761ab
wavpack: make the "key" argument to wavpack_tag() const
...
This allows us to remove the "static char[]" hack.
2008-11-11 16:19:29 +01:00
Max Kellermann
114b3c1e78
replay_gain: no CamelCase
...
Renamed functions and variables.
2008-11-11 15:55:34 +01:00
Max Kellermann
ab24e203cd
wavpack: removed try_decode() method
...
Wavpack's try_decode() implementation does nothing useful, it only
duplicates code already in stream_decode() / file_decode(), and slows
down MPD.
2008-11-09 22:10:48 +01:00
Laszlo Ashin
343a8a20e3
wavpack: make 24-bit samples available for mpd
...
This patch makes 24-bit samples available for mpd. I tested with the
WavPack Test Suite found on wavpack.com:
http://www.rarewares.org/wavpack/test_suite.zip
Every test file worked fine.
2008-11-08 13:11:10 +01:00
Laszlo Ashin
3e338da871
wavpack: check last_byte in push_back_byte() method
...
At this moment the wavpack lib doesn't use the return value of the
push_back function, which has an equivalent meaning of the return
value of ungetc(). This is a lucky situation, because so far it
simply returned with 1 as a hard coded value. From now on the
function will return EOF on error. (This function makes exactly one
byte pushable back.)
2008-11-08 13:10:15 +01:00
Laszlo Ashin
cfd55b29bd
wavpack: wrapper for converting void* to struct wavpack_input*
...
A new function has been added to do a cast and a little check in the
wavpack-mpd input stream wrapper.
2008-11-08 13:09:07 +01:00
Laszlo Ashin
2b4a410bb0
wavpack: put braces around one line code blocks
...
I think this makes the code more easily modifiable and prevents some
annoying mistakes.
2008-11-08 13:08:21 +01:00
Laszlo Ashin
d68df99ef4
wavpack: added prefix to local function names
...
There are some functions in the wavpack-mpd input streams wrapper
which had too commonly used names (especially can_seek). I prefixed
these with "wavpack_input_".
2008-11-08 13:07:40 +01:00
Laszlo Ashin
ff2e69c003
wavpack: unified code style
...
Not every function header has its return type in a distinct line. This
patch corrects that. This way there is more space for the arguments.
2008-11-08 13:07:09 +01:00
Laszlo Ashin
2e0ba90208
wavpack: check wvc seekability
...
Using wvc streams the seekableness depends on the seekability of the
wvc stream as well.
2008-11-06 06:48:33 +01:00
Laszlo Ashin
56d2b51056
wavpack: close wvc stream on error
...
The input stream opened for wvc is not closed in an if branch. A
close call has been added.
2008-11-06 06:48:33 +01:00
Laszlo Ashin
089c9b7e5c
wavpack: enable seeking
...
Somehow seeking is disabled on all kinds of wavpack playbacks now in
the git version. This patch corrects that.
2008-11-06 06:48:33 +01:00
Max Kellermann
eedbd28ec9
wavpack: read_bytes() should not return after partial reads
...
libwavpack expects the read_bytes() stream method to fill the whole
buffer, and fails badly when we return a partial read (i.e. not enough
data available yet). This caused wavpack streams to break.
Re-implement the buffer filling loop.
2008-11-05 07:24:57 +01:00
Max Kellermann
010a27cd95
wavpack: don't close the stream
...
The input_stream object is opened and closed by the caller.
2008-11-05 07:13:55 +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
59c20e5afe
wavpack: removed NULL element from tagtypes
...
The number of tag types is known at compile time. Use the GLib macro
G_N_ELEMENTS instead of having a NULL element at the end.
2008-11-04 17:10:17 +01:00
Max Kellermann
66eb3e90c3
wavpack: use enum tag_type
...
Don't store tag type values in a plain integer, use the proper enum.
2008-11-04 17:10:13 +01:00
Max Kellermann
946e69b2f6
wavpack: use GLib instead of utils.h / log.h
...
Replace deprecated code with GLib.
2008-11-04 17:10:10 +01:00
Max Kellermann
097bccd4ae
wavpack: read first byte from wvc stream
...
Instead of manually waiting for the input stream to become ready (to
catch server errors), just read the first byte. Since the
wavpack_input has the capability to push back one byte, we can simply
re-feed it. Advantage is: decoder_read() handles everything for us,
i.e. waiting for the stream, polling for decoder commands and error
handling.
2008-11-04 17:10:03 +01:00
Max Kellermann
3cf54591e9
wavpack: use the bool data type
...
Use boolean true/false instead of 1/0.
2008-11-04 17:10:01 +01:00
Max Kellermann
b6ea410ca7
wavpack: no CamelCase
...
Renamed functions and variables.
2008-11-04 17:08:59 +01:00
Max Kellermann
c1dfa52cbf
wavpack: fix indent
...
Fixed the indent of the switch statement in format_samples_int().
2008-11-04 17:08:57 +01:00
Max Kellermann
2124df1390
decoder: rewind input stream after try_decode()
...
The try_decode() method may have read some data from the stream, which
is now lost. To make this data available to other methods, get it
back by rewinding the input stream after each try_decode() invocation.
The ogg and wavpack plugins did this manually and inconsistently; this
code can now be removed.
2008-11-02 17:10:02 +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
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