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: michael@0: #ifndef WEBRTC_GONK michael@0: #pragma error WebrtcOMXH264VideoCodec works only on B2G. michael@0: #endif michael@0: michael@0: #ifndef WEBRTC_OMX_H264_CODEC_H_ michael@0: #define WEBRTC_OMX_H264_CODEC_H_ michael@0: michael@0: #include "AudioConduit.h" michael@0: #include "VideoConduit.h" michael@0: michael@0: namespace android { michael@0: class OMXVideoEncoder; michael@0: } michael@0: michael@0: namespace mozilla { michael@0: michael@0: class WebrtcOMXDecoder; michael@0: class OMXOutputDrain; michael@0: michael@0: class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder michael@0: { michael@0: public: michael@0: WebrtcOMXH264VideoEncoder(); michael@0: michael@0: virtual ~WebrtcOMXH264VideoEncoder(); michael@0: michael@0: // Implement VideoEncoder interface. michael@0: virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings, michael@0: int32_t aNumOfCores, michael@0: uint32_t aMaxPayloadSize) MOZ_OVERRIDE; michael@0: michael@0: virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage, michael@0: const webrtc::CodecSpecificInfo* aCodecSpecificInfo, michael@0: const std::vector* aFrameTypes) MOZ_OVERRIDE; michael@0: michael@0: virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* aCallback) MOZ_OVERRIDE; michael@0: michael@0: virtual int32_t Release() MOZ_OVERRIDE; michael@0: michael@0: virtual int32_t SetChannelParameters(uint32_t aPacketLossRate, michael@0: int aRoundTripTimeMs) MOZ_OVERRIDE; michael@0: michael@0: virtual int32_t SetRates(uint32_t aBitRate, uint32_t aFrameRate) MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: RefPtr mOMX; michael@0: webrtc::EncodedImageCallback* mCallback; michael@0: RefPtr mOutputDrain; michael@0: uint32_t mWidth; michael@0: uint32_t mHeight; michael@0: uint32_t mFrameRate; michael@0: bool mOMXConfigured; michael@0: webrtc::EncodedImage mEncodedImage; michael@0: }; michael@0: michael@0: class WebrtcOMXH264VideoDecoder : public WebrtcVideoDecoder michael@0: { michael@0: public: michael@0: WebrtcOMXH264VideoDecoder(); michael@0: michael@0: virtual ~WebrtcOMXH264VideoDecoder(); michael@0: michael@0: // Implement VideoDecoder interface. michael@0: virtual int32_t InitDecode(const webrtc::VideoCodec* aCodecSettings, michael@0: int32_t aNumOfCores) MOZ_OVERRIDE; michael@0: virtual int32_t Decode(const webrtc::EncodedImage& aInputImage, michael@0: bool aMissingFrames, michael@0: const webrtc::RTPFragmentationHeader* aFragmentation, michael@0: const webrtc::CodecSpecificInfo* aCodecSpecificInfo = nullptr, michael@0: int64_t aRenderTimeMs = -1) MOZ_OVERRIDE; michael@0: virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) MOZ_OVERRIDE; michael@0: michael@0: virtual int32_t Release() MOZ_OVERRIDE; michael@0: michael@0: virtual int32_t Reset() MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: webrtc::DecodedImageCallback* mCallback; michael@0: RefPtr mOMX; michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif // WEBRTC_OMX_H264_CODEC_H_