decoder/ogg_common: pass decoder to _type_detect()
Allow the function to be cancelled.
This commit is contained in:
parent
18e458154a
commit
5a52e91350
@ -433,7 +433,7 @@ oggflac_scan_file(const char *file,
|
|||||||
static void
|
static void
|
||||||
oggflac_decode(struct decoder *decoder, struct input_stream *input_stream)
|
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;
|
return;
|
||||||
|
|
||||||
/* rewind the stream, because ogg_stream_type_detect() has
|
/* rewind the stream, because ogg_stream_type_detect() has
|
||||||
|
@ -25,13 +25,13 @@
|
|||||||
#include "ogg_common.h"
|
#include "ogg_common.h"
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
/* oggflac detection based on code in ogg123 and this post
|
/* oggflac detection based on code in ogg123 and this post
|
||||||
* http://lists.xiph.org/pipermail/flac/2004-December/000393.html
|
* http://lists.xiph.org/pipermail/flac/2004-December/000393.html
|
||||||
* ogg123 trunk still doesn't have this patch as of June 2005 */
|
* ogg123 trunk still doesn't have this patch as of June 2005 */
|
||||||
unsigned char buf[41];
|
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)
|
if (r < sizeof(buf) || memcmp(buf, "OggS", 4) != 0)
|
||||||
return VORBIS;
|
return VORBIS;
|
||||||
|
|
||||||
|
@ -32,6 +32,6 @@ enum ogg_stream_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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 */
|
#endif /* _OGG_COMMON_H */
|
||||||
|
@ -184,7 +184,7 @@ vorbis_stream_decode(struct decoder *decoder,
|
|||||||
const vorbis_info *vi;
|
const vorbis_info *vi;
|
||||||
enum decoder_command cmd = DECODE_COMMAND_NONE;
|
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;
|
return;
|
||||||
|
|
||||||
/* rewind the stream, because ogg_stream_type_detect() has
|
/* rewind the stream, because ogg_stream_type_detect() has
|
||||||
|
Loading…
Reference in New Issue
Block a user