diff options
author | Max Kellermann <max@duempel.org> | 2009-12-30 23:27:37 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-01-01 17:25:07 +0100 |
commit | d3b763a48c09a60a0c0b5ccb6cccd9376875c470 (patch) | |
tree | 83b8794f78ef8941806cf5757888d8abf2eaa126 /test/run_decoder.c | |
parent | 816b6ad4a71c3ade95e62b62396f2b0415c03f20 (diff) | |
download | mpd-d3b763a48c09a60a0c0b5ccb6cccd9376875c470.tar.gz mpd-d3b763a48c09a60a0c0b5ccb6cccd9376875c470.tar.xz mpd-d3b763a48c09a60a0c0b5ccb6cccd9376875c470.zip |
input_stream: return allocated input_stream objects
Major API redesign: don't let the caller allocate the input_stream
object. Let each input plugin allocate its own (derived/extended)
input_stream pointer. The "data" attribute can now be removed, and
all input plugins simply cast the input_stream pointer to their own
structure (with an "struct input_stream base" as the first attribute).
Diffstat (limited to 'test/run_decoder.c')
-rw-r--r-- | test/run_decoder.c | 12 |
1 files changed, 5 insertions, 7 deletions
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; |