From 27ce02fa9146601ab4a0210cc85c2d5f50b833f4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:03 +0200 Subject: clean up CPP includes Include only headers which are really required. This speeds up compilation and helps detect cross-layer accesses. [ew: minor fixups to not break on new core] --- src/inputPlugins/oggflac_plugin.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/inputPlugins/oggflac_plugin.c') diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 6c5998afe..87444d261 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -27,12 +27,6 @@ #include "../utils.h" #include "../log.h" -#include "../pcm_utils.h" -#include "../inputStream.h" -#include "../outputBuffer.h" -#include "../replayGain.h" -#include "../audio.h" -#include "../os_compat.h" static void oggflac_cleanup(FlacData * data, OggFLAC__SeekableStreamDecoder * decoder) -- cgit v1.2.3 From 5136928aef27ae6e81ef56b7f005e04455d35c2f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Aug 2008 08:27:13 +0200 Subject: oggvorbis: don't detect OGG header if stream is not seekable If the input stream is not seekable, the try_decode() function consumes valuable data, which is not available to the decode() function anymore. This means that the decode() function does not parse the header correctly. Better skip the detection if we cannot seek. Or implement better buffering, something like unread() or buffered rewind(). --- src/inputPlugins/oggflac_plugin.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/inputPlugins/oggflac_plugin.c') diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 87444d261..d3016c9a2 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -327,6 +327,11 @@ static MpdTag *oggflac_TagDup(char *file) static unsigned int oggflac_try_decode(InputStream * inStream) { + if (!inStream->seekable) + /* we cannot seek after the detection, so don't bother + checking */ + return 1; + return (ogg_stream_type_detect(inStream) == FLAC) ? 1 : 0; } -- cgit v1.2.3 From bfd5d4e220bb3570c27e7b84118f17bb610be01c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2008 15:03:09 +0200 Subject: oggflac: fix GCC warnings Fix lots of "unused parameter" warnings in the OggFLAC decoder plugin. Not sure if anybody uses it anymore, since newer libflac obsoletes it. --- src/inputPlugins/oggflac_plugin.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/inputPlugins/oggflac_plugin.c') diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index d3016c9a2..4b3bb0a6b 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -37,7 +37,7 @@ static void oggflac_cleanup(FlacData * data, OggFLAC__seekable_stream_decoder_delete(decoder); } -static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(const +static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder, FLAC__byte buf[], @@ -62,7 +62,7 @@ static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(const return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; } -static OggFLAC__SeekableStreamDecoderSeekStatus of_seek_cb(const +static OggFLAC__SeekableStreamDecoderSeekStatus of_seek_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder, FLAC__uint64 offset, @@ -77,7 +77,7 @@ static OggFLAC__SeekableStreamDecoderSeekStatus of_seek_cb(const return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK; } -static OggFLAC__SeekableStreamDecoderTellStatus of_tell_cb(const +static OggFLAC__SeekableStreamDecoderTellStatus of_tell_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder, FLAC__uint64 * @@ -90,7 +90,7 @@ static OggFLAC__SeekableStreamDecoderTellStatus of_tell_cb(const return OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK; } -static OggFLAC__SeekableStreamDecoderLengthStatus of_length_cb(const +static OggFLAC__SeekableStreamDecoderLengthStatus of_length_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder, FLAC__uint64 * @@ -104,7 +104,7 @@ static OggFLAC__SeekableStreamDecoderLengthStatus of_length_cb(const return OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK; } -static FLAC__bool of_EOF_cb(const OggFLAC__SeekableStreamDecoder * decoder, +static FLAC__bool of_EOF_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder, void *fdata) { FlacData *data = (FlacData *) fdata; @@ -114,7 +114,7 @@ static FLAC__bool of_EOF_cb(const OggFLAC__SeekableStreamDecoder * decoder, return false; } -static void of_error_cb(const OggFLAC__SeekableStreamDecoder * decoder, +static void of_error_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder, FLAC__StreamDecoderErrorStatus status, void *fdata) { flac_error_common_cb("oggflac", status, (FlacData *) fdata); @@ -151,7 +151,7 @@ static void oggflacPrintErroredState(OggFLAC__SeekableStreamDecoderState state) } } -static FLAC__StreamDecoderWriteStatus oggflacWrite(const +static FLAC__StreamDecoderWriteStatus oggflacWrite(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder, const FLAC__Frame * frame, @@ -208,7 +208,7 @@ static FLAC__StreamDecoderWriteStatus oggflacWrite(const } /* used by TagDup */ -static void of_metadata_dup_cb(const OggFLAC__SeekableStreamDecoder * decoder, +static void of_metadata_dup_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder, const FLAC__StreamMetadata * block, void *vdata) { FlacData *data = (FlacData *) vdata; @@ -229,7 +229,7 @@ static void of_metadata_dup_cb(const OggFLAC__SeekableStreamDecoder * decoder, } /* used by decode */ -static void of_metadata_decode_cb(const OggFLAC__SeekableStreamDecoder * dec, +static void of_metadata_decode_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * dec, const FLAC__StreamMetadata * block, void *vdata) { -- cgit v1.2.3