OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Converts the I420 data to RGB of a certain type such as ARGB and ABGR. | 63 // Converts the I420 data to RGB of a certain type such as ARGB and ABGR. |
64 // Returns the frame's actual size, regardless of whether it was written or | 64 // Returns the frame's actual size, regardless of whether it was written or |
65 // not (like snprintf). Parameters size and stride_rgb are in units of bytes. | 65 // not (like snprintf). Parameters size and stride_rgb are in units of bytes. |
66 // If there is insufficient space, nothing is written. | 66 // If there is insufficient space, nothing is written. |
67 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, | 67 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, |
68 uint8_t* buffer, | 68 uint8_t* buffer, |
69 size_t size, | 69 size_t size, |
70 int stride_rgb) const; | 70 int stride_rgb) const; |
71 | 71 |
72 // Writes the frame into the given planes, stretched to the given width and | |
73 // height. The parameter "interpolate" controls whether to interpolate or just | |
74 // take the nearest-point. The parameter "crop" controls whether to crop this | |
75 // frame to the aspect ratio of the given dimensions before stretching. | |
76 virtual void StretchToPlanes(uint8_t* y, | |
77 uint8_t* u, | |
78 uint8_t* v, | |
79 int32_t pitchY, | |
80 int32_t pitchU, | |
81 int32_t pitchV, | |
82 size_t width, | |
83 size_t height, | |
84 bool interpolate, | |
85 bool crop) const; | |
86 | |
87 // Writes the frame into the target VideoFrame, stretched to the size of that | |
88 // frame. The parameter "interpolate" controls whether to interpolate or just | |
89 // take the nearest-point. The parameter "crop" controls whether to crop this | |
90 // frame to the aspect ratio of the target frame before stretching. | |
91 virtual void StretchToFrame(VideoFrame *target, bool interpolate, | |
92 bool crop) const; | |
93 | |
94 // Tests if sample is valid. Returns true if valid. | 72 // Tests if sample is valid. Returns true if valid. |
95 static bool Validate(uint32_t fourcc, | 73 static bool Validate(uint32_t fourcc, |
96 int w, | 74 int w, |
97 int h, | 75 int h, |
98 const uint8_t* sample, | 76 const uint8_t* sample, |
99 size_t sample_size); | 77 size_t sample_size); |
100 | 78 |
101 protected: | 79 protected: |
102 // Writes the frame into the given planes, stretched to the given width and | |
103 // height. The parameter "interpolate" controls whether to interpolate or just | |
104 // take the nearest-point. The parameter "crop" controls whether to crop this | |
105 // frame to the aspect ratio of the given dimensions before stretching. | |
106 virtual bool CopyToPlanes(uint8_t* dst_y, | |
107 uint8_t* dst_u, | |
108 uint8_t* dst_v, | |
109 int32_t dst_pitch_y, | |
110 int32_t dst_pitch_u, | |
111 int32_t dst_pitch_v) const; | |
112 | |
113 // Creates an empty frame. | 80 // Creates an empty frame. |
114 virtual VideoFrame* CreateEmptyFrame(int w, | 81 virtual VideoFrame* CreateEmptyFrame(int w, |
115 int h, | 82 int h, |
116 int64_t timestamp_us) const = 0; | 83 int64_t timestamp_us) const = 0; |
117 | 84 |
118 virtual void set_rotation(webrtc::VideoRotation rotation) = 0; | 85 virtual void set_rotation(webrtc::VideoRotation rotation) = 0; |
119 }; | 86 }; |
120 | 87 |
121 } // namespace cricket | 88 } // namespace cricket |
122 | 89 |
123 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 90 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
OLD | NEW |