Commit 5a52e913 authored by Max Kellermann's avatar Max Kellermann

decoder/ogg_common: pass decoder to _type_detect()

Allow the function to be cancelled.
parent 18e45815
......@@ -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
......
......@@ -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;
......
......@@ -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 */
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment