Max Kellermann
8f37f7c838
ogg: don't include _flac_common.h
...
The source _ogg_common.c does not need any symbols from
_flac_common.h, but including it leads to compiler errors when libflac
isn't available.
2008-10-31 08:52:09 +01:00
Max Kellermann
d65d6548a3
oggflac: adapt to new API
...
Again, I forgot to adapt oggflac to the new API (struct input_stream,
bool return values).
2008-10-31 08:52:09 +01:00
Max Kellermann
5024f0b6cc
ffmpeg: pass input_stream pointer to decoder_data()
...
decoder_data() uses wait times to let the input stream continue its
transfer.
2008-10-30 19:09:20 +01:00
Max Kellermann
b15c4cdeb5
ffmpeg: use return value of decoder_data()
...
decoder_data() always returns the current command. If we use this, we
can save a lot of decoder_get_command() calls.
2008-10-30 19:03:41 +01:00
Max Kellermann
f3b4a28518
ffmpeg: output buffer size cannot be negative
...
Converted the runtime check to an assertion.
2008-10-30 19:03:38 +01:00
Max Kellermann
130fc58b36
ffmpeg: break immediately after av_read_frame()
...
Remove one indent level.
2008-10-30 19:03:31 +01:00
Max Kellermann
5f1df0a927
ffmpeg: moved code to ffmpeg_send_frame()
...
Move code from ffmpeg_decode_internal() to make it smaller and more
readable.
2008-10-30 19:03:20 +01:00
Max Kellermann
048d62a628
ffmpeg: report seek errors to MPD
...
The decoder API provides the function decoder_seek_error() to report
seek errors. Use this function instead of logging the error.
2008-10-30 19:02:38 +01:00
Max Kellermann
cd7a720426
ffmpeg: simplified mpdurl_read()
...
The function mpdurl_read() is too complicated, and uses the wrong data
types.
2008-10-30 19:02:01 +01:00
Max Kellermann
964442c5ad
ffmpeg: call tag_free() instead of free()
...
tag objects must be freed with tag_free() to ensure that all resources
are freed.
2008-10-30 19:01:36 +01:00
Max Kellermann
25f4efcdb8
ffmpeg: eliminated local variable "tag"
...
The function ffmpeg_tag() already has the variable base.tag, which can
be used for this.
2008-10-30 19:01:31 +01:00
Max Kellermann
7cbd9821c6
ffmpeg: make ffmpeg_helper() return bool
...
ffmpeg_try_decode() did not interpret ffmpeg_helper()'s return value
properly; migrate everything to bool to make it consistent.
2008-10-30 19:01:23 +01:00
Max Kellermann
078d83ca13
ffmpeg: removed debug messages
...
We don't need those anymore, they just fill the log.
2008-10-30 19:01:18 +01:00
Max Kellermann
b180d0b47f
ffmpeg: initialize base.decoder
...
ffmpeg_tag() did not initialize base.decoder, which made valgrind
unhappy, and can lead to a egmentation fault.
2008-10-30 18:08:52 +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
d29bad4410
mp3: make mp3_read() return bool
...
Its only caller in mp3_decode() just compared its value with
DECODE_BREAK. Convert that to bool, and return false if the loop
should be ended. Also eliminate some superfluous command checking
code, which was already done in the preceding while loop.
2008-10-30 06:09:28 +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
d6c4441c78
mp3: seek in background
...
Remember the seek_where argument and call decoder_command_finished()
immediately. This way, the player thread can continue working, and we
can receive more commands.
This also fixes several issues which resulted in broken frames,
leading to erroneos "elapsed" values: frames weren't parsed properly,
since the code was checking for command!=NONE.
2008-10-29 17:22:56 +01:00
Max Kellermann
de588448df
mp3: return from mp3_synth_and_send() on any command
...
Previously, the function would only return when a STOP was issued. It
makes more sense to consider all possible commands.
2008-10-29 16:17:21 +01:00
Max Kellermann
6158858f82
mp3: moved code to mp3_synth_and_send()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:14:08 +01:00
Max Kellermann
e0532ae0a8
mp3: moved code to mp3_send_pcm()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:14:02 +01:00
Max Kellermann
a6ad0e4047
mp3: moved code to mp3_update_timer_next_frame()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:13:51 +01:00
Max Kellermann
0d079ee515
mp3: moved code to mp3_this_frame_offset()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:13:01 +01:00
Max Kellermann
a6f8776c94
mp3: moved code to mp3_time_to_frame()
...
Break the large function mp3_read() into smaller pieces.
2008-10-29 16:12:26 +01:00
Max Kellermann
ec3083948f
mp3: assert that the stream is seekable
...
dc_seek() won't send a SEEK command to the decoder thread unless the
stream is seekable. No need to do another check; convert that to an
assertion.
2008-10-29 16:11:16 +01:00
Max Kellermann
a0b57f3782
mp3: moved code to mp3_filesize_to_song_length()
...
The function mp3_decode_first_frame() is too large. Move some code to
separate smaller functions.
2008-10-28 20:44:08 +01:00
Max Kellermann
898978a67d
mp3: no "goto"
...
http://xkcd.com/292/
2008-10-28 20:43:17 +01:00
Max Kellermann
28b47725ff
mp3: use GLib allocation functions
...
This removes the need for util.h.
2008-10-28 20:43:15 +01:00
Max Kellermann
56ebdf1cd1
mp3: use bool
...
Use the C99 bool data type for boolean values.
2008-10-28 20:42:33 +01:00
Max Kellermann
e4bbc120ac
mp3: no CamelCase
...
Renamed all functions and variables. Also removed the mp3DecodeData
typedef.
2008-10-28 20:42:01 +01:00
Max Kellermann
1f7c53e619
mp3: remove obsolete comments
2008-10-28 20:41:25 +01:00
Max Kellermann
0a61877702
input_stream: convert offset and size to the off_t data type
...
size_t and long aren't 64 bit safe (i.e. files larger than 2 GB on a
32 bit OS). Use off_t instead, which is a 64 bit integer if compiled
with large file support.
2008-10-28 20:39:09 +01:00
Max Kellermann
016d996131
utils: use g_str_has_prefix() instead of prefixcmp()
...
Remove duplicated code from MPD.
2008-10-28 20:33:56 +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