From 996dddff64f90d8469e24107c44bfd618cf0c2dd Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 25 Jan 2010 15:30:31 -0800 Subject: Support for audio recording into AMR NB/WB files as well as audio tracks in MPEG4 files. related-to-bug: 2295449 --- include/media/stagefright/AMRWriter.h | 13 +++++----- include/media/stagefright/MPEG4Writer.h | 12 ++++----- include/media/stagefright/MediaWriter.h | 45 +++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 include/media/stagefright/MediaWriter.h (limited to 'include/media') 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 -#include +#include #include 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 &source); - - status_t start(); - void stop(); + virtual status_t addSource(const sp &source); + virtual bool reachedEOS(); + virtual status_t start(); + virtual void stop(); protected: virtual ~AMRWriter(); @@ -49,6 +49,7 @@ private: sp 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 +#include #include -#include #include 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 &source); - status_t start(); - bool reachedEOS(); - void stop(); + virtual status_t addSource(const sp &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 + +namespace android { + +struct MediaSource; + +struct MediaWriter : public RefBase { + MediaWriter() {} + + virtual status_t addSource(const sp &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_ -- cgit v1.1