| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Indicates the rotation angle in degrees. | 51 // Indicates the rotation angle in degrees. |
| 52 virtual webrtc::VideoRotation rotation() const = 0; | 52 virtual webrtc::VideoRotation rotation() const = 0; |
| 53 | 53 |
| 54 // Make a shallow copy of the frame. The frame buffer itself is not copied. | 54 // Make a shallow copy of the frame. The frame buffer itself is not copied. |
| 55 // Both the current and new VideoFrame will share a single reference-counted | 55 // Both the current and new VideoFrame will share a single reference-counted |
| 56 // frame buffer. | 56 // frame buffer. |
| 57 virtual VideoFrame *Copy() const = 0; | 57 virtual VideoFrame *Copy() const = 0; |
| 58 | 58 |
| 59 // Since VideoFrame supports shallow copy and the internal frame buffer might | |
| 60 // be shared, this function can be used to check exclusive ownership. | |
| 61 virtual bool IsExclusive() const = 0; | |
| 62 | |
| 63 // Return a copy of frame which has its pending rotation applied. The | 59 // Return a copy of frame which has its pending rotation applied. The |
| 64 // ownership of the returned frame is held by this frame. | 60 // ownership of the returned frame is held by this frame. |
| 65 virtual const VideoFrame* GetCopyWithRotationApplied() const = 0; | 61 virtual const VideoFrame* GetCopyWithRotationApplied() const = 0; |
| 66 | 62 |
| 67 // 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. |
| 68 // 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 |
| 69 // 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. |
| 70 // If there is insufficient space, nothing is written. | 66 // If there is insufficient space, nothing is written. |
| 71 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, | 67 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, |
| 72 uint8_t* buffer, | 68 uint8_t* buffer, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 88 bool interpolate, | 84 bool interpolate, |
| 89 bool crop) const; | 85 bool crop) const; |
| 90 | 86 |
| 91 // Writes the frame into the target VideoFrame, stretched to the size of that | 87 // Writes the frame into the target VideoFrame, stretched to the size of that |
| 92 // frame. The parameter "interpolate" controls whether to interpolate or just | 88 // frame. The parameter "interpolate" controls whether to interpolate or just |
| 93 // take the nearest-point. The parameter "crop" controls whether to crop this | 89 // take the nearest-point. The parameter "crop" controls whether to crop this |
| 94 // frame to the aspect ratio of the target frame before stretching. | 90 // frame to the aspect ratio of the target frame before stretching. |
| 95 virtual void StretchToFrame(VideoFrame *target, bool interpolate, | 91 virtual void StretchToFrame(VideoFrame *target, bool interpolate, |
| 96 bool crop) const; | 92 bool crop) const; |
| 97 | 93 |
| 98 // Stretches the frame to the given size, creating a new VideoFrame object to | |
| 99 // hold it. The parameter "interpolate" controls whether to interpolate or | |
| 100 // just take the nearest-point. The parameter "crop" controls whether to crop | |
| 101 // this frame to the aspect ratio of the given dimensions before stretching. | |
| 102 virtual VideoFrame *Stretch(size_t w, size_t h, bool interpolate, | |
| 103 bool crop) const; | |
| 104 | |
| 105 // Sets the video frame to black. | 94 // Sets the video frame to black. |
| 106 virtual bool SetToBlack(); | 95 virtual bool SetToBlack(); |
| 107 | 96 |
| 108 // Tests if sample is valid. Returns true if valid. | 97 // Tests if sample is valid. Returns true if valid. |
| 109 static bool Validate(uint32_t fourcc, | 98 static bool Validate(uint32_t fourcc, |
| 110 int w, | 99 int w, |
| 111 int h, | 100 int h, |
| 112 const uint8_t* sample, | 101 const uint8_t* sample, |
| 113 size_t sample_size); | 102 size_t sample_size); |
| 114 | 103 |
| 115 protected: | 104 protected: |
| 116 // Writes the frame into the given planes, stretched to the given width and | 105 // Writes the frame into the given planes, stretched to the given width and |
| 117 // height. The parameter "interpolate" controls whether to interpolate or just | 106 // height. The parameter "interpolate" controls whether to interpolate or just |
| 118 // take the nearest-point. The parameter "crop" controls whether to crop this | 107 // take the nearest-point. The parameter "crop" controls whether to crop this |
| 119 // frame to the aspect ratio of the given dimensions before stretching. | 108 // frame to the aspect ratio of the given dimensions before stretching. |
| 120 virtual bool CopyToPlanes(uint8_t* dst_y, | 109 virtual bool CopyToPlanes(uint8_t* dst_y, |
| 121 uint8_t* dst_u, | 110 uint8_t* dst_u, |
| 122 uint8_t* dst_v, | 111 uint8_t* dst_v, |
| 123 int32_t dst_pitch_y, | 112 int32_t dst_pitch_y, |
| 124 int32_t dst_pitch_u, | 113 int32_t dst_pitch_u, |
| 125 int32_t dst_pitch_v) const; | 114 int32_t dst_pitch_v) const; |
| 126 | 115 |
| 127 // Creates an empty frame. | 116 // Creates an empty frame. |
| 128 virtual VideoFrame* CreateEmptyFrame(int w, | 117 virtual VideoFrame* CreateEmptyFrame(int w, |
| 129 int h, | 118 int h, |
| 130 int64_t timestamp_us) const = 0; | 119 int64_t timestamp_us) const = 0; |
| 120 |
| 131 virtual void set_rotation(webrtc::VideoRotation rotation) = 0; | 121 virtual void set_rotation(webrtc::VideoRotation rotation) = 0; |
| 132 }; | 122 }; |
| 133 | 123 |
| 134 } // namespace cricket | 124 } // namespace cricket |
| 135 | 125 |
| 136 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 126 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
| OLD | NEW |