Home | History | Annotate | Download | only in include
      1 /*
      2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 /*
     12  * This file contains the interface to I420 "codec"
     13  * This is a dummy wrapper to allow VCM deal with raw I420 sequences
     14  */
     15 
     16 #ifndef WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_I420_CODEC_H_
     17 #define WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_I420_CODEC_H_
     18 
     19 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
     20 
     21 class TbI420Encoder: public webrtc::VideoEncoder
     22 {
     23 public:
     24     TbI420Encoder();
     25     virtual ~TbI420Encoder();
     26 
     27     virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings,
     28                                int32_t numberOfCores,
     29                                uint32_t maxPayloadSize) OVERRIDE;
     30 
     31     virtual int32_t Encode(
     32         const webrtc::I420VideoFrame& inputImage,
     33         const webrtc::CodecSpecificInfo* codecSpecificInfo,
     34         const std::vector<webrtc::VideoFrameType>* frameTypes) OVERRIDE;
     35 
     36     virtual int32_t RegisterEncodeCompleteCallback(
     37         webrtc::EncodedImageCallback* callback) OVERRIDE;
     38 
     39     virtual int32_t Release() OVERRIDE;
     40 
     41     virtual int32_t SetChannelParameters(uint32_t packetLoss, int rtt) OVERRIDE;
     42 
     43     virtual int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) OVERRIDE;
     44 
     45     virtual int32_t SetPeriodicKeyFrames(bool enable) OVERRIDE;
     46 
     47     virtual int32_t CodecConfigParameters(uint8_t* /*buffer*/,
     48                                           int32_t /*size*/) OVERRIDE;
     49 
     50     struct FunctionCalls
     51     {
     52         int32_t InitEncode;
     53         int32_t Encode;
     54         int32_t RegisterEncodeCompleteCallback;
     55         int32_t Release;
     56         int32_t Reset;
     57         int32_t SetChannelParameters;
     58         int32_t SetRates;
     59         int32_t SetPeriodicKeyFrames;
     60         int32_t CodecConfigParameters;
     61 
     62     };
     63 
     64     FunctionCalls GetFunctionCalls();
     65 private:
     66     bool _inited;
     67     webrtc::EncodedImage _encodedImage;
     68     FunctionCalls _functionCalls;
     69     webrtc::EncodedImageCallback* _encodedCompleteCallback;
     70 
     71 }; // end of tbI420Encoder class
     72 
     73 
     74 /***************************/
     75 /* tbI420Decoder class */
     76 /***************************/
     77 
     78 class TbI420Decoder: public webrtc::VideoDecoder
     79 {
     80 public:
     81     TbI420Decoder();
     82     virtual ~TbI420Decoder();
     83 
     84     virtual int32_t InitDecode(const webrtc::VideoCodec* inst,
     85                                int32_t numberOfCores) OVERRIDE;
     86     virtual int32_t Decode(
     87         const webrtc::EncodedImage& inputImage,
     88         bool missingFrames,
     89         const webrtc::RTPFragmentationHeader* fragmentation,
     90         const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,
     91         int64_t renderTimeMs = -1) OVERRIDE;
     92 
     93     virtual int32_t RegisterDecodeCompleteCallback(
     94         webrtc::DecodedImageCallback* callback) OVERRIDE;
     95     virtual int32_t Release() OVERRIDE;
     96     virtual int32_t Reset() OVERRIDE;
     97 
     98     struct FunctionCalls
     99     {
    100         int32_t InitDecode;
    101         int32_t Decode;
    102         int32_t RegisterDecodeCompleteCallback;
    103         int32_t Release;
    104         int32_t Reset;
    105     };
    106 
    107     FunctionCalls GetFunctionCalls();
    108 
    109 private:
    110 
    111     webrtc::I420VideoFrame _decodedImage;
    112     int32_t _width;
    113     int32_t _height;
    114     bool _inited;
    115     FunctionCalls _functionCalls;
    116     webrtc::DecodedImageCallback* _decodeCompleteCallback;
    117 
    118 }; // end of tbI420Decoder class
    119 
    120 #endif // WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_I420_CODEC_H_
    121