diff options
author | James Dong <jdong@google.com> | 2010-11-18 18:19:30 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-11-18 18:19:30 -0800 |
commit | 317ca79a49746dbd1b6bb83712e93e2dc5f6e4f0 (patch) | |
tree | ad8a70e1e44a6a22d1371390afe205fd2caed725 /media/libstagefright/AMRWriter.cpp | |
parent | c726bd8b7b9929fd917b01e5551a66ad5fe2c04e (diff) | |
parent | c7fc37a3dab9bd1f96713649f351b5990e6316ff (diff) | |
download | frameworks_av-317ca79a49746dbd1b6bb83712e93e2dc5f6e4f0.zip frameworks_av-317ca79a49746dbd1b6bb83712e93e2dc5f6e4f0.tar.gz frameworks_av-317ca79a49746dbd1b6bb83712e93e2dc5f6e4f0.tar.bz2 |
Merge "64-bit file size/offset support for media framework"
Diffstat (limited to 'media/libstagefright/AMRWriter.cpp')
-rw-r--r-- | media/libstagefright/AMRWriter.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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(); |