aboutsummaryrefslogtreecommitdiffstats
path: root/test/read_tags.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/read_tags.c')
-rw-r--r--test/read_tags.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/test/read_tags.c b/test/read_tags.c
index e7958abdb..adeabb156 100644
--- a/test/read_tags.c
+++ b/test/read_tags.c
@@ -17,19 +17,34 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "config.h"
#include "decoder_list.h"
#include "decoder_api.h"
+#include "input_init.h"
#include "input_stream.h"
#include "audio_format.h"
#include "pcm_volume.h"
#include "tag_ape.h"
#include "tag_id3.h"
+#include "idle.h"
#include <glib.h>
#include <assert.h>
#include <unistd.h>
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+/**
+ * No-op dummy.
+ */
+void
+idle_add(G_GNUC_UNUSED unsigned flags)
+{
+}
+
/**
* No-op dummy.
*/
@@ -78,14 +93,20 @@ decoder_read(G_GNUC_UNUSED struct decoder *decoder,
struct input_stream *is,
void *buffer, size_t length)
{
- return input_stream_read(is, buffer, length);
+ return input_stream_read(is, buffer, length, NULL);
+}
+
+void
+decoder_timestamp(G_GNUC_UNUSED struct decoder *decoder,
+ G_GNUC_UNUSED double t)
+{
}
enum decoder_command
decoder_data(G_GNUC_UNUSED struct decoder *decoder,
G_GNUC_UNUSED struct input_stream *is,
const void *data, size_t datalen,
- G_GNUC_UNUSED float data_time, G_GNUC_UNUSED uint16_t bit_rate,
+ G_GNUC_UNUSED uint16_t bit_rate,
G_GNUC_UNUSED struct replay_gain_info *replay_gain_info)
{
write(1, data, datalen);
@@ -114,11 +135,17 @@ print_tag(const struct tag *tag)
int main(int argc, char **argv)
{
+ GError *error = NULL;
const char *decoder_name, *path;
const struct decoder_plugin *plugin;
struct tag *tag;
bool empty;
+#ifdef HAVE_LOCALE_H
+ /* initialize locale */
+ setlocale(LC_CTYPE,"");
+#endif
+
if (argc != 3) {
g_printerr("Usage: read_tags DECODER FILE\n");
return 1;
@@ -127,7 +154,12 @@ int main(int argc, char **argv)
decoder_name = argv[1];
path = argv[2];
- input_stream_global_init();
+ if (!input_stream_global_init(&error)) {
+ g_warning("%s", error->message);
+ g_error_free(error);
+ return 2;
+ }
+
decoder_plugin_init_all();
plugin = decoder_plugin_from_name(decoder_name);