Chromium Code Reviews| 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 | 59 // Create a new frame with a given buffer and meta data. |
| 60 // be shared, this function can be used to check exclusive ownership. | 60 // TODO(nisse): Needed by VideoFactory. Must be deleted for merge of |
|
magjed_webrtc
2016/05/25 13:17:01
I don't see the need for this function. Why not us
nisse-webrtc
2016/05/25 13:39:47
It's used in VideoFrameFactory::CreateAliasedFrame
magjed_webrtc
2016/05/25 14:56:07
No, we don't have to care about that. The only imp
nisse-webrtc
2016/05/26 07:44:42
I see. I'll try that then.
| |
| 61 virtual bool IsExclusive() const = 0; | 61 // cricket::VideoFrame and webrtc::VideoFrame. |
| 62 virtual std::unique_ptr<VideoFrame> CreateWithBuffer( | |
| 63 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, | |
| 64 webrtc::VideoRotation rotation, | |
| 65 int64_t timestamp_us) const = 0; | |
| 62 | 66 |
| 63 // Return a copy of frame which has its pending rotation applied. The | 67 // Return a copy of frame which has its pending rotation applied. The |
| 64 // ownership of the returned frame is held by this frame. | 68 // ownership of the returned frame is held by this frame. |
| 65 virtual const VideoFrame* GetCopyWithRotationApplied() const = 0; | 69 virtual const VideoFrame* GetCopyWithRotationApplied() const = 0; |
| 66 | 70 |
| 67 // Converts the I420 data to RGB of a certain type such as ARGB and ABGR. | 71 // 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 | 72 // 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. | 73 // not (like snprintf). Parameters size and stride_rgb are in units of bytes. |
| 70 // If there is insufficient space, nothing is written. | 74 // If there is insufficient space, nothing is written. |
| 71 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, | 75 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 88 bool interpolate, | 92 bool interpolate, |
| 89 bool crop) const; | 93 bool crop) const; |
| 90 | 94 |
| 91 // Writes the frame into the target VideoFrame, stretched to the size of that | 95 // Writes the frame into the target VideoFrame, stretched to the size of that |
| 92 // frame. The parameter "interpolate" controls whether to interpolate or just | 96 // frame. The parameter "interpolate" controls whether to interpolate or just |
| 93 // take the nearest-point. The parameter "crop" controls whether to crop this | 97 // take the nearest-point. The parameter "crop" controls whether to crop this |
| 94 // frame to the aspect ratio of the target frame before stretching. | 98 // frame to the aspect ratio of the target frame before stretching. |
| 95 virtual void StretchToFrame(VideoFrame *target, bool interpolate, | 99 virtual void StretchToFrame(VideoFrame *target, bool interpolate, |
| 96 bool crop) const; | 100 bool crop) const; |
| 97 | 101 |
| 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. | 102 // Sets the video frame to black. |
| 106 virtual bool SetToBlack(); | 103 virtual bool SetToBlack(); |
| 107 | 104 |
| 108 // Tests if sample is valid. Returns true if valid. | 105 // Tests if sample is valid. Returns true if valid. |
| 109 static bool Validate(uint32_t fourcc, | 106 static bool Validate(uint32_t fourcc, |
| 110 int w, | 107 int w, |
| 111 int h, | 108 int h, |
| 112 const uint8_t* sample, | 109 const uint8_t* sample, |
| 113 size_t sample_size); | 110 size_t sample_size); |
| 114 | 111 |
| 115 protected: | 112 protected: |
| 116 // Writes the frame into the given planes, stretched to the given width and | 113 // Writes the frame into the given planes, stretched to the given width and |
| 117 // height. The parameter "interpolate" controls whether to interpolate or just | 114 // height. The parameter "interpolate" controls whether to interpolate or just |
| 118 // take the nearest-point. The parameter "crop" controls whether to crop this | 115 // take the nearest-point. The parameter "crop" controls whether to crop this |
| 119 // frame to the aspect ratio of the given dimensions before stretching. | 116 // frame to the aspect ratio of the given dimensions before stretching. |
| 120 virtual bool CopyToPlanes(uint8_t* dst_y, | 117 virtual bool CopyToPlanes(uint8_t* dst_y, |
| 121 uint8_t* dst_u, | 118 uint8_t* dst_u, |
| 122 uint8_t* dst_v, | 119 uint8_t* dst_v, |
| 123 int32_t dst_pitch_y, | 120 int32_t dst_pitch_y, |
| 124 int32_t dst_pitch_u, | 121 int32_t dst_pitch_u, |
| 125 int32_t dst_pitch_v) const; | 122 int32_t dst_pitch_v) const; |
| 126 | 123 |
| 127 // Creates an empty frame. | 124 // Creates an empty frame. |
| 128 virtual VideoFrame* CreateEmptyFrame(int w, | 125 virtual VideoFrame* CreateEmptyFrame(int w, |
| 129 int h, | 126 int h, |
| 130 int64_t timestamp_us) const = 0; | 127 int64_t timestamp_us) const = 0; |
| 128 | |
| 131 virtual void set_rotation(webrtc::VideoRotation rotation) = 0; | 129 virtual void set_rotation(webrtc::VideoRotation rotation) = 0; |
| 132 }; | 130 }; |
| 133 | 131 |
| 134 } // namespace cricket | 132 } // namespace cricket |
| 135 | 133 |
| 136 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 134 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
| OLD | NEW |