1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef MEDIA_VIDEO_VIDEO_ENCODER_INFO_H_
6 #define MEDIA_VIDEO_VIDEO_ENCODER_INFO_H_
7 
8 #include <stdint.h>
9 #include <string>
10 #include <vector>
11 
12 #include "media/base/media_export.h"
13 #include "ui/gfx/geometry/size.h"
14 
15 namespace media {
16 
17 // These chromium classes are the corresponding classes in webrtc project.
18 // See third_party/webrtc/api/video_codecs/video_encoder.h for the detail.
19 
20 struct MEDIA_EXPORT ScalingSettings {
21   ScalingSettings();
22   ScalingSettings(int min_qp, int max_qp);
23   ScalingSettings(const ScalingSettings&);
24   ~ScalingSettings();
25 
26   int min_qp = 4;
27   int max_qp = 157;
28 };
29 
30 struct MEDIA_EXPORT ResolutionBitrateLimit {
31   ResolutionBitrateLimit();
32   ResolutionBitrateLimit(const ResolutionBitrateLimit&);
33   ResolutionBitrateLimit(const gfx::Size& frame_size,
34                          int min_start_bitrate_bps,
35                          int min_bitrate_bps,
36                          int max_bitrate_bps);
37   ~ResolutionBitrateLimit();
38 
39   gfx::Size frame_size;
40   int min_start_bitrate_bps = 0;
41   int min_bitrate_bps = 0;
42   int max_bitrate_bps = 0;
43 };
44 
45 struct MEDIA_EXPORT VideoEncoderInfo {
46   static constexpr size_t kMaxSpatialLayers = 5;
47 
48   VideoEncoderInfo();
49   VideoEncoderInfo(const VideoEncoderInfo&);
50   ~VideoEncoderInfo();
51 
52   std::string implementation_name;
53 
54   bool supports_native_handle = true;
55   bool has_trusted_rate_controller = false;
56   bool is_hardware_accelerated = true;
57   bool supports_simulcast = false;
58 
59   ScalingSettings scaling_settings;
60   std::vector<uint8_t> fps_allocation[kMaxSpatialLayers];
61   std::vector<ResolutionBitrateLimit> resolution_bitrate_limits;
62 };
63 
64 }  // namespace media
65 
66 #endif  // MEDIA_VIDEO_VIDEO_ENCODER_INFO_H_
67