summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-11-16 14:04:54 -0800
committerJames Dong <jdong@google.com>2010-11-18 14:12:24 -0800
commitb1262a8b1dd23abad64465f9ffd25c44facdf4d2 (patch)
treecd19da06f0cc2c92ec35e1086d126c3546cc5584
parent83ed1ae073556f4971bf8f3a5cbcd2d37e1dd2bb (diff)
downloadframeworks_base-b1262a8b1dd23abad64465f9ffd25c44facdf4d2.zip
frameworks_base-b1262a8b1dd23abad64465f9ffd25c44facdf4d2.tar.gz
frameworks_base-b1262a8b1dd23abad64465f9ffd25c44facdf4d2.tar.bz2
64-bit file size/offset support for media framework
Change-Id: I3452bc2c0f1d990cc67285df2fce1f9f86ff8e10
-rw-r--r--include/media/stagefright/AMRWriter.h1
-rw-r--r--include/media/stagefright/DataSource.h6
-rw-r--r--include/media/stagefright/FileSource.h6
-rw-r--r--include/media/stagefright/JPEGSource.h4
-rw-r--r--include/media/stagefright/MPEG4Writer.h15
-rw-r--r--media/libstagefright/AMRExtractor.cpp6
-rw-r--r--media/libstagefright/AMRWriter.cpp12
-rw-r--r--media/libstagefright/AwesomePlayer.cpp2
-rw-r--r--media/libstagefright/DataSource.cpp4
-rw-r--r--media/libstagefright/FileSource.cpp17
-rw-r--r--media/libstagefright/JPEGSource.cpp2
-rw-r--r--media/libstagefright/MP3Extractor.cpp30
-rw-r--r--media/libstagefright/MPEG4Extractor.cpp56
-rw-r--r--media/libstagefright/MPEG4Writer.cpp87
-rw-r--r--media/libstagefright/NuCachedSource2.cpp18
-rw-r--r--media/libstagefright/NuHTTPDataSource.cpp16
-rw-r--r--media/libstagefright/OggExtractor.cpp32
-rw-r--r--media/libstagefright/SampleIterator.cpp2
-rw-r--r--media/libstagefright/SampleTable.cpp12
-rw-r--r--media/libstagefright/StagefrightMediaScanner.cpp4
-rw-r--r--media/libstagefright/ThrottledSource.cpp4
-rw-r--r--media/libstagefright/VBRISeeker.cpp8
-rw-r--r--media/libstagefright/WAVExtractor.cpp12
-rw-r--r--media/libstagefright/XINGSeeker.cpp8
-rw-r--r--media/libstagefright/httplive/LiveSource.cpp8
-rw-r--r--media/libstagefright/id3/ID3.cpp4
-rw-r--r--media/libstagefright/include/LiveSource.h6
-rw-r--r--media/libstagefright/include/MP3Extractor.h2
-rw-r--r--media/libstagefright/include/MP3Seeker.h2
-rw-r--r--media/libstagefright/include/MPEG2TSExtractor.h2
-rw-r--r--media/libstagefright/include/MPEG4Extractor.h8
-rw-r--r--media/libstagefright/include/NuCachedSource2.h12
-rw-r--r--media/libstagefright/include/NuHTTPDataSource.h14
-rw-r--r--media/libstagefright/include/SampleIterator.h8
-rw-r--r--media/libstagefright/include/SampleTable.h20
-rw-r--r--media/libstagefright/include/ThrottledSource.h4
-rw-r--r--media/libstagefright/include/VBRISeeker.h6
-rw-r--r--media/libstagefright/include/WAVExtractor.h2
-rw-r--r--media/libstagefright/include/XINGSeeker.h4
-rw-r--r--media/libstagefright/matroska/MatroskaExtractor.cpp2
-rw-r--r--media/tests/omxjpegdecoder/StreamSource.cpp4
-rw-r--r--media/tests/omxjpegdecoder/StreamSource.h4
42 files changed, 242 insertions, 234 deletions
diff --git a/include/media/stagefright/AMRWriter.h b/include/media/stagefright/AMRWriter.h
index aa965e1..d8410a9 100644
--- a/include/media/stagefright/AMRWriter.h
+++ b/include/media/stagefright/AMRWriter.h
@@ -45,6 +45,7 @@ protected:
private:
FILE *mFile;
+ int mFd;
status_t mInitCheck;
sp<MediaSource> mSource;
bool mStarted;
diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h
index 27f33fb..d4f1733 100644
--- a/include/media/stagefright/DataSource.h
+++ b/include/media/stagefright/DataSource.h
@@ -48,13 +48,13 @@ public:
virtual status_t initCheck() const = 0;
- virtual ssize_t readAt(off_t offset, void *data, size_t size) = 0;
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size) = 0;
// Convenience methods:
- bool getUInt16(off_t offset, uint16_t *x);
+ bool getUInt16(off64_t offset, uint16_t *x);
// May return ERROR_UNSUPPORTED.
- virtual status_t getSize(off_t *size);
+ virtual status_t getSize(off64_t *size);
virtual uint32_t flags() {
return 0;
diff --git a/include/media/stagefright/FileSource.h b/include/media/stagefright/FileSource.h
index 4307263..a7f7181 100644
--- a/include/media/stagefright/FileSource.h
+++ b/include/media/stagefright/FileSource.h
@@ -34,9 +34,9 @@ public:
virtual status_t initCheck() const;
- virtual ssize_t readAt(off_t offset, void *data, size_t size);
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
- virtual status_t getSize(off_t *size);
+ virtual status_t getSize(off64_t *size);
virtual DecryptHandle* DrmInitialization(DrmManagerClient *client);
@@ -59,7 +59,7 @@ private:
int64_t mDrmBufSize;
unsigned char *mDrmBuf;
- ssize_t readAtDRM(off_t offset, void *data, size_t size);
+ ssize_t readAtDRM(off64_t offset, void *data, size_t size);
FileSource(const FileSource &);
FileSource &operator=(const FileSource &);
diff --git a/include/media/stagefright/JPEGSource.h b/include/media/stagefright/JPEGSource.h
index 9d0a700..1b7e91b 100644
--- a/include/media/stagefright/JPEGSource.h
+++ b/include/media/stagefright/JPEGSource.h
@@ -42,9 +42,9 @@ private:
sp<DataSource> mSource;
MediaBufferGroup *mGroup;
bool mStarted;
- off_t mSize;
+ off64_t mSize;
int32_t mWidth, mHeight;
- off_t mOffset;
+ off64_t mOffset;
status_t parseJPEG();
diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h
index 7bf07eb..e6d8a26 100644
--- a/include/media/stagefright/MPEG4Writer.h
+++ b/include/media/stagefright/MPEG4Writer.h
@@ -62,19 +62,20 @@ private:
class Track;
FILE *mFile;
+ int mFd;
bool mUse4ByteNalLength;
bool mUse32BitOffset;
bool mIsFileSizeLimitExplicitlyRequested;
bool mPaused;
bool mStarted;
- off_t mOffset;
+ off64_t mOffset;
off_t mMdatOffset;
uint8_t *mMoovBoxBuffer;
- off_t mMoovBoxBufferOffset;
+ off64_t mMoovBoxBufferOffset;
bool mWriteMoovBoxToMemory;
- off_t mFreeBoxOffset;
+ off64_t mFreeBoxOffset;
bool mStreamableFile;
- off_t mEstimatedMoovBoxSize;
+ off64_t mEstimatedMoovBoxSize;
uint32_t mInterleaveDurationUs;
int32_t mTimeScale;
int64_t mStartTimestampUs;
@@ -83,7 +84,7 @@ private:
List<Track *> mTracks;
- List<off_t> mBoxes;
+ List<off64_t> mBoxes;
void setStartTimestampUs(int64_t timeUs);
int64_t getStartTimestampUs(); // Not const
@@ -145,8 +146,8 @@ private:
void unlock();
// Acquire lock before calling these methods
- off_t addSample_l(MediaBuffer *buffer);
- off_t addLengthPrefixedSample_l(MediaBuffer *buffer);
+ off64_t addSample_l(MediaBuffer *buffer);
+ off64_t addLengthPrefixedSample_l(MediaBuffer *buffer);
inline size_t write(const void *ptr, size_t size, size_t nmemb, FILE* stream);
bool exceedsFileSizeLimit();
diff --git a/media/libstagefright/AMRExtractor.cpp b/media/libstagefright/AMRExtractor.cpp
index 1b05528..ac87c29 100644
--- a/media/libstagefright/AMRExtractor.cpp
+++ b/media/libstagefright/AMRExtractor.cpp
@@ -55,7 +55,7 @@ private:
size_t mFrameSize;
bool mIsWide;
- off_t mOffset;
+ off64_t mOffset;
int64_t mCurrentTimeUs;
bool mStarted;
MediaBufferGroup *mGroup;
@@ -115,9 +115,9 @@ AMRExtractor::AMRExtractor(const sp<DataSource> &source)
mFrameSize = getFrameSize(mIsWide, FT);
- off_t streamSize;
+ off64_t streamSize;
if (mDataSource->getSize(&streamSize) == OK) {
- off_t numFrames = streamSize / mFrameSize;
+ off64_t numFrames = streamSize / mFrameSize;
mMeta->setInt64(kKeyDuration, 20000ll * numFrames);
}
diff --git a/media/libstagefright/AMRWriter.cpp b/media/libstagefright/AMRWriter.cpp
index c0b1abe..ecbd96c 100644
--- a/media/libstagefright/AMRWriter.cpp
+++ b/media/libstagefright/AMRWriter.cpp
@@ -29,6 +29,7 @@ namespace android {
AMRWriter::AMRWriter(const char *filename)
: mFile(fopen(filename, "wb")),
+ mFd(mFile == NULL? -1: fileno(mFile)),
mInitCheck(mFile != NULL ? OK : NO_INIT),
mStarted(false),
mPaused(false),
@@ -37,6 +38,7 @@ AMRWriter::AMRWriter(const char *filename)
AMRWriter::AMRWriter(int fd)
: mFile(fdopen(fd, "wb")),
+ mFd(mFile == NULL? -1: fileno(mFile)),
mInitCheck(mFile != NULL ? OK : NO_INIT),
mStarted(false),
mPaused(false),
@@ -91,7 +93,7 @@ status_t AMRWriter::addSource(const sp<MediaSource> &source) {
const char *kHeader = isWide ? "#!AMR-WB\n" : "#!AMR\n";
size_t n = strlen(kHeader);
- if (fwrite(kHeader, 1, n, mFile) != n) {
+ if (write(mFd, kHeader, n) != n) {
return ERROR_IO;
}
@@ -240,11 +242,9 @@ status_t AMRWriter::threadFunc() {
notify(MEDIA_RECORDER_EVENT_INFO, MEDIA_RECORDER_INFO_MAX_DURATION_REACHED, 0);
break;
}
- ssize_t n = fwrite(
- (const uint8_t *)buffer->data() + buffer->range_offset(),
- 1,
- buffer->range_length(),
- mFile);
+ ssize_t n = write(mFd,
+ (const uint8_t *)buffer->data() + buffer->range_offset(),
+ buffer->range_length());
if (n < (ssize_t)buffer->range_length()) {
buffer->release();
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 538e7bf..922aaa8 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -499,7 +499,7 @@ void AwesomePlayer::notifyListener_l(int msg, int ext1, int ext2) {
}
bool AwesomePlayer::getBitrate(int64_t *bitrate) {
- off_t size;
+ off64_t size;
if (mDurationUs >= 0 && mCachedSource != NULL
&& mCachedSource->getSize(&size) == OK) {
*bitrate = size * 8000000ll / mDurationUs; // in bits/sec
diff --git a/media/libstagefright/DataSource.cpp b/media/libstagefright/DataSource.cpp
index 0b8997c..ee0d792 100644
--- a/media/libstagefright/DataSource.cpp
+++ b/media/libstagefright/DataSource.cpp
@@ -36,7 +36,7 @@
namespace android {
-bool DataSource::getUInt16(off_t offset, uint16_t *x) {
+bool DataSource::getUInt16(off64_t offset, uint16_t *x) {
*x = 0;
uint8_t byte[2];
@@ -49,7 +49,7 @@ bool DataSource::getUInt16(off_t offset, uint16_t *x) {
return true;
}
-status_t DataSource::getSize(off_t *size) {
+status_t DataSource::getSize(off64_t *size) {
*size = 0;
return ERROR_UNSUPPORTED;
diff --git a/media/libstagefright/FileSource.cpp b/media/libstagefright/FileSource.cpp
index 1c1a9c5..c9f68e9 100644
--- a/media/libstagefright/FileSource.cpp
+++ b/media/libstagefright/FileSource.cpp
@@ -16,6 +16,8 @@
#include <media/stagefright/FileSource.h>
#include <media/stagefright/MediaDebug.h>
+#include <sys/types.h>
+#include <unistd.h>
namespace android {
@@ -61,7 +63,7 @@ status_t FileSource::initCheck() const {
return mFile != NULL ? OK : NO_INIT;
}
-ssize_t FileSource::readAt(off_t offset, void *data, size_t size) {
+ssize_t FileSource::readAt(off64_t offset, void *data, size_t size) {
if (mFile == NULL) {
return NO_INIT;
}
@@ -82,17 +84,17 @@ ssize_t FileSource::readAt(off_t offset, void *data, size_t size) {
== mDecryptHandle->decryptApiType) {
return readAtDRM(offset, data, size);
} else {
- int err = fseeko(mFile, offset + mOffset, SEEK_SET);
- if (err < 0) {
+ off64_t result = lseek64(mFd, offset + mOffset, SEEK_SET);
+ if (result == -1) {
LOGE("seek to %lld failed", offset + mOffset);
return UNKNOWN_ERROR;
}
- return fread(data, 1, size, mFile);
+ return ::read(mFd, data, size);
}
}
-status_t FileSource::getSize(off_t *size) {
+status_t FileSource::getSize(off64_t *size) {
if (mFile == NULL) {
return NO_INIT;
}
@@ -103,8 +105,7 @@ status_t FileSource::getSize(off_t *size) {
return OK;
}
- fseek(mFile, 0, SEEK_END);
- *size = ftello(mFile);
+ *size = lseek64(mFd, 0, SEEK_END);
return OK;
}
@@ -133,7 +134,7 @@ void FileSource::getDrmInfo(DecryptHandle **handle, DrmManagerClient **client) {
*client = mDrmManagerClient;
}
-ssize_t FileSource::readAtDRM(off_t offset, void *data, size_t size) {
+ssize_t FileSource::readAtDRM(off64_t offset, void *data, size_t size) {
size_t DRM_CACHE_SIZE = 1024;
if (mDrmBuf == NULL) {
mDrmBuf = new unsigned char[DRM_CACHE_SIZE];
diff --git a/media/libstagefright/JPEGSource.cpp b/media/libstagefright/JPEGSource.cpp
index ec81097..e818115 100644
--- a/media/libstagefright/JPEGSource.cpp
+++ b/media/libstagefright/JPEGSource.cpp
@@ -142,7 +142,7 @@ status_t JPEGSource::parseJPEG() {
mWidth = 0;
mHeight = 0;
- off_t i = 0;
+ off64_t i = 0;
uint16_t soi;
if (!mSource->getUInt16(i, &soi)) {
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp
index 84ced8f..9610f90 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -183,7 +183,7 @@ bool MP3Extractor::get_mp3_frame_size(
static bool Resync(
const sp<DataSource> &source, uint32_t match_header,
- off_t *inout_pos, off_t *post_id3_pos, uint32_t *out_header) {
+ off64_t *inout_pos, off64_t *post_id3_pos, uint32_t *out_header) {
if (post_id3_pos != NULL) {
*post_id3_pos = 0;
}
@@ -226,7 +226,7 @@ static bool Resync(
}
}
- off_t pos = *inout_pos;
+ off64_t pos = *inout_pos;
bool valid = false;
do {
if (pos >= *inout_pos + 128 * 1024) {
@@ -261,7 +261,7 @@ static bool Resync(
// We found what looks like a valid frame,
// now find its successors.
- off_t test_pos = pos + frame_size;
+ off64_t test_pos = pos + frame_size;
valid = true;
for (int j = 0; j < 3; ++j) {
@@ -312,7 +312,7 @@ class MP3Source : public MediaSource {
public:
MP3Source(
const sp<MetaData> &meta, const sp<DataSource> &source,
- off_t first_frame_pos, uint32_t fixed_header,
+ off64_t first_frame_pos, uint32_t fixed_header,
const sp<MP3Seeker> &seeker);
virtual status_t start(MetaData *params = NULL);
@@ -329,9 +329,9 @@ protected:
private:
sp<MetaData> mMeta;
sp<DataSource> mDataSource;
- off_t mFirstFramePos;
+ off64_t mFirstFramePos;
uint32_t mFixedHeader;
- off_t mCurrentPos;
+ off64_t mCurrentPos;
int64_t mCurrentTimeUs;
bool mStarted;
sp<MP3Seeker> mSeeker;
@@ -347,8 +347,8 @@ MP3Extractor::MP3Extractor(
mDataSource(source),
mFirstFramePos(-1),
mFixedHeader(0) {
- off_t pos = 0;
- off_t post_id3_pos;
+ off64_t pos = 0;
+ off64_t post_id3_pos;
uint32_t header;
bool success;
@@ -361,9 +361,9 @@ MP3Extractor::MP3Extractor(
&& meta->findInt64("post-id3-offset", &meta_post_id3_offset)) {
// The sniffer has already done all the hard work for us, simply
// accept its judgement.
- pos = (off_t)meta_offset;
+ pos = (off64_t)meta_offset;
header = meta_header;
- post_id3_pos = (off_t)meta_post_id3_offset;
+ post_id3_pos = (off64_t)meta_post_id3_offset;
success = true;
} else {
@@ -401,7 +401,7 @@ MP3Extractor::MP3Extractor(
int64_t durationUs;
if (mSeeker == NULL || !mSeeker->getDuration(&durationUs)) {
- off_t fileSize;
+ off64_t fileSize;
if (mDataSource->getSize(&fileSize) == OK) {
durationUs = 8000LL * (fileSize - mFirstFramePos) / bitrate;
} else {
@@ -442,7 +442,7 @@ sp<MetaData> MP3Extractor::getTrackMetaData(size_t index, uint32_t flags) {
MP3Source::MP3Source(
const sp<MetaData> &meta, const sp<DataSource> &source,
- off_t first_frame_pos, uint32_t fixed_header,
+ off64_t first_frame_pos, uint32_t fixed_header,
const sp<MP3Seeker> &seeker)
: mMeta(meta),
mDataSource(source),
@@ -545,7 +545,7 @@ status_t MP3Source::read(
// Lost sync.
LOGV("lost sync! header = 0x%08x, old header = 0x%08x\n", header, mFixedHeader);
- off_t pos = mCurrentPos;
+ off64_t pos = mCurrentPos;
if (!Resync(mDataSource, mFixedHeader, &pos, NULL, NULL)) {
LOGE("Unable to resync. Signalling end of stream.");
@@ -651,8 +651,8 @@ sp<MetaData> MP3Extractor::getMetaData() {
bool SniffMP3(
const sp<DataSource> &source, String8 *mimeType,
float *confidence, sp<AMessage> *meta) {
- off_t pos = 0;
- off_t post_id3_pos;
+ off64_t pos = 0;
+ off64_t post_id3_pos;
uint32_t header;
if (!Resync(source, 0, &pos, &post_id3_pos, &header)) {
return false;
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index bb929fd..bbe99d3 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -98,11 +98,11 @@ struct MPEG4DataSource : public DataSource {
MPEG4DataSource(const sp<DataSource> &source);
virtual status_t initCheck() const;
- virtual ssize_t readAt(off_t offset, void *data, size_t size);
- virtual status_t getSize(off_t *size);
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
+ virtual status_t getSize(off64_t *size);
virtual uint32_t flags();
- status_t setCachedRange(off_t offset, size_t size);
+ status_t setCachedRange(off64_t offset, size_t size);
protected:
virtual ~MPEG4DataSource();
@@ -111,7 +111,7 @@ private:
Mutex mLock;
sp<DataSource> mSource;
- off_t mCachedOffset;
+ off64_t mCachedOffset;
size_t mCachedSize;
uint8_t *mCache;
@@ -146,7 +146,7 @@ status_t MPEG4DataSource::initCheck() const {
return mSource->initCheck();
}
-ssize_t MPEG4DataSource::readAt(off_t offset, void *data, size_t size) {
+ssize_t MPEG4DataSource::readAt(off64_t offset, void *data, size_t size) {
Mutex::Autolock autoLock(mLock);
if (offset >= mCachedOffset
@@ -158,7 +158,7 @@ ssize_t MPEG4DataSource::readAt(off_t offset, void *data, size_t size) {
return mSource->readAt(offset, data, size);
}
-status_t MPEG4DataSource::getSize(off_t *size) {
+status_t MPEG4DataSource::getSize(off64_t *size) {
return mSource->getSize(size);
}
@@ -166,7 +166,7 @@ uint32_t MPEG4DataSource::flags() {
return mSource->flags();
}
-status_t MPEG4DataSource::setCachedRange(off_t offset, size_t size) {
+status_t MPEG4DataSource::setCachedRange(off64_t offset, size_t size) {
Mutex::Autolock autoLock(mLock);
clearCache();
@@ -363,7 +363,7 @@ status_t MPEG4Extractor::readMetaData() {
return OK;
}
- off_t offset = 0;
+ off64_t offset = 0;
status_t err;
while ((err = parseChunk(&offset, 0)) == OK) {
}
@@ -404,7 +404,7 @@ char* MPEG4Extractor::getDrmTrackInfo(size_t trackID, int *len) {
}
// Reads an encoded integer 7 bits at a time until it encounters the high bit clear.
-int32_t readSize(off_t offset,
+int32_t readSize(off64_t offset,
const sp<DataSource> DataSource, uint8_t *numOfBytes) {
uint32_t size = 0;
uint8_t data;
@@ -424,7 +424,7 @@ int32_t readSize(off_t offset,
return size;
}
-status_t MPEG4Extractor::parseDrmSINF(off_t *offset, off_t data_offset) {
+status_t MPEG4Extractor::parseDrmSINF(off64_t *offset, off64_t data_offset) {
uint8_t updateIdTag;
if (mDataSource->readAt(data_offset, &updateIdTag, 1) < 1) {
return ERROR_IO;
@@ -596,14 +596,14 @@ static void convertTimeToDate(int64_t time_1904, String8 *s) {
s->setTo(tmp);
}
-status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
+status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
uint32_t hdr[2];
if (mDataSource->readAt(*offset, hdr, 8) < 8) {
return ERROR_IO;
}
uint64_t chunk_size = ntohl(hdr[0]);
uint32_t chunk_type = ntohl(hdr[1]);
- off_t data_offset = *offset + 8;
+ off64_t data_offset = *offset + 8;
if (chunk_size == 1) {
if (mDataSource->readAt(*offset + 8, &chunk_size, 8) < 8) {
@@ -644,11 +644,11 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
PathAdder autoAdder(&mPath, chunk_type);
- off_t chunk_data_size = *offset + chunk_size - data_offset;
+ off64_t chunk_data_size = *offset + chunk_size - data_offset;
if (chunk_type != FOURCC('c', 'p', 'r', 't')
&& mPath.size() == 5 && underMetaDataPath(mPath)) {
- off_t stop_offset = *offset + chunk_size;
+ off64_t stop_offset = *offset + chunk_size;
*offset = data_offset;
while (*offset < stop_offset) {
status_t err = parseChunk(offset, depth + 1);
@@ -715,7 +715,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
track->meta->setCString(kKeyMIMEType, "application/octet-stream");
}
- off_t stop_offset = *offset + chunk_size;
+ off64_t stop_offset = *offset + chunk_size;
*offset = data_offset;
while (*offset < stop_offset) {
status_t err = parseChunk(offset, depth + 1);
@@ -788,7 +788,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
return ERROR_IO;
}
- off_t timescale_offset;
+ off64_t timescale_offset;
if (version == 1) {
timescale_offset = data_offset + 4 + 16;
@@ -838,7 +838,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
}
uint8_t buffer[8];
- if (chunk_data_size < (off_t)sizeof(buffer)) {
+ if (chunk_data_size < (off64_t)sizeof(buffer)) {
return ERROR_MALFORMED;
}
@@ -862,7 +862,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
break;
}
- off_t stop_offset = *offset + chunk_size;
+ off64_t stop_offset = *offset + chunk_size;
*offset = data_offset + 8;
for (uint32_t i = 0; i < entry_count; ++i) {
status_t err = parseChunk(offset, depth + 1);
@@ -919,7 +919,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
mLastTrack->meta->setInt32(kKeyChannelCount, num_channels);
mLastTrack->meta->setInt32(kKeySampleRate, sample_rate);
- off_t stop_offset = *offset + chunk_size;
+ off64_t stop_offset = *offset + chunk_size;
*offset = data_offset + sizeof(buffer);
while (*offset < stop_offset) {
status_t err = parseChunk(offset, depth + 1);
@@ -962,7 +962,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
mLastTrack->meta->setInt32(kKeyWidth, width);
mLastTrack->meta->setInt32(kKeyHeight, height);
- off_t stop_offset = *offset + chunk_size;
+ off64_t stop_offset = *offset + chunk_size;
*offset = data_offset + sizeof(buffer);
while (*offset < stop_offset) {
status_t err = parseChunk(offset, depth + 1);
@@ -1069,7 +1069,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
}
uint8_t buffer[256];
- if (chunk_data_size > (off_t)sizeof(buffer)) {
+ if (chunk_data_size > (off64_t)sizeof(buffer)) {
return ERROR_BUFFER_TOO_SMALL;
}
@@ -1108,7 +1108,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
case FOURCC('a', 'v', 'c', 'C'):
{
char buffer[256];
- if (chunk_data_size > (off_t)sizeof(buffer)) {
+ if (chunk_data_size > (off64_t)sizeof(buffer)) {
return ERROR_BUFFER_TOO_SMALL;
}
@@ -1127,7 +1127,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
case FOURCC('m', 'e', 't', 'a'):
{
uint8_t buffer[4];
- if (chunk_data_size < (off_t)sizeof(buffer)) {
+ if (chunk_data_size < (off64_t)sizeof(buffer)) {
return ERROR_MALFORMED;
}
@@ -1147,7 +1147,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
return OK;
}
- off_t stop_offset = *offset + chunk_size;
+ off64_t stop_offset = *offset + chunk_size;
*offset = data_offset + sizeof(buffer);
while (*offset < stop_offset) {
status_t err = parseChunk(offset, depth + 1);
@@ -1232,7 +1232,7 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) {
}
status_t MPEG4Extractor::parseTrackHeader(
- off_t data_offset, off_t data_size) {
+ off64_t data_offset, off64_t data_size) {
if (data_size < 4) {
return ERROR_MALFORMED;
}
@@ -1246,7 +1246,7 @@ status_t MPEG4Extractor::parseTrackHeader(
uint8_t buffer[36 + 60];
- if (data_size != (off_t)dynSize + 60) {
+ if (data_size != (off64_t)dynSize + 60) {
return ERROR_MALFORMED;
}
@@ -1318,7 +1318,7 @@ status_t MPEG4Extractor::parseTrackHeader(
return OK;
}
-status_t MPEG4Extractor::parseMetaData(off_t offset, size_t size) {
+status_t MPEG4Extractor::parseMetaData(off64_t offset, size_t size) {
if (size < 4) {
return ERROR_MALFORMED;
}
@@ -1807,7 +1807,7 @@ status_t MPEG4Source::read(
// fall through
}
- off_t offset;
+ off64_t offset;
size_t size;
uint32_t dts;
bool isSyncSample;
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 17a40b0..19e3eae 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -64,7 +64,7 @@ public:
bool isAvc() const { return mIsAvc; }
bool isAudio() const { return mIsAudio; }
bool isMPEG4() const { return mIsMPEG4; }
- void addChunkOffset(off_t offset);
+ void addChunkOffset(off64_t offset);
status_t dump(int fd, const Vector<String16>& args) const;
private:
@@ -99,7 +99,7 @@ private:
List<MediaBuffer *> mChunkSamples;
size_t mNumStcoTableEntries;
- List<off_t> mChunkOffsets;
+ List<off64_t> mChunkOffsets;
size_t mNumStscTableEntries;
struct StscTableEntry {
@@ -215,6 +215,7 @@ private:
MPEG4Writer::MPEG4Writer(const char *filename)
: mFile(fopen(filename, "wb")),
+ mFd(mFile == NULL? -1: fileno(mFile)),
mUse4ByteNalLength(true),
mUse32BitOffset(true),
mIsFileSizeLimitExplicitlyRequested(false),
@@ -229,6 +230,7 @@ MPEG4Writer::MPEG4Writer(const char *filename)
MPEG4Writer::MPEG4Writer(int fd)
: mFile(fdopen(fd, "wb")),
+ mFd(mFile == NULL? -1: fileno(mFile)),
mUse4ByteNalLength(true),
mUse32BitOffset(true),
mIsFileSizeLimitExplicitlyRequested(false),
@@ -459,13 +461,13 @@ status_t MPEG4Writer::start(MetaData *param) {
mEstimatedMoovBoxSize = estimateMoovBoxSize(bitRate);
}
CHECK(mEstimatedMoovBoxSize >= 8);
- fseeko(mFile, mFreeBoxOffset, SEEK_SET);
+ lseek64(mFd, mFreeBoxOffset, SEEK_SET);
writeInt32(mEstimatedMoovBoxSize);
write("free", 4);
mMdatOffset = mFreeBoxOffset + mEstimatedMoovBoxSize;
mOffset = mMdatOffset;
- fseeko(mFile, mMdatOffset, SEEK_SET);
+ lseek64(mFd, mMdatOffset, SEEK_SET);
if (mUse32BitOffset) {
write("????mdat", 8);
} else {
@@ -607,19 +609,19 @@ status_t MPEG4Writer::stop() {
// Fix up the size of the 'mdat' chunk.
if (mUse32BitOffset) {
- fseeko(mFile, mMdatOffset, SEEK_SET);
+ lseek64(mFd, mMdatOffset, SEEK_SET);
int32_t size = htonl(static_cast<int32_t>(mOffset - mMdatOffset));
- fwrite(&size, 1, 4, mFile);
+ ::write(mFd, &size, 4);
} else {
- fseeko(mFile, mMdatOffset + 8, SEEK_SET);
+ lseek64(mFd, mMdatOffset + 8, SEEK_SET);
int64_t size = mOffset - mMdatOffset;
size = hton64(size);
- fwrite(&size, 1, 8, mFile);
+ ::write(mFd, &size, 8);
}
- fseeko(mFile, mOffset, SEEK_SET);
+ lseek64(mFd, mOffset, SEEK_SET);
time_t now = time(NULL);
- const off_t moovOffset = mOffset;
+ const off64_t moovOffset = mOffset;
mWriteMoovBoxToMemory = true;
mMoovBoxBuffer = (uint8_t *) malloc(mEstimatedMoovBoxSize);
mMoovBoxBufferOffset = 0;
@@ -661,12 +663,12 @@ status_t MPEG4Writer::stop() {
CHECK(mMoovBoxBufferOffset + 8 <= mEstimatedMoovBoxSize);
// Moov box
- fseeko(mFile, mFreeBoxOffset, SEEK_SET);
+ lseek64(mFd, mFreeBoxOffset, SEEK_SET);
mOffset = mFreeBoxOffset;
write(mMoovBoxBuffer, 1, mMoovBoxBufferOffset, mFile);
// Free box
- fseeko(mFile, mOffset, SEEK_SET);
+ lseek64(mFd, mOffset, SEEK_SET);
writeInt32(mEstimatedMoovBoxSize - mMoovBoxBufferOffset);
write("free", 4);
@@ -700,11 +702,12 @@ void MPEG4Writer::unlock() {
mLock.unlock();
}
-off_t MPEG4Writer::addSample_l(MediaBuffer *buffer) {
- off_t old_offset = mOffset;
+off64_t MPEG4Writer::addSample_l(MediaBuffer *buffer) {
+ off64_t old_offset = mOffset;
- fwrite((const uint8_t *)buffer->data() + buffer->range_offset(),
- 1, buffer->range_length(), mFile);
+ ::write(mFd,
+ (const uint8_t *)buffer->data() + buffer->range_offset(),
+ buffer->range_length());
mOffset += buffer->range_length();
@@ -725,33 +728,34 @@ static void StripStartcode(MediaBuffer *buffer) {
}
}
-off_t MPEG4Writer::addLengthPrefixedSample_l(MediaBuffer *buffer) {
- off_t old_offset = mOffset;
+off64_t MPEG4Writer::addLengthPrefixedSample_l(MediaBuffer *buffer) {
+ off64_t old_offset = mOffset;
size_t length = buffer->range_length();
if (mUse4ByteNalLength) {
uint8_t x = length >> 24;
- fwrite(&x, 1, 1, mFile);
+ ::write(mFd, &x, 1);
x = (length >> 16) & 0xff;
- fwrite(&x, 1, 1, mFile);
+ ::write(mFd, &x, 1);
x = (length >> 8) & 0xff;
- fwrite(&x, 1, 1, mFile);
+ ::write(mFd, &x, 1);
x = length & 0xff;
- fwrite(&x, 1, 1, mFile);
+ ::write(mFd, &x, 1);
+
+ ::write(mFd,
+ (const uint8_t *)buffer->data() + buffer->range_offset(),
+ length);
- fwrite((const uint8_t *)buffer->data() + buffer->range_offset(),
- 1, length, mFile);
mOffset += length + 4;
} else {
CHECK(length < 65536);
uint8_t x = length >> 8;
- fwrite(&x, 1, 1, mFile);
+ ::write(mFd, &x, 1);
x = length & 0xff;
- fwrite(&x, 1, 1, mFile);
- fwrite((const uint8_t *)buffer->data() + buffer->range_offset(),
- 1, length, mFile);
+ ::write(mFd, &x, 1);
+ ::write(mFd, (const uint8_t *)buffer->data() + buffer->range_offset(), length);
mOffset += length + 2;
}
@@ -762,16 +766,17 @@ size_t MPEG4Writer::write(
const void *ptr, size_t size, size_t nmemb, FILE *stream) {
const size_t bytes = size * nmemb;
+ int fd = fileno(stream);
if (mWriteMoovBoxToMemory) {
- off_t moovBoxSize = 8 + mMoovBoxBufferOffset + bytes;
+ off64_t moovBoxSize = 8 + mMoovBoxBufferOffset + bytes;
if (moovBoxSize > mEstimatedMoovBoxSize) {
- for (List<off_t>::iterator it = mBoxes.begin();
+ for (List<off64_t>::iterator it = mBoxes.begin();
it != mBoxes.end(); ++it) {
(*it) += mOffset;
}
- fseeko(mFile, mOffset, SEEK_SET);
- fwrite(mMoovBoxBuffer, 1, mMoovBoxBufferOffset, stream);
- fwrite(ptr, size, nmemb, stream);
+ lseek64(fd, mOffset, SEEK_SET);
+ ::write(fd, mMoovBoxBuffer, mMoovBoxBufferOffset);
+ ::write(fd, ptr, size * nmemb);
mOffset += (bytes + mMoovBoxBufferOffset);
free(mMoovBoxBuffer);
mMoovBoxBuffer = NULL;
@@ -783,7 +788,7 @@ size_t MPEG4Writer::write(
mMoovBoxBufferOffset += bytes;
}
} else {
- fwrite(ptr, size, nmemb, stream);
+ ::write(fd, ptr, size * nmemb);
mOffset += bytes;
}
return bytes;
@@ -802,17 +807,17 @@ void MPEG4Writer::beginBox(const char *fourcc) {
void MPEG4Writer::endBox() {
CHECK(!mBoxes.empty());
- off_t offset = *--mBoxes.end();
+ off64_t offset = *--mBoxes.end();
mBoxes.erase(--mBoxes.end());
if (mWriteMoovBoxToMemory) {
int32_t x = htonl(mMoovBoxBufferOffset - offset);
memcpy(mMoovBoxBuffer + offset, &x, 4);
} else {
- fseeko(mFile, offset, SEEK_SET);
+ lseek64(mFd, offset, SEEK_SET);
writeInt32(mOffset - offset);
mOffset -= 4;
- fseeko(mFile, mOffset, SEEK_SET);
+ lseek64(mFd, mOffset, SEEK_SET);
}
}
@@ -987,7 +992,7 @@ void MPEG4Writer::Track::addOneSttsTableEntry(
++mNumSttsTableEntries;
}
-void MPEG4Writer::Track::addChunkOffset(off_t offset) {
+void MPEG4Writer::Track::addChunkOffset(off64_t offset) {
++mNumStcoTableEntries;
mChunkOffsets.push_back(offset);
}
@@ -1102,7 +1107,7 @@ void MPEG4Writer::writeFirstChunk(ChunkInfo* info) {
for (List<MediaBuffer *>::iterator it = chunkIt->mSamples.begin();
it != chunkIt->mSamples.end(); ++it) {
- off_t offset = info->mTrack->isAvc()
+ off64_t offset = info->mTrack->isAvc()
? addLengthPrefixedSample_l(*it)
: addSample_l(*it);
if (it == chunkIt->mSamples.begin()) {
@@ -1926,7 +1931,7 @@ status_t MPEG4Writer::Track::threadEntry() {
trackProgressStatus(timestampUs);
}
if (mOwner->numTracks() == 1) {
- off_t offset = mIsAvc? mOwner->addLengthPrefixedSample_l(copy)
+ off64_t offset = mIsAvc? mOwner->addLengthPrefixedSample_l(copy)
: mOwner->addSample_l(copy);
if (mChunkOffsets.empty()) {
addChunkOffset(offset);
@@ -2477,7 +2482,7 @@ void MPEG4Writer::Track::writeTrackHeader(
mOwner->beginBox(use32BitOffset? "stco": "co64");
mOwner->writeInt32(0); // version=0, flags=0
mOwner->writeInt32(mNumStcoTableEntries);
- for (List<off_t>::iterator it = mChunkOffsets.begin();
+ for (List<off64_t>::iterator it = mChunkOffsets.begin();
it != mChunkOffsets.end(); ++it) {
if (use32BitOffset) {
mOwner->writeInt32(static_cast<int32_t>(*it));
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 3bb38de..7f765ca 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -201,7 +201,7 @@ status_t NuCachedSource2::initCheck() const {
return mSource->initCheck();
}
-status_t NuCachedSource2::getSize(off_t *size) {
+status_t NuCachedSource2::getSize(off64_t *size) {
return mSource->getSize(size);
}
@@ -353,7 +353,7 @@ void NuCachedSource2::restartPrefetcherIfNecessary_l(
mFetching = true;
}
-ssize_t NuCachedSource2::readAt(off_t offset, void *data, size_t size) {
+ssize_t NuCachedSource2::readAt(off64_t offset, void *data, size_t size) {
Mutex::Autolock autoSerializer(mSerializer);
LOGV("readAt offset %ld, size %d", offset, size);
@@ -408,27 +408,27 @@ size_t NuCachedSource2::approxDataRemaining(bool *eos) {
size_t NuCachedSource2::approxDataRemaining_l(bool *eos) {
*eos = (mFinalStatus != OK);
- off_t lastBytePosCached = mCacheOffset + mCache->totalSize();
+ off64_t lastBytePosCached = mCacheOffset + mCache->totalSize();
if (mLastAccessPos < lastBytePosCached) {
return lastBytePosCached - mLastAccessPos;
}
return 0;
}
-ssize_t NuCachedSource2::readInternal(off_t offset, void *data, size_t size) {
+ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) {
LOGV("readInternal offset %ld size %d", offset, size);
Mutex::Autolock autoLock(mLock);
if (offset < mCacheOffset
- || offset >= (off_t)(mCacheOffset + mCache->totalSize())) {
- static const off_t kPadding = 32768;
+ || offset >= (off64_t)(mCacheOffset + mCache->totalSize())) {
+ static const off64_t kPadding = 32768;
// In the presence of multiple decoded streams, once of them will
// trigger this seek request, the other one will request data "nearby"
// soon, adjust the seek position so that that subsequent request
// does not trigger another seek.
- off_t seekOffset = (offset > kPadding) ? offset - kPadding : 0;
+ off64_t seekOffset = (offset > kPadding) ? offset - kPadding : 0;
seekInternal_l(seekOffset);
}
@@ -457,11 +457,11 @@ ssize_t NuCachedSource2::readInternal(off_t offset, void *data, size_t size) {
return -EAGAIN;
}
-status_t NuCachedSource2::seekInternal_l(off_t offset) {
+status_t NuCachedSource2::seekInternal_l(off64_t offset) {
mLastAccessPos = offset;
if (offset >= mCacheOffset
- && offset <= (off_t)(mCacheOffset + mCache->totalSize())) {
+ && offset <= (off64_t)(mCacheOffset + mCache->totalSize())) {
return OK;
}
diff --git a/media/libstagefright/NuHTTPDataSource.cpp b/media/libstagefright/NuHTTPDataSource.cpp
index c3c0d81..15c9ac6 100644
--- a/media/libstagefright/NuHTTPDataSource.cpp
+++ b/media/libstagefright/NuHTTPDataSource.cpp
@@ -84,7 +84,7 @@ NuHTTPDataSource::~NuHTTPDataSource() {
status_t NuHTTPDataSource::connect(
const char *uri,
const KeyedVector<String8, String8> *overrides,
- off_t offset) {
+ off64_t offset) {
String8 headers;
MakeFullHeaders(overrides, &headers);
@@ -94,7 +94,7 @@ status_t NuHTTPDataSource::connect(
status_t NuHTTPDataSource::connect(
const char *uri,
const String8 &headers,
- off_t offset) {
+ off64_t offset) {
String8 host, path;
unsigned port;
@@ -115,8 +115,8 @@ static bool IsRedirectStatusCode(int httpStatus) {
status_t NuHTTPDataSource::connect(
const char *host, unsigned port, const char *path,
const String8 &headers,
- off_t offset) {
- LOGI("connect to %s:%u%s @%ld", host, port, path, offset);
+ off64_t offset) {
+ LOGI("connect to %s:%u%s @%lld", host, port, path, offset);
bool needsToReconnect = true;
@@ -162,7 +162,7 @@ status_t NuHTTPDataSource::connect(
if (offset != 0) {
char rangeHeader[128];
- sprintf(rangeHeader, "Range: bytes=%ld-\r\n", offset);
+ sprintf(rangeHeader, "Range: bytes=%lld-\r\n", offset);
request.append(rangeHeader);
}
@@ -226,7 +226,7 @@ status_t NuHTTPDataSource::connect(
unsigned long x;
if (mHTTP.find_header_value(string("Content-Length"), &value)
&& ParseSingleUnsignedLong(value.c_str(), &x)) {
- mContentLength = (off_t)x;
+ mContentLength = (off64_t)x;
mContentLengthValid = true;
} else {
LOGW("Server did not give us the content length!");
@@ -331,7 +331,7 @@ ssize_t NuHTTPDataSource::internalRead(void *data, size_t size) {
return n;
}
-ssize_t NuHTTPDataSource::readAt(off_t offset, void *data, size_t size) {
+ssize_t NuHTTPDataSource::readAt(off64_t offset, void *data, size_t size) {
LOGV("readAt offset %ld, size %d", offset, size);
Mutex::Autolock autoLock(mLock);
@@ -388,7 +388,7 @@ ssize_t NuHTTPDataSource::readAt(off_t offset, void *data, size_t size) {
return numBytesRead;
}
-status_t NuHTTPDataSource::getSize(off_t *size) {
+status_t NuHTTPDataSource::getSize(off64_t *size) {
*size = 0;
if (mState != CONNECTED) {
diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp
index 43938b2..4b8a014 100644
--- a/media/libstagefright/OggExtractor.cpp
+++ b/media/libstagefright/OggExtractor.cpp
@@ -73,7 +73,7 @@ struct MyVorbisExtractor {
// Returns an approximate bitrate in bits per second.
uint64_t approxBitrate();
- status_t seekToOffset(off_t offset);
+ status_t seekToOffset(off64_t offset);
status_t readNextPacket(MediaBuffer **buffer);
status_t init();
@@ -91,7 +91,7 @@ private:
};
sp<DataSource> mSource;
- off_t mOffset;
+ off64_t mOffset;
Page mCurrentPage;
uint64_t mPrevGranulePosition;
size_t mCurrentPageSize;
@@ -99,7 +99,7 @@ private:
uint64_t mCurrentPageSamples;
size_t mNextLaceIndex;
- off_t mFirstDataOffset;
+ off64_t mFirstDataOffset;
vorbis_info mVi;
vorbis_comment mVc;
@@ -107,8 +107,8 @@ private:
sp<MetaData> mMeta;
sp<MetaData> mFileMeta;
- ssize_t readPage(off_t offset, Page *page);
- status_t findNextPage(off_t startOffset, off_t *pageOffset);
+ ssize_t readPage(off64_t offset, Page *page);
+ status_t findNextPage(off64_t startOffset, off64_t *pageOffset);
status_t verifyHeader(
MediaBuffer *buffer, uint8_t type);
@@ -116,7 +116,7 @@ private:
void parseFileMetaData();
void extractAlbumArt(const void *data, size_t size);
- uint64_t findPrevGranulePosition(off_t pageOffset);
+ uint64_t findPrevGranulePosition(off64_t pageOffset);
MyVorbisExtractor(const MyVorbisExtractor &);
MyVorbisExtractor &operator=(const MyVorbisExtractor &);
@@ -162,7 +162,7 @@ status_t OggSource::read(
int64_t seekTimeUs;
ReadOptions::SeekMode mode;
if (options && options->getSeekTo(&seekTimeUs, &mode)) {
- off_t pos = seekTimeUs * mExtractor->mImpl->approxBitrate() / 8000000ll;
+ off64_t pos = seekTimeUs * mExtractor->mImpl->approxBitrate() / 8000000ll;
LOGV("seeking to offset %ld", pos);
if (mExtractor->mImpl->seekToOffset(pos) != OK) {
@@ -220,7 +220,7 @@ sp<MetaData> MyVorbisExtractor::getFormat() const {
}
status_t MyVorbisExtractor::findNextPage(
- off_t startOffset, off_t *pageOffset) {
+ off64_t startOffset, off64_t *pageOffset) {
*pageOffset = startOffset;
for (;;) {
@@ -250,9 +250,9 @@ status_t MyVorbisExtractor::findNextPage(
// it (if any) and return its granule position.
// To do this we back up from the "current" page's offset until we find any
// page preceding it and then scan forward to just before the current page.
-uint64_t MyVorbisExtractor::findPrevGranulePosition(off_t pageOffset) {
- off_t prevPageOffset = 0;
- off_t prevGuess = pageOffset;
+uint64_t MyVorbisExtractor::findPrevGranulePosition(off64_t pageOffset) {
+ off64_t prevPageOffset = 0;
+ off64_t prevGuess = pageOffset;
for (;;) {
if (prevGuess >= 5000) {
prevGuess -= 5000;
@@ -292,14 +292,14 @@ uint64_t MyVorbisExtractor::findPrevGranulePosition(off_t pageOffset) {
}
}
-status_t MyVorbisExtractor::seekToOffset(off_t offset) {
+status_t MyVorbisExtractor::seekToOffset(off64_t offset) {
if (mFirstDataOffset >= 0 && offset < mFirstDataOffset) {
// Once we know where the actual audio data starts (past the headers)
// don't ever seek to anywhere before that.
offset = mFirstDataOffset;
}
- off_t pageOffset;
+ off64_t pageOffset;
status_t err = findNextPage(offset, &pageOffset);
if (err != OK) {
@@ -324,7 +324,7 @@ status_t MyVorbisExtractor::seekToOffset(off_t offset) {
return OK;
}
-ssize_t MyVorbisExtractor::readPage(off_t offset, Page *page) {
+ssize_t MyVorbisExtractor::readPage(off64_t offset, Page *page) {
uint8_t header[27];
if (mSource->readAt(offset, header, sizeof(header))
< (ssize_t)sizeof(header)) {
@@ -410,7 +410,7 @@ status_t MyVorbisExtractor::readNextPacket(MediaBuffer **out) {
}
if (mNextLaceIndex < mCurrentPage.mNumSegments) {
- off_t dataOffset = mOffset + 27 + mCurrentPage.mNumSegments;
+ off64_t dataOffset = mOffset + 27 + mCurrentPage.mNumSegments;
for (size_t j = 0; j < mNextLaceIndex; ++j) {
dataOffset += mCurrentPage.mLace[j];
}
@@ -609,7 +609,7 @@ status_t MyVorbisExtractor::verifyHeader(
LOGV("nominal-bitrate = %ld", mVi.bitrate_nominal);
LOGV("window-bitrate = %ld", mVi.bitrate_window);
- off_t size;
+ off64_t size;
if (mSource->getSize(&size) == OK) {
uint64_t bps = approxBitrate();
diff --git a/media/libstagefright/SampleIterator.cpp b/media/libstagefright/SampleIterator.cpp
index 7155c61..062ab9b 100644
--- a/media/libstagefright/SampleIterator.cpp
+++ b/media/libstagefright/SampleIterator.cpp
@@ -179,7 +179,7 @@ status_t SampleIterator::findChunkRange(uint32_t sampleIndex) {
return OK;
}
-status_t SampleIterator::getChunkOffset(uint32_t chunk, off_t *offset) {
+status_t SampleIterator::getChunkOffset(uint32_t chunk, off64_t *offset) {
*offset = 0;
if (chunk >= mTable->mNumChunkOffsets) {
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp
index 092c33e..e922c73 100644
--- a/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/SampleTable.cpp
@@ -76,7 +76,7 @@ SampleTable::~SampleTable() {
}
status_t SampleTable::setChunkOffsetParams(
- uint32_t type, off_t data_offset, size_t data_size) {
+ uint32_t type, off64_t data_offset, size_t data_size) {
if (mChunkOffsetOffset >= 0) {
return ERROR_MALFORMED;
}
@@ -117,7 +117,7 @@ status_t SampleTable::setChunkOffsetParams(
}
status_t SampleTable::setSampleToChunkParams(
- off_t data_offset, size_t data_size) {
+ off64_t data_offset, size_t data_size) {
if (mSampleToChunkOffset >= 0) {
return ERROR_MALFORMED;
}
@@ -168,7 +168,7 @@ status_t SampleTable::setSampleToChunkParams(
}
status_t SampleTable::setSampleSizeParams(
- uint32_t type, off_t data_offset, size_t data_size) {
+ uint32_t type, off64_t data_offset, size_t data_size) {
if (mSampleSizeOffset >= 0) {
return ERROR_MALFORMED;
}
@@ -228,7 +228,7 @@ status_t SampleTable::setSampleSizeParams(
}
status_t SampleTable::setTimeToSampleParams(
- off_t data_offset, size_t data_size) {
+ off64_t data_offset, size_t data_size) {
if (mTimeToSample != NULL || data_size < 8) {
return ERROR_MALFORMED;
}
@@ -260,7 +260,7 @@ status_t SampleTable::setTimeToSampleParams(
return OK;
}
-status_t SampleTable::setSyncSampleParams(off_t data_offset, size_t data_size) {
+status_t SampleTable::setSyncSampleParams(off64_t data_offset, size_t data_size) {
if (mSyncSampleOffset >= 0 || data_size < 8) {
return ERROR_MALFORMED;
}
@@ -557,7 +557,7 @@ status_t SampleTable::getSampleSize_l(
status_t SampleTable::getMetaDataForSample(
uint32_t sampleIndex,
- off_t *offset,
+ off64_t *offset,
size_t *size,
uint32_t *decodingTime,
bool *isSyncSample) {
diff --git a/media/libstagefright/StagefrightMediaScanner.cpp b/media/libstagefright/StagefrightMediaScanner.cpp
index 6c05e03..0f6af28 100644
--- a/media/libstagefright/StagefrightMediaScanner.cpp
+++ b/media/libstagefright/StagefrightMediaScanner.cpp
@@ -174,11 +174,11 @@ status_t StagefrightMediaScanner::processFile(
char *StagefrightMediaScanner::extractAlbumArt(int fd) {
LOGV("extractAlbumArt %d", fd);
- off_t size = lseek(fd, 0, SEEK_END);
+ off64_t size = lseek64(fd, 0, SEEK_END);
if (size < 0) {
return NULL;
}
- lseek(fd, 0, SEEK_SET);
+ lseek64(fd, 0, SEEK_SET);
if (mRetriever->setDataSource(fd, 0, size) == OK
&& mRetriever->setMode(
diff --git a/media/libstagefright/ThrottledSource.cpp b/media/libstagefright/ThrottledSource.cpp
index 4711f7c..88e07b0 100644
--- a/media/libstagefright/ThrottledSource.cpp
+++ b/media/libstagefright/ThrottledSource.cpp
@@ -41,7 +41,7 @@ status_t ThrottledSource::initCheck() const {
return mSource->initCheck();
}
-ssize_t ThrottledSource::readAt(off_t offset, void *data, size_t size) {
+ssize_t ThrottledSource::readAt(off64_t offset, void *data, size_t size) {
Mutex::Autolock autoLock(mLock);
ssize_t n = mSource->readAt(offset, data, size);
@@ -72,7 +72,7 @@ ssize_t ThrottledSource::readAt(off_t offset, void *data, size_t size) {
return n;
}
-status_t ThrottledSource::getSize(off_t *size) {
+status_t ThrottledSource::getSize(off64_t *size) {
return mSource->getSize(size);
}
diff --git a/media/libstagefright/VBRISeeker.cpp b/media/libstagefright/VBRISeeker.cpp
index 6608644..48bddc2 100644
--- a/media/libstagefright/VBRISeeker.cpp
+++ b/media/libstagefright/VBRISeeker.cpp
@@ -34,8 +34,8 @@ static uint32_t U24_AT(const uint8_t *ptr) {
// static
sp<VBRISeeker> VBRISeeker::CreateFromSource(
- const sp<DataSource> &source, off_t post_id3_pos) {
- off_t pos = post_id3_pos;
+ const sp<DataSource> &source, off64_t post_id3_pos) {
+ off64_t pos = post_id3_pos;
uint8_t header[4];
ssize_t n = source->readAt(pos, header, sizeof(header));
@@ -94,7 +94,7 @@ sp<VBRISeeker> VBRISeeker::CreateFromSource(
seeker->mBasePos = post_id3_pos;
seeker->mDurationUs = durationUs;
- off_t offset = post_id3_pos;
+ off64_t offset = post_id3_pos;
for (size_t i = 0; i < numEntries; ++i) {
uint32_t numBytes;
switch (entrySize) {
@@ -138,7 +138,7 @@ bool VBRISeeker::getDuration(int64_t *durationUs) {
return true;
}
-bool VBRISeeker::getOffsetForTime(int64_t *timeUs, off_t *pos) {
+bool VBRISeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) {
if (mDurationUs < 0) {
return false;
}
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index aff06bc..446021c 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -51,7 +51,7 @@ struct WAVSource : public MediaSource {
const sp<MetaData> &meta,
uint16_t waveFormat,
int32_t bitsPerSample,
- off_t offset, size_t size);
+ off64_t offset, size_t size);
virtual status_t start(MetaData *params = NULL);
virtual status_t stop();
@@ -72,11 +72,11 @@ private:
int32_t mSampleRate;
int32_t mNumChannels;
int32_t mBitsPerSample;
- off_t mOffset;
+ off64_t mOffset;
size_t mSize;
bool mStarted;
MediaBufferGroup *mGroup;
- off_t mCurrentPos;
+ off64_t mCurrentPos;
WAVSource(const WAVSource &);
WAVSource &operator=(const WAVSource &);
@@ -139,7 +139,7 @@ status_t WAVExtractor::init() {
size_t totalSize = U32_LE_AT(&header[4]);
- off_t offset = 12;
+ off64_t offset = 12;
size_t remainingSize = totalSize;
while (remainingSize >= 8) {
uint8_t chunkHeader[8];
@@ -251,7 +251,7 @@ WAVSource::WAVSource(
const sp<MetaData> &meta,
uint16_t waveFormat,
int32_t bitsPerSample,
- off_t offset, size_t size)
+ off64_t offset, size_t size)
: mDataSource(dataSource),
mMeta(meta),
mWaveFormat(waveFormat),
@@ -335,7 +335,7 @@ status_t WAVSource::read(
mBitsPerSample == 8 ? kMaxFrameSize / 2 : kMaxFrameSize;
size_t maxBytesAvailable =
- (mCurrentPos - mOffset >= (off_t)mSize)
+ (mCurrentPos - mOffset >= (off64_t)mSize)
? 0 : mSize - (mCurrentPos - mOffset);
if (maxBytesToRead > maxBytesAvailable) {
diff --git a/media/libstagefright/XINGSeeker.cpp b/media/libstagefright/XINGSeeker.cpp
index 72f260e..616836c 100644
--- a/media/libstagefright/XINGSeeker.cpp
+++ b/media/libstagefright/XINGSeeker.cpp
@@ -22,14 +22,14 @@
namespace android {
static bool parse_xing_header(
- const sp<DataSource> &source, off_t first_frame_pos,
+ const sp<DataSource> &source, off64_t first_frame_pos,
int32_t *frame_number = NULL, int32_t *byte_number = NULL,
char *table_of_contents = NULL, int32_t *quality_indicator = NULL,
int64_t *duration = NULL);
// static
sp<XINGSeeker> XINGSeeker::CreateFromSource(
- const sp<DataSource> &source, off_t first_frame_pos) {
+ const sp<DataSource> &source, off64_t first_frame_pos) {
sp<XINGSeeker> seeker = new XINGSeeker;
seeker->mFirstFramePos = first_frame_pos;
@@ -61,7 +61,7 @@ bool XINGSeeker::getDuration(int64_t *durationUs) {
return true;
}
-bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off_t *pos) {
+bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) {
if (mSizeBytes == 0 || mTableOfContents[0] <= 0 || mDurationUs < 0) {
return false;
}
@@ -94,7 +94,7 @@ bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off_t *pos) {
}
static bool parse_xing_header(
- const sp<DataSource> &source, off_t first_frame_pos,
+ const sp<DataSource> &source, off64_t first_frame_pos,
int32_t *frame_number, int32_t *byte_number,
char *table_of_contents, int32_t *quality_indicator,
int64_t *duration) {
diff --git a/media/libstagefright/httplive/LiveSource.cpp b/media/libstagefright/httplive/LiveSource.cpp
index c19b6f7..4b4c3d2 100644
--- a/media/libstagefright/httplive/LiveSource.cpp
+++ b/media/libstagefright/httplive/LiveSource.cpp
@@ -447,11 +447,11 @@ bool LiveSource::setupCipher() {
static const ssize_t kHeaderSize = 188;
-ssize_t LiveSource::readAt(off_t offset, void *data, size_t size) {
+ssize_t LiveSource::readAt(off64_t offset, void *data, size_t size) {
CHECK(offset >= mOffsetBias);
offset -= mOffsetBias;
- off_t delta = mSignalDiscontinuity ? kHeaderSize : 0;
+ off64_t delta = mSignalDiscontinuity ? kHeaderSize : 0;
if (offset >= mSourceSize + delta) {
CHECK_EQ(offset, mSourceSize + delta);
@@ -502,7 +502,7 @@ ssize_t LiveSource::readAt(off_t offset, void *data, size_t size) {
mAESIVec,
AES_DECRYPT);
- if (mSourceSize == (off_t)(offset + numRead - delta + n)) {
+ if (mSourceSize == (off64_t)(offset + numRead - delta + n)) {
// check for padding at the end of the file.
size_t pad = tmp->data()[n - 1];
@@ -551,7 +551,7 @@ status_t LiveSource::fetchM3U(const char *url, sp<ABuffer> *out) {
source = mSource;
}
- off_t size;
+ off64_t size;
status_t err = source->getSize(&size);
if (err != OK) {
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index da340f7..e9131a6 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -769,8 +769,8 @@ ID3::getAlbumArt(size_t *length, String8 *mime) const {
bool ID3::parseV1(const sp<DataSource> &source) {
const size_t V1_TAG_SIZE = 128;
- off_t size;
- if (source->getSize(&size) != OK || size < (off_t)V1_TAG_SIZE) {
+ off64_t size;
+ if (source->getSize(&size) != OK || size < (off64_t)V1_TAG_SIZE) {
return false;
}
diff --git a/media/libstagefright/include/LiveSource.h b/media/libstagefright/include/LiveSource.h
index 7ba1f44..38fe328 100644
--- a/media/libstagefright/include/LiveSource.h
+++ b/media/libstagefright/include/LiveSource.h
@@ -35,7 +35,7 @@ struct LiveSource : public DataSource {
virtual status_t initCheck() const;
- virtual ssize_t readAt(off_t offset, void *data, size_t size);
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
virtual uint32_t flags() {
return kWantsPrefetching;
@@ -67,8 +67,8 @@ private:
int64_t mLastFetchTimeUs;
sp<NuHTTPDataSource> mSource;
- off_t mSourceSize;
- off_t mOffsetBias;
+ off64_t mSourceSize;
+ off64_t mOffsetBias;
bool mSignalDiscontinuity;
ssize_t mPrevBandwidthIndex;
diff --git a/media/libstagefright/include/MP3Extractor.h b/media/libstagefright/include/MP3Extractor.h
index 11ca243..728980e 100644
--- a/media/libstagefright/include/MP3Extractor.h
+++ b/media/libstagefright/include/MP3Extractor.h
@@ -47,7 +47,7 @@ private:
status_t mInitCheck;
sp<DataSource> mDataSource;
- off_t mFirstFramePos;
+ off64_t mFirstFramePos;
sp<MetaData> mMeta;
uint32_t mFixedHeader;
sp<MP3Seeker> mSeeker;
diff --git a/media/libstagefright/include/MP3Seeker.h b/media/libstagefright/include/MP3Seeker.h
index 190eaed..599542e 100644
--- a/media/libstagefright/include/MP3Seeker.h
+++ b/media/libstagefright/include/MP3Seeker.h
@@ -31,7 +31,7 @@ struct MP3Seeker : public RefBase {
// Given a request seek time in "*timeUs", find the byte offset closest
// to that position and return it in "*pos". Update "*timeUs" to reflect
// the actual time that seekpoint represents.
- virtual bool getOffsetForTime(int64_t *timeUs, off_t *pos) = 0;
+ virtual bool getOffsetForTime(int64_t *timeUs, off64_t *pos) = 0;
protected:
virtual ~MP3Seeker() {}
diff --git a/media/libstagefright/include/MPEG2TSExtractor.h b/media/libstagefright/include/MPEG2TSExtractor.h
index d83b538..58401d4 100644
--- a/media/libstagefright/include/MPEG2TSExtractor.h
+++ b/media/libstagefright/include/MPEG2TSExtractor.h
@@ -43,7 +43,7 @@ private:
Vector<sp<AnotherPacketSource> > mSourceImpls;
- off_t mOffset;
+ off64_t mOffset;
void init();
status_t feedMore();
diff --git a/media/libstagefright/include/MPEG4Extractor.h b/media/libstagefright/include/MPEG4Extractor.h
index bc2e4dc..04e8a6a 100644
--- a/media/libstagefright/include/MPEG4Extractor.h
+++ b/media/libstagefright/include/MPEG4Extractor.h
@@ -67,8 +67,8 @@ private:
Vector<uint32_t> mPath;
status_t readMetaData();
- status_t parseChunk(off_t *offset, int depth);
- status_t parseMetaData(off_t offset, size_t size);
+ status_t parseChunk(off64_t *offset, int depth);
+ status_t parseMetaData(off64_t offset, size_t size);
status_t updateAudioTrackInfoFromESDS_MPEG4Audio(
const void *esds_data, size_t esds_size);
@@ -86,9 +86,9 @@ private:
SINF *mFirstSINF;
bool mIsDrm;
- status_t parseDrmSINF(off_t *offset, off_t data_offset);
+ status_t parseDrmSINF(off64_t *offset, off64_t data_offset);
- status_t parseTrackHeader(off_t data_offset, off_t data_size);
+ status_t parseTrackHeader(off64_t data_offset, off64_t data_size);
MPEG4Extractor(const MPEG4Extractor &);
MPEG4Extractor &operator=(const MPEG4Extractor &);
diff --git a/media/libstagefright/include/NuCachedSource2.h b/media/libstagefright/include/NuCachedSource2.h
index 5e404b6..f0f7daf 100644
--- a/media/libstagefright/include/NuCachedSource2.h
+++ b/media/libstagefright/include/NuCachedSource2.h
@@ -32,9 +32,9 @@ struct NuCachedSource2 : public DataSource {
virtual status_t initCheck() const;
- virtual ssize_t readAt(off_t offset, void *data, size_t size);
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
- virtual status_t getSize(off_t *size);
+ virtual status_t getSize(off64_t *size);
virtual uint32_t flags();
virtual DecryptHandle* DrmInitialization(DrmManagerClient *client);
@@ -81,9 +81,9 @@ private:
Condition mCondition;
PageCache *mCache;
- off_t mCacheOffset;
+ off64_t mCacheOffset;
status_t mFinalStatus;
- off_t mLastAccessPos;
+ off64_t mLastAccessPos;
sp<AMessage> mAsyncResult;
bool mFetching;
int64_t mLastFetchTimeUs;
@@ -95,8 +95,8 @@ private:
void onSuspend();
void fetchInternal();
- ssize_t readInternal(off_t offset, void *data, size_t size);
- status_t seekInternal_l(off_t offset);
+ ssize_t readInternal(off64_t offset, void *data, size_t size);
+ status_t seekInternal_l(off64_t offset);
size_t approxDataRemaining_l(bool *eos);
void restartPrefetcherIfNecessary_l(bool ignoreLowWaterThreshold = false);
diff --git a/media/libstagefright/include/NuHTTPDataSource.h b/media/libstagefright/include/NuHTTPDataSource.h
index c42691f..c8e93be 100644
--- a/media/libstagefright/include/NuHTTPDataSource.h
+++ b/media/libstagefright/include/NuHTTPDataSource.h
@@ -17,14 +17,14 @@ struct NuHTTPDataSource : public DataSource {
status_t connect(
const char *uri,
const KeyedVector<String8, String8> *headers = NULL,
- off_t offset = 0);
+ off64_t offset = 0);
void disconnect();
virtual status_t initCheck() const;
- virtual ssize_t readAt(off_t offset, void *data, size_t size);
- virtual status_t getSize(off_t *size);
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
+ virtual status_t getSize(off64_t *size);
virtual uint32_t flags();
// Returns true if bandwidth could successfully be estimated,
@@ -61,8 +61,8 @@ private:
String8 mUri;
HTTPStream mHTTP;
- off_t mOffset;
- off_t mContentLength;
+ off64_t mOffset;
+ off64_t mContentLength;
bool mContentLengthValid;
bool mHasChunkedTransferEncoding;
@@ -79,12 +79,12 @@ private:
DrmManagerClient *mDrmManagerClient;
status_t connect(
- const char *uri, const String8 &headers, off_t offset);
+ const char *uri, const String8 &headers, off64_t offset);
status_t connect(
const char *host, unsigned port, const char *path,
const String8 &headers,
- off_t offset);
+ off64_t offset);
// Read up to "size" bytes of data, respect transfer encoding.
ssize_t internalRead(void *data, size_t size);
diff --git a/media/libstagefright/include/SampleIterator.h b/media/libstagefright/include/SampleIterator.h
index a5eaed9..b5a043c 100644
--- a/media/libstagefright/include/SampleIterator.h
+++ b/media/libstagefright/include/SampleIterator.h
@@ -27,7 +27,7 @@ struct SampleIterator {
uint32_t getChunkIndex() const { return mCurrentChunkIndex; }
uint32_t getDescIndex() const { return mChunkDesc; }
- off_t getSampleOffset() const { return mCurrentSampleOffset; }
+ off64_t getSampleOffset() const { return mCurrentSampleOffset; }
size_t getSampleSize() const { return mCurrentSampleSize; }
uint32_t getSampleTime() const { return mCurrentSampleTime; }
@@ -48,7 +48,7 @@ private:
uint32_t mChunkDesc;
uint32_t mCurrentChunkIndex;
- off_t mCurrentChunkOffset;
+ off64_t mCurrentChunkOffset;
Vector<size_t> mCurrentChunkSampleSizes;
uint32_t mTimeToSampleIndex;
@@ -58,13 +58,13 @@ private:
uint32_t mTTSDuration;
uint32_t mCurrentSampleIndex;
- off_t mCurrentSampleOffset;
+ off64_t mCurrentSampleOffset;
size_t mCurrentSampleSize;
uint32_t mCurrentSampleTime;
void reset();
status_t findChunkRange(uint32_t sampleIndex);
- status_t getChunkOffset(uint32_t chunk, off_t *offset);
+ status_t getChunkOffset(uint32_t chunk, off64_t *offset);
status_t findSampleTime(uint32_t sampleIndex, uint32_t *time);
SampleIterator(const SampleIterator &);
diff --git a/media/libstagefright/include/SampleTable.h b/media/libstagefright/include/SampleTable.h
index f830690..c5e8136 100644
--- a/media/libstagefright/include/SampleTable.h
+++ b/media/libstagefright/include/SampleTable.h
@@ -36,17 +36,17 @@ public:
// type can be 'stco' or 'co64'.
status_t setChunkOffsetParams(
- uint32_t type, off_t data_offset, size_t data_size);
+ uint32_t type, off64_t data_offset, size_t data_size);
- status_t setSampleToChunkParams(off_t data_offset, size_t data_size);
+ status_t setSampleToChunkParams(off64_t data_offset, size_t data_size);
// type can be 'stsz' or 'stz2'.
status_t setSampleSizeParams(
- uint32_t type, off_t data_offset, size_t data_size);
+ uint32_t type, off64_t data_offset, size_t data_size);
- status_t setTimeToSampleParams(off_t data_offset, size_t data_size);
+ status_t setTimeToSampleParams(off64_t data_offset, size_t data_size);
- status_t setSyncSampleParams(off_t data_offset, size_t data_size);
+ status_t setSyncSampleParams(off64_t data_offset, size_t data_size);
////////////////////////////////////////////////////////////////////////////
@@ -58,7 +58,7 @@ public:
status_t getMetaDataForSample(
uint32_t sampleIndex,
- off_t *offset,
+ off64_t *offset,
size_t *size,
uint32_t *decodingTime,
bool *isSyncSample = NULL);
@@ -89,14 +89,14 @@ private:
sp<DataSource> mDataSource;
Mutex mLock;
- off_t mChunkOffsetOffset;
+ off64_t mChunkOffsetOffset;
uint32_t mChunkOffsetType;
uint32_t mNumChunkOffsets;
- off_t mSampleToChunkOffset;
+ off64_t mSampleToChunkOffset;
uint32_t mNumSampleToChunkOffsets;
- off_t mSampleSizeOffset;
+ off64_t mSampleSizeOffset;
uint32_t mSampleSizeFieldSize;
uint32_t mDefaultSampleSize;
uint32_t mNumSampleSizes;
@@ -104,7 +104,7 @@ private:
uint32_t mTimeToSampleCount;
uint32_t *mTimeToSample;
- off_t mSyncSampleOffset;
+ off64_t mSyncSampleOffset;
uint32_t mNumSyncSamples;
uint32_t *mSyncSamples;
size_t mLastSyncSampleIndex;
diff --git a/media/libstagefright/include/ThrottledSource.h b/media/libstagefright/include/ThrottledSource.h
index 88164b3..8928a4a 100644
--- a/media/libstagefright/include/ThrottledSource.h
+++ b/media/libstagefright/include/ThrottledSource.h
@@ -30,9 +30,9 @@ struct ThrottledSource : public DataSource {
virtual status_t initCheck() const;
- virtual ssize_t readAt(off_t offset, void *data, size_t size);
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
- virtual status_t getSize(off_t *size);
+ virtual status_t getSize(off64_t *size);
virtual uint32_t flags();
private:
diff --git a/media/libstagefright/include/VBRISeeker.h b/media/libstagefright/include/VBRISeeker.h
index d6bd19d..1a2bf9f 100644
--- a/media/libstagefright/include/VBRISeeker.h
+++ b/media/libstagefright/include/VBRISeeker.h
@@ -28,13 +28,13 @@ struct DataSource;
struct VBRISeeker : public MP3Seeker {
static sp<VBRISeeker> CreateFromSource(
- const sp<DataSource> &source, off_t post_id3_pos);
+ const sp<DataSource> &source, off64_t post_id3_pos);
virtual bool getDuration(int64_t *durationUs);
- virtual bool getOffsetForTime(int64_t *timeUs, off_t *pos);
+ virtual bool getOffsetForTime(int64_t *timeUs, off64_t *pos);
private:
- off_t mBasePos;
+ off64_t mBasePos;
int64_t mDurationUs;
Vector<uint32_t> mSegments;
diff --git a/media/libstagefright/include/WAVExtractor.h b/media/libstagefright/include/WAVExtractor.h
index df6d3e7..9de197f 100644
--- a/media/libstagefright/include/WAVExtractor.h
+++ b/media/libstagefright/include/WAVExtractor.h
@@ -48,7 +48,7 @@ private:
uint16_t mNumChannels;
uint32_t mSampleRate;
uint16_t mBitsPerSample;
- off_t mDataOffset;
+ off64_t mDataOffset;
size_t mDataSize;
sp<MetaData> mTrackMeta;
diff --git a/media/libstagefright/include/XINGSeeker.h b/media/libstagefright/include/XINGSeeker.h
index d4ff4e1..d5a484e 100644
--- a/media/libstagefright/include/XINGSeeker.h
+++ b/media/libstagefright/include/XINGSeeker.h
@@ -26,10 +26,10 @@ struct DataSource;
struct XINGSeeker : public MP3Seeker {
static sp<XINGSeeker> CreateFromSource(
- const sp<DataSource> &source, off_t first_frame_pos);
+ const sp<DataSource> &source, off64_t first_frame_pos);
virtual bool getDuration(int64_t *durationUs);
- virtual bool getOffsetForTime(int64_t *timeUs, off_t *pos);
+ virtual bool getOffsetForTime(int64_t *timeUs, off64_t *pos);
private:
int64_t mFirstFramePos;
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index a40c0a3..e0ac49f 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -58,7 +58,7 @@ struct DataSourceReader : public mkvparser::IMkvReader {
}
virtual int Length(long long* total, long long* available) {
- off_t size;
+ off64_t size;
if (mSource->getSize(&size) != OK) {
return -1;
}
diff --git a/media/tests/omxjpegdecoder/StreamSource.cpp b/media/tests/omxjpegdecoder/StreamSource.cpp
index 76aa85b..5f44203 100644
--- a/media/tests/omxjpegdecoder/StreamSource.cpp
+++ b/media/tests/omxjpegdecoder/StreamSource.cpp
@@ -35,7 +35,7 @@ status_t StreamSource::initCheck() const {
return mStream != NULL ? OK : NO_INIT;
}
-ssize_t StreamSource::readAt(off_t offset, void *data, size_t size) {
+ssize_t StreamSource::readAt(off64_t offset, void *data, size_t size) {
Mutex::Autolock autoLock(mLock);
mStream->rewind();
@@ -45,7 +45,7 @@ ssize_t StreamSource::readAt(off_t offset, void *data, size_t size) {
return result;
}
-status_t StreamSource::getSize(off_t *size) {
+status_t StreamSource::getSize(off64_t *size) {
*size = mSize;
return OK;
}
diff --git a/media/tests/omxjpegdecoder/StreamSource.h b/media/tests/omxjpegdecoder/StreamSource.h
index c1ed5bf..6c34cbd 100644
--- a/media/tests/omxjpegdecoder/StreamSource.h
+++ b/media/tests/omxjpegdecoder/StreamSource.h
@@ -32,8 +32,8 @@ public:
// Pass the ownership of SkStream to StreamSource.
StreamSource(SkStream *SkStream);
virtual status_t initCheck() const;
- virtual ssize_t readAt(off_t offset, void *data, size_t size);
- virtual status_t getSize(off_t *size);
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
+ virtual status_t getSize(off64_t *size);
protected:
virtual ~StreamSource();