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     static int32_t VersionStatic(char* version, int32_t length);
     28     virtual int32_t  Version(char* version, int32_t length) const;
     29 
     30     virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings,
     31                                int32_t numberOfCores,
     32                                uint32_t maxPayloadSize);
     33 
     34     virtual int32_t Encode(
     35         const webrtc::I420VideoFrame& inputImage,
     36         const webrtc::CodecSpecificInfo* codecSpecificInfo,
     37         const std::vector<webrtc::VideoFrameType>* frameTypes);
     38 
     39     virtual int32_t RegisterEncodeCompleteCallback(
     40         webrtc::EncodedImageCallback* callback);
     41 
     42     virtual int32_t Release();
     43 
     44     virtual int32_t Reset();
     45 
     46     virtual int32_t SetChannelParameters(uint32_t packetLoss, int rtt);
     47 
     48     virtual int32_t SetRates(uint32_t newBitRate, uint32_t frameRate);
     49 
     50     virtual int32_t SetPeriodicKeyFrames(bool enable);
     51 
     52     virtual int32_t CodecConfigParameters(uint8_t* /*buffer*/,
     53                                           int32_t /*size*/);
     54 
     55     struct FunctionCalls
     56     {
     57         int32_t InitEncode;
     58         int32_t Encode;
     59         int32_t RegisterEncodeCompleteCallback;
     60         int32_t Release;
     61         int32_t Reset;
     62         int32_t SetChannelParameters;
     63         int32_t SetRates;
     64         int32_t SetPeriodicKeyFrames;
     65         int32_t CodecConfigParameters;
     66 
     67     };
     68 
     69     FunctionCalls GetFunctionCalls();
     70 private:
     71     bool _inited;
     72     webrtc::EncodedImage _encodedImage;
     73     FunctionCalls _functionCalls;
     74     webrtc::EncodedImageCallback* _encodedCompleteCallback;
     75 
     76 }; // end of tbI420Encoder class
     77 
     78 
     79 /***************************/
     80 /* tbI420Decoder class */
     81 /***************************/
     82 
     83 class TbI420Decoder: public webrtc::VideoDecoder
     84 {
     85 public:
     86     TbI420Decoder();
     87     virtual ~TbI420Decoder();
     88 
     89     virtual int32_t InitDecode(const webrtc::VideoCodec* inst,
     90                                int32_t numberOfCores);
     91     virtual int32_t Decode(
     92         const webrtc::EncodedImage& inputImage,
     93         bool missingFrames,
     94         const webrtc::RTPFragmentationHeader* fragmentation,
     95         const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL,
     96         int64_t renderTimeMs = -1);
     97 
     98     virtual int32_t
     99         RegisterDecodeCompleteCallback(webrtc::DecodedImageCallback* callback);
    100     virtual int32_t Release();
    101     virtual int32_t Reset();
    102 
    103     struct FunctionCalls
    104     {
    105         int32_t InitDecode;
    106         int32_t Decode;
    107         int32_t RegisterDecodeCompleteCallback;
    108         int32_t Release;
    109         int32_t Reset;
    110     };
    111 
    112     FunctionCalls GetFunctionCalls();
    113 
    114 private:
    115 
    116     webrtc::I420VideoFrame _decodedImage;
    117     int32_t _width;
    118     int32_t _height;
    119     bool _inited;
    120     FunctionCalls _functionCalls;
    121     webrtc::DecodedImageCallback* _decodeCompleteCallback;
    122 
    123 }; // end of tbI420Decoder class
    124 
    125 #endif // WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_I420_CODEC_H_
    126