OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
11 #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ | 11 #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ |
12 #define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ | 12 #define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/common_types.h" | 16 #include "webrtc/common_types.h" |
17 #include "webrtc/media/base/codec.h" | 17 #include "webrtc/media/base/codec.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 class VideoEncoder; | 20 class VideoEncoder; |
21 } | 21 } |
22 | 22 |
23 namespace cricket { | 23 namespace cricket { |
24 | 24 |
25 class WebRtcVideoEncoderFactory { | 25 class WebRtcVideoEncoderFactory { |
26 public: | 26 public: |
27 // This VideoCodec class is deprecated. Use cricket::VideoCodec directly | |
28 // instead and the corresponding factory function. See | |
29 // http://crbug/webrtc/6402 for more info. | |
30 struct VideoCodec { | |
31 webrtc::VideoCodecType type; | |
32 std::string name; | |
33 | |
34 VideoCodec(webrtc::VideoCodecType t, const std::string& nm) | |
35 : type(t), name(nm) {} | |
36 | |
37 VideoCodec(webrtc::VideoCodecType t, | |
38 const std::string& nm, | |
39 int w, | |
40 int h, | |
41 int fr) | |
42 : type(t), name(nm) {} | |
43 }; | |
44 | |
45 virtual ~WebRtcVideoEncoderFactory() {} | 27 virtual ~WebRtcVideoEncoderFactory() {} |
46 | 28 |
47 // TODO(magjed): Make these functions pure virtual when every external client | |
48 // implements it. See http://crbug/webrtc/6402 for more info. | |
49 // Caller takes the ownership of the returned object and it should be released | 29 // Caller takes the ownership of the returned object and it should be released |
50 // by calling DestroyVideoEncoder(). | 30 // by calling DestroyVideoEncoder(). |
51 virtual webrtc::VideoEncoder* CreateVideoEncoder( | 31 virtual webrtc::VideoEncoder* CreateVideoEncoder( |
52 const cricket::VideoCodec& codec); | 32 const cricket::VideoCodec& codec) = 0; |
53 | 33 |
54 // Returns a list of supported codecs in order of preference. | 34 // Returns a list of supported codecs in order of preference. |
55 virtual const std::vector<cricket::VideoCodec>& supported_codecs() const; | 35 virtual const std::vector<cricket::VideoCodec>& supported_codecs() const = 0; |
56 | |
57 // Caller takes the ownership of the returned object and it should be released | |
58 // by calling DestroyVideoEncoder(). | |
59 // Deprecated: Use cricket::VideoCodec as argument instead. See | |
60 // http://crbug/webrtc/6402 for more info. | |
61 virtual webrtc::VideoEncoder* CreateVideoEncoder(webrtc::VideoCodecType type); | |
62 | |
63 // Returns a list of supported codecs in order of preference. | |
64 // Deprecated: Return cricket::VideoCodecs instead. See | |
65 // http://crbug/webrtc/6402 for more info. | |
66 virtual const std::vector<VideoCodec>& codecs() const; | |
67 | 36 |
68 // Returns true if encoders created by this factory of the given codec type | 37 // Returns true if encoders created by this factory of the given codec type |
69 // will use internal camera sources, meaning that they don't require/expect | 38 // will use internal camera sources, meaning that they don't require/expect |
70 // frames to be delivered via webrtc::VideoEncoder::Encode. This flag is used | 39 // frames to be delivered via webrtc::VideoEncoder::Encode. This flag is used |
71 // as the internal_source parameter to | 40 // as the internal_source parameter to |
72 // webrtc::ViEExternalCodec::RegisterExternalSendCodec. | 41 // webrtc::ViEExternalCodec::RegisterExternalSendCodec. |
73 virtual bool EncoderTypeHasInternalSource(webrtc::VideoCodecType type) const { | 42 virtual bool EncoderTypeHasInternalSource(webrtc::VideoCodecType type) const { |
74 return false; | 43 return false; |
75 } | 44 } |
76 | 45 |
77 virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) = 0; | 46 virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) = 0; |
78 | |
79 private: | |
80 // TODO(magjed): Remove these. They are necessary in order to return a const | |
81 // reference to a std::vector in the default implementations of codecs() and | |
82 // supported_codecs(). See http://crbug/webrtc/6402 for more info. | |
83 mutable std::vector<VideoCodec> encoder_codecs_; | |
84 mutable std::vector<cricket::VideoCodec> codecs_; | |
85 }; | 47 }; |
86 | 48 |
87 } // namespace cricket | 49 } // namespace cricket |
88 | 50 |
89 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ | 51 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENCODERFACTORY_H_ |
OLD | NEW |