aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_api.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* decoder: check length==0 in decoder_read()Max Kellermann2008-11-151-0/+3
| | | | | When the caller passes length==0, decoder_read() entered an endless loop. Check that condition before entering the "while" loop.
* decoder: additional dc.command checks in decoder_data()Max Kellermann2008-11-131-0/+3
| | | | | When a command is sent while the decoder waits for a free chunk in the music pipe, it was not returned by decoder_data().
* decoder: wait for the player only if the music pipe is fullMax Kellermann2008-11-131-4/+5
| | | | Prevent superfluous wakeups and a deadlock condition.
* decoder: check dc.command at the beginning of decoder_data()Max Kellermann2008-11-131-0/+4
| | | | | | Seeking was somewhat broken in some decoder plugins because they sent empty chunks, and never got a command. Check the decoder command before doing anything else in decoder_data().
* decoder: ignore SEEK commands during initializationMax Kellermann2008-11-131-1/+4
| | | | | When the decoder receives a SEEK during initialization, it should ignore that for now. The old code made most decoders abort.
* replay_gain: no CamelCaseMax Kellermann2008-11-111-3/+3
| | | | Renamed functions and variables.
* decoder: fixed assertion failure for decoder==NULL in decoder_read()Max Kellermann2008-11-111-1/+2
| | | | | | The assertion on dc.state in decoder_read() was too strict: when a decoder tried to call decoder_read() from tag_dup(), the decoder state was NONE. Allow this special case.
* decoder: added more assertionsMax Kellermann2008-11-101-0/+10
| | | | Added a lot of assertions checking the state of the decoder plugin.
* decoder: no CamelCaseMax Kellermann2008-11-031-4/+4
| | | | Renamed variables and functions.
* decoder_api: send song tag in decoder_data()Max Kellermann2008-11-031-8/+26
| | | | | Before passing the first chunk to the audio output device, send the current song's tag.
* decoder_api: automatically send stream tagMax Kellermann2008-11-031-0/+51
| | | | | | | | | | 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.
* decoder_api: no CamelCaseMax Kellermann2008-11-031-34/+32
| | | | Renamed variables.
* decoder_api: added decoder_tag()Max Kellermann2008-11-021-0/+13
| | | | Provide an API for submitting additional tags from the stream.
* decoder_api: pass "seekable" flag to decoder_initialized()Max Kellermann2008-11-021-16/+8
| | | | | | 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.
* decoder: replaced music_pipe.audioFormat with dc.out_audio_formatMax Kellermann2008-11-021-10/+13
| | | | | | | .. and rename dc.audioFormat to dc.in_audio_format. The music pipe does not need to know the audio format, and its former "audioFormat" property indicated the format of the most recently added chunk, which might be confusing when you are reading the oldest chunks.
* music_pipe: renamed ob_* functions to music_pipe_*Max Kellermann2008-11-021-2/+2
| | | | Rename all functions to the new prefix.
* renamed outputBuffer.[ch] to pipe.[ch]Max Kellermann2008-11-021-1/+1
| | | | | | | No CamelCase in the file name. The output_buffer struct is going to be renamed to music_pipe. There are so many buffer levels in MPD, and calling this one "output buffer" is wrong, because it's not the last buffer before the music reaches the output devices.
* decoder: manage decoder list in a static arrayMax Kellermann2008-11-011-11/+0
| | | | | Currently, there is no way to dynamically load decoder plugins, thus we don't need a dynamic list to manage them.
* decoder: use bool for return values and flagsMax Kellermann2008-10-301-2/+2
| | | | | Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
* decoder: automatically flush the output buffer after decoder exitsMax Kellermann2008-10-291-5/+0
| | | | | | | 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().
* decoder_api: make the audio_format parameter mandatoryMax Kellermann2008-10-291-5/+3
| | | | | There are no callers which pass audio_format==NULL, and it shouldn't be allowed.
* decoder_api: removed decoder_clear()Max Kellermann2008-10-291-5/+4
| | | | | Call ob_clear() in decoder_command_finished() instead of implementing that call in every decoder plugin.
* decoder_api: don't cast need_chunks() to intMax Kellermann2008-10-291-4/+4
| | | | | need_chunks() returns a decoder_command enum. Store its return value as this type.
* input_stream: no CamelCaseMax Kellermann2008-10-261-3/+3
| | | | Renamed all functions and variables.
* pcm_utils: added pcm_convert_init()Max Kellermann2008-10-211-1/+1
| | | | | | Instead of manually calling memset(0) on the pcm_convert_state struct, client code should use a library function from pcm_utils.c. This way, we can change the semantics of the struct easily.
* pcm_utils: no CamelCaseMax Kellermann2008-10-211-5/+5
| | | | Renamed all functions which were still in CamelCase.
* input_stream: removed nmemb argumentMax Kellermann2008-10-171-1/+1
| | | | | The nmemb argument isn't actually useful, and one of nmemb and size was always passed as 1. Remove it.
* input: declare struct input_streamMax Kellermann2008-10-171-3/+5
| | | | | Provide a struct type which can be forward-declared. The typedef InputStream is deprecated now.
* song: removed CamelCaseMax Kellermann2008-10-081-1/+1
| | | | CamelCase is ugly... rename all functions.
* use the "bool" data type instead of "int"Max Kellermann2008-10-081-1/+1
| | | | "bool" should be used in C99 programs for boolean values.
* don't include os_compat.hMax Kellermann2008-10-081-0/+2
| | | | | When there are standardized headers, use these instead of the bloated os_compat.h.
* song: converted typedef Song to struct songMax Kellermann2008-10-081-0/+1
| | | | Again, a data type which can be forward-declared.
* switch to C99 types, part IIMax Kellermann2008-09-291-1/+1
| | | | | Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
* audio: moved cmpAudioFormat() to audio_format.hMax Kellermann2008-09-091-1/+1
| | | | | Rename it to audio_format_equals() and return "true" if they are equal.
* audio_format: converted typedef AudioFormat to struct audio_formatMax Kellermann2008-09-071-1/+1
| | | | | Get rid of CamelCase, and don't use a typedef, so we can forward-declare it, and unclutter the include dependencies.
* renamed player.c to player_control.cMax Kellermann2008-08-261-1/+1
| | | | | Give player.c a better name, meaning that the code is used to control the player thread.
* renamed decode.h to decoder_control.hMax Kellermann2008-08-261-1/+1
|
* moved global variable "pc" to player.hMax Kellermann2008-08-261-1/+1
| | | | | This is the last of the three variables. Now we don't need playerData.h anymore in most sources.
* moved global variable "ob" to outputBuffer.hMax Kellermann2008-08-261-0/+1
| | | | | | | This releases several include file dependencies. As a side effect, "CHUNK_SIZE" isn't defined by decoder_api.h anymore, so we have to define it directly in the plugins which need it. It just isn't worth it to add it to the decoder plugin API.
* moved variable "dc" to decode.hMax Kellermann2008-08-261-0/+1
| | | | | Now that "dc" is available here, we don't have to pass it to decoder_is_idle() and decoder_is_starting() anymore.
* added flag "decoder.seeking"Max Kellermann2008-08-261-1/+8
| | | | | | | | | | This flag is used internally; it is set by decoder_seek_where(), and indicates that the decoder plugin has begun the seek process. It is used for the case that the decoder plugin has to read data during the seek process. Before this patch, that was impossible, because decoder_read() would refuse to read data unless dc->command is NONE. This patch is kind of a dirty workaround, and needs to be redesigned later.
* added decoder_read()Max Kellermann2008-08-261-0/+24
| | | | | | | | | 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.
* added decoder_plugin_register()Max Kellermann2008-08-261-0/+11
| | | | | | | 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".
* eliminate OUTPUT_BUFFER_DC_STOP, OUTPUT_BUFFER_DC_SEEKMax Kellermann2008-08-261-11/+11
| | | | | (Ab)use the decoder_command enumeration, which has nearly the same values and the same meaning.
* added decoder_get_url()Max Kellermann2008-08-261-0/+5
| | | | | | The wavpack decoder plugin implements a hack, and it needs the song URL for that. This API (and the hack) should be revised later, but add that function for now.
* added decoder_seek_where() and decoder_seek_error()Max Kellermann2008-08-261-2/+16
| | | | | 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.
* added decoder_command_finished() to decoder_api.hMax Kellermann2008-08-261-3/+12
| | | | | | | 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().
* added decoder_get_command()Max Kellermann2008-08-261-0/+5
| | | | | | 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.
* moved convState to struct decoderMax Kellermann2008-08-261-4/+6
| | | | | | Since we moved all PCM conversions to decoder_data(), the attribute convState isn't being used anymore by the OutputBuffer code. Move it to struct decoder.
* moved struct AudioFormat to audio_format.hMax Kellermann2008-08-261-0/+1
| | | | | We want to expose the AudioFormat structure to plugins; remove some clutter by moving its declaration to a separate header file.