michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef OMX_CODEC_PROXY_DECODER_H_ michael@0: #define OMX_CODEC_PROXY_DECODER_H_ michael@0: michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: #include "MediaResourceManagerClient.h" michael@0: michael@0: namespace android { michael@0: michael@0: struct MediaBufferGroup; michael@0: struct MetaData; michael@0: michael@0: class OMXCodecProxy : public MediaSource, michael@0: public MediaResourceManagerClient::EventListener michael@0: { michael@0: public: michael@0: struct EventListener : public virtual RefBase { michael@0: virtual void statusChanged() = 0; michael@0: }; michael@0: michael@0: static sp Create( michael@0: const sp &omx, michael@0: const sp &meta, bool createEncoder, michael@0: const sp &source, michael@0: const char *matchComponentName = nullptr, michael@0: uint32_t flags = 0, michael@0: const sp &nativeWindow = nullptr); michael@0: michael@0: MediaResourceManagerClient::State getState(); michael@0: michael@0: void setEventListener(const wp& listener); michael@0: michael@0: void requestResource(); michael@0: bool IsWaitingResources(); michael@0: michael@0: // MediaResourceManagerClient::EventListener michael@0: virtual void statusChanged(int event); michael@0: michael@0: // MediaSource michael@0: virtual status_t start(MetaData *params = nullptr); michael@0: virtual status_t stop(); michael@0: michael@0: virtual sp getFormat(); michael@0: michael@0: virtual status_t read( michael@0: MediaBuffer **buffer, const ReadOptions *options = nullptr); michael@0: michael@0: virtual status_t pause(); michael@0: michael@0: protected: michael@0: OMXCodecProxy( michael@0: const sp &omx, michael@0: const sp &meta, michael@0: bool createEncoder, michael@0: const sp &source, michael@0: const char *matchComponentName, michael@0: uint32_t flags, michael@0: const sp &nativeWindow); michael@0: michael@0: virtual ~OMXCodecProxy(); michael@0: michael@0: void notifyStatusChangedLocked(); michael@0: michael@0: private: michael@0: OMXCodecProxy(const OMXCodecProxy &); michael@0: OMXCodecProxy &operator=(const OMXCodecProxy &); michael@0: michael@0: Mutex mLock; michael@0: michael@0: sp mOMX; michael@0: sp mSrcMeta; michael@0: char *mComponentName; michael@0: bool mIsEncoder; michael@0: // Flags specified in the creation of the codec. michael@0: uint32_t mFlags; michael@0: sp mNativeWindow; michael@0: michael@0: sp mSource; michael@0: michael@0: sp mOMXCodec; michael@0: sp mClient; michael@0: MediaResourceManagerClient::State mState; michael@0: michael@0: sp mManagerService; michael@0: wp mEventListener; michael@0: }; michael@0: michael@0: } // namespace android michael@0: michael@0: #endif // OMX_CODEC_PROXY_DECODER_H_