blob: e57a31435279e0c6d04dea8c8a3d096b1e864249 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellander1afca732016-02-07 20:46:45 -08002 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellander1afca732016-02-07 20:46:45 -08004 * 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.org28e20752013-07-10 00:45:36 +00009 */
10
kjellander@webrtc.org5ad12972016-02-12 06:39:40 +010011#ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_
12#define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000013
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000014#include "webrtc/base/refcount.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000015#include "webrtc/common_types.h"
kjellandera96e2d72016-02-04 23:52:28 -080016#include "webrtc/media/base/codec.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000017
18namespace webrtc {
19class VideoEncoder;
20}
21
22namespace cricket {
23
24class 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.org3c16d8b2014-10-13 06:35:10 +000039 virtual ~WebRtcVideoEncoderFactory() {}
henrike@webrtc.org28e20752013-07-10 00:45:36 +000040
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.org28e20752013-07-10 00:45:36 +000045
46 // Returns a list of supported codecs in order of preference.
henrike@webrtc.org28e20752013-07-10 00:45:36 +000047 virtual const std::vector<VideoCodec>& codecs() const = 0;
48
pthatcher@webrtc.org52cd8282015-03-18 02:24:43 +000049 // 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.org28e20752013-07-10 00:45:36 +000058 virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) = 0;
59};
60
61} // namespace cricket
62
kjellander@webrtc.org5ad12972016-02-12 06:39:40 +010063#endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_