LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/video_coding/codecs/i420/include - i420.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_I420_INCLUDE_I420_H_
      12             : #define WEBRTC_MODULES_VIDEO_CODING_CODECS_I420_INCLUDE_I420_H_
      13             : 
      14             : #include <vector>
      15             : 
      16             : #include "webrtc/base/checks.h"
      17             : #include "webrtc/modules/video_coding/include/video_codec_interface.h"
      18             : #include "webrtc/typedefs.h"
      19             : 
      20             : namespace webrtc {
      21             : 
      22             : class I420Encoder : public VideoEncoder {
      23             :  public:
      24             :   I420Encoder();
      25             : 
      26             :   virtual ~I420Encoder();
      27             : 
      28             :   // Initialize the encoder with the information from the VideoCodec.
      29             :   //
      30             :   // Input:
      31             :   //          - codecSettings     : Codec settings.
      32             :   //          - numberOfCores     : Number of cores available for the encoder.
      33             :   //          - maxPayloadSize    : The maximum size each payload is allowed
      34             :   //                                to have. Usually MTU - overhead.
      35             :   //
      36             :   // Return value                 : WEBRTC_VIDEO_CODEC_OK if OK.
      37             :   //                                <0 - Error
      38             :   int InitEncode(const VideoCodec* codecSettings,
      39             :                  int /*numberOfCores*/,
      40             :                  size_t /*maxPayloadSize*/) override;
      41             : 
      42             :   // "Encode" an I420 image (as a part of a video stream). The encoded image
      43             :   // will be returned to the user via the encode complete callback.
      44             :   //
      45             :   // Input:
      46             :   //          - inputImage        : Image to be encoded.
      47             :   //          - codecSpecificInfo : Pointer to codec specific data.
      48             :   //          - frameType         : Frame type to be sent (Key /Delta).
      49             :   //
      50             :   // Return value                 : WEBRTC_VIDEO_CODEC_OK if OK.
      51             :   //                                <0 - Error
      52             :   int Encode(const VideoFrame& inputImage,
      53             :              const CodecSpecificInfo* /*codecSpecificInfo*/,
      54             :              const std::vector<FrameType>* /*frame_types*/) override;
      55             : 
      56             :   // Register an encode complete callback object.
      57             :   //
      58             :   // Input:
      59             :   //          - callback         : Callback object which handles encoded images.
      60             :   //
      61             :   // Return value                : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
      62             :   int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
      63             : 
      64             :   // Free encoder memory.
      65             :   //
      66             :   // Return value                : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
      67             :   int Release() override;
      68             : 
      69           0 :   int SetChannelParameters(uint32_t /*packetLoss*/, int64_t /*rtt*/) override {
      70           0 :     return WEBRTC_VIDEO_CODEC_OK;
      71             :   }
      72             : 
      73             :  private:
      74             :   static uint8_t* InsertHeader(uint8_t* buffer,
      75             :                                uint16_t width,
      76             :                                uint16_t height);
      77             : 
      78             :   bool _inited;
      79             :   EncodedImage _encodedImage;
      80             :   EncodedImageCallback* _encodedCompleteCallback;
      81             : };  // class I420Encoder
      82             : 
      83             : class I420Decoder : public VideoDecoder {
      84             :  public:
      85             :   I420Decoder();
      86             : 
      87             :   virtual ~I420Decoder();
      88             : 
      89             :   // Initialize the decoder.
      90             :   // The user must notify the codec of width and height values.
      91             :   //
      92             :   // Return value         :  WEBRTC_VIDEO_CODEC_OK.
      93             :   //                        <0 - Errors
      94             :   int InitDecode(const VideoCodec* codecSettings,
      95             :                  int /*numberOfCores*/) override;
      96             : 
      97             :   // Decode encoded image (as a part of a video stream). The decoded image
      98             :   // will be returned to the user through the decode complete callback.
      99             :   //
     100             :   // Input:
     101             :   //          - inputImage        : Encoded image to be decoded
     102             :   //          - missingFrames     : True if one or more frames have been lost
     103             :   //                                since the previous decode call.
     104             :   //          - codecSpecificInfo : pointer to specific codec data
     105             :   //          - renderTimeMs      : Render time in Ms
     106             :   //
     107             :   // Return value                 : WEBRTC_VIDEO_CODEC_OK if OK
     108             :   //                                 <0 - Error
     109             :   int Decode(const EncodedImage& inputImage,
     110             :              bool missingFrames,
     111             :              const RTPFragmentationHeader* /*fragmentation*/,
     112             :              const CodecSpecificInfo* /*codecSpecificInfo*/,
     113             :              int64_t /*renderTimeMs*/) override;
     114             : 
     115             :   // Register a decode complete callback object.
     116             :   //
     117             :   // Input:
     118             :   //          - callback         : Callback object which handles decoded images.
     119             :   //
     120             :   // Return value                : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
     121             :   int RegisterDecodeCompleteCallback(DecodedImageCallback* callback) override;
     122             : 
     123             :   // Free decoder memory.
     124             :   //
     125             :   // Return value                : WEBRTC_VIDEO_CODEC_OK if OK.
     126             :   //                                  <0 - Error
     127             :   int Release() override;
     128             : 
     129             :  private:
     130             :   static const uint8_t* ExtractHeader(const uint8_t* buffer,
     131             :                                       uint16_t* width,
     132             :                                       uint16_t* height);
     133             : 
     134             :   int _width;
     135             :   int _height;
     136             :   bool _inited;
     137             :   DecodedImageCallback* _decodeCompleteCallback;
     138             : };  // class I420Decoder
     139             : 
     140             : }  // namespace webrtc
     141             : 
     142             : #endif  // WEBRTC_MODULES_VIDEO_CODING_CODECS_I420_INCLUDE_I420_H_

Generated by: LCOV version 1.13