diff options
author | Bill Yi <byi@google.com> | 2015-02-19 14:31:34 -0800 |
---|---|---|
committer | Bill Yi <byi@google.com> | 2015-02-19 14:31:34 -0800 |
commit | 1f9b6745d7c88dac2bfd19d583c3d98b361f67b3 (patch) | |
tree | fa16251e7e839cc14b09074a4874dfab2f1c00cb /include/media/stagefright | |
parent | 2d9ded1d03653c747ba173f622e19ed6d56f26f4 (diff) | |
parent | 56fbb4d7bcb34af71a08cd126891afafdec217f1 (diff) | |
download | frameworks_av-1f9b6745d7c88dac2bfd19d583c3d98b361f67b3.zip frameworks_av-1f9b6745d7c88dac2bfd19d583c3d98b361f67b3.tar.gz frameworks_av-1f9b6745d7c88dac2bfd19d583c3d98b361f67b3.tar.bz2 |
Merge commit '56fbb4d7bcb34af71a08cd126891afafdec217f1' into HEAD
Diffstat (limited to 'include/media/stagefright')
-rw-r--r-- | include/media/stagefright/ACodec.h | 16 | ||||
-rw-r--r-- | include/media/stagefright/MediaCodec.h | 3 | ||||
-rw-r--r-- | include/media/stagefright/MediaCodecList.h | 6 | ||||
-rw-r--r-- | include/media/stagefright/MediaCodecSource.h | 4 | ||||
-rw-r--r-- | include/media/stagefright/MediaDefs.h | 1 | ||||
-rw-r--r-- | include/media/stagefright/SurfaceMediaSource.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/foundation/ADebug.h | 30 | ||||
-rw-r--r-- | include/media/stagefright/foundation/AStringUtils.h | 36 | ||||
-rw-r--r-- | include/media/stagefright/foundation/AUtils.h | 6 | ||||
-rw-r--r-- | include/media/stagefright/foundation/AWakeLock.h | 68 |
10 files changed, 161 insertions, 11 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index d77ddaf..595ace8 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -78,7 +78,7 @@ struct ACodec : public AHierarchicalStateMachine, public CodecBase { static bool isFlexibleColorFormat( const sp<IOMX> &omx, IOMX::node_id node, - uint32_t colorFormat, OMX_U32 *flexibleEquivalent); + uint32_t colorFormat, bool usingNativeBuffers, OMX_U32 *flexibleEquivalent); // Returns 0 if configuration is not supported. NOTE: this is treated by // some OMX components as auto level, and by others as invalid level. @@ -120,6 +120,7 @@ private: kWhatSetParameters = 'setP', kWhatSubmitOutputMetaDataBufferIfEOS = 'subm', kWhatOMXDied = 'OMXd', + kWhatReleaseCodecInstance = 'relC', }; enum { @@ -130,6 +131,7 @@ private: enum { kFlagIsSecure = 1, kFlagPushBlankBuffersToNativeWindowOnShutdown = 2, + kFlagIsGrallocUsageProtected = 4, }; struct BufferInfo { @@ -181,6 +183,7 @@ private: sp<ANativeWindow> mNativeWindow; sp<AMessage> mInputFormat; sp<AMessage> mOutputFormat; + sp<AMessage> mBaseOutputFormat; Vector<BufferInfo> mBuffers[2]; bool mPortEOS[2]; @@ -248,12 +251,13 @@ private: status_t setVideoPortFormatType( OMX_U32 portIndex, OMX_VIDEO_CODINGTYPE compressionFormat, - OMX_COLOR_FORMATTYPE colorFormat); + OMX_COLOR_FORMATTYPE colorFormat, + bool usingNativeBuffers = false); - status_t setSupportedOutputFormat(); + status_t setSupportedOutputFormat(bool getLegacyFlexibleFormat); status_t setupVideoDecoder( - const char *mime, const sp<AMessage> &msg); + const char *mime, const sp<AMessage> &msg, bool usingNativeBuffers); status_t setupVideoEncoder( const char *mime, const sp<AMessage> &msg); @@ -261,7 +265,7 @@ private: status_t setVideoFormatOnPort( OMX_U32 portIndex, int32_t width, int32_t height, - OMX_VIDEO_CODINGTYPE compressionFormat); + OMX_VIDEO_CODINGTYPE compressionFormat, float frameRate = -1.0); typedef struct drcParams { int32_t drcCut; @@ -280,6 +284,8 @@ private: status_t setupAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate); + status_t setupEAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate); + status_t selectAudioPortFormat( OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE desiredFormat); diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index bca78b9..d448097 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -194,7 +194,7 @@ private: }; enum { - kFlagIsSoftwareCodec = 1, + kFlagUsesSoftwareRenderer = 1, kFlagOutputFormatChanged = 2, kFlagOutputBuffersChanged = 4, kFlagStickyError = 8, @@ -205,6 +205,7 @@ private: kFlagIsEncoder = 256, kFlagGatherCodecSpecificData = 512, kFlagIsAsync = 1024, + kFlagIsComponentAllocated = 2048, }; struct BufferInfo { diff --git a/include/media/stagefright/MediaCodecList.h b/include/media/stagefright/MediaCodecList.h index 8605d99..c2bbe4d 100644 --- a/include/media/stagefright/MediaCodecList.h +++ b/include/media/stagefright/MediaCodecList.h @@ -52,6 +52,12 @@ struct MediaCodecList : public BnMediaCodecList { static sp<IMediaCodecList> getLocalInstance(); private: + class BinderDeathObserver : public IBinder::DeathRecipient { + void binderDied(const wp<IBinder> &the_late_who __unused); + }; + + static sp<BinderDeathObserver> sBinderDeathObserver; + enum Section { SECTION_TOPLEVEL, SECTION_DECODERS, diff --git a/include/media/stagefright/MediaCodecSource.h b/include/media/stagefright/MediaCodecSource.h index 3629c8b..0970b2b 100644 --- a/include/media/stagefright/MediaCodecSource.h +++ b/include/media/stagefright/MediaCodecSource.h @@ -85,8 +85,6 @@ private: status_t initEncoder(); void releaseEncoder(); status_t feedEncoderInputBuffers(); - void scheduleDoMoreWork(); - status_t doMoreWork(int32_t numInput, int32_t numOutput); void suspend(); void resume(int64_t skipFramesBeforeUs = -1ll); void signalEOS(status_t err = ERROR_END_OF_STREAM); @@ -108,8 +106,6 @@ private: bool mDoMoreWorkPending; sp<AMessage> mEncoderActivityNotify; sp<IGraphicBufferProducer> mGraphicBufferProducer; - Vector<sp<ABuffer> > mEncoderInputBuffers; - Vector<sp<ABuffer> > mEncoderOutputBuffers; List<MediaBuffer *> mInputBufferQueue; List<size_t> mAvailEncoderInputIndices; List<int64_t> mDecodingTimeQueue; // decoding time (us) for video diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h index 1f9ff45..a0036e0 100644 --- a/include/media/stagefright/MediaDefs.h +++ b/include/media/stagefright/MediaDefs.h @@ -48,6 +48,7 @@ extern const char *MEDIA_MIMETYPE_AUDIO_FLAC; extern const char *MEDIA_MIMETYPE_AUDIO_AAC_ADTS; extern const char *MEDIA_MIMETYPE_AUDIO_MSGSM; extern const char *MEDIA_MIMETYPE_AUDIO_AC3; +extern const char *MEDIA_MIMETYPE_AUDIO_EAC3; extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG4; extern const char *MEDIA_MIMETYPE_CONTAINER_WAV; diff --git a/include/media/stagefright/SurfaceMediaSource.h b/include/media/stagefright/SurfaceMediaSource.h index ffe4f4c..2177c00 100644 --- a/include/media/stagefright/SurfaceMediaSource.h +++ b/include/media/stagefright/SurfaceMediaSource.h @@ -126,7 +126,7 @@ protected: // Implementation of the BufferQueue::ConsumerListener interface. These // calls are used to notify the Surface of asynchronous events in the // BufferQueue. - virtual void onFrameAvailable(); + virtual void onFrameAvailable(const BufferItem& item); // Used as a hook to BufferQueue::disconnect() // This is called by the client side when it is done diff --git a/include/media/stagefright/foundation/ADebug.h b/include/media/stagefright/foundation/ADebug.h index 450dcfe..1d0e2cb 100644 --- a/include/media/stagefright/foundation/ADebug.h +++ b/include/media/stagefright/foundation/ADebug.h @@ -80,6 +80,36 @@ MAKE_COMPARATOR(GT,>) __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ " Should not be here."); +struct ADebug { + enum Level { + kDebugNone, // no debug + kDebugLifeCycle, // lifecycle events: creation/deletion + kDebugState, // commands and events + kDebugConfig, // configuration + kDebugInternalState, // internal state changes + kDebugAll, // all + kDebugMax = kDebugAll, + + }; + + // parse the property or string to get the debug level for a component name + // string format is: + // <level>[:<glob>][,<level>[:<glob>]...] + // - <level> is 0-5 corresponding to ADebug::Level + // - <glob> is used to match component name case insensitively, if omitted, it + // matches all components + // - string is read left-to-right, and the last matching level is returned, or + // the def if no terms matched + static Level GetDebugLevelFromProperty( + const char *name, const char *propertyName, Level def = kDebugNone); + static Level GetDebugLevelFromString( + const char *name, const char *value, Level def = kDebugNone); + + // remove redundant segments of a codec name, and return a newly allocated + // string suitable for debugging + static char *GetDebugName(const char *name); +}; + } // namespace android #endif // A_DEBUG_H_ diff --git a/include/media/stagefright/foundation/AStringUtils.h b/include/media/stagefright/foundation/AStringUtils.h new file mode 100644 index 0000000..76a7791 --- /dev/null +++ b/include/media/stagefright/foundation/AStringUtils.h @@ -0,0 +1,36 @@ +/* + * Copyright 2014 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 A_STRING_UTILS_H_ +#define A_STRING_UTILS_H_ + +#include <stdlib.h> + +namespace android { + +struct AStringUtils { + // similar to strncmp or strcasecmp, but case sensitivity is parametric + static int Compare(const char *a, const char *b, size_t len, bool ignoreCase); + + // matches a string (str) to a glob pattern that supports: + // * - matches any number of characters + static bool MatchesGlob( + const char *glob, size_t globLen, const char *str, size_t strLen, bool ignoreCase); +}; + +} // namespace android + +#endif // A_STRING_UTILS_H_ diff --git a/include/media/stagefright/foundation/AUtils.h b/include/media/stagefright/foundation/AUtils.h index 3a73a39..d7ecf50 100644 --- a/include/media/stagefright/foundation/AUtils.h +++ b/include/media/stagefright/foundation/AUtils.h @@ -40,6 +40,12 @@ inline static const T divUp(const T &nom, const T &den) { } } +/* == ceil(nom / den) * den. T must be integer type, alignment must be positive power of 2 */ +template<class T, class U> +inline static const T align(const T &nom, const U &den) { + return (nom + (T)(den - 1)) & (T)~(den - 1); +} + template<class T> inline static T abs(const T &a) { return a < 0 ? -a : a; diff --git a/include/media/stagefright/foundation/AWakeLock.h b/include/media/stagefright/foundation/AWakeLock.h new file mode 100644 index 0000000..57716c1 --- /dev/null +++ b/include/media/stagefright/foundation/AWakeLock.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2015 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 A_WAKELOCK_H_ +#define A_WAKELOCK_H_ + +#include <media/stagefright/foundation/ABase.h> +#include <powermanager/IPowerManager.h> +#include <utils/RefBase.h> + +namespace android { + +class AWakeLock : public RefBase { + +public: + AWakeLock(); + + // NOTE: acquire and release are not thread safe + + // returns true if wakelock was acquired + bool acquire(); + void release(bool force = false); + + virtual ~AWakeLock(); + +private: + sp<IPowerManager> mPowerManager; + sp<IBinder> mWakeLockToken; + uint32_t mWakeLockCount; + + class PMDeathRecipient : public IBinder::DeathRecipient { + public: + PMDeathRecipient(AWakeLock *wakeLock) : mWakeLock(wakeLock) {} + virtual ~PMDeathRecipient() {} + + // IBinder::DeathRecipient + virtual void binderDied(const wp<IBinder> &who); + + private: + PMDeathRecipient(const PMDeathRecipient&); + PMDeathRecipient& operator= (const PMDeathRecipient&); + + AWakeLock *mWakeLock; + }; + + const sp<PMDeathRecipient> mDeathRecipient; + + void clearPowerManager(); + + DISALLOW_EVIL_CONSTRUCTORS(AWakeLock); +}; + +} // namespace android + +#endif // A_WAKELOCK_H_ |