aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/flac_plugin.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-11-24flac, mpc, ogg, wavpack: include unistd.h for SEEK_SETMax Kellermann1-0/+1
SEEK_SET is defined by unistd.h. Explicitly include it.
2008-11-21decoder: check audio_format_valid() in all decodersMax Kellermann1-0/+8
Refuse to play audio formats which are not supported by MPD.
2008-11-21flac, oggflac: use GLib instead of utils.h/log.hMax Kellermann1-15/+10
2008-11-16input_stream: size==-1 means unknown sizeMax Kellermann1-0/+3
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-11decoder: return void from decode() methodsMax Kellermann1-9/+9
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-11replay_gain: no CamelCaseMax Kellermann1-1/+1
Renamed functions and variables.
2008-11-10decoder: removed plugin method try_decode()Max Kellermann1-7/+7
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-10flac: call flac_process_metadata() for ogg filesMax Kellermann1-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().
2008-11-10flac: enable the oggflac plugin with older libflac versionsMax Kellermann1-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.
2008-11-09flac: make the init() method check for oggflac supportMax Kellermann1-2/+8
Disable flac's "oggflac" sub-plugin when libflac does not support ogg-flac files.
2008-11-04decoder: removed stream_typesMax Kellermann1-2/+0
Instead of checking the stream_types bit set, we can simply check whether the methods stream_decode() and file_decode() are implemented.
2008-11-02decoder_api: pass "seekable" flag to decoder_initialized()Max Kellermann1-1/+2
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-01decoder: make the suffixes and mime_types arrays really constMax Kellermann1-9/+11
The strings were constant, but the pointers weren't. C syntax is somewhat tricky..
2008-11-01decoder: make all decoder_plugin structs constMax Kellermann1-2/+2
All decoder_plugin structs are initialized at compile time, and must never change.
2008-10-31decoder_api: pass constant path pointersMax Kellermann1-3/+3
2008-10-30decoder: use bool for return values and flagsMax Kellermann1-14/+15
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
2008-10-29decoder_api: removed decoder_clear()Max Kellermann1-1/+0
Call ob_clear() in decoder_command_finished() instead of implementing that call in every decoder plugin.
2008-10-26input_stream: use "bool" instead of "int"Max Kellermann1-2/+1
For boolean values and success flags, use bool instead of integer (1/0 for true/false, 0/-1 for success/failure).
2008-10-26input_stream: no CamelCaseMax Kellermann1-3/+3
Renamed all functions and variables.
2008-10-26input_stream: removed the InputStream typedefMax Kellermann1-5/+9
Everybody should use struct input_stream.
2008-10-26renamed src/inputPlugins/ to src/decoder/Max Kellermann1-0/+0
These plugins are not input plugins, they are decoder plugins. No CamelCase in the directory name.
2008-10-17Makefile.am: don't compile disabled decoder pluginsMax Kellermann1-36/+13
Don't compile the sources of disabled decoder plugins at all, and don't attempt to register these.
2008-10-10audio_format: renamed sampleRate to sample_rateMax Kellermann1-2/+2
The last bit of CamelCase in audio_format.h. Additionally, rename a bunch of local variables.
2008-10-08use the "bool" data type instead of "int"Max Kellermann1-2/+2
"bool" should be used in C99 programs for boolean values.
2008-10-08don't include os_compat.hMax Kellermann1-0/+2
When there are standardized headers, use these instead of the bloated os_compat.h.
2008-09-29use C99 struct initializersMax Kellermann1-10/+7
The old struct initializers are error prone and don't allow moving elements around. Since we are going to overhaul some of the APIs soon, it's easier to have all implementations use C99 initializers.
2008-09-29decoder: renamed plugin methodsMax Kellermann1-3/+3
Why have a "_func" prefix on all method names? Also don't typedef the methods, there is no advantage in that.
2008-09-23flac: moved code from flacWrite() to _flac_common.cMax Kellermann1-72/+2
There is still a lot of duplicated code in flac_plugin.c and oggflac_plugin.c. Move code from flac_plugin.c to _flac_common.c, and use the new function flac_common_write() also in oggflac_plugin.c, porting lots of optimizations over to it.
2008-09-23flac: assume the buffer is empty in flacWrite() IIMax Kellermann1-7/+2
The previous patch on this topic was incomplete: it still added data->chunk_length when calling flac_convert(). Remove this, too.
2008-09-23audio_format: added audio_format_sample_size()Max Kellermann1-1/+2
The inline function audio_format_sample_size() calculates how many bytes each sample consumes. This function already takes into account that 24 bit samples are 4 bytes long, not 3.
2008-08-29tag: renamed functions, no CamelCaseMax Kellermann1-4/+4
2008-08-29tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann1-7/+7
Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
2008-08-26flac: decoder command means EOFMax Kellermann1-8/+6
It was possible for the decoder thread to go into an endless loop (flac and oggflac decoders): when a "STOP" command arrived, the Read() callback would return 0, but the EOF() callback returned false. Fix: when decoder_get_command()!=NONE, return EOF==true.
2008-08-26mp3, flac: check for seek command after decoder_read()Max Kellermann1-3/+6
When we introduced decoder_read(), we added code which aborts the read operation when a decoder command arrives. Several plugins however did not expect that when they were converted to decoder_read(). Add proper checks to the mp3 and flac decoder plugins.
2008-08-26check decoder_command!=NONE instead of decoder_command==STOPMax Kellermann1-1/+1
The code said "decoder_command==STOP" because that was a conversion from the old "dc->stop" test. As we can now check for all commands in one test, we can simply rewrite that to decoder_command!=NONE.
2008-08-26added decoder_read()Max Kellermann1-8/+1
On our way to stabilize the decoder API, we will one day remove the input stream functions. The most basic function, read() will be provided by decoder_api.h with this patch. It already contains a loop (still with manual polling), error/eof handling and decoder command checks. This kind of code used to be duplicated in all decoder plugins.
2008-08-26added decoder_plugin_register()Max Kellermann1-2/+1
With the functions decoder_plugin_register() and decoder_plugin_unregister(), decoder plugins can register a "secondary" plugin, like the flac input plugin does this for "oggflac".
2008-08-26renamed functions in decoder_list.hMax Kellermann1-1/+1
InputPlugin to decoder_plugin, and no camelCase.
2008-08-26no camel case in struct decoder_pluginMax Kellermann1-5/+5
2008-08-26renamed inputPlugin.* to decoder_list.*Max Kellermann1-1/+1
Since inputPlugin.c manages the list of registered decoders, we should rename the source file.
2008-08-26renamed InputPlugin to struct decoder_pluginMax Kellermann1-3/+3
"decoder plugin" is a better name than "input plugin", since the plugin does not actually do the input - InputStream does. Also don't use typedef, so we can forward-declare it if required.
2008-08-26added decoder_seek_where() and decoder_seek_error()Max Kellermann1-3/+3
Provide access to seeking for the decoder plugins; they have to know where to seek, and they need a way to tell us that seeking has failed.
2008-08-26added decoder_command_finished() to decoder_api.hMax Kellermann1-1/+1
Some decoder commands are implemented in the decoder plugins, thus they need to have an API call to signal that their current command has been finished. Let them use the new decoder_command_finished() instead of the internal dc_command_finished().
2008-08-26added decoder_get_command()Max Kellermann1-6/+6
Another big patch which hides internal mpd APIs from decoder plugins: decoder plugins regularly poll dc->command; expose it with a decoder_api.h function.
2008-08-26moved InputPlugin to decoder_api.hMax Kellermann1-0/+1
InputPlugin is the API which is implemented by a decoder plugin. This belongs to the public API/ABI, so move it to decoder_api.h. It will later be renamed to something like "decoder_plugin".
2008-08-26added parameter total_time to decoder_initialized()Max Kellermann1-1/+1
Similar to the previous patch: pass total_time instead of manipulating dc->totalTime directly.
2008-08-26added audio_format parameter to decoder_initialized()Max Kellermann1-5/+5
dc->audioFormat is set once by the decoder plugins before invoking decoder_initialized(); hide dc->audioFormat and let the decoder pass an AudioFormat pointer to decoder_initialized().
2008-08-26added decoder_clear() and decoder_flush()Max Kellermann1-2/+2
We are now beginning to remove direct structure accesses from the decoder plugins. decoder_clear() and decoder_flush() mask two very common buffer functions.
2008-08-26added decoder_initialized()Max Kellermann1-1/+1
decoder_initialized() sets the state to DECODE_STATE_DECODE and wakes up the player thread. It is called by the decoder plugin after its internal initialization is finished. More arguments will be added later to prevent direct accesses to the DecoderControl struct.
2008-08-26added struct decoderMax Kellermann1-6/+7
The decoder struct should later be made opaque to the decoder plugin, because maintaining a stable struct ABI is quite difficult. The ABI should only consist of a small number of stable functions.