diff options
Diffstat (limited to '')
-rw-r--r-- | test/dump_playlist.c | 21 | ||||
-rw-r--r-- | test/read_tags.c | 8 | ||||
-rw-r--r-- | test/run_decoder.c | 12 | ||||
-rw-r--r-- | test/run_input.c | 9 |
4 files changed, 23 insertions, 27 deletions
diff --git a/test/dump_playlist.c b/test/dump_playlist.c index 7be9b973f..95207e24d 100644 --- a/test/dump_playlist.c +++ b/test/dump_playlist.c @@ -44,8 +44,7 @@ my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level, int main(int argc, char **argv) { const char *uri; - struct input_stream is; - bool stream_open = false; + struct input_stream *is = NULL; bool success; GError *error = NULL; struct playlist_provider *playlist; @@ -88,8 +87,8 @@ int main(int argc, char **argv) if (playlist == NULL) { /* open the stream and wait until it becomes ready */ - success = input_stream_open(&is, uri, &error); - if (!success) { + is = input_stream_open(uri, &error); + if (is == NULL) { if (error != NULL) { g_warning("%s", error->message); g_error_free(error); @@ -98,8 +97,8 @@ int main(int argc, char **argv) return 2; } - while (!is.ready) { - int ret = input_stream_buffer(&is, &error); + while (!is->ready) { + int ret = input_stream_buffer(is, &error); if (ret < 0) { /* error */ g_warning("%s", error->message); @@ -112,13 +111,11 @@ int main(int argc, char **argv) g_usleep(10000); } - stream_open = true; - /* open the playlist */ - playlist = playlist_list_open_stream(&is, uri); + playlist = playlist_list_open_stream(is, uri); if (playlist == NULL) { - input_stream_close(&is); + input_stream_close(is); g_printerr("Failed to open playlist\n"); return 2; } @@ -145,8 +142,8 @@ int main(int argc, char **argv) /* deinitialize everything */ playlist_plugin_close(playlist); - if (stream_open) - input_stream_close(&is); + if (is != NULL) + input_stream_close(is); playlist_list_global_finish(); input_stream_global_finish(); config_global_finish(); diff --git a/test/read_tags.c b/test/read_tags.c index a16b703f0..8138c187f 100644 --- a/test/read_tags.c +++ b/test/read_tags.c @@ -170,17 +170,17 @@ int main(int argc, char **argv) tag = decoder_plugin_tag_dup(plugin, path); if (tag == NULL && plugin->stream_tag != NULL) { - struct input_stream is; + struct input_stream *is = input_stream_open(path, &error); - if (!input_stream_open(&is, path, &error)) { + if (is == NULL) { g_printerr("Failed to open %s: %s\n", path, error->message); g_error_free(error); return 1; } - tag = decoder_plugin_stream_tag(plugin, &is); - input_stream_close(&is); + tag = decoder_plugin_stream_tag(plugin, is); + input_stream_close(is); } decoder_plugin_deinit_all(); diff --git a/test/run_decoder.c b/test/run_decoder.c index 9ec08af4d..5a41ef8f6 100644 --- a/test/run_decoder.c +++ b/test/run_decoder.c @@ -145,7 +145,6 @@ decoder_tag(G_GNUC_UNUSED struct decoder *decoder, int main(int argc, char **argv) { GError *error = NULL; - bool ret; const char *decoder_name; struct decoder decoder; @@ -179,10 +178,9 @@ int main(int argc, char **argv) decoder_plugin_file_decode(decoder.plugin, &decoder, decoder.uri); } else if (decoder.plugin->stream_decode != NULL) { - struct input_stream is; - - ret = input_stream_open(&is, decoder.uri, &error); - if (!ret) { + struct input_stream *is = + input_stream_open(decoder.uri, &error); + if (is == NULL) { if (error != NULL) { g_warning("%s", error->message); g_error_free(error); @@ -192,9 +190,9 @@ int main(int argc, char **argv) return 1; } - decoder_plugin_stream_decode(decoder.plugin, &decoder, &is); + decoder_plugin_stream_decode(decoder.plugin, &decoder, is); - input_stream_close(&is); + input_stream_close(is); } else { g_printerr("Decoder plugin is not usable\n"); return 1; diff --git a/test/run_input.c b/test/run_input.c index 581b22dca..9a31019dd 100644 --- a/test/run_input.c +++ b/test/run_input.c @@ -103,7 +103,7 @@ dump_input_stream(struct input_stream *is) int main(int argc, char **argv) { GError *error = NULL; - struct input_stream is; + struct input_stream *is; int ret; if (argc != 2) { @@ -133,9 +133,10 @@ int main(int argc, char **argv) /* open the stream and dump it */ - if (input_stream_open(&is, argv[1], &error)) { - ret = dump_input_stream(&is); - input_stream_close(&is); + is = input_stream_open(argv[1], &error); + if (is != NULL) { + ret = dump_input_stream(is); + input_stream_close(is); } else { if (error != NULL) { g_warning("%s", error->message); |