OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2014 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 | |
11 #ifndef WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ | |
12 #define WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ | |
13 | |
14 #include <memory> | |
15 | |
16 #include "webrtc/common_video/include/i420_buffer_pool.h" | |
17 #include "webrtc/media/base/videoframe.h" | |
18 | |
19 namespace cricket { | |
20 | |
21 struct CapturedFrame; | |
22 class VideoFrame; | |
23 | |
24 // Creates cricket::VideoFrames, or a subclass of cricket::VideoFrame | |
25 // depending on the subclass of VideoFrameFactory. | |
26 class VideoFrameFactory { | |
27 public: | |
28 VideoFrameFactory() : apply_rotation_(false) {} | |
29 virtual ~VideoFrameFactory() {} | |
30 | |
31 // The returned frame aliases the aliased_frame if the input color | |
32 // space allows for aliasing, otherwise a color conversion will | |
33 // occur. Returns NULL if conversion fails. | |
34 | |
35 // The returned frame will be a center crop of |input_frame| with | |
36 // size |cropped_width| x |cropped_height|. | |
37 virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame, | |
38 int cropped_width, | |
39 int cropped_height) const = 0; | |
40 | |
41 // The returned frame will be a center crop of |input_frame| with size | |
42 // |cropped_width| x |cropped_height|, scaled to |output_width| x | |
43 // |output_height|. | |
44 virtual VideoFrame* CreateAliasedFrame(const CapturedFrame* input_frame, | |
45 int cropped_input_width, | |
46 int cropped_input_height, | |
47 int output_width, | |
48 int output_height) const; | |
49 | |
50 void SetApplyRotation(bool enable) { apply_rotation_ = enable; } | |
51 | |
52 protected: | |
53 bool apply_rotation_; | |
54 | |
55 private: | |
56 // An internal pool to avoid reallocations. It is mutable because it | |
57 // does not affect behaviour, only performance. | |
58 mutable webrtc::I420BufferPool pool_; | |
59 }; | |
60 | |
61 } // namespace cricket | |
62 | |
63 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAMEFACTORY_H_ | |
OLD | NEW |