diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/media/stagefright/MediaSource.h | 10 | ||||
-rw-r--r-- | include/media/stagefright/MetaData.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/MetadataBufferType.h | 77 | ||||
-rw-r--r-- | include/media/stagefright/OMXCodec.h | 20 |
4 files changed, 103 insertions, 6 deletions
diff --git a/include/media/stagefright/MediaSource.h b/include/media/stagefright/MediaSource.h index a31395e..37dbcd8 100644 --- a/include/media/stagefright/MediaSource.h +++ b/include/media/stagefright/MediaSource.h @@ -22,6 +22,7 @@ #include <media/stagefright/MediaErrors.h> #include <utils/RefBase.h> +#include <utils/Vector.h> namespace android { @@ -99,6 +100,15 @@ struct MediaSource : public RefBase { return ERROR_UNSUPPORTED; } + // The consumer of this media source requests that the given buffers + // are to be returned exclusively in response to read calls. + // This will be called after a successful start() and before the + // first read() call. + // Callee assumes ownership of the buffers if no error is returned. + virtual status_t setBuffers(const Vector<MediaBuffer *> &buffers) { + return ERROR_UNSUPPORTED; + } + protected: virtual ~MediaSource(); diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h index 99b72ad..57f678c 100644 --- a/include/media/stagefright/MetaData.h +++ b/include/media/stagefright/MetaData.h @@ -121,6 +121,8 @@ enum { // To store the timed text format data kKeyTextFormatData = 'text', // raw data + + kKeyRequiresSecureBuffers = 'secu', // bool (int32_t) }; enum { diff --git a/include/media/stagefright/MetadataBufferType.h b/include/media/stagefright/MetadataBufferType.h new file mode 100644 index 0000000..275c19f --- /dev/null +++ b/include/media/stagefright/MetadataBufferType.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2011 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 METADATA_BUFFER_TYPE_H +#define METADATA_BUFFER_TYPE_H + +namespace android { +/* + * MetadataBufferType defines the type of the metadata buffers that + * can be passed to video encoder component for encoding, via Stagefright + * media recording framework. To see how to work with the metadata buffers + * in media recording framework, please consult HardwareAPI.h + * + * The creator of metadata buffers and video encoder share common knowledge + * on what is actually being stored in these metadata buffers, and + * how the information can be used by the video encoder component + * to locate the actual pixel data as the source input for video + * encoder, plus whatever other information that is necessary. Stagefright + * media recording framework does not need to know anything specific about the + * metadata buffers, except for receving each individual metadata buffer + * as the source input, making a copy of the metadata buffer, and passing the + * copy via OpenMAX API to the video encoder component. + * + * The creator of the metadata buffers must ensure that the first + * 4 bytes in every metadata buffer indicates its buffer type, + * and the rest of the metadata buffer contains the + * actual metadata information. When a video encoder component receives + * a metadata buffer, it uses the first 4 bytes in that buffer to find + * out the type of the metadata buffer, and takes action appropriate + * to that type of metadata buffers (for instance, locate the actual + * pixel data input and then encoding the input data to produce a + * compressed output buffer). + * + * The following shows the layout of a metadata buffer, + * where buffer type is a 4-byte field of MetadataBufferType, + * and the payload is the metadata information. + * + * -------------------------------------------------------------- + * | buffer type | payload | + * -------------------------------------------------------------- + * + */ +typedef enum { + + /* + * kMetadataBufferTypeCameraSource is used to indicate that + * the source of the metadata buffer is the camera component. + */ + kMetadataBufferTypeCameraSource = 0, + + /* + * kMetadataBufferTypeGrallocSource is used to indicate that + * the payload of the metadata buffers can be interpreted as + * a buffer_handle_t. + */ + kMetadataBufferTypeGrallocSource = 1, + + // Add more here... + +} MetadataBufferType; + +} // namespace android + +#endif // METADATA_BUFFER_TYPE_H diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 92331a1..7f3c497 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -53,6 +53,9 @@ struct OMXCodec : public MediaSource, // Enable GRALLOC_USAGE_PROTECTED for output buffers from native window kEnableGrallocUsageProtected = 128, + + // Secure decoding mode + kUseSecureInputBuffers = 256, }; static sp<MediaSource> Create( const sp<IOMX> &omx, @@ -164,6 +167,10 @@ private: bool mOMXLivesLocally; IOMX::node_id mNode; uint32_t mQuirks; + + // Flags specified in the creation of the codec. + uint32_t mFlags; + bool mIsEncoder; char *mMIME; char *mComponentName; @@ -205,15 +212,12 @@ private: List<size_t> mFilledBuffers; Condition mBufferFilled; - bool mIsMetaDataStoredInVideoBuffers; - bool mOnlySubmitOneBufferAtOneTime; - bool mEnableGrallocUsageProtected; - // Used to record the decoding time for an output picture from // a video encoder. List<int64_t> mDecodingTimeList; - OMXCodec(const sp<IOMX> &omx, IOMX::node_id node, uint32_t quirks, + OMXCodec(const sp<IOMX> &omx, IOMX::node_id node, + uint32_t quirks, uint32_t flags, bool isEncoder, const char *mime, const char *componentName, const sp<MediaSource> &source, const sp<ANativeWindow> &nativeWindow); @@ -287,6 +291,10 @@ private: void drainInputBuffers(); void fillOutputBuffers(); + bool drainAnyInputBuffer(); + BufferInfo *findInputBufferByDataPointer(void *ptr); + BufferInfo *findEmptyInputBuffer(); + // Returns true iff a flush was initiated and a completion event is // upcoming, false otherwise (A flush was not necessary as we own all // the buffers on that port). @@ -313,7 +321,7 @@ private: void dumpPortStatus(OMX_U32 portIndex); - status_t configureCodec(const sp<MetaData> &meta, uint32_t flags); + status_t configureCodec(const sp<MetaData> &meta); static uint32_t getComponentQuirks( const char *componentName, bool isEncoder); |