diff options
author | James Dong <jdong@google.com> | 2010-05-11 14:57:02 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-05-14 10:46:56 -0700 |
commit | d599cd4573b5a2d5914c5040e0565ef866749b77 (patch) | |
tree | f7b799092087742c9cfdda8b21a141f9934cf0ae /include | |
parent | 2e90514be4c98b5fa6e1df5f2049a5e005a4263d (diff) | |
download | frameworks_av-d599cd4573b5a2d5914c5040e0565ef866749b77.zip frameworks_av-d599cd4573b5a2d5914c5040e0565ef866749b77.tar.gz frameworks_av-d599cd4573b5a2d5914c5040e0565ef866749b77.tar.bz2 |
Handle recording file size and/or duration limit
Change-Id: Ib9ed1f3ebd8fef550cc130a7ef11f2905fa9aedc
Diffstat (limited to 'include')
-rw-r--r-- | include/media/stagefright/AMRWriter.h | 4 | ||||
-rw-r--r-- | include/media/stagefright/MPEG4Writer.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/MediaWriter.h | 16 |
3 files changed, 21 insertions, 1 deletions
diff --git a/include/media/stagefright/AMRWriter.h b/include/media/stagefright/AMRWriter.h index 34f3c4a..dd11809 100644 --- a/include/media/stagefright/AMRWriter.h +++ b/include/media/stagefright/AMRWriter.h @@ -49,9 +49,13 @@ private: volatile bool mDone; volatile bool mReachedEOS; pthread_t mThread; + int64_t mEstimatedSizeBytes; + int64_t mEstimatedDurationUs; static void *ThreadWrapper(void *); void threadFunc(); + bool exceedsFileSizeLimit(); + bool exceedsFileDurationLimit(); AMRWriter(const AMRWriter &); AMRWriter &operator=(const AMRWriter &); diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index 6064fc4..60f30f5 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -82,6 +82,8 @@ private: off_t addLengthPrefixedSample_l(MediaBuffer *buffer); inline size_t write(const void *ptr, size_t size, size_t nmemb, FILE* stream); + bool exceedsFileSizeLimit(); + bool exceedsFileDurationLimit(); MPEG4Writer(const MPEG4Writer &); MPEG4Writer &operator=(const MPEG4Writer &); diff --git a/include/media/stagefright/MediaWriter.h b/include/media/stagefright/MediaWriter.h index b8232c6..b15f69c 100644 --- a/include/media/stagefright/MediaWriter.h +++ b/include/media/stagefright/MediaWriter.h @@ -19,6 +19,7 @@ #define MEDIA_WRITER_H_ #include <utils/RefBase.h> +#include <media/IMediaPlayerClient.h> namespace android { @@ -31,10 +32,23 @@ struct MediaWriter : public RefBase { virtual bool reachedEOS() = 0; virtual status_t start() = 0; virtual void stop() = 0; + virtual void setMaxFileSize(int64_t bytes) { mMaxFileSizeLimitBytes = bytes; } + virtual void setMaxFileDuration(int64_t durationUs) { mMaxFileDurationLimitUs = durationUs; } + virtual void setListener(const sp<IMediaPlayerClient>& listener) { + mListener = listener; + } protected: virtual ~MediaWriter() {} - + int64_t mMaxFileSizeLimitBytes; + int64_t mMaxFileDurationLimitUs; + sp<IMediaPlayerClient> mListener; + + void notify(int msg, int ext1, int ext2) { + if (mListener != NULL) { + mListener->notify(msg, ext1, ext2); + } + } private: MediaWriter(const MediaWriter &); MediaWriter &operator=(const MediaWriter &); |