henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 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. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
kjellander@webrtc.org | 5ad1297 | 2016-02-12 06:39:40 +0100 | [diff] [blame^] | 11 | #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ |
| 12 | #define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 13 | |
buildbot@webrtc.org | a09a999 | 2014-08-13 17:26:08 +0000 | [diff] [blame] | 14 | #include "webrtc/base/refcount.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 15 | #include "webrtc/common_types.h" |
kjellander | a96e2d7 | 2016-02-04 23:52:28 -0800 | [diff] [blame] | 16 | #include "webrtc/media/base/codec.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | class VideoEncoder; |
| 20 | } |
| 21 | |
| 22 | namespace cricket { |
| 23 | |
| 24 | class WebRtcVideoEncoderFactory { |
| 25 | public: |
| 26 | struct VideoCodec { |
| 27 | webrtc::VideoCodecType type; |
| 28 | std::string name; |
| 29 | int max_width; |
| 30 | int max_height; |
| 31 | int max_fps; |
| 32 | |
| 33 | VideoCodec(webrtc::VideoCodecType t, const std::string& nm, int w, int h, |
| 34 | int fr) |
| 35 | : type(t), name(nm), max_width(w), max_height(h), max_fps(fr) { |
| 36 | } |
| 37 | }; |
| 38 | |
buildbot@webrtc.org | 3c16d8b | 2014-10-13 06:35:10 +0000 | [diff] [blame] | 39 | virtual ~WebRtcVideoEncoderFactory() {} |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 40 | |
| 41 | // Caller takes the ownership of the returned object and it should be released |
| 42 | // by calling DestroyVideoEncoder(). |
| 43 | virtual webrtc::VideoEncoder* CreateVideoEncoder( |
| 44 | webrtc::VideoCodecType type) = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 45 | |
| 46 | // Returns a list of supported codecs in order of preference. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 47 | virtual const std::vector<VideoCodec>& codecs() const = 0; |
| 48 | |
pthatcher@webrtc.org | 52cd828 | 2015-03-18 02:24:43 +0000 | [diff] [blame] | 49 | // Returns true if encoders created by this factory of the given codec type |
| 50 | // will use internal camera sources, meaning that they don't require/expect |
| 51 | // frames to be delivered via webrtc::VideoEncoder::Encode. This flag is used |
| 52 | // as the internal_source parameter to |
| 53 | // webrtc::ViEExternalCodec::RegisterExternalSendCodec. |
| 54 | virtual bool EncoderTypeHasInternalSource(webrtc::VideoCodecType type) const { |
| 55 | return false; |
| 56 | } |
| 57 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 58 | virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) = 0; |
| 59 | }; |
| 60 | |
| 61 | } // namespace cricket |
| 62 | |
kjellander@webrtc.org | 5ad1297 | 2016-02-12 06:39:40 +0100 | [diff] [blame^] | 63 | #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ |