aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/plugins
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-19 22:29:52 +0200
committerMax Kellermann <max@duempel.org>2014-08-19 22:29:52 +0200
commitbb472206dee0adcff09b2efccfb5795101b45705 (patch)
tree6c9e7fd526b71113b3991d57cef7a8c944d713bb /src/decoder/plugins
parentd87cf5146e8c64907a0c3ee6f3f36745163c295c (diff)
downloadmpd-bb472206dee0adcff09b2efccfb5795101b45705.tar.gz
mpd-bb472206dee0adcff09b2efccfb5795101b45705.tar.xz
mpd-bb472206dee0adcff09b2efccfb5795101b45705.zip
InputStream: move typedef offset_type to Offset.hxx
Reduce header dependencies.
Diffstat (limited to 'src/decoder/plugins')
-rw-r--r--src/decoder/plugins/AudiofileDecoderPlugin.cxx2
-rw-r--r--src/decoder/plugins/DsdiffDecoderPlugin.cxx18
-rw-r--r--src/decoder/plugins/DsfDecoderPlugin.cxx4
-rw-r--r--src/decoder/plugins/FlacIOHandle.cxx2
-rw-r--r--src/decoder/plugins/MadDecoderPlugin.cxx10
-rw-r--r--src/decoder/plugins/ModplugDecoderPlugin.cxx2
-rw-r--r--src/decoder/plugins/OggFind.cxx3
-rw-r--r--src/decoder/plugins/OggFind.hxx5
-rw-r--r--src/decoder/plugins/OpusDecoderPlugin.cxx4
-rw-r--r--src/decoder/plugins/PcmDecoderPlugin.cxx4
-rw-r--r--src/decoder/plugins/SndfileDecoderPlugin.cxx2
-rw-r--r--src/decoder/plugins/VorbisDecoderPlugin.cxx2
-rw-r--r--src/decoder/plugins/WavpackDecoderPlugin.cxx2
13 files changed, 31 insertions, 29 deletions
diff --git a/src/decoder/plugins/AudiofileDecoderPlugin.cxx b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
index 5accff034..02f60db34 100644
--- a/src/decoder/plugins/AudiofileDecoderPlugin.cxx
+++ b/src/decoder/plugins/AudiofileDecoderPlugin.cxx
@@ -114,7 +114,7 @@ audiofile_file_seek(AFvirtualfile *vfile, AFfileoffset _offset,
AudioFileInputStream &afis = *(AudioFileInputStream *)vfile->closure;
InputStream &is = afis.is;
- InputStream::offset_type offset = _offset;
+ offset_type offset = _offset;
if (is_relative)
offset += is.GetOffset();
diff --git a/src/decoder/plugins/DsdiffDecoderPlugin.cxx b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
index 4ea2bb97c..3395f9881 100644
--- a/src/decoder/plugins/DsdiffDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsdiffDecoderPlugin.cxx
@@ -110,14 +110,14 @@ dsdiff_read_payload(Decoder *decoder, InputStream &is,
static bool
dsdiff_read_prop_snd(Decoder *decoder, InputStream &is,
DsdiffMetaData *metadata,
- InputStream::offset_type end_offset)
+ offset_type end_offset)
{
DsdiffChunkHeader header;
- while ((InputStream::offset_type)(is.GetOffset() + sizeof(header)) <= end_offset) {
+ while (offset_type(is.GetOffset() + sizeof(header)) <= end_offset) {
if (!dsdiff_read_chunk_header(decoder, is, &header))
return false;
- InputStream::offset_type chunk_end_offset = is.GetOffset()
+ offset_type chunk_end_offset = is.GetOffset()
+ header.GetSize();
if (chunk_end_offset > end_offset)
return false;
@@ -171,7 +171,7 @@ dsdiff_read_prop(Decoder *decoder, InputStream &is,
const DsdiffChunkHeader *prop_header)
{
uint64_t prop_size = prop_header->GetSize();
- InputStream::offset_type end_offset = is.GetOffset() + prop_size;
+ const offset_type end_offset = is.GetOffset() + prop_size;
DsdId prop_id;
if (prop_size < sizeof(prop_id) ||
@@ -188,7 +188,7 @@ dsdiff_read_prop(Decoder *decoder, InputStream &is,
static void
dsdiff_handle_native_tag(InputStream &is,
const struct tag_handler *handler,
- void *handler_ctx, InputStream::offset_type tagoffset,
+ void *handler_ctx, offset_type tagoffset,
TagType type)
{
if (!dsdlib_skip_to(nullptr, is, tagoffset))
@@ -240,12 +240,12 @@ dsdiff_read_metadata_extra(Decoder *decoder, InputStream &is,
return false;
/** offset for artist tag */
- InputStream::offset_type artist_offset = 0;
+ offset_type artist_offset = 0;
/** offset for title tag */
- InputStream::offset_type title_offset = 0;
+ offset_type title_offset = 0;
#ifdef HAVE_ID3TAG
- InputStream::offset_type id3_offset = 0;
+ offset_type id3_offset = 0;
#endif
/* Now process all the remaining chunk headers in the stream
@@ -334,7 +334,7 @@ dsdiff_read_metadata(Decoder *decoder, InputStream &is,
} else {
/* ignore unknown chunk */
const uint64_t chunk_size = chunk_header->GetSize();
- InputStream::offset_type chunk_end_offset =
+ const offset_type chunk_end_offset =
is.GetOffset() + chunk_size;
if (!dsdlib_skip_to(decoder, is, chunk_end_offset))
diff --git a/src/decoder/plugins/DsfDecoderPlugin.cxx b/src/decoder/plugins/DsfDecoderPlugin.cxx
index b510352ee..19687d06d 100644
--- a/src/decoder/plugins/DsfDecoderPlugin.cxx
+++ b/src/decoder/plugins/DsfDecoderPlugin.cxx
@@ -44,7 +44,7 @@ struct DsfMetaData {
bool bitreverse;
uint64_t chunk_size;
#ifdef HAVE_ID3TAG
- InputStream::offset_type id3_offset;
+ offset_type id3_offset;
uint64_t id3_size;
#endif
};
@@ -173,7 +173,7 @@ dsf_read_metadata(Decoder *decoder, InputStream &is,
metadata->channels = (unsigned) dsf_fmt_chunk.channelnum;
metadata->sample_rate = samplefreq;
#ifdef HAVE_ID3TAG
- metadata->id3_offset = (InputStream::offset_type)metadata_offset;
+ metadata->id3_offset = (offset_type)metadata_offset;
#endif
/* check bits per sample format, determine if bitreverse is needed */
metadata->bitreverse = dsf_fmt_chunk.bitssample == 1;
diff --git a/src/decoder/plugins/FlacIOHandle.cxx b/src/decoder/plugins/FlacIOHandle.cxx
index d37cea532..0dd895798 100644
--- a/src/decoder/plugins/FlacIOHandle.cxx
+++ b/src/decoder/plugins/FlacIOHandle.cxx
@@ -67,7 +67,7 @@ FlacIOSeek(FLAC__IOHandle handle, FLAC__int64 _offset, int whence)
{
InputStream *is = (InputStream *)handle;
- InputStream::offset_type offset = _offset;
+ offset_type offset = _offset;
switch (whence) {
case SEEK_SET:
break;
diff --git a/src/decoder/plugins/MadDecoderPlugin.cxx b/src/decoder/plugins/MadDecoderPlugin.cxx
index e38fe3f29..0ab9ab8a4 100644
--- a/src/decoder/plugins/MadDecoderPlugin.cxx
+++ b/src/decoder/plugins/MadDecoderPlugin.cxx
@@ -153,10 +153,10 @@ struct MadDecoder {
enum mp3_action DecodeNextFrame();
gcc_pure
- InputStream::offset_type ThisFrameOffset() const;
+ offset_type ThisFrameOffset() const;
gcc_pure
- InputStream::offset_type RestIncludingThisFrame() const;
+ offset_type RestIncludingThisFrame() const;
/**
* Attempt to calulcate the length of the song from filesize
@@ -747,7 +747,7 @@ mp3_frame_duration(const struct mad_frame *frame)
MAD_UNITS_MILLISECONDS) / 1000.0;
}
-inline InputStream::offset_type
+inline offset_type
MadDecoder::ThisFrameOffset() const
{
auto offset = input_stream.GetOffset();
@@ -760,7 +760,7 @@ MadDecoder::ThisFrameOffset() const
return offset;
}
-inline InputStream::offset_type
+inline offset_type
MadDecoder::RestIncludingThisFrame() const
{
return input_stream.GetSize() - ThisFrameOffset();
@@ -770,7 +770,7 @@ inline void
MadDecoder::FileSizeToSongLength()
{
if (input_stream.KnownSize()) {
- InputStream::offset_type rest = RestIncludingThisFrame();
+ offset_type rest = RestIncludingThisFrame();
float frame_duration = mp3_frame_duration(&frame);
diff --git a/src/decoder/plugins/ModplugDecoderPlugin.cxx b/src/decoder/plugins/ModplugDecoderPlugin.cxx
index e76737345..110955367 100644
--- a/src/decoder/plugins/ModplugDecoderPlugin.cxx
+++ b/src/decoder/plugins/ModplugDecoderPlugin.cxx
@@ -36,7 +36,7 @@ static constexpr Domain modplug_domain("modplug");
static constexpr size_t MODPLUG_FRAME_SIZE = 4096;
static constexpr size_t MODPLUG_PREALLOC_BLOCK = 256 * 1024;
-static constexpr InputStream::offset_type MODPLUG_FILE_LIMIT = 100 * 1024 * 1024;
+static constexpr offset_type MODPLUG_FILE_LIMIT = 100 * 1024 * 1024;
static int modplug_loop_count;
diff --git a/src/decoder/plugins/OggFind.cxx b/src/decoder/plugins/OggFind.cxx
index 15e9c5c92..978e1d7cf 100644
--- a/src/decoder/plugins/OggFind.cxx
+++ b/src/decoder/plugins/OggFind.cxx
@@ -20,6 +20,7 @@
#include "config.h"
#include "OggFind.hxx"
#include "OggSyncState.hxx"
+#include "input/InputStream.hxx"
#include "util/Error.hxx"
bool
@@ -39,7 +40,7 @@ OggFindEOS(OggSyncState &oy, ogg_stream_state &os, ogg_packet &packet)
bool
OggSeekPageAtOffset(OggSyncState &oy, ogg_stream_state &os, InputStream &is,
- InputStream::offset_type offset)
+ offset_type offset)
{
oy.Reset();
diff --git a/src/decoder/plugins/OggFind.hxx b/src/decoder/plugins/OggFind.hxx
index 8ced7fd86..2aa4f6c06 100644
--- a/src/decoder/plugins/OggFind.hxx
+++ b/src/decoder/plugins/OggFind.hxx
@@ -21,11 +21,12 @@
#define MPD_OGG_FIND_HXX
#include "check.h"
-#include "input/InputStream.hxx"
+#include "input/Offset.hxx"
#include <ogg/ogg.h>
class OggSyncState;
+class InputStream;
/**
* Skip all pages/packets until an end-of-stream (EOS) packet for the
@@ -41,7 +42,7 @@ OggFindEOS(OggSyncState &oy, ogg_stream_state &os, ogg_packet &packet);
*/
bool
OggSeekPageAtOffset(OggSyncState &oy, ogg_stream_state &os, InputStream &is,
- InputStream::offset_type offset);
+ offset_type offset);
/**
* Try to find the end-of-stream (EOS) packet. Seek to the end of the
diff --git a/src/decoder/plugins/OpusDecoderPlugin.cxx b/src/decoder/plugins/OpusDecoderPlugin.cxx
index 2ea8e0497..d41c212f9 100644
--- a/src/decoder/plugins/OpusDecoderPlugin.cxx
+++ b/src/decoder/plugins/OpusDecoderPlugin.cxx
@@ -339,8 +339,8 @@ MPDOpusDecoder::Seek(OggSyncState &oy, double where_s)
/* interpolate the file offset where we expect to find the
given granule position */
/* TODO: implement binary search */
- InputStream::offset_type offset(where_granulepos * input_stream.GetSize()
- / eos_granulepos);
+ offset_type offset(where_granulepos * input_stream.GetSize()
+ / eos_granulepos);
if (!OggSeekPageAtOffset(oy, os, input_stream, offset))
return false;
diff --git a/src/decoder/plugins/PcmDecoderPlugin.cxx b/src/decoder/plugins/PcmDecoderPlugin.cxx
index da8287464..f8e02500b 100644
--- a/src/decoder/plugins/PcmDecoderPlugin.cxx
+++ b/src/decoder/plugins/PcmDecoderPlugin.cxx
@@ -70,8 +70,8 @@ pcm_stream_decode(Decoder &decoder, InputStream &is)
buffer, nbytes, 0)
: decoder_get_command(decoder);
if (cmd == DecoderCommand::SEEK) {
- InputStream::offset_type offset(time_to_size *
- decoder_seek_where(decoder));
+ offset_type offset(time_to_size *
+ decoder_seek_where(decoder));
Error error;
if (is.LockSeek(offset, error)) {
diff --git a/src/decoder/plugins/SndfileDecoderPlugin.cxx b/src/decoder/plugins/SndfileDecoderPlugin.cxx
index 5aad2f16c..1e84d8be5 100644
--- a/src/decoder/plugins/SndfileDecoderPlugin.cxx
+++ b/src/decoder/plugins/SndfileDecoderPlugin.cxx
@@ -70,7 +70,7 @@ sndfile_vio_seek(sf_count_t _offset, int whence, void *user_data)
SndfileInputStream &sis = *(SndfileInputStream *)user_data;
InputStream &is = sis.is;
- InputStream::offset_type offset = _offset;
+ offset_type offset = _offset;
switch (whence) {
case SEEK_SET:
break;
diff --git a/src/decoder/plugins/VorbisDecoderPlugin.cxx b/src/decoder/plugins/VorbisDecoderPlugin.cxx
index 72542e3a2..64a744d25 100644
--- a/src/decoder/plugins/VorbisDecoderPlugin.cxx
+++ b/src/decoder/plugins/VorbisDecoderPlugin.cxx
@@ -80,7 +80,7 @@ static int ogg_seek_cb(void *data, ogg_int64_t _offset, int whence)
decoder_get_command(*vis->decoder) == DecoderCommand::STOP))
return -1;
- InputStream::offset_type offset = _offset;
+ offset_type offset = _offset;
switch (whence) {
case SEEK_SET:
break;
diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx
index 88fa2af56..248034350 100644
--- a/src/decoder/plugins/WavpackDecoderPlugin.cxx
+++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx
@@ -405,7 +405,7 @@ wavpack_input_set_pos_rel(void *id, int32_t delta, int mode)
WavpackInput &wpi = *wpin(id);
InputStream &is = wpi.is;
- InputStream::offset_type offset = delta;
+ offset_type offset = delta;
switch (mode) {
case SEEK_SET:
break;