summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-08-27 10:53:25 +0900
committerMichele Calgaro <[email protected]>2021-08-27 10:53:25 +0900
commit30b73db1c0a028e6b179dd749ef7e7162b50d806 (patch)
tree9262e8e3d3e874283154496d70e9b30f95f4f3fb
parentd4affcc0cbde9d77ce6bea6029715414c37618a4 (diff)
downloadakode-30b73db1c0a028e6b179dd749ef7e7162b50d806.tar.gz
akode-30b73db1c0a028e6b179dd749ef7e7162b50d806.zip
Rename File::seek() to File::lseek() and related derived methods and calls.
Signed-off-by: Michele Calgaro <[email protected]>
-rw-r--r--akode/lib/file.h2
-rw-r--r--akode/lib/localfile.cpp8
-rw-r--r--akode/lib/localfile.h2
-rw-r--r--akode/lib/magic.cpp10
-rw-r--r--akode/lib/mmapfile.cpp2
-rw-r--r--akode/lib/mmapfile.h2
-rw-r--r--akode/lib/wav_decoder.cpp16
-rw-r--r--akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp2
-rw-r--r--akode/plugins/mpc_decoder/mpc_decoder.cpp2
-rw-r--r--akode/plugins/mpeg_decoder/mpeg_decoder.cpp12
-rw-r--r--akode/plugins/xiph_decoder/flac113_decoder.cpp8
-rw-r--r--akode/plugins/xiph_decoder/speex_decoder.cpp2
-rw-r--r--akode/plugins/xiph_decoder/vorbis_decoder.cpp2
13 files changed, 35 insertions, 35 deletions
diff --git a/akode/lib/file.h b/akode/lib/file.h
index 3685bcc..ced8795 100644
--- a/akode/lib/file.h
+++ b/akode/lib/file.h
@@ -76,7 +76,7 @@ public:
* Seeks to the position.
* Behaves semantically as lseek.
*/
- virtual ssize_t seek(long to, int whence = SEEK_SET) = 0;
+ virtual ssize_t lseek(long to, int whence = SEEK_SET) = 0;
/*!
* Returns current position in file, or negative if unknown.
*/
diff --git a/akode/lib/localfile.cpp b/akode/lib/localfile.cpp
index 35ce2f3..7c89df0 100644
--- a/akode/lib/localfile.cpp
+++ b/akode/lib/localfile.cpp
@@ -53,7 +53,7 @@ LocalFile::~LocalFile() {
bool LocalFile::openRO() {
if(_fd != -1) {
- return seek(0) && m_readable;
+ return lseek(0) && m_readable;
}
struct stat stat;
@@ -69,7 +69,7 @@ bool LocalFile::openRO() {
bool LocalFile::openRW() {
if(_fd != -1) {
- return seek(0) && m_readable && m_writeable;
+ return lseek(0) && m_readable && m_writeable;
}
struct stat stat;
@@ -84,7 +84,7 @@ bool LocalFile::openRW() {
bool LocalFile::openWO() {
if(_fd != -1) {
- return seek(0) && m_writeable;
+ return lseek(0) && m_writeable;
}
_fd = ::open(filename, O_WRONLY);
@@ -115,7 +115,7 @@ long LocalFile::write(const char* ptr, long num) {
return n;
}
-ssize_t LocalFile::seek(long to, int whence) {
+ssize_t LocalFile::lseek(long to, int whence) {
if(_fd == -1) return -1;
ssize_t s = ::lseek(_fd, to, whence);
if (s >= 0) pos = s;
diff --git a/akode/lib/localfile.h b/akode/lib/localfile.h
index 9003e43..e105eca 100644
--- a/akode/lib/localfile.h
+++ b/akode/lib/localfile.h
@@ -50,7 +50,7 @@ public:
long read(char* ptr, long num);
long write(const char* ptr, long num);
- ssize_t seek(long to, int whence = SEEK_SET);
+ ssize_t lseek(long to, int whence = SEEK_SET);
long position() const;
long length() const;
diff --git a/akode/lib/magic.cpp b/akode/lib/magic.cpp
index c16ba3e..155d06a 100644
--- a/akode/lib/magic.cpp
+++ b/akode/lib/magic.cpp
@@ -74,7 +74,7 @@ namespace aKode {
Format* detectOgg(File *src, int skip) {
Format *res = 0;
char oggmagic[7];
- src->seek(skip+28);
+ src->lseek(skip+28);
src->read(oggmagic, 7);
for (OggMagic *i = ogg_magic; i->len >0; i++) {
@@ -88,11 +88,11 @@ namespace aKode {
string detectRIFF(File *src, int skip) {
string res;
char riffmagic[4];
- src->seek(skip+8);
+ src->lseek(skip+8);
src->read(riffmagic, 4);
if (memcmp(riffmagic, "WAVE",4) == 0) {
char wavmagic[2];
- src->seek(skip+20);
+ src->lseek(skip+20);
src->read(wavmagic, 2);
if (wavmagic[0] == 1)
res = "wav";
@@ -109,7 +109,7 @@ namespace aKode {
string detectMPEG(File *src, int skip) {
string res;
unsigned char mpegheader[2];
- src->seek(skip);
+ src->lseek(skip);
src->read((char*)mpegheader, 2);
if (mpegheader[0] == 0xff && (mpegheader[1] & 0xe0) == 0xe0) // frame synchronizer
@@ -144,7 +144,7 @@ namespace aKode {
int skip = detectID3v2(src);
char magic[4];
- src->seek(skip);
+ src->lseek(skip);
src->read(magic, 4);
if (memcmp(magic, "fLaC", 4) == 0)
diff --git a/akode/lib/mmapfile.cpp b/akode/lib/mmapfile.cpp
index ec45f98..d79192b 100644
--- a/akode/lib/mmapfile.cpp
+++ b/akode/lib/mmapfile.cpp
@@ -94,7 +94,7 @@ long MMapFile::write(const char*, long) {
return false;
}
-ssize_t MMapFile::seek(long to, int whence) {
+ssize_t MMapFile::lseek(long to, int whence) {
if(!handle) return false;
long newpos = 0;
diff --git a/akode/lib/mmapfile.h b/akode/lib/mmapfile.h
index c2de99f..e41acb6 100644
--- a/akode/lib/mmapfile.h
+++ b/akode/lib/mmapfile.h
@@ -47,7 +47,7 @@ public:
long read(char* ptr, long num);
long write(const char*, long);
- ssize_t seek(long to, int whence = SEEK_SET);
+ ssize_t lseek(long to, int whence = SEEK_SET);
long position() const;
long length() const;
diff --git a/akode/lib/wav_decoder.cpp b/akode/lib/wav_decoder.cpp
index 73f663c..c8895cb 100644
--- a/akode/lib/wav_decoder.cpp
+++ b/akode/lib/wav_decoder.cpp
@@ -34,9 +34,9 @@ bool WavDecoderPlugin::canDecode(File* src) {
bool res = false;
src->openRO();
if (src->read(header, 4) != 4 || memcmp(header, "RIFF",4) != 0 ) goto close;
- src->seek(8);
+ src->lseek(8);
if (src->read(header, 4) != 4 || memcmp(header, "WAVE",4) != 0 ) goto close;
- src->seek(20);
+ src->lseek(20);
if (src->read(header, 2) != 2 || memcmp(header, "\x01\0",2) != 0 ) goto close;
res = true;
close:
@@ -77,11 +77,11 @@ bool WavDecoder::openFile(File* src) {
// Get format information
unsigned char buffer[4];
- src->seek(4);
+ src->lseek(4);
src->read((char*)buffer, 4); // size of stream
d->length = buffer[0] + buffer[1]*256 + buffer[2] * (1<<16) + buffer[3] * (1<<24) + 8;
- src->seek(16);
+ src->lseek(16);
src->read((char*)buffer, 4); // should really be 16
d->pos = 20 + buffer[0] + buffer[1]*256;
if (buffer[2] != 0 || buffer[3] != 0) goto invalid;
@@ -99,7 +99,7 @@ bool WavDecoder::openFile(File* src) {
src->read((char*)buffer, 4);
d->config.sample_rate = buffer[0] + buffer[1]*256 + buffer[2] * (1<<16) + buffer[3] * (1<<24);
- src->seek(34);
+ src->lseek(34);
src->read((char*)buffer, 2);
d->config.sample_width = buffer[0] + buffer[1]*256;
@@ -108,7 +108,7 @@ bool WavDecoder::openFile(File* src) {
if (d->config.sample_rate > 200000) goto invalid;
find_data:
- src->seek(d->pos);
+ src->lseek(d->pos);
src->read((char*)buffer, 4);
if (memcmp(buffer, "data", 4) != 0)
if (memcmp(buffer, "clm ", 4) != 0)
@@ -119,7 +119,7 @@ find_data:
goto find_data;
}
- src->seek(d->pos+8); // start of data
+ src->lseek(d->pos+8); // start of data
d->position = 0;
d->valid = true;
// 1024 samples:
@@ -219,7 +219,7 @@ bool WavDecoder::seek(long pos) {
long sample_pos = (pos * byterate) / 1000;
long byte_pos = sample_pos * samplesize;
if (byte_pos+44 >= d->length) return false;
- if (!d->src->seek(byte_pos+44)) return false;
+ if (!d->src->lseek(byte_pos+44)) return false;
d->pos = byte_pos + 44;
return true;
}
diff --git a/akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp b/akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp
index 43f5a35..4d347c4 100644
--- a/akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp
+++ b/akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp
@@ -58,7 +58,7 @@ extern "C" {
static off_t akode_seek(void* opaque, off_t pos, int whence)
{
aKode::File *file = (aKode::File*)opaque;
- return file->seek(pos, whence);
+ return file->lseek(pos, whence);
}
}
diff --git a/akode/plugins/mpc_decoder/mpc_decoder.cpp b/akode/plugins/mpc_decoder/mpc_decoder.cpp
index a355ff4..cf314b9 100644
--- a/akode/plugins/mpc_decoder/mpc_decoder.cpp
+++ b/akode/plugins/mpc_decoder/mpc_decoder.cpp
@@ -48,7 +48,7 @@ public:
m_file->close();
}
size_t read ( void *ptr, size_t size ) {return m_file->read((char*)ptr,size);}
- bool seek ( int offset, int origin ) {return m_file->seek(offset,origin);}
+ bool seek ( int offset, int origin ) {return m_file->lseek(offset,origin);}
long tell () {return m_file->position();}
long get_size () {return m_file->length();}
bool canseek() {return m_file->seekable();}
diff --git a/akode/plugins/mpeg_decoder/mpeg_decoder.cpp b/akode/plugins/mpeg_decoder/mpeg_decoder.cpp
index 33466fa..715fcfa 100644
--- a/akode/plugins/mpeg_decoder/mpeg_decoder.cpp
+++ b/akode/plugins/mpeg_decoder/mpeg_decoder.cpp
@@ -52,7 +52,7 @@ bool MPEGDecoderPlugin::canDecode(File* src) {
size += buf[4] << 7;
size += buf[3] << 14;
size += buf[2] << 21;
- src->seek(10+size);
+ src->lseek(10+size);
src->read(header, 4);
}
if (buf[0] == 0xff && (buf[1] & 14)) // frame synchronizer
@@ -142,7 +142,7 @@ MPEGDecoder::~MPEGDecoder() {
}
bool MPEGDecoder::skipID3v2() {
- m_data->src->seek(0);
+ m_data->src->lseek(0);
m_data->id3v2size = 0;
char buf[16];
if (m_data->src->read(buf, 10)) {
@@ -158,7 +158,7 @@ bool MPEGDecoder::skipID3v2() {
size += buf[7] << 14;
size += buf[6] << 21;
m_data->id3v2size = size;
- if (!m_data->src->seek(10+size)) {
+ if (!m_data->src->lseek(10+size)) {
char space[256];
for(int i=0; i<size; ) {
i += m_data->src->read(space, (size-i) > 256 ? 256 : (size-i));
@@ -167,7 +167,7 @@ bool MPEGDecoder::skipID3v2() {
return true;
}
}
- if (!m_data->src->seek(0)) {
+ if (!m_data->src->lseek(0)) {
mad_stream_buffer(&m_data->stream, (uint8_t*)buf, 10);
}
return false;
@@ -542,7 +542,7 @@ bool MPEGDecoder::seek(long pos) {
#ifdef MPEG_DEBUG
cerr << "TOC seeking " << procent << "/100 -> " << (long)(place*256.0) << "/256\n" ;
#endif
- res = m_data->src->seek(bpos);
+ res = m_data->src->lseek(bpos);
if (res)
m_data->position = (long)(((float)procent/100.0)*mpeg_length(m_data)*m_data->config.sample_rate);
}
@@ -552,7 +552,7 @@ bool MPEGDecoder::seek(long pos) {
#endif
long bpos = (long)((((float)pos)*m_data->bitrate)/8000.0);
bpos += m_data->id3v2size;
- res = m_data->src->seek(bpos);
+ res = m_data->src->lseek(bpos);
if (res)
m_data->position = (long)(((float)pos*(float)m_data->config.sample_rate)/1000.0);
}
diff --git a/akode/plugins/xiph_decoder/flac113_decoder.cpp b/akode/plugins/xiph_decoder/flac113_decoder.cpp
index 02a6ccc..df4f393 100644
--- a/akode/plugins/xiph_decoder/flac113_decoder.cpp
+++ b/akode/plugins/xiph_decoder/flac113_decoder.cpp
@@ -41,7 +41,7 @@ class FLACDecoder;
static bool checkFLAC(File *src) {
char header[6];
bool res = false;
- src->seek(0);
+ src->lseek(0);
if(src->read(header, 4) == 4) {
// skip id3v2 headers
if (memcmp(header, "ID3", 3) == 0) {
@@ -52,7 +52,7 @@ static bool checkFLAC(File *src) {
size += header[4] << 7;
size += header[3] << 14;
size += header[2] << 21;
- src->seek(10+size);
+ src->lseek(10+size);
if (src->read(header, 4) != 4) goto end;
}
if (memcmp(header, "fLaC",4) == 0 ) res = true;
@@ -64,7 +64,7 @@ end:
static bool checkOggFLAC(File *src) {
char header[34];
bool res = false;
- src->seek(0);
+ src->lseek(0);
if (src->read(header, 34) == 34)
if (memcmp(header, "OggS",4) == 0 )
// old FLAC 1.1.0 format
@@ -134,7 +134,7 @@ static FLAC__StreamDecoderSeekStatus flac_seek_callback(
{
FLACDecoder::private_data *data = (FLACDecoder::private_data*)client_data;
- if(data->source->seek(absolute_byte_offset))
+ if(data->source->lseek(absolute_byte_offset))
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
else
return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
diff --git a/akode/plugins/xiph_decoder/speex_decoder.cpp b/akode/plugins/xiph_decoder/speex_decoder.cpp
index 495c323..5fc2e4f 100644
--- a/akode/plugins/xiph_decoder/speex_decoder.cpp
+++ b/akode/plugins/xiph_decoder/speex_decoder.cpp
@@ -327,7 +327,7 @@ bool SpeexDecoder::seek(long pos) {
if(!m_data->initialized) return false;
long bpos = (long)(((float)pos*(float)m_data->bitrate)/8000.0);
- if (m_data->src->seek(bpos)) {
+ if (m_data->src->lseek(bpos)) {
speex_bits_reset(&m_data->bits);
ogg_sync_reset(&m_data->sync);
ogg_stream_reset(&m_data->stream);
diff --git a/akode/plugins/xiph_decoder/vorbis_decoder.cpp b/akode/plugins/xiph_decoder/vorbis_decoder.cpp
index 44329d0..f4b0d28 100644
--- a/akode/plugins/xiph_decoder/vorbis_decoder.cpp
+++ b/akode/plugins/xiph_decoder/vorbis_decoder.cpp
@@ -39,7 +39,7 @@ static size_t _read(void *ptr, size_t size, size_t nmemb, void *datasource) {
static int _seek(void *datasource, ogg_int64_t offset, int whence) {
File *src = (File*)datasource;
- if (src->seek(offset, whence))
+ if (src->lseek(offset, whence))
return 0;
else
return -1;