aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mp3: eliminated duplicate command checkMax Kellermann2008-11-111-18/+20
| | | | | | | 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.
* oggflac: removed the obsolete try_decode() methodMax Kellermann2008-11-111-6/+3
|
* decoder: return void from decode() methodsMax Kellermann2008-11-1111-85/+46
| | | | | | | | 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.
* replay_gain: converted struct replay_gain_info elements to an arrayMax Kellermann2008-11-115-22/+22
| | | | | Having an array instead of individual variables allows the use of the replay_gain_mode enum as an array index.
* wavpack: added wavpack_tag_float()Max Kellermann2008-11-111-41/+25
| | | | | | 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.
* wavpack: make the "key" argument to wavpack_tag() constMax Kellermann2008-11-111-9/+5
| | | | This allows us to remove the "static char[]" hack.
* ogg: ogg_getReplayGainInfo() returns replay_gain_info pointerMax Kellermann2008-11-111-13/+20
| | | | Some code simplification. Avoid pointers to pointers.
* replay_gain: no CamelCaseMax Kellermann2008-11-118-60/+65
| | | | Renamed functions and variables.
* decoder: removed plugin method try_decode()Max Kellermann2008-11-103-21/+14
| | | | | | 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.
* flac: call flac_process_metadata() for ogg filesMax Kellermann2008-11-101-4/+5
| | | | | | | 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().
* flac: enable the oggflac plugin with older libflac versionsMax Kellermann2008-11-101-3/+14
| | | | | | | | | 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.
* wavpack: removed try_decode() methodMax Kellermann2008-11-091-23/+0
| | | | | | Wavpack's try_decode() implementation does nothing useful, it only duplicates code already in stream_decode() / file_decode(), and slows down MPD.
* flac: make the init() method check for oggflac supportMax Kellermann2008-11-091-2/+8
| | | | | Disable flac's "oggflac" sub-plugin when libflac does not support ogg-flac files.
* wavpack: make 24-bit samples available for mpdLaszlo Ashin2008-11-081-47/+46
| | | | | | | | | 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.
* wavpack: check last_byte in push_back_byte() methodLaszlo Ashin2008-11-081-2/+6
| | | | | | | | | 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.)
* wavpack: wrapper for converting void* to struct wavpack_input*Laszlo Ashin2008-11-081-13/+20
| | | | | A new function has been added to do a cast and a little check in the wavpack-mpd input stream wrapper.
* wavpack: put braces around one line code blocksLaszlo Ashin2008-11-081-15/+27
| | | | | I think this makes the code more easily modifiable and prevents some annoying mistakes.
* wavpack: added prefix to local function namesLaszlo Ashin2008-11-081-14/+14
| | | | | | 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_".
* wavpack: unified code styleLaszlo Ashin2008-11-081-16/+28
| | | | | 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.
* wavpack: check wvc seekabilityLaszlo Ashin2008-11-061-2/+5
| | | | | Using wvc streams the seekableness depends on the seekability of the wvc stream as well.
* wavpack: close wvc stream on errorLaszlo Ashin2008-11-061-1/+3
| | | | | The input stream opened for wvc is not closed in an if branch. A close call has been added.
* wavpack: enable seekingLaszlo Ashin2008-11-061-1/+1
| | | | | Somehow seeking is disabled on all kinds of wavpack playbacks now in the git version. This patch corrects that.
* wavpack: read_bytes() should not return after partial readsMax Kellermann2008-11-051-1/+16
| | | | | | | 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.
* wavpack: don't close the streamMax Kellermann2008-11-051-1/+0
| | | | The input_stream object is opened and closed by the caller.
* decoder: removed stream_typesMax Kellermann2008-11-0411-12/+0
| | | | | Instead of checking the stream_types bit set, we can simply check whether the methods stream_decode() and file_decode() are implemented.
* wavpack: removed NULL element from tagtypesMax Kellermann2008-11-041-3/+2
| | | | | 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.
* wavpack: use enum tag_typeMax Kellermann2008-11-041-1/+1
| | | | Don't store tag type values in a plain integer, use the proper enum.
* wavpack: use GLib instead of utils.h / log.hMax Kellermann2008-11-041-28/+12
| | | | Replace deprecated code with GLib.
* wavpack: read first byte from wvc streamMax Kellermann2008-11-041-25/+13
| | | | | | | | | 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.
* wavpack: use the bool data typeMax Kellermann2008-11-041-12/+12
| | | | Use boolean true/false instead of 1/0.
* wavpack: no CamelCaseMax Kellermann2008-11-041-42/+44
| | | | Renamed functions and variables.
* wavpack: fix indentMax Kellermann2008-11-041-47/+47
| | | | Fixed the indent of the switch statement in format_samples_int().
* mp4: get decoder command from decoder_data()Max Kellermann2008-11-041-7/+8
| | | | | Eliminate a superfluous decoder_get_command() call. decoder_data() already returns the command.
* mp4: initialize audio_format before decoder_initialized()Max Kellermann2008-11-041-6/+5
| | | | Removed the duplicate audio_format initialization.
* mp4: use decoder_read() instead of input_stream_read()Max Kellermann2008-11-041-1/+4
| | | | | decoder_read() handles decoder commands, and should be used in decoder plugins.
* mp4: pass struct mp4_context to the mp4ff_callback_t methodsMax Kellermann2008-11-041-10/+18
| | | | | | 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.
* mp4: use GLib instead of utils.h / log.hMax Kellermann2008-11-041-13/+14
| | | | Replace deprecated code with GLib.
* mp4: use tag_is_empty() instead of passing the tag_is_found flagMax Kellermann2008-11-041-13/+3
| | | | | | | | 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.
* mp4: static mp4ff_callback_t variablesMax Kellermann2008-11-041-22/+15
| | | | | | 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().
* mp4: no CamelCaseeMax Kellermann2008-11-041-104/+109
| | | | Renamed functions and variables.
* ffmpeg: removed loop from mpd_ffmpeg_read()Max Kellermann2008-11-041-15/+2
| | | | | | 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.
* ffmpeg: removed ffmpeg_context.codecMax Kellermann2008-11-041-2/+0
| | | | | That variable is never used except during initialization in ffmpeg_helper().
* ffmpeg: moved code to ffmpeg_find_audio_stream()Max Kellermann2008-11-041-9/+12
|
* ffmpeg: no CamelCaseMax Kellermann2008-11-041-100/+101
| | | | Renamed variables.
* decoder_api: automatically send stream tagMax Kellermann2008-11-032-51/+5
| | | | | | | | | | 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.
* mod: removed boolean globals for lazy initMax Kellermann2008-11-031-15/+4
| | | | | The variables mod_mikModInitiated and mod_mikModInitError were used to control lazy initialization, but they are superfluous now.
* mod: always initialize libmikmodMax Kellermann2008-11-031-8/+1
| | | | | | | 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.
* ffmpeg: fix boolean inversion in ffmpeg_tag()Max Kellermann2008-11-021-1/+1
| | | | | | ffmpeg_tag() deleted the tag when ffmpeg_helper() returned success. The return value was interpreted incorrectly, it should return the tag on success.
* ffmpeg: don't rewind stream in url_close()Max Kellermann2008-11-021-4/+0
| | | | | Rewinding the stream here is not useful, but may consume valuable resources (and time).
* decoder: rewind input stream after try_decode()Max Kellermann2008-11-022-8/+0
| | | | | | | | | 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.