aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-23 21:22:29 +0200
committerMax Kellermann <max@duempel.org>2013-10-23 21:58:44 +0200
commitf1027ed198535ce16cfb9c83ac802788ec750488 (patch)
treebc8787407538be55e8bf70d3413644a8a8f4abf4 /src/decoder
parentfe3c5e4e8e3c46d57cb49c2dd6c4c2dc814a797b (diff)
downloadmpd-f1027ed198535ce16cfb9c83ac802788ec750488.tar.gz
mpd-f1027ed198535ce16cfb9c83ac802788ec750488.tar.xz
mpd-f1027ed198535ce16cfb9c83ac802788ec750488.zip
InputStream: add method Rewind()
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/FfmpegDecoderPlugin.cxx14
-rw-r--r--src/decoder/FlacDecoderPlugin.cxx6
-rw-r--r--src/decoder/OpusDecoderPlugin.cxx3
-rw-r--r--src/decoder/VorbisDecoderPlugin.cxx3
4 files changed, 7 insertions, 19 deletions
diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx
index 5092bdf9e..cba7f5e2d 100644
--- a/src/decoder/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/FfmpegDecoderPlugin.cxx
@@ -31,15 +31,6 @@
#include "util/Domain.hxx"
#include "LogV.hxx"
-#include <assert.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@@ -50,6 +41,9 @@ extern "C" {
#include <libavutil/dict.h>
}
+#include <assert.h>
+#include <string.h>
+
static constexpr Domain ffmpeg_domain("ffmpeg");
/* suppress the ffmpeg compatibility macro */
@@ -352,7 +346,7 @@ ffmpeg_probe(Decoder *decoder, struct input_stream *is)
unsigned char buffer[BUFFER_SIZE];
size_t nbytes = decoder_read(decoder, is, buffer, BUFFER_SIZE);
- if (nbytes <= PADDING || !is->LockSeek(0, SEEK_SET, error))
+ if (nbytes <= PADDING || !is->LockRewind(error))
return nullptr;
/* some ffmpeg parsers (e.g. ac3_parser.c) read a few bytes
diff --git a/src/decoder/FlacDecoderPlugin.cxx b/src/decoder/FlacDecoderPlugin.cxx
index 168dfdd19..10a052d3d 100644
--- a/src/decoder/FlacDecoderPlugin.cxx
+++ b/src/decoder/FlacDecoderPlugin.cxx
@@ -29,10 +29,6 @@
#include <glib.h>
#include <assert.h>
-#include <unistd.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
#error libFLAC is too old
@@ -340,7 +336,7 @@ oggflac_decode(Decoder &decoder, struct input_stream *input_stream)
/* rewind the stream, because ogg_codec_detect() has
moved it */
- input_stream->LockSeek(0, SEEK_SET, IgnoreError());
+ input_stream->LockRewind(IgnoreError());
flac_decode_internal(decoder, input_stream, true);
}
diff --git a/src/decoder/OpusDecoderPlugin.cxx b/src/decoder/OpusDecoderPlugin.cxx
index 48267e104..1ef4b5f92 100644
--- a/src/decoder/OpusDecoderPlugin.cxx
+++ b/src/decoder/OpusDecoderPlugin.cxx
@@ -39,7 +39,6 @@
#include <glib.h>
-#include <stdio.h>
#include <string.h>
static const opus_int32 opus_sample_rate = 48000;
@@ -273,7 +272,7 @@ mpd_opus_stream_decode(Decoder &decoder,
/* rewind the stream, because ogg_codec_detect() has
moved it */
- input_stream->LockSeek(0, SEEK_SET, IgnoreError());
+ input_stream->LockRewind(IgnoreError());
MPDOpusDecoder d(decoder, input_stream);
OggSyncState oy(*input_stream, &decoder);
diff --git a/src/decoder/VorbisDecoderPlugin.cxx b/src/decoder/VorbisDecoderPlugin.cxx
index 105ca018e..c1d3566e1 100644
--- a/src/decoder/VorbisDecoderPlugin.cxx
+++ b/src/decoder/VorbisDecoderPlugin.cxx
@@ -50,7 +50,6 @@
#include <assert.h>
#include <errno.h>
-#include <unistd.h>
struct vorbis_input_stream {
Decoder *decoder;
@@ -184,7 +183,7 @@ vorbis_stream_decode(Decoder &decoder,
/* rewind the stream, because ogg_codec_detect() has
moved it */
- input_stream->LockSeek(0, SEEK_SET, IgnoreError());
+ input_stream->LockRewind(IgnoreError());
struct vorbis_input_stream vis;
OggVorbis_File vf;