From 3d5dcfe8a592e4cb5fef4ef440d4f440937ee697 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 23 Apr 2013 16:03:04 +0200 Subject: decoder*h: remove tabs --- src/decoder_api.h | 12 +-- src/decoder_command.h | 8 +- src/decoder_control.h | 246 ++++++++++++++++++++++++------------------------- src/decoder_internal.h | 100 ++++++++++---------- src/decoder_list.h | 14 +-- src/decoder_plugin.h | 190 +++++++++++++++++++------------------- 6 files changed, 285 insertions(+), 285 deletions(-) diff --git a/src/decoder_api.h b/src/decoder_api.h index 4ac00142..eede43d1 100644 --- a/src/decoder_api.h +++ b/src/decoder_api.h @@ -52,8 +52,8 @@ */ void decoder_initialized(struct decoder *decoder, - const struct audio_format *audio_format, - bool seekable, float total_time); + const struct audio_format *audio_format, + bool seekable, float total_time); /** * Determines the pending decoder command. @@ -105,7 +105,7 @@ decoder_seek_error(struct decoder *decoder); */ size_t decoder_read(struct decoder *decoder, struct input_stream *is, - void *buffer, size_t length); + void *buffer, size_t length); /** * Sets the time stamp for the next data chunk [seconds]. The MPD @@ -144,7 +144,7 @@ enum decoder_command decoder_data(struct decoder *decoder, struct input_stream * */ enum decoder_command decoder_tag(struct decoder *decoder, struct input_stream *is, - const struct tag *tag); + const struct tag *tag); /** * Set replay gain values for the following chunks. @@ -156,7 +156,7 @@ decoder_tag(struct decoder *decoder, struct input_stream *is, */ float decoder_replay_gain(struct decoder *decoder, - const struct replay_gain_info *replay_gain_info); + const struct replay_gain_info *replay_gain_info); /** * Store MixRamp tags. @@ -168,6 +168,6 @@ decoder_replay_gain(struct decoder *decoder, */ void decoder_mixramp(struct decoder *decoder, float replay_gain_db, - char *mixramp_start, char *mixramp_end); + char *mixramp_start, char *mixramp_end); #endif diff --git a/src/decoder_command.h b/src/decoder_command.h index 795e13fb..fa57bf88 100644 --- a/src/decoder_command.h +++ b/src/decoder_command.h @@ -21,10 +21,10 @@ #define MPD_DECODER_COMMAND_H enum decoder_command { - DECODE_COMMAND_NONE = 0, - DECODE_COMMAND_START, - DECODE_COMMAND_STOP, - DECODE_COMMAND_SEEK + 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 index 963e73ea..8f3fc948 100644 --- a/src/decoder_control.h +++ b/src/decoder_control.h @@ -28,96 +28,96 @@ #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, + 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; + /** 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 @@ -133,7 +133,7 @@ dc_free(struct decoder_control *dc); static inline void decoder_lock(struct decoder_control *dc) { - g_mutex_lock(dc->mutex); + g_mutex_lock(dc->mutex); } /** @@ -142,7 +142,7 @@ decoder_lock(struct decoder_control *dc) static inline void decoder_unlock(struct decoder_control *dc) { - g_mutex_unlock(dc->mutex); + g_mutex_unlock(dc->mutex); } /** @@ -153,7 +153,7 @@ decoder_unlock(struct decoder_control *dc) static inline void decoder_wait(struct decoder_control *dc) { - g_cond_wait(dc->cond, dc->mutex); + g_cond_wait(dc->cond, dc->mutex); } /** @@ -164,81 +164,81 @@ decoder_wait(struct decoder_control *dc) static inline void decoder_signal(struct decoder_control *dc) { - g_cond_signal(dc->cond); + 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; + 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; + return dc->state == DECODE_STATE_START; } static inline bool decoder_has_failed(const struct decoder_control *dc) { - assert(dc->command == DECODE_COMMAND_NONE); + assert(dc->command == DECODE_COMMAND_NONE); - return dc->state == DECODE_STATE_ERROR; + return dc->state == DECODE_STATE_ERROR; } static inline bool decoder_lock_is_idle(struct decoder_control *dc) { - bool ret; + bool ret; - decoder_lock(dc); - ret = decoder_is_idle(dc); - decoder_unlock(dc); + decoder_lock(dc); + ret = decoder_is_idle(dc); + decoder_unlock(dc); - return ret; + return ret; } static inline bool decoder_lock_is_starting(struct decoder_control *dc) { - bool ret; + bool ret; - decoder_lock(dc); - ret = decoder_is_starting(dc); - decoder_unlock(dc); + decoder_lock(dc); + ret = decoder_is_starting(dc); + decoder_unlock(dc); - return ret; + return ret; } static inline bool decoder_lock_has_failed(struct decoder_control *dc) { - bool ret; + bool ret; - decoder_lock(dc); - ret = decoder_has_failed(dc); - decoder_unlock(dc); + decoder_lock(dc); + ret = decoder_has_failed(dc); + decoder_unlock(dc); - return ret; + 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; + 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; } /** diff --git a/src/decoder_internal.h b/src/decoder_internal.h index 1f331aa1..853fd72b 100644 --- a/src/decoder_internal.h +++ b/src/decoder_internal.h @@ -27,56 +27,56 @@ 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; + 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; }; /** diff --git a/src/decoder_list.h b/src/decoder_list.h index d0a6ade7..9eb92b25 100644 --- a/src/decoder_list.h +++ b/src/decoder_list.h @@ -28,14 +28,14 @@ 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) + 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]) + decoder_plugins_for_each(plugin) \ + if (decoder_plugins_enabled[decoder_plugin_iterator - decoder_plugins]) /* interface for using plugins */ @@ -48,7 +48,7 @@ extern bool decoder_plugins_enabled[]; */ const struct decoder_plugin * decoder_plugin_from_suffix(const char *suffix, - const struct decoder_plugin *plugin); + const struct decoder_plugin *plugin); const struct decoder_plugin * decoder_plugin_from_mime_type(const char *mimeType, unsigned int next); diff --git a/src/decoder_plugin.h b/src/decoder_plugin.h index 933ba675..e00d3383 100644 --- a/src/decoder_plugin.h +++ b/src/decoder_plugin.h @@ -35,74 +35,74 @@ struct tag_handler; 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; + 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; }; /** @@ -115,11 +115,11 @@ struct decoder_plugin { */ static inline bool decoder_plugin_init(const struct decoder_plugin *plugin, - const struct config_param *param) + const struct config_param *param) { - return plugin->init != NULL - ? plugin->init(param) - : true; + return plugin->init != NULL + ? plugin->init(param) + : true; } /** @@ -128,8 +128,8 @@ decoder_plugin_init(const struct decoder_plugin *plugin, static inline void decoder_plugin_finish(const struct decoder_plugin *plugin) { - if (plugin->finish != NULL) - plugin->finish(); + if (plugin->finish != NULL) + plugin->finish(); } /** @@ -137,9 +137,9 @@ decoder_plugin_finish(const struct decoder_plugin *plugin) */ static inline void decoder_plugin_stream_decode(const struct decoder_plugin *plugin, - struct decoder *decoder, struct input_stream *is) + struct decoder *decoder, struct input_stream *is) { - plugin->stream_decode(decoder, is); + plugin->stream_decode(decoder, is); } /** @@ -147,9 +147,9 @@ decoder_plugin_stream_decode(const struct decoder_plugin *plugin, */ static inline void decoder_plugin_file_decode(const struct decoder_plugin *plugin, - struct decoder *decoder, const char *path_fs) + struct decoder *decoder, const char *path_fs) { - plugin->file_decode(decoder, path_fs); + plugin->file_decode(decoder, path_fs); } /** @@ -157,12 +157,12 @@ decoder_plugin_file_decode(const struct decoder_plugin *plugin, */ static inline bool decoder_plugin_scan_file(const struct decoder_plugin *plugin, - const char *path_fs, - const struct tag_handler *handler, void *handler_ctx) + 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; + return plugin->scan_file != NULL + ? plugin->scan_file(path_fs, handler, handler_ctx) + : false; } /** @@ -170,24 +170,24 @@ decoder_plugin_scan_file(const struct decoder_plugin *plugin, */ static inline bool decoder_plugin_scan_stream(const struct decoder_plugin *plugin, - struct input_stream *is, - const struct tag_handler *handler, - void *handler_ctx) + 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 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) +decoder_plugin_container_scan( const struct decoder_plugin *plugin, + const char* pathname, + const unsigned int tnum) { - return plugin->container_scan(pathname, tnum); + return plugin->container_scan(pathname, tnum); } /** @@ -195,13 +195,13 @@ decoder_plugin_container_scan( const struct decoder_plugin *plugin, */ bool decoder_plugin_supports_suffix(const struct decoder_plugin *plugin, - const char *suffix); + 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); + const char *mime_type); #endif -- cgit v1.2.3