From c7fc37a3dab9bd1f96713649f351b5990e6316ff Mon Sep 17 00:00:00 2001 From: James Dong Date: Tue, 16 Nov 2010 14:04:54 -0800 Subject: 64-bit file size/offset support for media framework Change-Id: I3452bc2c0f1d990cc67285df2fce1f9f86ff8e10 --- media/libstagefright/MP3Extractor.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'media/libstagefright/MP3Extractor.cpp') 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 &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 &meta, const sp &source, - off_t first_frame_pos, uint32_t fixed_header, + off64_t first_frame_pos, uint32_t fixed_header, const sp &seeker); virtual status_t start(MetaData *params = NULL); @@ -329,9 +329,9 @@ protected: private: sp mMeta; sp mDataSource; - off_t mFirstFramePos; + off64_t mFirstFramePos; uint32_t mFixedHeader; - off_t mCurrentPos; + off64_t mCurrentPos; int64_t mCurrentTimeUs; bool mStarted; sp 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 MP3Extractor::getTrackMetaData(size_t index, uint32_t flags) { MP3Source::MP3Source( const sp &meta, const sp &source, - off_t first_frame_pos, uint32_t fixed_header, + off64_t first_frame_pos, uint32_t fixed_header, const sp &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 MP3Extractor::getMetaData() { bool SniffMP3( const sp &source, String8 *mimeType, float *confidence, sp *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; -- cgit v1.1