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