aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/sidplay_decoder_plugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/sidplay_decoder_plugin.cxx34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/decoder/sidplay_decoder_plugin.cxx b/src/decoder/sidplay_decoder_plugin.cxx
index 5d162f179..4e26efecb 100644
--- a/src/decoder/sidplay_decoder_plugin.cxx
+++ b/src/decoder/sidplay_decoder_plugin.cxx
@@ -18,14 +18,15 @@
*/
#include "config.h"
+#include "../DecoderAPI.hxx"
extern "C" {
-#include "../decoder_api.h"
-#include "tag_handler.h"
+#include "TagHandler.hxx"
}
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <glib.h>
#include <sidplay/sidplay2.h>
@@ -82,29 +83,27 @@ sidplay_load_songlength_db(const char *path)
}
static bool
-sidplay_init(const struct config_param *param)
+sidplay_init(const config_param &param)
{
/* 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 +135,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 +171,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,11 +283,10 @@ 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 */
@@ -330,7 +328,7 @@ 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);