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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 // Callback function which is called when an image has been encoded. | 57 // Callback function which is called when an image has been encoded. |
58 virtual Result OnEncodedImage( | 58 virtual Result OnEncodedImage( |
59 const EncodedImage& encoded_image, | 59 const EncodedImage& encoded_image, |
60 const CodecSpecificInfo* codec_specific_info, | 60 const CodecSpecificInfo* codec_specific_info, |
61 const RTPFragmentationHeader* fragmentation) = 0; | 61 const RTPFragmentationHeader* fragmentation) = 0; |
62 }; | 62 }; |
63 | 63 |
64 class VideoEncoder { | 64 class VideoEncoder { |
65 public: | 65 public: |
| 66 enum EncoderType { |
| 67 kH264, |
| 68 kVp8, |
| 69 kVp9, |
| 70 kUnsupportedCodec, |
| 71 }; |
| 72 |
| 73 static VideoEncoder* Create(EncoderType codec_type); |
| 74 // Returns true if this type of encoder can be created using |
| 75 // VideoEncoder::Create. |
| 76 static bool IsSupportedSoftware(EncoderType codec_type); |
| 77 static EncoderType CodecToEncoderType(VideoCodecType codec_type); |
| 78 |
66 static VideoCodecVP8 GetDefaultVp8Settings(); | 79 static VideoCodecVP8 GetDefaultVp8Settings(); |
67 static VideoCodecVP9 GetDefaultVp9Settings(); | 80 static VideoCodecVP9 GetDefaultVp9Settings(); |
68 static VideoCodecH264 GetDefaultH264Settings(); | 81 static VideoCodecH264 GetDefaultH264Settings(); |
69 | 82 |
70 virtual ~VideoEncoder() {} | 83 virtual ~VideoEncoder() {} |
71 | 84 |
72 // Initialize the encoder with the information from the codecSettings | 85 // Initialize the encoder with the information from the codecSettings |
73 // | 86 // |
74 // Input: | 87 // Input: |
75 // - codec_settings : Codec settings | 88 // - codec_settings : Codec settings |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 162 } |
150 | 163 |
151 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } | 164 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } |
152 virtual void OnDroppedFrame() {} | 165 virtual void OnDroppedFrame() {} |
153 virtual bool SupportsNativeHandle() const { return false; } | 166 virtual bool SupportsNativeHandle() const { return false; } |
154 virtual const char* ImplementationName() const { return "unknown"; } | 167 virtual const char* ImplementationName() const { return "unknown"; } |
155 }; | 168 }; |
156 | 169 |
157 } // namespace webrtc | 170 } // namespace webrtc |
158 #endif // WEBRTC_VIDEO_ENCODER_H_ | 171 #endif // WEBRTC_VIDEO_ENCODER_H_ |
OLD | NEW |