diff options
Diffstat (limited to 'src/decoder/sidplay_decoder_plugin.cxx')
-rw-r--r-- | src/decoder/sidplay_decoder_plugin.cxx | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/src/decoder/sidplay_decoder_plugin.cxx b/src/decoder/sidplay_decoder_plugin.cxx index 5d162f179..fed0476ec 100644 --- a/src/decoder/sidplay_decoder_plugin.cxx +++ b/src/decoder/sidplay_decoder_plugin.cxx @@ -18,14 +18,12 @@ */ #include "config.h" - -extern "C" { -#include "../decoder_api.h" -#include "tag_handler.h" -} +#include "../DecoderAPI.hxx" +#include "tag/TagHandler.hxx" #include <errno.h> #include <stdlib.h> +#include <string.h> #include <glib.h> #include <sidplay/sidplay2.h> @@ -82,29 +80,27 @@ sidplay_load_songlength_db(const char *path) } static bool -sidplay_init(const struct config_param *param) +sidplay_init(const config_param ¶m) { /* read the songlengths database file */ - songlength_file=config_get_block_string(param, - "songlength_database", NULL); + songlength_file = param.GetBlockValue("songlength_database"); if (songlength_file != NULL) songlength_database = sidplay_load_songlength_db(songlength_file); - default_songlength=config_get_block_unsigned(param, - "default_songlength", 0); + default_songlength = param.GetBlockValue("default_songlength", 0u); - all_files_are_containers=config_get_block_bool(param, - "all_files_are_containers", true); + all_files_are_containers = + param.GetBlockValue("all_files_are_containers", true); path_with_subtune=g_pattern_spec_new( "*/" SUBTUNE_PREFIX "???.sid"); - filter_setting=config_get_block_bool(param, "filter", true); + filter_setting = param.GetBlockValue("filter", true); return true; } -void +static void sidplay_finish() { g_pattern_spec_free(path_with_subtune); @@ -136,7 +132,7 @@ get_container_name(const char *path_fs) * returns tune number from file.sid/tune_xxx.sid style path or 1 if * no subtune is appended */ -static int +static unsigned get_song_num(const char *path_fs) { if(g_pattern_match(path_with_subtune, @@ -172,7 +168,7 @@ get_song_length(const char *path_fs) char md5sum[SIDTUNE_MD5_LENGTH+1]; tune.createMD5(md5sum); - int song_num=get_song_num(path_fs); + const unsigned song_num = get_song_num(path_fs); gsize num_items; gchar **values=g_key_file_get_string_list(songlength_database, @@ -284,18 +280,17 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs) /* initialize the MPD decoder */ - struct audio_format audio_format; - audio_format_init(&audio_format, 48000, SAMPLE_FORMAT_S16, channels); - assert(audio_format_valid(&audio_format)); + const AudioFormat audio_format(48000, SampleFormat::S16, channels); + assert(audio_format.IsValid()); - decoder_initialized(decoder, &audio_format, true, (float)song_len); + decoder_initialized(decoder, audio_format, true, (float)song_len); /* .. and play */ const unsigned timebase = player.timebase(); song_len *= timebase; - enum decoder_command cmd; + DecoderCommand cmd; do { char buffer[4096]; size_t nbytes; @@ -308,7 +303,7 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs) cmd = decoder_data(decoder, NULL, buffer, nbytes, 0); - if(cmd==DECODE_COMMAND_SEEK) { + if (cmd == DecoderCommand::SEEK) { unsigned data_time = player.time(); unsigned target_time = (unsigned) (decoder_seek_where(decoder) * timebase); @@ -330,10 +325,10 @@ sidplay_file_decode(struct decoder *decoder, const char *path_fs) decoder_command_finished(decoder); } - if (song_len > 0 && player.time() >= song_len) + if (song_len > 0 && player.time() >= (unsigned)song_len) break; - } while (cmd != DECODE_COMMAND_STOP); + } while (cmd != DecoderCommand::STOP); } static bool |