diff options
author | Max Kellermann <max@duempel.org> | 2012-09-04 12:49:02 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-09-04 12:49:02 +0200 |
commit | 5a52e9135087e1e28ef7f5a4e5282fec439fe866 (patch) | |
tree | c4d5f4ca39652594fef5111ceca9cb8cdd0b6e4b | |
parent | 18e458154a25d41b2b18862d18f417e6e8e74d6b (diff) | |
download | mpd-5a52e9135087e1e28ef7f5a4e5282fec439fe866.tar.gz mpd-5a52e9135087e1e28ef7f5a4e5282fec439fe866.tar.xz mpd-5a52e9135087e1e28ef7f5a4e5282fec439fe866.zip |
decoder/ogg_common: pass decoder to _type_detect()
Allow the function to be cancelled.
-rw-r--r-- | src/decoder/flac_decoder_plugin.c | 2 | ||||
-rw-r--r-- | src/decoder/ogg_common.c | 4 | ||||
-rw-r--r-- | src/decoder/ogg_common.h | 2 | ||||
-rw-r--r-- | src/decoder/vorbis_decoder_plugin.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/decoder/flac_decoder_plugin.c b/src/decoder/flac_decoder_plugin.c index 818f75904..8103a8faf 100644 --- a/src/decoder/flac_decoder_plugin.c +++ b/src/decoder/flac_decoder_plugin.c @@ -433,7 +433,7 @@ oggflac_scan_file(const char *file, static void oggflac_decode(struct decoder *decoder, struct input_stream *input_stream) { - if (ogg_stream_type_detect(input_stream) != FLAC) + if (ogg_stream_type_detect(decoder, input_stream) != FLAC) return; /* rewind the stream, because ogg_stream_type_detect() has diff --git a/src/decoder/ogg_common.c b/src/decoder/ogg_common.c index ba1a8edea..f63bc094b 100644 --- a/src/decoder/ogg_common.c +++ b/src/decoder/ogg_common.c @@ -25,13 +25,13 @@ #include "ogg_common.h" enum ogg_stream_type -ogg_stream_type_detect(struct input_stream *is) +ogg_stream_type_detect(struct decoder *decoder, struct input_stream *is) { /* oggflac detection based on code in ogg123 and this post * http://lists.xiph.org/pipermail/flac/2004-December/000393.html * ogg123 trunk still doesn't have this patch as of June 2005 */ unsigned char buf[41]; - size_t r = decoder_read(NULL, is, buf, sizeof(buf)); + size_t r = decoder_read(decoder, is, buf, sizeof(buf)); if (r < sizeof(buf) || memcmp(buf, "OggS", 4) != 0) return VORBIS; diff --git a/src/decoder/ogg_common.h b/src/decoder/ogg_common.h index 26414e96e..b3c8de238 100644 --- a/src/decoder/ogg_common.h +++ b/src/decoder/ogg_common.h @@ -32,6 +32,6 @@ enum ogg_stream_type { }; enum ogg_stream_type -ogg_stream_type_detect(struct input_stream *is); +ogg_stream_type_detect(struct decoder *decoder, struct input_stream *is); #endif /* _OGG_COMMON_H */ diff --git a/src/decoder/vorbis_decoder_plugin.c b/src/decoder/vorbis_decoder_plugin.c index 40594faad..e59f7a87f 100644 --- a/src/decoder/vorbis_decoder_plugin.c +++ b/src/decoder/vorbis_decoder_plugin.c @@ -184,7 +184,7 @@ vorbis_stream_decode(struct decoder *decoder, const vorbis_info *vi; enum decoder_command cmd = DECODE_COMMAND_NONE; - if (ogg_stream_type_detect(input_stream) != VORBIS) + if (ogg_stream_type_detect(decoder, input_stream) != VORBIS) return; /* rewind the stream, because ogg_stream_type_detect() has |