Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef WEBRTC_GONK
6 #pragma error WebrtcOMXH264VideoCodec works only on B2G.
7 #endif
9 #ifndef WEBRTC_OMX_H264_CODEC_H_
10 #define WEBRTC_OMX_H264_CODEC_H_
12 #include "AudioConduit.h"
13 #include "VideoConduit.h"
15 namespace android {
16 class OMXVideoEncoder;
17 }
19 namespace mozilla {
21 class WebrtcOMXDecoder;
22 class OMXOutputDrain;
24 class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder
25 {
26 public:
27 WebrtcOMXH264VideoEncoder();
29 virtual ~WebrtcOMXH264VideoEncoder();
31 // Implement VideoEncoder interface.
32 virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings,
33 int32_t aNumOfCores,
34 uint32_t aMaxPayloadSize) MOZ_OVERRIDE;
36 virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage,
37 const webrtc::CodecSpecificInfo* aCodecSpecificInfo,
38 const std::vector<webrtc::VideoFrameType>* aFrameTypes) MOZ_OVERRIDE;
40 virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* aCallback) MOZ_OVERRIDE;
42 virtual int32_t Release() MOZ_OVERRIDE;
44 virtual int32_t SetChannelParameters(uint32_t aPacketLossRate,
45 int aRoundTripTimeMs) MOZ_OVERRIDE;
47 virtual int32_t SetRates(uint32_t aBitRate, uint32_t aFrameRate) MOZ_OVERRIDE;
49 private:
50 RefPtr<android::OMXVideoEncoder> mOMX;
51 webrtc::EncodedImageCallback* mCallback;
52 RefPtr<OMXOutputDrain> mOutputDrain;
53 uint32_t mWidth;
54 uint32_t mHeight;
55 uint32_t mFrameRate;
56 bool mOMXConfigured;
57 webrtc::EncodedImage mEncodedImage;
58 };
60 class WebrtcOMXH264VideoDecoder : public WebrtcVideoDecoder
61 {
62 public:
63 WebrtcOMXH264VideoDecoder();
65 virtual ~WebrtcOMXH264VideoDecoder();
67 // Implement VideoDecoder interface.
68 virtual int32_t InitDecode(const webrtc::VideoCodec* aCodecSettings,
69 int32_t aNumOfCores) MOZ_OVERRIDE;
70 virtual int32_t Decode(const webrtc::EncodedImage& aInputImage,
71 bool aMissingFrames,
72 const webrtc::RTPFragmentationHeader* aFragmentation,
73 const webrtc::CodecSpecificInfo* aCodecSpecificInfo = nullptr,
74 int64_t aRenderTimeMs = -1) MOZ_OVERRIDE;
75 virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) MOZ_OVERRIDE;
77 virtual int32_t Release() MOZ_OVERRIDE;
79 virtual int32_t Reset() MOZ_OVERRIDE;
81 private:
82 webrtc::DecodedImageCallback* mCallback;
83 RefPtr<WebrtcOMXDecoder> mOMX;
84 };
86 }
88 #endif // WEBRTC_OMX_H264_CODEC_H_