| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 int dh, | 44 int dh, |
| 45 uint8_t* sample, | 45 uint8_t* sample, |
| 46 size_t sample_size, | 46 size_t sample_size, |
| 47 int64_t time_stamp_ns, | 47 int64_t time_stamp_ns, |
| 48 webrtc::VideoRotation rotation); | 48 webrtc::VideoRotation rotation); |
| 49 | 49 |
| 50 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); | 50 bool Init(const CapturedFrame* frame, int dw, int dh, bool apply_rotation); |
| 51 | 51 |
| 52 void InitToEmptyBuffer(int w, int h, int64_t time_stamp_ns); | 52 void InitToEmptyBuffer(int w, int h, int64_t time_stamp_ns); |
| 53 | 53 |
| 54 bool InitToBlack(int w, int h, int64_t time_stamp_ns) override; | 54 bool InitToBlack(int w, int h, int64_t time_stamp_ns); |
| 55 | |
| 56 // From base class VideoFrame. | |
| 57 bool Reset(uint32_t format, | |
| 58 int w, | |
| 59 int h, | |
| 60 int dw, | |
| 61 int dh, | |
| 62 uint8_t* sample, | |
| 63 size_t sample_size, | |
| 64 int64_t time_stamp_ns, | |
| 65 webrtc::VideoRotation rotation, | |
| 66 bool apply_rotation) override; | |
| 67 | 55 |
| 68 size_t GetWidth() const override; | 56 size_t GetWidth() const override; |
| 69 size_t GetHeight() const override; | 57 size_t GetHeight() const override; |
| 70 const uint8_t* GetYPlane() const override; | 58 const uint8_t* GetYPlane() const override; |
| 71 const uint8_t* GetUPlane() const override; | 59 const uint8_t* GetUPlane() const override; |
| 72 const uint8_t* GetVPlane() const override; | 60 const uint8_t* GetVPlane() const override; |
| 73 uint8_t* GetYPlane() override; | 61 uint8_t* GetYPlane() override; |
| 74 uint8_t* GetUPlane() override; | 62 uint8_t* GetUPlane() override; |
| 75 uint8_t* GetVPlane() override; | 63 uint8_t* GetVPlane() override; |
| 76 int32_t GetYPitch() const override; | 64 int32_t GetYPitch() const override; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 96 uint8_t* buffer, | 84 uint8_t* buffer, |
| 97 size_t size, | 85 size_t size, |
| 98 int stride_rgb) const override; | 86 int stride_rgb) const override; |
| 99 | 87 |
| 100 const VideoFrame* GetCopyWithRotationApplied() const override; | 88 const VideoFrame* GetCopyWithRotationApplied() const override; |
| 101 | 89 |
| 102 protected: | 90 protected: |
| 103 void SetRotation(webrtc::VideoRotation rotation) override { | 91 void SetRotation(webrtc::VideoRotation rotation) override { |
| 104 rotation_ = rotation; | 92 rotation_ = rotation; |
| 105 } | 93 } |
| 94 // Creates a frame from a raw sample with FourCC |format| and size |w| x |h|. |
| 95 // |h| can be negative indicating a vertically flipped image. |
| 96 // |dw| is destination width; can be less than |w| if cropping is desired. |
| 97 // |dh| is destination height, like |dw|, but must be a positive number. |
| 98 // Returns whether the function succeeded or failed. |
| 99 bool Reset(uint32_t format, |
| 100 int w, |
| 101 int h, |
| 102 int dw, |
| 103 int dh, |
| 104 uint8_t* sample, |
| 105 size_t sample_size, |
| 106 int64_t time_stamp_ns, |
| 107 webrtc::VideoRotation rotation, |
| 108 bool apply_rotation); |
| 106 | 109 |
| 107 private: | 110 private: |
| 108 VideoFrame* CreateEmptyFrame(int w, int h, | 111 VideoFrame* CreateEmptyFrame(int w, int h, |
| 109 int64_t time_stamp_ns) const override; | 112 int64_t time_stamp_ns) const override; |
| 110 | 113 |
| 111 // An opaque reference counted handle that stores the pixel data. | 114 // An opaque reference counted handle that stores the pixel data. |
| 112 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; | 115 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; |
| 113 int64_t time_stamp_ns_; | 116 int64_t time_stamp_ns_; |
| 114 webrtc::VideoRotation rotation_; | 117 webrtc::VideoRotation rotation_; |
| 115 | 118 |
| 116 // This is mutable as the calculation is expensive but once calculated, it | 119 // This is mutable as the calculation is expensive but once calculated, it |
| 117 // remains const. | 120 // remains const. |
| 118 mutable std::unique_ptr<VideoFrame> rotated_frame_; | 121 mutable std::unique_ptr<VideoFrame> rotated_frame_; |
| 119 }; | 122 }; |
| 120 | 123 |
| 121 } // namespace cricket | 124 } // namespace cricket |
| 122 | 125 |
| 123 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_ | 126 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOFRAME_H_ |
| OLD | NEW |