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