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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,88 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef WEBRTC_GONK
     1.9 +#pragma error WebrtcOMXH264VideoCodec works only on B2G.
    1.10 +#endif
    1.11 +
    1.12 +#ifndef WEBRTC_OMX_H264_CODEC_H_
    1.13 +#define WEBRTC_OMX_H264_CODEC_H_
    1.14 +
    1.15 +#include "AudioConduit.h"
    1.16 +#include "VideoConduit.h"
    1.17 +
    1.18 +namespace android {
    1.19 +  class OMXVideoEncoder;
    1.20 +}
    1.21 +
    1.22 +namespace mozilla {
    1.23 +
    1.24 +class WebrtcOMXDecoder;
    1.25 +class OMXOutputDrain;
    1.26 +
    1.27 +class WebrtcOMXH264VideoEncoder : public WebrtcVideoEncoder
    1.28 +{
    1.29 +public:
    1.30 +  WebrtcOMXH264VideoEncoder();
    1.31 +
    1.32 +  virtual ~WebrtcOMXH264VideoEncoder();
    1.33 +
    1.34 +  // Implement VideoEncoder interface.
    1.35 +  virtual int32_t InitEncode(const webrtc::VideoCodec* aCodecSettings,
    1.36 +                             int32_t aNumOfCores,
    1.37 +                             uint32_t aMaxPayloadSize) MOZ_OVERRIDE;
    1.38 +
    1.39 +  virtual int32_t Encode(const webrtc::I420VideoFrame& aInputImage,
    1.40 +                         const webrtc::CodecSpecificInfo* aCodecSpecificInfo,
    1.41 +                         const std::vector<webrtc::VideoFrameType>* aFrameTypes) MOZ_OVERRIDE;
    1.42 +
    1.43 +  virtual int32_t RegisterEncodeCompleteCallback(webrtc::EncodedImageCallback* aCallback) MOZ_OVERRIDE;
    1.44 +
    1.45 +  virtual int32_t Release() MOZ_OVERRIDE;
    1.46 +
    1.47 +  virtual int32_t SetChannelParameters(uint32_t aPacketLossRate,
    1.48 +                                       int aRoundTripTimeMs) MOZ_OVERRIDE;
    1.49 +
    1.50 +  virtual int32_t SetRates(uint32_t aBitRate, uint32_t aFrameRate) MOZ_OVERRIDE;
    1.51 +
    1.52 +private:
    1.53 +  RefPtr<android::OMXVideoEncoder> mOMX;
    1.54 +  webrtc::EncodedImageCallback* mCallback;
    1.55 +  RefPtr<OMXOutputDrain> mOutputDrain;
    1.56 +  uint32_t mWidth;
    1.57 +  uint32_t mHeight;
    1.58 +  uint32_t mFrameRate;
    1.59 +  bool mOMXConfigured;
    1.60 +  webrtc::EncodedImage mEncodedImage;
    1.61 +};
    1.62 +
    1.63 +class WebrtcOMXH264VideoDecoder : public WebrtcVideoDecoder
    1.64 +{
    1.65 +public:
    1.66 +  WebrtcOMXH264VideoDecoder();
    1.67 +
    1.68 +  virtual ~WebrtcOMXH264VideoDecoder();
    1.69 +
    1.70 +  // Implement VideoDecoder interface.
    1.71 +  virtual int32_t InitDecode(const webrtc::VideoCodec* aCodecSettings,
    1.72 +                             int32_t aNumOfCores) MOZ_OVERRIDE;
    1.73 +  virtual int32_t Decode(const webrtc::EncodedImage& aInputImage,
    1.74 +                         bool aMissingFrames,
    1.75 +                         const webrtc::RTPFragmentationHeader* aFragmentation,
    1.76 +                         const webrtc::CodecSpecificInfo* aCodecSpecificInfo = nullptr,
    1.77 +                         int64_t aRenderTimeMs = -1) MOZ_OVERRIDE;
    1.78 +  virtual int32_t RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback) MOZ_OVERRIDE;
    1.79 +
    1.80 +  virtual int32_t Release() MOZ_OVERRIDE;
    1.81 +
    1.82 +  virtual int32_t Reset() MOZ_OVERRIDE;
    1.83 +
    1.84 +private:
    1.85 +  webrtc::DecodedImageCallback* mCallback;
    1.86 +  RefPtr<WebrtcOMXDecoder> mOMX;
    1.87 +};
    1.88 +
    1.89 +}
    1.90 +
    1.91 +#endif // WEBRTC_OMX_H264_CODEC_H_

mercurial