diff options
author | Andreas Huber <andih@google.com> | 2010-01-25 15:30:31 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-01-26 09:10:33 -0800 |
commit | 2dce41ad26cb3e9e15c9e456a84bcf5309548ca0 (patch) | |
tree | 5a4a3bcffcde8652b6ba8f97117ef30f0816e710 /include | |
parent | e7dc360f6fcb4d5348e72ba57e936254216ae399 (diff) | |
download | frameworks_av-2dce41ad26cb3e9e15c9e456a84bcf5309548ca0.zip frameworks_av-2dce41ad26cb3e9e15c9e456a84bcf5309548ca0.tar.gz frameworks_av-2dce41ad26cb3e9e15c9e456a84bcf5309548ca0.tar.bz2 |
Support for audio recording into AMR NB/WB files as well as audio tracks in MPEG4 files.
related-to-bug: 2295449
Diffstat (limited to 'include')
-rw-r--r-- | include/media/stagefright/AMRWriter.h | 13 | ||||
-rw-r--r-- | include/media/stagefright/MPEG4Writer.h | 12 | ||||
-rw-r--r-- | include/media/stagefright/MediaWriter.h | 45 |
3 files changed, 58 insertions, 12 deletions
diff --git a/include/media/stagefright/AMRWriter.h b/include/media/stagefright/AMRWriter.h index 6ee9869..372909a 100644 --- a/include/media/stagefright/AMRWriter.h +++ b/include/media/stagefright/AMRWriter.h @@ -20,23 +20,23 @@ #include <stdio.h> -#include <utils/RefBase.h> +#include <media/stagefright/MediaWriter.h> #include <utils/threads.h> namespace android { struct MediaSource; -struct AMRWriter : public RefBase { +struct AMRWriter : public MediaWriter { AMRWriter(const char *filename); AMRWriter(int fd); status_t initCheck() const; - status_t addSource(const sp<MediaSource> &source); - - status_t start(); - void stop(); + virtual status_t addSource(const sp<MediaSource> &source); + virtual bool reachedEOS(); + virtual status_t start(); + virtual void stop(); protected: virtual ~AMRWriter(); @@ -49,6 +49,7 @@ private: sp<MediaSource> mSource; bool mStarted; volatile bool mDone; + bool mReachedEOS; pthread_t mThread; static void *ThreadWrapper(void *); diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index 2ca04fa..6b93f19 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -20,8 +20,8 @@ #include <stdio.h> +#include <media/stagefright/MediaWriter.h> #include <utils/List.h> -#include <utils/RefBase.h> #include <utils/threads.h> namespace android { @@ -30,15 +30,15 @@ class MediaBuffer; class MediaSource; class MetaData; -class MPEG4Writer : public RefBase { +class MPEG4Writer : public MediaWriter { public: MPEG4Writer(const char *filename); MPEG4Writer(int fd); - void addSource(const sp<MediaSource> &source); - status_t start(); - bool reachedEOS(); - void stop(); + virtual status_t addSource(const sp<MediaSource> &source); + virtual status_t start(); + virtual bool reachedEOS(); + virtual void stop(); void beginBox(const char *fourcc); void writeInt8(int8_t x); diff --git a/include/media/stagefright/MediaWriter.h b/include/media/stagefright/MediaWriter.h new file mode 100644 index 0000000..b8232c6 --- /dev/null +++ b/include/media/stagefright/MediaWriter.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MEDIA_WRITER_H_ + +#define MEDIA_WRITER_H_ + +#include <utils/RefBase.h> + +namespace android { + +struct MediaSource; + +struct MediaWriter : public RefBase { + MediaWriter() {} + + virtual status_t addSource(const sp<MediaSource> &source) = 0; + virtual bool reachedEOS() = 0; + virtual status_t start() = 0; + virtual void stop() = 0; + +protected: + virtual ~MediaWriter() {} + +private: + MediaWriter(const MediaWriter &); + MediaWriter &operator=(const MediaWriter &); +}; + +} // namespace android + +#endif // MEDIA_WRITER_H_ |