From e92bd0c0ff3d68cadc1ca8f79347e9f0871eb4d1 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 23 Apr 2013 16:06:00 +0200 Subject: decoder*h: move under decoder/ --- src/cmdline.c | 4 +- src/command.c | 2 +- src/decoder/decoder_api.h | 173 ++++++++++++++++++++++++++ src/decoder/decoder_command.h | 30 +++++ src/decoder/decoder_control.h | 276 +++++++++++++++++++++++++++++++++++++++++ src/decoder/decoder_internal.h | 91 ++++++++++++++ src/decoder/decoder_list.h | 65 ++++++++++ src/decoder/decoder_plugin.h | 207 +++++++++++++++++++++++++++++++ src/decoder/decoder_print.h | 28 +++++ src/decoder/decoder_thread.h | 28 +++++ src/decoder_api.h | 173 -------------------------- src/decoder_command.h | 30 ----- src/decoder_control.h | 276 ----------------------------------------- src/decoder_internal.h | 91 -------------- src/decoder_list.h | 65 ---------- src/decoder_plugin.h | 207 ------------------------------- src/decoder_print.h | 28 ----- src/decoder_thread.h | 28 ----- src/main.c | 2 +- src/player_control.c | 2 +- src/player_thread.c | 4 +- src/song_update.c | 4 +- src/tag_file.c | 4 +- src/update_container.c | 2 +- src/update_song.c | 4 +- 25 files changed, 912 insertions(+), 912 deletions(-) create mode 100644 src/decoder/decoder_api.h create mode 100644 src/decoder/decoder_command.h create mode 100644 src/decoder/decoder_control.h create mode 100644 src/decoder/decoder_internal.h create mode 100644 src/decoder/decoder_list.h create mode 100644 src/decoder/decoder_plugin.h create mode 100644 src/decoder/decoder_print.h create mode 100644 src/decoder/decoder_thread.h delete mode 100644 src/decoder_api.h delete mode 100644 src/decoder_command.h delete mode 100644 src/decoder_control.h delete mode 100644 src/decoder_internal.h delete mode 100644 src/decoder_list.h delete mode 100644 src/decoder_plugin.h delete mode 100644 src/decoder_print.h delete mode 100644 src/decoder_thread.h diff --git a/src/cmdline.c b/src/cmdline.c index a972daf9..9fcca400 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -22,8 +22,8 @@ #include "path.h" #include "log.h" #include "conf.h" -#include "decoder_list.h" -#include "decoder_plugin.h" +#include "decoder/decoder_list.h" +#include "decoder/decoder_plugin.h" #include "output_list.h" #include "output_plugin.h" #include "input_registry.h" diff --git a/src/command.c b/src/command.c index 9cb0e69b..e78d8ff7 100644 --- a/src/command.c +++ b/src/command.c @@ -30,7 +30,7 @@ #include "queue_print.h" #include "ls.h" #include "uri.h" -#include "decoder_print.h" +#include "decoder/decoder_print.h" #include "directory.h" #include "database.h" #include "update.h" diff --git a/src/decoder/decoder_api.h b/src/decoder/decoder_api.h new file mode 100644 index 00000000..eede43d1 --- /dev/null +++ b/src/decoder/decoder_api.h @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2003-2011 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/*! \file + * \brief The MPD Decoder API + * + * This is the public API which is used by decoder plugins to + * communicate with the mpd core. + */ + +#ifndef MPD_DECODER_API_H +#define MPD_DECODER_API_H + +#include "check.h" +#include "decoder_command.h" +#include "decoder_plugin.h" +#include "input_stream.h" +#include "replay_gain_info.h" +#include "tag.h" +#include "audio_format.h" +#include "conf.h" + +#include + +#include + +/** + * Notify the player thread that it has finished initialization and + * that it has read the song's meta data. + * + * @param decoder the decoder object + * @param audio_format the audio format which is going to be sent to + * decoder_data() + * @param seekable true if the song is seekable + * @param total_time the total number of seconds in this song; -1 if unknown + */ +void +decoder_initialized(struct decoder *decoder, + const struct audio_format *audio_format, + bool seekable, float total_time); + +/** + * Determines the pending decoder command. + * + * @param decoder the decoder object + * @return the current command, or DECODE_COMMAND_NONE if there is no + * command pending + */ +enum decoder_command +decoder_get_command(struct decoder *decoder); + +/** + * Called by the decoder when it has performed the requested command + * (dc->command). This function resets dc->command and wakes up the + * player thread. + * + * @param decoder the decoder object + */ +void +decoder_command_finished(struct decoder *decoder); + +/** + * Call this when you have received the DECODE_COMMAND_SEEK command. + * + * @param decoder the decoder object + * @return the destination position for the week + */ +double +decoder_seek_where(struct decoder *decoder); + +/** + * Call this instead of decoder_command_finished() when seeking has + * failed. + * + * @param decoder the decoder object + */ +void +decoder_seek_error(struct decoder *decoder); + +/** + * Blocking read from the input stream. + * + * @param decoder the decoder object + * @param is the input stream to read from + * @param buffer the destination buffer + * @param length the maximum number of bytes to read + * @return the number of bytes read, or 0 if one of the following + * occurs: end of file; error; command (like SEEK or STOP). + */ +size_t +decoder_read(struct decoder *decoder, struct input_stream *is, + void *buffer, size_t length); + +/** + * Sets the time stamp for the next data chunk [seconds]. The MPD + * core automatically counts it up, and a decoder plugin only needs to + * use this function if it thinks that adding to the time stamp based + * on the buffer size won't work. + */ +void +decoder_timestamp(struct decoder *decoder, double t); + +/** + * This function is called by the decoder plugin when it has + * successfully decoded block of input data. + * + * @param decoder the decoder object + * @param is an input stream which is buffering while we are waiting + * for the player + * @param data the source buffer + * @param length the number of bytes in the buffer + * @return the current command, or DECODE_COMMAND_NONE if there is no + * command pending + */ +enum decoder_command decoder_data(struct decoder *decoder, struct input_stream *is, + AVFrame *frame, uint16_t kbit_rate); + +/** + * This function is called by the decoder plugin when it has + * successfully decoded a tag. + * + * @param decoder the decoder object + * @param is an input stream which is buffering while we are waiting + * for the player + * @param tag the tag to send + * @return the current command, or DECODE_COMMAND_NONE if there is no + * command pending + */ +enum decoder_command +decoder_tag(struct decoder *decoder, struct input_stream *is, + const struct tag *tag); + +/** + * Set replay gain values for the following chunks. + * + * @param decoder the decoder object + * @param rgi the replay_gain_info object; may be NULL to invalidate + * the previous replay gain values + * @return the replay gain adjustment used + */ +float +decoder_replay_gain(struct decoder *decoder, + const struct replay_gain_info *replay_gain_info); + +/** + * Store MixRamp tags. + * + * @param decoder the decoder object + * @param replay_gain_db the ReplayGain adjustment used for this song + * @param mixramp_start the mixramp_start tag; may be NULL to invalidate + * @param mixramp_end the mixramp_end tag; may be NULL to invalidate + */ +void +decoder_mixramp(struct decoder *decoder, float replay_gain_db, + char *mixramp_start, char *mixramp_end); + +#endif diff --git a/src/decoder/decoder_command.h b/src/decoder/decoder_command.h new file mode 100644 index 00000000..fa57bf88 --- /dev/null +++ b/src/decoder/decoder_command.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2003-2011 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_COMMAND_H +#define MPD_DECODER_COMMAND_H + +enum decoder_command { + DECODE_COMMAND_NONE = 0, + DECODE_COMMAND_START, + DECODE_COMMAND_STOP, + DECODE_COMMAND_SEEK +}; + +#endif diff --git a/src/decoder/decoder_control.h b/src/decoder/decoder_control.h new file mode 100644 index 00000000..8f3fc948 --- /dev/null +++ b/src/decoder/decoder_control.h @@ -0,0 +1,276 @@ +/* + * Copyright (C) 2003-2011 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_CONTROL_H +#define MPD_DECODER_CONTROL_H + +#include "decoder_command.h" +#include "audio_format.h" + +#include + +#include + +enum decoder_state { + DECODE_STATE_STOP = 0, + DECODE_STATE_START, + DECODE_STATE_DECODE, + + /** + * The last "START" command failed, because there was an I/O + * error or because no decoder was able to decode the file. + * This state will only come after START; once the state has + * turned to DECODE, by definition no such error can occur. + */ + DECODE_STATE_ERROR, +}; + +struct decoder_control { + /** the handle of the decoder thread, or NULL if the decoder + thread isn't running */ + GThread *thread; + + /** + * This lock protects #state and #command. + */ + GMutex *mutex; + + /** + * Trigger this object after you have modified #command. This + * is also used by the decoder thread to notify the caller + * when it has finished a command. + */ + GCond *cond; + + /** + * The trigger of this object's client. It is signalled + * whenever an event occurs. + */ + GCond *client_cond; + + enum decoder_state state; + enum decoder_command command; + + bool quit; + bool seek_error; + bool seekable; + double seek_where; + + /** the format of the song file */ + struct audio_format in_audio_format; + + /** the format being sent to the music pipe */ + struct audio_format out_audio_format; + + /** + * The song currently being decoded. This attribute is set by + * the player thread, when it sends the #DECODE_COMMAND_START + * command. + */ + const struct song *song; + + /** + * The initial seek position (in milliseconds), e.g. to the + * start of a sub-track described by a CUE file. + * + * This attribute is set by dc_start(). + */ + unsigned start_ms; + + /** + * The decoder will stop when it reaches this position (in + * milliseconds). 0 means don't stop before the end of the + * file. + * + * This attribute is set by dc_start(). + */ + unsigned end_ms; + + float total_time; + + /** maximum number of samples to keep buffered */ + int buffer_samples; + + /** + * The destination pipe for decoded chunks. The caller thread + * owns this object, and is responsible for freeing it. + */ + struct music_pipe *pipe; + + float replay_gain_db; + float replay_gain_prev_db; + char *mixramp_start; + char *mixramp_end; + char *mixramp_prev_end; +}; + +G_GNUC_MALLOC +struct decoder_control * +dc_new(GCond *client_cond); + +void +dc_free(struct decoder_control *dc); + +/** + * Locks the #decoder_control object. + */ +static inline void +decoder_lock(struct decoder_control *dc) +{ + g_mutex_lock(dc->mutex); +} + +/** + * Unlocks the #decoder_control object. + */ +static inline void +decoder_unlock(struct decoder_control *dc) +{ + g_mutex_unlock(dc->mutex); +} + +/** + * Waits for a signal on the #decoder_control object. This function + * is only valid in the decoder thread. The object must be locked + * prior to calling this function. + */ +static inline void +decoder_wait(struct decoder_control *dc) +{ + g_cond_wait(dc->cond, dc->mutex); +} + +/** + * Signals the #decoder_control object. This function is only valid + * in the player thread. The object should be locked prior to calling + * this function. + */ +static inline void +decoder_signal(struct decoder_control *dc) +{ + g_cond_signal(dc->cond); +} + +static inline bool +decoder_is_idle(const struct decoder_control *dc) +{ + return dc->state == DECODE_STATE_STOP || + dc->state == DECODE_STATE_ERROR; +} + +static inline bool +decoder_is_starting(const struct decoder_control *dc) +{ + return dc->state == DECODE_STATE_START; +} + +static inline bool +decoder_has_failed(const struct decoder_control *dc) +{ + assert(dc->command == DECODE_COMMAND_NONE); + + return dc->state == DECODE_STATE_ERROR; +} + +static inline bool +decoder_lock_is_idle(struct decoder_control *dc) +{ + bool ret; + + decoder_lock(dc); + ret = decoder_is_idle(dc); + decoder_unlock(dc); + + return ret; +} + +static inline bool +decoder_lock_is_starting(struct decoder_control *dc) +{ + bool ret; + + decoder_lock(dc); + ret = decoder_is_starting(dc); + decoder_unlock(dc); + + return ret; +} + +static inline bool +decoder_lock_has_failed(struct decoder_control *dc) +{ + bool ret; + + decoder_lock(dc); + ret = decoder_has_failed(dc); + decoder_unlock(dc); + + return ret; +} + +static inline const struct song * +decoder_current_song(const struct decoder_control *dc) +{ + switch (dc->state) { + case DECODE_STATE_STOP: + case DECODE_STATE_ERROR: + return NULL; + + case DECODE_STATE_START: + case DECODE_STATE_DECODE: + return dc->song; + } + + assert(false); + return NULL; +} + +/** + * Start the decoder. + * + * @param the decoder + * @param song the song to be decoded + * @param start_ms see #decoder_control + * @param end_ms see #decoder_control + * @param pipe the pipe which receives the decoded chunks (owned by + * the caller) + */ +void dc_start(struct decoder_control *dc, struct song *song, + unsigned start_ms, unsigned end_ms, + int buffer_samples, struct music_pipe *pipe); + +void +dc_stop(struct decoder_control *dc); + +bool +dc_seek(struct decoder_control *dc, double where); + +void +dc_quit(struct decoder_control *dc); + +void +dc_mixramp_start(struct decoder_control *dc, char *mixramp_start); + +void +dc_mixramp_end(struct decoder_control *dc, char *mixramp_end); + +void +dc_mixramp_prev_end(struct decoder_control *dc, char *mixramp_prev_end); + +#endif diff --git a/src/decoder/decoder_internal.h b/src/decoder/decoder_internal.h new file mode 100644 index 00000000..853fd72b --- /dev/null +++ b/src/decoder/decoder_internal.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2003-2011 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_INTERNAL_H +#define MPD_DECODER_INTERNAL_H + +#include "decoder_command.h" +#include "pcm_convert.h" +#include "replay_gain_info.h" + +struct input_stream; + +struct decoder { + struct decoder_control *dc; + + struct pcm_convert_state conv_state; + + /** + * The time stamp of the next data chunk, in seconds. + */ + double timestamp; + + /** + * Is the initial seek (to the start position of the sub-song) + * pending, or has it been performed already? + */ + bool initial_seek_pending; + + /** + * Is the initial seek currently running? During this time, + * the decoder command is SEEK. This flag is set by + * decoder_get_virtual_command(), when the virtual SEEK + * command is generated for the first time. + */ + bool initial_seek_running; + + /** + * This flag is set by decoder_seek_where(), and checked by + * decoder_command_finished(). It is used to clean up after + * seeking. + */ + bool seeking; + + /** + * The tag from the song object. This is only used for local + * files, because we expect the stream server to send us a new + * tag each time we play it. + */ + struct tag *song_tag; + + /** the last tag received from the stream */ + struct tag *stream_tag; + + /** the last tag received from the decoder plugin */ + struct tag *decoder_tag; + + struct replay_gain_info replay_gain_info; + + /** + * A positive serial number for checking if replay gain info + * has changed since the last check. + */ + unsigned replay_gain_serial; +}; + +/** + * Returns the current chunk the decoder writes to, or allocates a new + * chunk if there is none. + * + * @return the chunk, or NULL if we have received a decoder command + */ +struct music_chunk * +decoder_get_chunk(struct decoder *decoder); + +#endif diff --git a/src/decoder/decoder_list.h b/src/decoder/decoder_list.h new file mode 100644 index 00000000..9eb92b25 --- /dev/null +++ b/src/decoder/decoder_list.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2003-2011 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_LIST_H +#define MPD_DECODER_LIST_H + +#include + +struct decoder_plugin; + +extern const struct decoder_plugin *const decoder_plugins[]; +extern bool decoder_plugins_enabled[]; + +#define decoder_plugins_for_each(plugin) \ + for (const struct decoder_plugin *plugin, \ + *const*decoder_plugin_iterator = &decoder_plugins[0]; \ + (plugin = *decoder_plugin_iterator) != NULL; \ + ++decoder_plugin_iterator) + +#define decoder_plugins_for_each_enabled(plugin) \ + decoder_plugins_for_each(plugin) \ + if (decoder_plugins_enabled[decoder_plugin_iterator - decoder_plugins]) + +/* interface for using plugins */ + +/** + * Find the next enabled decoder plugin which supports the specified suffix. + * + * @param suffix the file name suffix + * @param plugin the previous plugin, or NULL to find the first plugin + * @return a plugin, or NULL if none matches + */ +const struct decoder_plugin * +decoder_plugin_from_suffix(const char *suffix, + const struct decoder_plugin *plugin); + +const struct decoder_plugin * +decoder_plugin_from_mime_type(const char *mimeType, unsigned int next); + +const struct decoder_plugin * +decoder_plugin_from_name(const char *name); + +/* this is where we "load" all the "plugins" ;-) */ +void decoder_plugin_init_all(void); + +/* this is where we "unload" all the "plugins" */ +void decoder_plugin_deinit_all(void); + +#endif diff --git a/src/decoder/decoder_plugin.h b/src/decoder/decoder_plugin.h new file mode 100644 index 00000000..e00d3383 --- /dev/null +++ b/src/decoder/decoder_plugin.h @@ -0,0 +1,207 @@ +/* + * Copyright (C) 2003-2011 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_PLUGIN_H +#define MPD_DECODER_PLUGIN_H + +#include +#include + +struct config_param; +struct input_stream; +struct tag; +struct tag_handler; + +/** + * Opaque handle which the decoder plugin passes to the functions in + * this header. + */ +struct decoder; + +struct decoder_plugin { + const char *name; + + /** + * Initialize the decoder plugin. Optional method. + * + * @param param a configuration block for this plugin, or NULL + * if none is configured + * @return true if the plugin was initialized successfully, + * false if the plugin is not available + */ + bool (*init)(const struct config_param *param); + + /** + * Deinitialize a decoder plugin which was initialized + * successfully. Optional method. + */ + void (*finish)(void); + + /** + * Decode a stream (data read from an #input_stream object). + * + * Either implement this method or file_decode(). If + * possible, it is recommended to implement this method, + * because it is more versatile. + */ + void (*stream_decode)(struct decoder *decoder, + struct input_stream *is); + + /** + * Decode a local file. + * + * Either implement this method or stream_decode(). + */ + void (*file_decode)(struct decoder *decoder, const char *path_fs); + + /** + * Scan metadata of a file. + * + * @return false if the operation has failed + */ + bool (*scan_file)(const char *path_fs, + const struct tag_handler *handler, + void *handler_ctx); + + /** + * Scan metadata of a file. + * + * @return false if the operation has failed + */ + bool (*scan_stream)(struct input_stream *is, + const struct tag_handler *handler, + void *handler_ctx); + + /** + * @brief Return a "virtual" filename for subtracks in + * container formats like flac + * @param const char* pathname full pathname for the file on fs + * @param const unsigned int tnum track number + * + * @return NULL if there are no multiple files + * a filename for every single track according to tnum (param 2) + * do not include full pathname here, just the "virtual" file + */ + char* (*container_scan)(const char *path_fs, const unsigned int tnum); + + /* last element in these arrays must always be a NULL: */ + const char *const*suffixes; + const char *const*mime_types; +}; + +/** + * Initialize a decoder plugin. + * + * @param param a configuration block for this plugin, or NULL if none + * is configured + * @return true if the plugin was initialized successfully, false if + * the plugin is not available + */ +static inline bool +decoder_plugin_init(const struct decoder_plugin *plugin, + const struct config_param *param) +{ + return plugin->init != NULL + ? plugin->init(param) + : true; +} + +/** + * Deinitialize a decoder plugin which was initialized successfully. + */ +static inline void +decoder_plugin_finish(const struct decoder_plugin *plugin) +{ + if (plugin->finish != NULL) + plugin->finish(); +} + +/** + * Decode a stream. + */ +static inline void +decoder_plugin_stream_decode(const struct decoder_plugin *plugin, + struct decoder *decoder, struct input_stream *is) +{ + plugin->stream_decode(decoder, is); +} + +/** + * Decode a file. + */ +static inline void +decoder_plugin_file_decode(const struct decoder_plugin *plugin, + struct decoder *decoder, const char *path_fs) +{ + plugin->file_decode(decoder, path_fs); +} + +/** + * Read the tag of a file. + */ +static inline bool +decoder_plugin_scan_file(const struct decoder_plugin *plugin, + const char *path_fs, + const struct tag_handler *handler, void *handler_ctx) +{ + return plugin->scan_file != NULL + ? plugin->scan_file(path_fs, handler, handler_ctx) + : false; +} + +/** + * Read the tag of a stream. + */ +static inline bool +decoder_plugin_scan_stream(const struct decoder_plugin *plugin, + struct input_stream *is, + const struct tag_handler *handler, + void *handler_ctx) +{ + return plugin->scan_stream != NULL + ? plugin->scan_stream(is, handler, handler_ctx) + : false; +} + +/** + * return "virtual" tracks in a container + */ +static inline char * +decoder_plugin_container_scan( const struct decoder_plugin *plugin, + const char* pathname, + const unsigned int tnum) +{ + return plugin->container_scan(pathname, tnum); +} + +/** + * Does the plugin announce the specified file name suffix? + */ +bool +decoder_plugin_supports_suffix(const struct decoder_plugin *plugin, + const char *suffix); + +/** + * Does the plugin announce the specified MIME type? + */ +bool +decoder_plugin_supports_mime_type(const struct decoder_plugin *plugin, + const char *mime_type); + +#endif diff --git a/src/decoder/decoder_print.h b/src/decoder/decoder_print.h new file mode 100644 index 00000000..31713d5d --- /dev/null +++ b/src/decoder/decoder_print.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2003-2011 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_PRINT_H +#define MPD_DECODER_PRINT_H + +struct client; + +void +decoder_list_print(struct client *client); + +#endif diff --git a/src/decoder/decoder_thread.h b/src/decoder/decoder_thread.h new file mode 100644 index 00000000..78f12a54 --- /dev/null +++ b/src/decoder/decoder_thread.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2003-2011 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_DECODER_THREAD_H +#define MPD_DECODER_THREAD_H + +struct decoder_control; + +void +decoder_thread_start(struct decoder_control *dc); + +#endif diff --git a/src/decoder_api.h b/src/decoder_api.h deleted file mode 100644 index eede43d1..00000000 --- a/src/decoder_api.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/*! \file - * \brief The MPD Decoder API - * - * This is the public API which is used by decoder plugins to - * communicate with the mpd core. - */ - -#ifndef MPD_DECODER_API_H -#define MPD_DECODER_API_H - -#include "check.h" -#include "decoder_command.h" -#include "decoder_plugin.h" -#include "input_stream.h" -#include "replay_gain_info.h" -#include "tag.h" -#include "audio_format.h" -#include "conf.h" - -#include - -#include - -/** - * Notify the player thread that it has finished initialization and - * that it has read the song's meta data. - * - * @param decoder the decoder object - * @param audio_format the audio format which is going to be sent to - * decoder_data() - * @param seekable true if the song is seekable - * @param total_time the total number of seconds in this song; -1 if unknown - */ -void -decoder_initialized(struct decoder *decoder, - const struct audio_format *audio_format, - bool seekable, float total_time); - -/** - * Determines the pending decoder command. - * - * @param decoder the decoder object - * @return the current command, or DECODE_COMMAND_NONE if there is no - * command pending - */ -enum decoder_command -decoder_get_command(struct decoder *decoder); - -/** - * Called by the decoder when it has performed the requested command - * (dc->command). This function resets dc->command and wakes up the - * player thread. - * - * @param decoder the decoder object - */ -void -decoder_command_finished(struct decoder *decoder); - -/** - * Call this when you have received the DECODE_COMMAND_SEEK command. - * - * @param decoder the decoder object - * @return the destination position for the week - */ -double -decoder_seek_where(struct decoder *decoder); - -/** - * Call this instead of decoder_command_finished() when seeking has - * failed. - * - * @param decoder the decoder object - */ -void -decoder_seek_error(struct decoder *decoder); - -/** - * Blocking read from the input stream. - * - * @param decoder the decoder object - * @param is the input stream to read from - * @param buffer the destination buffer - * @param length the maximum number of bytes to read - * @return the number of bytes read, or 0 if one of the following - * occurs: end of file; error; command (like SEEK or STOP). - */ -size_t -decoder_read(struct decoder *decoder, struct input_stream *is, - void *buffer, size_t length); - -/** - * Sets the time stamp for the next data chunk [seconds]. The MPD - * core automatically counts it up, and a decoder plugin only needs to - * use this function if it thinks that adding to the time stamp based - * on the buffer size won't work. - */ -void -decoder_timestamp(struct decoder *decoder, double t); - -/** - * This function is called by the decoder plugin when it has - * successfully decoded block of input data. - * - * @param decoder the decoder object - * @param is an input stream which is buffering while we are waiting - * for the player - * @param data the source buffer - * @param length the number of bytes in the buffer - * @return the current command, or DECODE_COMMAND_NONE if there is no - * command pending - */ -enum decoder_command decoder_data(struct decoder *decoder, struct input_stream *is, - AVFrame *frame, uint16_t kbit_rate); - -/** - * This function is called by the decoder plugin when it has - * successfully decoded a tag. - * - * @param decoder the decoder object - * @param is an input stream which is buffering while we are waiting - * for the player - * @param tag the tag to send - * @return the current command, or DECODE_COMMAND_NONE if there is no - * command pending - */ -enum decoder_command -decoder_tag(struct decoder *decoder, struct input_stream *is, - const struct tag *tag); - -/** - * Set replay gain values for the following chunks. - * - * @param decoder the decoder object - * @param rgi the replay_gain_info object; may be NULL to invalidate - * the previous replay gain values - * @return the replay gain adjustment used - */ -float -decoder_replay_gain(struct decoder *decoder, - const struct replay_gain_info *replay_gain_info); - -/** - * Store MixRamp tags. - * - * @param decoder the decoder object - * @param replay_gain_db the ReplayGain adjustment used for this song - * @param mixramp_start the mixramp_start tag; may be NULL to invalidate - * @param mixramp_end the mixramp_end tag; may be NULL to invalidate - */ -void -decoder_mixramp(struct decoder *decoder, float replay_gain_db, - char *mixramp_start, char *mixramp_end); - -#endif diff --git a/src/decoder_command.h b/src/decoder_command.h deleted file mode 100644 index fa57bf88..00000000 --- a/src/decoder_command.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_COMMAND_H -#define MPD_DECODER_COMMAND_H - -enum decoder_command { - DECODE_COMMAND_NONE = 0, - DECODE_COMMAND_START, - DECODE_COMMAND_STOP, - DECODE_COMMAND_SEEK -}; - -#endif diff --git a/src/decoder_control.h b/src/decoder_control.h deleted file mode 100644 index 8f3fc948..00000000 --- a/src/decoder_control.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_CONTROL_H -#define MPD_DECODER_CONTROL_H - -#include "decoder_command.h" -#include "audio_format.h" - -#include - -#include - -enum decoder_state { - DECODE_STATE_STOP = 0, - DECODE_STATE_START, - DECODE_STATE_DECODE, - - /** - * The last "START" command failed, because there was an I/O - * error or because no decoder was able to decode the file. - * This state will only come after START; once the state has - * turned to DECODE, by definition no such error can occur. - */ - DECODE_STATE_ERROR, -}; - -struct decoder_control { - /** the handle of the decoder thread, or NULL if the decoder - thread isn't running */ - GThread *thread; - - /** - * This lock protects #state and #command. - */ - GMutex *mutex; - - /** - * Trigger this object after you have modified #command. This - * is also used by the decoder thread to notify the caller - * when it has finished a command. - */ - GCond *cond; - - /** - * The trigger of this object's client. It is signalled - * whenever an event occurs. - */ - GCond *client_cond; - - enum decoder_state state; - enum decoder_command command; - - bool quit; - bool seek_error; - bool seekable; - double seek_where; - - /** the format of the song file */ - struct audio_format in_audio_format; - - /** the format being sent to the music pipe */ - struct audio_format out_audio_format; - - /** - * The song currently being decoded. This attribute is set by - * the player thread, when it sends the #DECODE_COMMAND_START - * command. - */ - const struct song *song; - - /** - * The initial seek position (in milliseconds), e.g. to the - * start of a sub-track described by a CUE file. - * - * This attribute is set by dc_start(). - */ - unsigned start_ms; - - /** - * The decoder will stop when it reaches this position (in - * milliseconds). 0 means don't stop before the end of the - * file. - * - * This attribute is set by dc_start(). - */ - unsigned end_ms; - - float total_time; - - /** maximum number of samples to keep buffered */ - int buffer_samples; - - /** - * The destination pipe for decoded chunks. The caller thread - * owns this object, and is responsible for freeing it. - */ - struct music_pipe *pipe; - - float replay_gain_db; - float replay_gain_prev_db; - char *mixramp_start; - char *mixramp_end; - char *mixramp_prev_end; -}; - -G_GNUC_MALLOC -struct decoder_control * -dc_new(GCond *client_cond); - -void -dc_free(struct decoder_control *dc); - -/** - * Locks the #decoder_control object. - */ -static inline void -decoder_lock(struct decoder_control *dc) -{ - g_mutex_lock(dc->mutex); -} - -/** - * Unlocks the #decoder_control object. - */ -static inline void -decoder_unlock(struct decoder_control *dc) -{ - g_mutex_unlock(dc->mutex); -} - -/** - * Waits for a signal on the #decoder_control object. This function - * is only valid in the decoder thread. The object must be locked - * prior to calling this function. - */ -static inline void -decoder_wait(struct decoder_control *dc) -{ - g_cond_wait(dc->cond, dc->mutex); -} - -/** - * Signals the #decoder_control object. This function is only valid - * in the player thread. The object should be locked prior to calling - * this function. - */ -static inline void -decoder_signal(struct decoder_control *dc) -{ - g_cond_signal(dc->cond); -} - -static inline bool -decoder_is_idle(const struct decoder_control *dc) -{ - return dc->state == DECODE_STATE_STOP || - dc->state == DECODE_STATE_ERROR; -} - -static inline bool -decoder_is_starting(const struct decoder_control *dc) -{ - return dc->state == DECODE_STATE_START; -} - -static inline bool -decoder_has_failed(const struct decoder_control *dc) -{ - assert(dc->command == DECODE_COMMAND_NONE); - - return dc->state == DECODE_STATE_ERROR; -} - -static inline bool -decoder_lock_is_idle(struct decoder_control *dc) -{ - bool ret; - - decoder_lock(dc); - ret = decoder_is_idle(dc); - decoder_unlock(dc); - - return ret; -} - -static inline bool -decoder_lock_is_starting(struct decoder_control *dc) -{ - bool ret; - - decoder_lock(dc); - ret = decoder_is_starting(dc); - decoder_unlock(dc); - - return ret; -} - -static inline bool -decoder_lock_has_failed(struct decoder_control *dc) -{ - bool ret; - - decoder_lock(dc); - ret = decoder_has_failed(dc); - decoder_unlock(dc); - - return ret; -} - -static inline const struct song * -decoder_current_song(const struct decoder_control *dc) -{ - switch (dc->state) { - case DECODE_STATE_STOP: - case DECODE_STATE_ERROR: - return NULL; - - case DECODE_STATE_START: - case DECODE_STATE_DECODE: - return dc->song; - } - - assert(false); - return NULL; -} - -/** - * Start the decoder. - * - * @param the decoder - * @param song the song to be decoded - * @param start_ms see #decoder_control - * @param end_ms see #decoder_control - * @param pipe the pipe which receives the decoded chunks (owned by - * the caller) - */ -void dc_start(struct decoder_control *dc, struct song *song, - unsigned start_ms, unsigned end_ms, - int buffer_samples, struct music_pipe *pipe); - -void -dc_stop(struct decoder_control *dc); - -bool -dc_seek(struct decoder_control *dc, double where); - -void -dc_quit(struct decoder_control *dc); - -void -dc_mixramp_start(struct decoder_control *dc, char *mixramp_start); - -void -dc_mixramp_end(struct decoder_control *dc, char *mixramp_end); - -void -dc_mixramp_prev_end(struct decoder_control *dc, char *mixramp_prev_end); - -#endif diff --git a/src/decoder_internal.h b/src/decoder_internal.h deleted file mode 100644 index 853fd72b..00000000 --- a/src/decoder_internal.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_INTERNAL_H -#define MPD_DECODER_INTERNAL_H - -#include "decoder_command.h" -#include "pcm_convert.h" -#include "replay_gain_info.h" - -struct input_stream; - -struct decoder { - struct decoder_control *dc; - - struct pcm_convert_state conv_state; - - /** - * The time stamp of the next data chunk, in seconds. - */ - double timestamp; - - /** - * Is the initial seek (to the start position of the sub-song) - * pending, or has it been performed already? - */ - bool initial_seek_pending; - - /** - * Is the initial seek currently running? During this time, - * the decoder command is SEEK. This flag is set by - * decoder_get_virtual_command(), when the virtual SEEK - * command is generated for the first time. - */ - bool initial_seek_running; - - /** - * This flag is set by decoder_seek_where(), and checked by - * decoder_command_finished(). It is used to clean up after - * seeking. - */ - bool seeking; - - /** - * The tag from the song object. This is only used for local - * files, because we expect the stream server to send us a new - * tag each time we play it. - */ - struct tag *song_tag; - - /** the last tag received from the stream */ - struct tag *stream_tag; - - /** the last tag received from the decoder plugin */ - struct tag *decoder_tag; - - struct replay_gain_info replay_gain_info; - - /** - * A positive serial number for checking if replay gain info - * has changed since the last check. - */ - unsigned replay_gain_serial; -}; - -/** - * Returns the current chunk the decoder writes to, or allocates a new - * chunk if there is none. - * - * @return the chunk, or NULL if we have received a decoder command - */ -struct music_chunk * -decoder_get_chunk(struct decoder *decoder); - -#endif diff --git a/src/decoder_list.h b/src/decoder_list.h deleted file mode 100644 index 9eb92b25..00000000 --- a/src/decoder_list.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_LIST_H -#define MPD_DECODER_LIST_H - -#include - -struct decoder_plugin; - -extern const struct decoder_plugin *const decoder_plugins[]; -extern bool decoder_plugins_enabled[]; - -#define decoder_plugins_for_each(plugin) \ - for (const struct decoder_plugin *plugin, \ - *const*decoder_plugin_iterator = &decoder_plugins[0]; \ - (plugin = *decoder_plugin_iterator) != NULL; \ - ++decoder_plugin_iterator) - -#define decoder_plugins_for_each_enabled(plugin) \ - decoder_plugins_for_each(plugin) \ - if (decoder_plugins_enabled[decoder_plugin_iterator - decoder_plugins]) - -/* interface for using plugins */ - -/** - * Find the next enabled decoder plugin which supports the specified suffix. - * - * @param suffix the file name suffix - * @param plugin the previous plugin, or NULL to find the first plugin - * @return a plugin, or NULL if none matches - */ -const struct decoder_plugin * -decoder_plugin_from_suffix(const char *suffix, - const struct decoder_plugin *plugin); - -const struct decoder_plugin * -decoder_plugin_from_mime_type(const char *mimeType, unsigned int next); - -const struct decoder_plugin * -decoder_plugin_from_name(const char *name); - -/* this is where we "load" all the "plugins" ;-) */ -void decoder_plugin_init_all(void); - -/* this is where we "unload" all the "plugins" */ -void decoder_plugin_deinit_all(void); - -#endif diff --git a/src/decoder_plugin.h b/src/decoder_plugin.h deleted file mode 100644 index e00d3383..00000000 --- a/src/decoder_plugin.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_PLUGIN_H -#define MPD_DECODER_PLUGIN_H - -#include -#include - -struct config_param; -struct input_stream; -struct tag; -struct tag_handler; - -/** - * Opaque handle which the decoder plugin passes to the functions in - * this header. - */ -struct decoder; - -struct decoder_plugin { - const char *name; - - /** - * Initialize the decoder plugin. Optional method. - * - * @param param a configuration block for this plugin, or NULL - * if none is configured - * @return true if the plugin was initialized successfully, - * false if the plugin is not available - */ - bool (*init)(const struct config_param *param); - - /** - * Deinitialize a decoder plugin which was initialized - * successfully. Optional method. - */ - void (*finish)(void); - - /** - * Decode a stream (data read from an #input_stream object). - * - * Either implement this method or file_decode(). If - * possible, it is recommended to implement this method, - * because it is more versatile. - */ - void (*stream_decode)(struct decoder *decoder, - struct input_stream *is); - - /** - * Decode a local file. - * - * Either implement this method or stream_decode(). - */ - void (*file_decode)(struct decoder *decoder, const char *path_fs); - - /** - * Scan metadata of a file. - * - * @return false if the operation has failed - */ - bool (*scan_file)(const char *path_fs, - const struct tag_handler *handler, - void *handler_ctx); - - /** - * Scan metadata of a file. - * - * @return false if the operation has failed - */ - bool (*scan_stream)(struct input_stream *is, - const struct tag_handler *handler, - void *handler_ctx); - - /** - * @brief Return a "virtual" filename for subtracks in - * container formats like flac - * @param const char* pathname full pathname for the file on fs - * @param const unsigned int tnum track number - * - * @return NULL if there are no multiple files - * a filename for every single track according to tnum (param 2) - * do not include full pathname here, just the "virtual" file - */ - char* (*container_scan)(const char *path_fs, const unsigned int tnum); - - /* last element in these arrays must always be a NULL: */ - const char *const*suffixes; - const char *const*mime_types; -}; - -/** - * Initialize a decoder plugin. - * - * @param param a configuration block for this plugin, or NULL if none - * is configured - * @return true if the plugin was initialized successfully, false if - * the plugin is not available - */ -static inline bool -decoder_plugin_init(const struct decoder_plugin *plugin, - const struct config_param *param) -{ - return plugin->init != NULL - ? plugin->init(param) - : true; -} - -/** - * Deinitialize a decoder plugin which was initialized successfully. - */ -static inline void -decoder_plugin_finish(const struct decoder_plugin *plugin) -{ - if (plugin->finish != NULL) - plugin->finish(); -} - -/** - * Decode a stream. - */ -static inline void -decoder_plugin_stream_decode(const struct decoder_plugin *plugin, - struct decoder *decoder, struct input_stream *is) -{ - plugin->stream_decode(decoder, is); -} - -/** - * Decode a file. - */ -static inline void -decoder_plugin_file_decode(const struct decoder_plugin *plugin, - struct decoder *decoder, const char *path_fs) -{ - plugin->file_decode(decoder, path_fs); -} - -/** - * Read the tag of a file. - */ -static inline bool -decoder_plugin_scan_file(const struct decoder_plugin *plugin, - const char *path_fs, - const struct tag_handler *handler, void *handler_ctx) -{ - return plugin->scan_file != NULL - ? plugin->scan_file(path_fs, handler, handler_ctx) - : false; -} - -/** - * Read the tag of a stream. - */ -static inline bool -decoder_plugin_scan_stream(const struct decoder_plugin *plugin, - struct input_stream *is, - const struct tag_handler *handler, - void *handler_ctx) -{ - return plugin->scan_stream != NULL - ? plugin->scan_stream(is, handler, handler_ctx) - : false; -} - -/** - * return "virtual" tracks in a container - */ -static inline char * -decoder_plugin_container_scan( const struct decoder_plugin *plugin, - const char* pathname, - const unsigned int tnum) -{ - return plugin->container_scan(pathname, tnum); -} - -/** - * Does the plugin announce the specified file name suffix? - */ -bool -decoder_plugin_supports_suffix(const struct decoder_plugin *plugin, - const char *suffix); - -/** - * Does the plugin announce the specified MIME type? - */ -bool -decoder_plugin_supports_mime_type(const struct decoder_plugin *plugin, - const char *mime_type); - -#endif diff --git a/src/decoder_print.h b/src/decoder_print.h deleted file mode 100644 index 31713d5d..00000000 --- a/src/decoder_print.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_PRINT_H -#define MPD_DECODER_PRINT_H - -struct client; - -void -decoder_list_print(struct client *client); - -#endif diff --git a/src/decoder_thread.h b/src/decoder_thread.h deleted file mode 100644 index 78f12a54..00000000 --- a/src/decoder_thread.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2003-2011 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_DECODER_THREAD_H -#define MPD_DECODER_THREAD_H - -struct decoder_control; - -void -decoder_thread_start(struct decoder_control *dc); - -#endif diff --git a/src/main.c b/src/main.c index aa021d64..d1186111 100644 --- a/src/main.c +++ b/src/main.c @@ -45,7 +45,7 @@ #include "log.h" #include "permission.h" #include "replay_gain_config.h" -#include "decoder_list.h" +#include "decoder/decoder_list.h" #include "input_init.h" #include "playlist_list.h" #include "state_file.h" diff --git a/src/player_control.c b/src/player_control.c index 3c0b30b5..29d1e12d 100644 --- a/src/player_control.c +++ b/src/player_control.c @@ -19,7 +19,7 @@ #include "config.h" #include "player_control.h" -#include "decoder_control.h" +#include "decoder/decoder_control.h" #include "path.h" #include "log.h" #include "tag.h" diff --git a/src/player_thread.c b/src/player_thread.c index 5c9b7015..4a45e3af 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -20,8 +20,8 @@ #include "config.h" #include "player_thread.h" #include "player_control.h" -#include "decoder_control.h" -#include "decoder_thread.h" +#include "decoder/decoder_control.h" +#include "decoder/decoder_thread.h" #include "output_all.h" #include "path.h" #include "event_pipe.h" diff --git a/src/song_update.c b/src/song_update.c index 37f502a2..7e4df352 100644 --- a/src/song_update.c +++ b/src/song_update.c @@ -22,8 +22,8 @@ #include "uri.h" #include "directory.h" #include "mapper.h" -#include "decoder_list.h" -#include "decoder_plugin.h" +#include "decoder/decoder_list.h" +#include "decoder/decoder_plugin.h" #include "tag_ape.h" #include "tag_id3.h" #include "tag.h" diff --git a/src/tag_file.c b/src/tag_file.c index 8d8a0f5f..05145784 100644 --- a/src/tag_file.c +++ b/src/tag_file.c @@ -20,8 +20,8 @@ #include "config.h" #include "tag_file.h" #include "uri.h" -#include "decoder_list.h" -#include "decoder_plugin.h" +#include "decoder/decoder_list.h" +#include "decoder/decoder_plugin.h" #include "input_stream.h" #include diff --git a/src/update_container.c b/src/update_container.c index bda95dab..7ab5b1ba 100644 --- a/src/update_container.c +++ b/src/update_container.c @@ -25,7 +25,7 @@ #include "directory.h" #include "song.h" #include "mapper.h" -#include "decoder_plugin.h" +#include "decoder/decoder_plugin.h" #include "tag.h" #include "tag_handler.h" diff --git a/src/update_song.c b/src/update_song.c index 1126ad11..4d66fa49 100644 --- a/src/update_song.c +++ b/src/update_song.c @@ -26,8 +26,8 @@ #include "db_lock.h" #include "directory.h" #include "song.h" -#include "decoder_list.h" -#include "decoder_plugin.h" +#include "decoder/decoder_list.h" +#include "decoder/decoder_plugin.h" #include -- cgit v1.2.3