| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual Result OnEncodedImage( | 60 virtual Result OnEncodedImage( |
| 61 const EncodedImage& encoded_image, | 61 const EncodedImage& encoded_image, |
| 62 const CodecSpecificInfo* codec_specific_info, | 62 const CodecSpecificInfo* codec_specific_info, |
| 63 const RTPFragmentationHeader* fragmentation) = 0; | 63 const RTPFragmentationHeader* fragmentation) = 0; |
| 64 | 64 |
| 65 virtual void OnDroppedFrame() {} | 65 virtual void OnDroppedFrame() {} |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 class VideoEncoder { | 68 class VideoEncoder { |
| 69 public: | 69 public: |
| 70 enum EncoderType { | |
| 71 kH264, | |
| 72 kVp8, | |
| 73 kVp9, | |
| 74 kUnsupportedCodec, | |
| 75 }; | |
| 76 struct QpThresholds { | 70 struct QpThresholds { |
| 77 QpThresholds(int l, int h) : low(l), high(h) {} | 71 QpThresholds(int l, int h) : low(l), high(h) {} |
| 78 QpThresholds() : low(-1), high(-1) {} | 72 QpThresholds() : low(-1), high(-1) {} |
| 79 int low; | 73 int low; |
| 80 int high; | 74 int high; |
| 81 }; | 75 }; |
| 82 struct ScalingSettings { | 76 struct ScalingSettings { |
| 83 ScalingSettings(bool on, int low, int high) | 77 ScalingSettings(bool on, int low, int high) |
| 84 : enabled(on), | 78 : enabled(on), |
| 85 thresholds(rtc::Optional<QpThresholds>(QpThresholds(low, high))) {} | 79 thresholds(rtc::Optional<QpThresholds>(QpThresholds(low, high))) {} |
| 86 explicit ScalingSettings(bool on) : enabled(on) {} | 80 explicit ScalingSettings(bool on) : enabled(on) {} |
| 87 const bool enabled; | 81 const bool enabled; |
| 88 const rtc::Optional<QpThresholds> thresholds; | 82 const rtc::Optional<QpThresholds> thresholds; |
| 89 }; | 83 }; |
| 90 static VideoEncoder* Create(EncoderType codec_type); | |
| 91 // Returns true if this type of encoder can be created using | |
| 92 // VideoEncoder::Create. | |
| 93 static bool IsSupportedSoftware(EncoderType codec_type); | |
| 94 static EncoderType CodecToEncoderType(VideoCodecType codec_type); | |
| 95 | 84 |
| 96 static VideoCodecVP8 GetDefaultVp8Settings(); | 85 static VideoCodecVP8 GetDefaultVp8Settings(); |
| 97 static VideoCodecVP9 GetDefaultVp9Settings(); | 86 static VideoCodecVP9 GetDefaultVp9Settings(); |
| 98 static VideoCodecH264 GetDefaultH264Settings(); | 87 static VideoCodecH264 GetDefaultH264Settings(); |
| 99 | 88 |
| 100 virtual ~VideoEncoder() {} | 89 virtual ~VideoEncoder() {} |
| 101 | 90 |
| 102 // Initialize the encoder with the information from the codecSettings | 91 // Initialize the encoder with the information from the codecSettings |
| 103 // | 92 // |
| 104 // Input: | 93 // Input: |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return ScalingSettings(false); | 173 return ScalingSettings(false); |
| 185 } | 174 } |
| 186 | 175 |
| 187 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } | 176 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } |
| 188 virtual bool SupportsNativeHandle() const { return false; } | 177 virtual bool SupportsNativeHandle() const { return false; } |
| 189 virtual const char* ImplementationName() const { return "unknown"; } | 178 virtual const char* ImplementationName() const { return "unknown"; } |
| 190 }; | 179 }; |
| 191 | 180 |
| 192 } // namespace webrtc | 181 } // namespace webrtc |
| 193 #endif // WEBRTC_API_VIDEO_CODECS_VIDEO_ENCODER_H_ | 182 #endif // WEBRTC_API_VIDEO_CODECS_VIDEO_ENCODER_H_ |
| OLD | NEW |