1 /*
2  *  Copyright (c) 2016 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 MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INITIALIZER_H_
12 #define MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INITIALIZER_H_
13 
14 #include <memory>
15 #include <string>
16 #include <vector>
17 
18 #include "api/video_codecs/video_encoder_config.h"
19 
20 namespace webrtc {
21 
22 class VideoBitrateAllocator;
23 class VideoCodec;
24 
25 class VideoCodecInitializer {
26  public:
27   // Takes a VideoEncoderConfig and the VideoStream configuration and
28   // translates them into the old school VideoCodec type.
29   // It also creates a VideoBitrateAllocator instance, suitable for the codec
30   // type used. For instance, VP8 will create an allocator than can handle
31   // simulcast and temporal layering.
32   // GetBitrateAllocator is called implicitly from here, no need to call again.
33   static bool SetupCodec(const VideoEncoderConfig& config,
34                          const std::vector<VideoStream>& streams,
35                          VideoCodec* codec);
36 
37  private:
38   static VideoCodec VideoEncoderConfigToVideoCodec(
39       const VideoEncoderConfig& config,
40       const std::vector<VideoStream>& streams);
41 };
42 
43 }  // namespace webrtc
44 
45 #endif  // MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INITIALIZER_H_
46