From 05cde5810accc64b4f57a106ad41ba46dfd99bbd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 31 Dec 2009 18:20:08 +0100 Subject: decoder: switch a bunch of plugins to stream_tag() This patch changes the following decoder plugins to implement stream_tag() instead of tag_dup(): faad, ffmpeg, mad, modplug, mp4ff, mpcdec, oggflac This simplifies their code, because they do not need to take care of opening/closing the stream. --- src/decoder/ffmpeg_plugin.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/decoder/ffmpeg_plugin.c') diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index 6d856f293..c8be5bcdb 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -426,28 +426,21 @@ static bool ffmpeg_tag_internal(struct ffmpeg_context *ctx) } //no tag reading in ffmpeg, check if playable -static struct tag *ffmpeg_tag(const char *file) +static struct tag * +ffmpeg_stream_tag(struct input_stream *is) { - struct input_stream input; struct ffmpeg_context ctx; bool ret; - if (!input_stream_open(&input, file, NULL)) { - g_warning("failed to open %s\n", file); - return NULL; - } - ctx.decoder = NULL; ctx.tag = tag_new(); - ret = ffmpeg_helper(&input, ffmpeg_tag_internal, &ctx); + ret = ffmpeg_helper(is, ffmpeg_tag_internal, &ctx); if (!ret) { tag_free(ctx.tag); ctx.tag = NULL; } - input_stream_close(&input); - return ctx.tag; } @@ -553,7 +546,7 @@ const struct decoder_plugin ffmpeg_decoder_plugin = { .name = "ffmpeg", .init = ffmpeg_init, .stream_decode = ffmpeg_decode, - .tag_dup = ffmpeg_tag, + .stream_tag = ffmpeg_stream_tag, .suffixes = ffmpeg_suffixes, .mime_types = ffmpeg_mime_types }; -- cgit v1.2.3