Laszlo Ashin
c368a2f91c
aac: fix compiler warnings on amd64
2008-11-15 11:54:22 +01:00
Laszlo Ashin
00da7db1e3
aac: don't try to free static buffer
...
In 432da18e
a dynamic buffer was replaced by a static one but some
frees were accidently left there which caused some segfaults.
2008-11-15 11:50:25 +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
7b7340f703
mp3: fix SEEK command check after mp3_synth_and_send()
...
mp3 seeking was broken, because the command==SEEK check was never
reached. Swap the command check order (==SEEK before !=NONE) to fix
that.
2008-11-13 14:43:19 +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
ef80464c0c
ogg: revert "use ogg_fopen() instead of ogg_open()"
...
Unfortunately, ov_fopen() is not supported by libvorbis versions older
than 1.2.
2008-11-12 08:38:04 +01:00
Max Kellermann
b67a8e4d6e
aac: shift the input buffer before the full check
...
When the buffer was full, but everything was already consumed,
fillAacBuffer() would not attempt to flush and refill it.
2008-11-12 08:32:21 +01:00
Max Kellermann
432da18e44
aac: make the input buffer static
...
Allocate the input buffer within the AacBuffer struct.
2008-11-12 08:29:40 +01:00
Max Kellermann
487e05c67d
aac: reject SEEK commands
...
The aac plugin does not support seeking. Reject SEEK requests by
calling decoder_seek_error(). Quit the plugin's main loop only when
STOP is received.
2008-11-12 08:25:09 +01:00
Max Kellermann
a9723e661a
aac: get decoder command from decoder_data()
...
Removed a superfluous decoder_get_command() call.
2008-11-12 08:25:06 +01:00
Max Kellermann
35a4ca2421
aac: convert audio_format to temporary variable
...
The audio_format variable is only used and initialized for
decoder_initialized(). Move it into that block to save some bytes on
the stack.
2008-11-12 08:21:00 +01:00
Max Kellermann
39fa60769c
aac: removed method file_decode()
...
aac_stream_decode() was basically copy+pasted from aac_decode().
Since stream_decode() can also decode files, eliminate aac_decode().
2008-11-12 08:17:50 +01:00
Max Kellermann
e19b53f814
aac: check the buffer length in the ADIF parser
...
Check whether enough data has been read yet.
2008-11-12 08:16:54 +01:00
Max Kellermann
b30ec73099
aac: use unsigned integers and size_t where appropriate
2008-11-12 08:16:38 +01:00
Max Kellermann
9806355d4c
aac: check if the stream is seekable before length check
...
If the stream is not seekable, don't try to decode all frames to find
out the total song time.
2008-11-12 07:46:01 +01:00
Max Kellermann
f6765c4d8b
aac: removed attribute "atEof"
...
Use input_stream_eof() instead.
2008-11-12 07:41:54 +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
97080b796c
ogg: removed stray "}"
...
Due to an unnoticed merge error, there was a superfluous "}". Remove
it.
2008-11-11 21:39:31 +01:00
Max Kellermann
53c17db5e9
ogg: use ogg_fopen() instead of ogg_open()
...
Move the reponsibility for freeing the file handle to libvorbis.
2008-11-11 21:33:10 +01:00
Max Kellermann
448ff32c96
ogg: use GLib instead of utils.h/log.h
2008-11-11 21:33:01 +01:00
Max Kellermann
0cba1ae312
ogg: get decoder command from decoder_data()
...
Eliminate two decoder_get_command() invocations from the main loop.
2008-11-11 21:21:54 +01:00
Max Kellermann
7b575b55c2
ogg: flush buffer after every ov_read() call
...
Don't let the buffer grow until it is full, flush it whenever there is
data available.
2008-11-11 21:15:01 +01:00
Max Kellermann
67814eddff
mp3: support stream tags
...
Parse ID3 tags, even when they are in the middle of the stream. Very
few streams provide embedded ID3 tags. Most of them send only
Shoutcast "icy" tags, which limits the practical usefulness of this
patch.
2008-11-11 20:53:24 +01:00
Max Kellermann
514c37b0cd
mp3: eliminated duplicate command check
...
When a command is received, decode_next_frame_header() and
decodeNextFrame() return DECODE_BREAK. This is already checked by
both callers, which means that we can eliminate lots of
decoder_get_command() checks.
2008-11-11 20:50:37 +01:00
Max Kellermann
81d2076bcf
oggflac: removed the obsolete try_decode() method
2008-11-11 17:17:06 +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
e2c07dbbbc
ogg: ogg_getReplayGainInfo() returns replay_gain_info pointer
...
Some code simplification. Avoid pointers to pointers.
2008-11-11 16:19:00 +01:00
Max Kellermann
114b3c1e78
replay_gain: no CamelCase
...
Renamed functions and variables.
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
23a4ce4444
flac: call flac_process_metadata() for ogg files
...
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().
2008-11-10 14:49:34 +01:00
Max Kellermann
0e87f85598
flac: enable the oggflac plugin with older libflac versions
...
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.
2008-11-10 14:39:42 +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
Max Kellermann
b054ad0ea6
flac: make the init() method check for oggflac support
...
Disable flac's "oggflac" sub-plugin when libflac does not support
ogg-flac files.
2008-11-09 22:01:47 +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
fef14683ae
mp4: get decoder command from decoder_data()
...
Eliminate a superfluous decoder_get_command() call. decoder_data()
already returns the command.
2008-11-04 17:05:08 +01:00
Max Kellermann
11404b5d10
mp4: initialize audio_format before decoder_initialized()
...
Removed the duplicate audio_format initialization.
2008-11-04 17:05:05 +01:00
Max Kellermann
290347c482
mp4: use decoder_read() instead of input_stream_read()
...
decoder_read() handles decoder commands, and should be used in decoder
plugins.
2008-11-04 17:05:02 +01:00
Max Kellermann
9ecfc57c3a
mp4: pass struct mp4_context to the mp4ff_callback_t methods
...
We need the decoder object, so we have to begin passing a new struct
to these callbacks, instead of only the pointer to the input_stream
object.
2008-11-04 17:05:00 +01:00
Max Kellermann
632dc7c96b
mp4: use GLib instead of utils.h / log.h
...
Replace deprecated code with GLib.
2008-11-04 17:04:57 +01:00
Max Kellermann
01706dd46c
mp4: use tag_is_empty() instead of passing the tag_is_found flag
...
The API of mp4_load_tag() was strange: it always returned a tag
object, no matter if a tag was found in the file; the existence of a
tag was indicated with the tag_found integer reference. This flag is
superfluous, since we can simply check whether the tag is empty or
not.
2008-11-04 17:04:54 +01:00
Max Kellermann
02a172f2c2
mp4: static mp4ff_callback_t variables
...
Allocate the mp4ff_callback_t object on the stack. This is easier to
handle, since we don't have to free it. Incidentally, this fixes a
memory leak in mp4_load_tag().
2008-11-04 16:55:12 +01:00
Max Kellermann
8712a1f7bf
mp4: no CamelCasee
...
Renamed functions and variables.
2008-11-04 16:55:12 +01:00
Max Kellermann
ab07cdd453
ffmpeg: removed loop from mpd_ffmpeg_read()
...
The function decoder_read() already cares about the decoder command,
and loops until data is available. Reduced mpd_ffmpeg_read() to no
more than the decoder_read() call.
2008-11-04 16:55:12 +01:00
Max Kellermann
292334a27a
ffmpeg: removed ffmpeg_context.codec
...
That variable is never used except during initialization in
ffmpeg_helper().
2008-11-04 16:55:12 +01:00
Max Kellermann
7e84c73b17
ffmpeg: moved code to ffmpeg_find_audio_stream()
2008-11-04 16:55:12 +01:00
Max Kellermann
5e486964e8
ffmpeg: no CamelCase
...
Renamed variables.
2008-11-04 16:55:11 +01:00
Max Kellermann
ac96022c1d
decoder_api: automatically send stream tag
...
If an input stream provides tags (e.g. from an icecast server), send
them in the decoder_data() and decoder_tag() methods. Removed the
according code from the mp3 and oggvorbis plugins - decoders shouldn't
have to care about stream tags.
This patch also adds the missing decoder_tag() invocation to the mp3
plugin.
2008-11-03 18:24:01 +01:00
Max Kellermann
e6f334a088
mod: removed boolean globals for lazy init
...
The variables mod_mikModInitiated and mod_mikModInitError were used to
control lazy initialization, but they are superfluous now.
2008-11-03 07:32:02 +01:00
Max Kellermann
bb15c3bd45
mod: always initialize libmikmod
...
The "mod" decoder plugin was being initialized lazily, but was
deinitialized unconditionally. That led to segmentation faults.
Convert mod_initMikMod() to be the global module initialization
method. The MPD core should care about lazy initialization.
2008-11-03 07:30:42 +01:00
Max Kellermann
e5137706d1
ffmpeg: fix boolean inversion in ffmpeg_tag()
...
ffmpeg_tag() deleted the tag when ffmpeg_helper() returned success.
The return value was interpreted incorrectly, it should return the tag
on success.
2008-11-02 17:32:40 +01:00
Max Kellermann
accc82cd6c
ffmpeg: don't rewind stream in url_close()
...
Rewinding the stream here is not useful, but may consume valuable
resources (and time).
2008-11-02 17:10:12 +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
0f80428fda
ffmpeg: use decoder_read() wrapper instead of direct input_stream_read()
...
decoder_read() checks the decoder command. Without this patch, the
ffmpeg plugin could become unresponsive.
2008-11-02 17:06:53 +01:00
Max Kellermann
4d069b4991
ogg, ffmpeg: try to decode, even when the stream is not seekable
...
Ogg and ffmpeg detection was disabled when the stream was not
seekable, because the detection was too expensive. Since the curl
input stream can now rewind the stream cheaply, we can re-enable
detection on streams.
2008-11-02 17:06:32 +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
5b13f067cd
aac, mod: moved decoder command check into loop condition
...
Avoid while(true) loops, and convert them to a loop with a proper
condition.
2008-11-02 17:02:23 +01:00
Max Kellermann
3f6fcfd38e
aac, mod: don't check for SEEK command
...
Since the aac and mod plugins have told MPD that they cannot seek, MPD
will never send a SEEK command to them. Removed the SEEK comand
checks from both plugins.
2008-11-02 17:02:00 +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
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
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