media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:094acd0b811c
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/. */
4
5 #ifndef WEBRTC_GONK
6 #pragma error WebrtcOMXH264VideoCodec works only on B2G.
7 #endif
8
9 #ifndef WEBRTC_OMX_H264_CODEC_H_
10 #define WEBRTC_OMX_H264_CODEC_H_
11
12 #include "AudioConduit.h"
13 #include "VideoConduit.h"
14
15 namespace android {
16 class OMXVideoEncoder;
17 }
18
19 namespace mozilla {
20
21 class WebrtcOMXDecoder;
22 class OMXOutputDrain;
23
24 class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder
25 {
26 public:
27 WebrtcOMXH264VideoEncoder();
28
29 virtual ~WebrtcOMXH264VideoEncoder();
30
31 // Implement VideoEncoder interface.
32 virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings,
33 int32_t aNumOfCores,
34 uint32_t aMaxPayloadSize) MOZ_OVERRIDE;
35
36 virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage,
37 const webrtc::CodecSpecificInfo* aCodecSpecificInfo,
38 const std::vector<webrtc::VideoFrameType>* aFrameTypes) MOZ_OVERRIDE;
39
40 virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* aCallback) MOZ_OVERRIDE;
41
42 virtual int32_t Release() MOZ_OVERRIDE;
43
44 virtual int32_t SetChannelParameters(uint32_t aPacketLossRate,
45 int aRoundTripTimeMs) MOZ_OVERRIDE;
46
47 virtual int32_t SetRates(uint32_t aBitRate, uint32_t aFrameRate) MOZ_OVERRIDE;
48
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 };
59
60 class WebrtcOMXH264VideoDecoder : public WebrtcVideoDecoder
61 {
62 public:
63 WebrtcOMXH264VideoDecoder();
64
65 virtual ~WebrtcOMXH264VideoDecoder();
66
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;
76
77 virtual int32_t Release() MOZ_OVERRIDE;
78
79 virtual int32_t Reset() MOZ_OVERRIDE;
80
81 private:
82 webrtc::DecodedImageCallback* mCallback;
83 RefPtr<WebrtcOMXDecoder> mOMX;
84 };
85
86 }
87
88 #endif // WEBRTC_OMX_H264_CODEC_H_

mercurial