diff options
author | Max Kellermann <max@duempel.org> | 2009-12-31 18:20:08 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-12-31 18:32:09 +0100 |
commit | 05cde5810accc64b4f57a106ad41ba46dfd99bbd (patch) | |
tree | 401baa007b179882fe242fb0641f30ccd89a1b3d /src/decoder/ffmpeg_plugin.c | |
parent | 6b96f5d566a6a36bfcdb70c8a27771717eb3d038 (diff) | |
download | mpd-05cde5810accc64b4f57a106ad41ba46dfd99bbd.tar.gz mpd-05cde5810accc64b4f57a106ad41ba46dfd99bbd.tar.xz mpd-05cde5810accc64b4f57a106ad41ba46dfd99bbd.zip |
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.
Diffstat (limited to 'src/decoder/ffmpeg_plugin.c')
-rw-r--r-- | src/decoder/ffmpeg_plugin.c | 15 |
1 files changed, 4 insertions, 11 deletions
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 }; |