aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
-rw-r--r--src/input/InputStream.hxx3
-rw-r--r--src/input/Offset.hxx32
15 files changed, 65 insertions, 30 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;
diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx
index 19cf0a2de..15c350103 100644
--- a/src/input/InputStream.hxx
+++ b/src/input/InputStream.hxx
@@ -21,6 +21,7 @@
#define MPD_INPUT_STREAM_HXX
#include "check.h"
+#include "Offset.hxx"
#include "thread/Mutex.hxx"
#include "Compiler.h"
@@ -35,7 +36,7 @@ struct Tag;
class InputStream {
public:
- typedef uint64_t offset_type;
+ typedef ::offset_type offset_type;
private:
/**
diff --git a/src/input/Offset.hxx b/src/input/Offset.hxx
new file mode 100644
index 000000000..552397904
--- /dev/null
+++ b/src/input/Offset.hxx
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPD_OFFSET_HXX
+#define MPD_OFFSET_HXX
+
+#include "check.h"
+
+#include <stdint.h>
+
+/**
+ * A type for absolute offsets in a file.
+ */
+typedef uint64_t offset_type;
+
+#endif