diff options
author | James Dong <jdong@google.com> | 2010-11-16 14:04:54 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-11-18 14:12:24 -0800 |
commit | c7fc37a3dab9bd1f96713649f351b5990e6316ff (patch) | |
tree | bd8cb4ea7521967152650311b485d2d0e6b3bcf2 /media/libstagefright/MP3Extractor.cpp | |
parent | 17468ee8dbfe5eb0b9a4f72be80cbb92a5134800 (diff) | |
download | frameworks_av-c7fc37a3dab9bd1f96713649f351b5990e6316ff.zip frameworks_av-c7fc37a3dab9bd1f96713649f351b5990e6316ff.tar.gz frameworks_av-c7fc37a3dab9bd1f96713649f351b5990e6316ff.tar.bz2 |
64-bit file size/offset support for media framework
Change-Id: I3452bc2c0f1d990cc67285df2fce1f9f86ff8e10
Diffstat (limited to 'media/libstagefright/MP3Extractor.cpp')
-rw-r--r-- | media/libstagefright/MP3Extractor.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
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; |