aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/oggflac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-31 18:20:08 +0100
committerMax Kellermann <max@duempel.org>2009-12-31 18:32:09 +0100
commit05cde5810accc64b4f57a106ad41ba46dfd99bbd (patch)
tree401baa007b179882fe242fb0641f30ccd89a1b3d /src/decoder/oggflac_plugin.c
parent6b96f5d566a6a36bfcdb70c8a27771717eb3d038 (diff)
downloadmpd-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 '')
-rw-r--r--src/decoder/oggflac_plugin.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c
index b8b087b47..6aa9818f1 100644
--- a/src/decoder/oggflac_plugin.c
+++ b/src/decoder/oggflac_plugin.c
@@ -243,33 +243,20 @@ fail:
/* public functions: */
static struct tag *
-oggflac_tag_dup(const char *file)
+oggflac_stream_tag(struct input_stream *is)
{
- GError *error = NULL;
- struct input_stream input_stream;
OggFLAC__SeekableStreamDecoder *decoder;
struct flac_data data;
struct tag *tag;
- if (!input_stream_open(&input_stream, file, &error)) {
- if (error != NULL) {
- g_warning("%s", error->message);
- g_error_free(error);
- }
-
- return NULL;
- }
-
- if (ogg_stream_type_detect(&input_stream) != FLAC) {
- input_stream_close(&input_stream);
+ if (ogg_stream_type_detect(is) != FLAC)
return NULL;
- }
/* rewind the stream, because ogg_stream_type_detect() has
moved it */
- input_stream_seek(&input_stream, 0, SEEK_SET, NULL);
+ input_stream_seek(is, 0, SEEK_SET, NULL);
- flac_data_init(&data, NULL, &input_stream);
+ flac_data_init(&data, NULL, is);
data.tag = tag_new();
@@ -278,7 +265,6 @@ oggflac_tag_dup(const char *file)
decoder = full_decoder_init_and_read_metadata(&data, 1);
oggflac_cleanup(decoder);
- input_stream_close(&input_stream);
if (tag_is_defined(data.tag)) {
tag = data.tag;
@@ -362,7 +348,7 @@ static const char *const oggflac_mime_types[] = {
const struct decoder_plugin oggflac_decoder_plugin = {
.name = "oggflac",
.stream_decode = oggflac_decode,
- .tag_dup = oggflac_tag_dup,
+ .stream_tag = oggflac_stream_tag,
.suffixes = oggflac_suffixes,
.mime_types = oggflac_mime_types
};