Home | History | Annotate | Download | only in video_engine
      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_VIDEO_ENGINE_VIE_CODEC_IMPL_H_
     12 #define WEBRTC_VIDEO_ENGINE_VIE_CODEC_IMPL_H_
     13 
     14 #include "webrtc/typedefs.h"
     15 #include "webrtc/video_engine/include/vie_codec.h"
     16 #include "webrtc/video_engine/vie_defines.h"
     17 #include "webrtc/video_engine/vie_ref_count.h"
     18 
     19 namespace webrtc {
     20 
     21 class ViESharedData;
     22 
     23 class ViECodecImpl
     24     : public ViECodec,
     25       public ViERefCount {
     26  public:
     27   virtual int Release();
     28 
     29   // Implements ViECodec.
     30   virtual int NumberOfCodecs() const;
     31   virtual int GetCodec(const unsigned char list_number,
     32                        VideoCodec& video_codec) const;
     33   virtual int SetSendCodec(const int video_channel,
     34                            const VideoCodec& video_codec);
     35   virtual int GetSendCodec(const int video_channel,
     36                            VideoCodec& video_codec) const;
     37   virtual int SetReceiveCodec(const int video_channel,
     38                               const VideoCodec& video_codec);
     39   virtual int GetReceiveCodec(const int video_channel,
     40                               VideoCodec& video_codec) const;
     41   virtual int GetCodecConfigParameters(
     42     const int video_channel,
     43     unsigned char config_parameters[kConfigParameterSize],
     44     unsigned char& config_parameters_size) const;
     45   virtual int SetImageScaleStatus(const int video_channel, const bool enable);
     46   virtual int GetSendCodecStastistics(const int video_channel,
     47                                       unsigned int& key_frames,
     48                                       unsigned int& delta_frames) const;
     49   virtual int GetReceiveCodecStastistics(const int video_channel,
     50                                          unsigned int& key_frames,
     51                                          unsigned int& delta_frames) const;
     52   virtual int GetReceiveSideDelay(const int video_channel,
     53                                   int* delay_ms) const;
     54   virtual int GetCodecTargetBitrate(const int video_channel,
     55                                     unsigned int* bitrate) const;
     56   virtual unsigned int GetDiscardedPackets(const int video_channel) const;
     57   virtual int SetKeyFrameRequestCallbackStatus(const int video_channel,
     58                                                const bool enable);
     59   virtual int SetSignalKeyPacketLossStatus(const int video_channel,
     60                                            const bool enable,
     61                                            const bool only_key_frames = false);
     62   virtual int RegisterEncoderObserver(const int video_channel,
     63                                       ViEEncoderObserver& observer);
     64   virtual int DeregisterEncoderObserver(const int video_channel);
     65   virtual int RegisterDecoderObserver(const int video_channel,
     66                                       ViEDecoderObserver& observer);
     67   virtual int DeregisterDecoderObserver(const int video_channel);
     68   virtual int SendKeyFrame(const int video_channel);
     69   virtual int WaitForFirstKeyFrame(const int video_channel, const bool wait);
     70   virtual int StartDebugRecording(int video_channel,
     71                                   const char* file_name_utf8);
     72   virtual int StopDebugRecording(int video_channel);
     73   virtual void SuspendBelowMinBitrate(int video_channel);
     74   virtual bool GetSendSideDelay(int video_channel, int* avg_delay_ms,
     75                                 int* max_delay_ms) const;
     76 
     77  protected:
     78   explicit ViECodecImpl(ViESharedData* shared_data);
     79   virtual ~ViECodecImpl();
     80 
     81  private:
     82   bool CodecValid(const VideoCodec& video_codec);
     83 
     84   ViESharedData* shared_data_;
     85 };
     86 
     87 }  // namespace webrtc
     88 
     89 #endif  // WEBRTC_VIDEO_ENGINE_VIE_CODEC_IMPL_H_
     90