blob: 7b2b156f2f7f9665f1712d2c905b0f5bd7fabf09 [file] [log] [blame]
Magnus Jedvertd4b0c052017-09-14 10:24:54 +02001/*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef API_VIDEO_CODECS_VIDEO_ENCODER_FACTORY_H_
12#define API_VIDEO_CODECS_VIDEO_ENCODER_FACTORY_H_
Magnus Jedvertd4b0c052017-09-14 10:24:54 +020013
14#include <memory>
15#include <vector>
16
17namespace webrtc {
18
19class VideoEncoder;
20struct SdpVideoFormat;
21
22// A factory that creates VideoEncoders.
23// NOTE: This class is still under development and may change without notice.
24class VideoEncoderFactory {
25 public:
26 // TODO(magjed): Try to get rid of this struct.
27 struct CodecInfo {
Mirta Dvorniciccdc5eb02018-12-05 13:22:09 +010028 CodecInfo();
29 ~CodecInfo();
30
Magnus Jedvertd4b0c052017-09-14 10:24:54 +020031 // |is_hardware_accelerated| is true if the encoders created by this factory
32 // of the given codec will use hardware support.
33 bool is_hardware_accelerated;
34 // |has_internal_source| is true if encoders created by this factory of the
35 // given codec will use internal camera sources, meaning that they don't
36 // require/expect frames to be delivered via webrtc::VideoEncoder::Encode.
37 // This flag is used as the internal_source parameter to
38 // webrtc::ViEExternalCodec::RegisterExternalSendCodec.
39 bool has_internal_source;
40 };
41
42 // Returns a list of supported video formats in order of preference, to use
43 // for signaling etc.
44 virtual std::vector<SdpVideoFormat> GetSupportedFormats() const = 0;
45
46 // Returns information about how this format will be encoded. The specified
47 // format must be one of the supported formats by this factory.
48 // TODO(magjed): Try to get rid of this method.
Mirta Dvorniciccdc5eb02018-12-05 13:22:09 +010049 virtual CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const;
Magnus Jedvertd4b0c052017-09-14 10:24:54 +020050
51 // Creates a VideoEncoder for the specified format.
52 virtual std::unique_ptr<VideoEncoder> CreateVideoEncoder(
53 const SdpVideoFormat& format) = 0;
54
55 virtual ~VideoEncoderFactory() {}
56};
57
58} // namespace webrtc
59
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020060#endif // API_VIDEO_CODECS_VIDEO_ENCODER_FACTORY_H_