| 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 |
| 11 #ifndef WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 11 #ifndef WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
| 12 #define WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 12 #define WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
| 13 | 13 |
| 14 #include "webrtc/base/basictypes.h" | 14 #include "webrtc/base/basictypes.h" |
| 15 #include "webrtc/base/stream.h" | 15 #include "webrtc/base/stream.h" |
| 16 #include "webrtc/common_video/include/video_frame_buffer.h" | 16 #include "webrtc/common_video/include/video_frame_buffer.h" |
| 17 #include "webrtc/common_video/rotation.h" | 17 #include "webrtc/common_video/rotation.h" |
| 18 | 18 |
| 19 namespace cricket { | 19 namespace cricket { |
| 20 | 20 |
| 21 // Represents a YUV420 (a.k.a. I420) video frame. | 21 // Represents a YUV420 (a.k.a. I420) video frame. |
| 22 class VideoFrame { | 22 class VideoFrame { |
| 23 public: | 23 public: |
| 24 VideoFrame() {} | 24 VideoFrame() {} |
| 25 virtual ~VideoFrame() {} | 25 virtual ~VideoFrame() {} |
| 26 | 26 |
| 27 virtual bool InitToBlack(int w, int h, int64_t time_stamp) = 0; | |
| 28 | |
| 29 // Creates a frame from a raw sample with FourCC |format| and size |w| x |h|. | |
| 30 // |h| can be negative indicating a vertically flipped image. | |
| 31 // |dw| is destination width; can be less than |w| if cropping is desired. | |
| 32 // |dh| is destination height, like |dw|, but must be a positive number. | |
| 33 // Returns whether the function succeeded or failed. | |
| 34 | |
| 35 virtual bool Reset(uint32_t fourcc, | |
| 36 int w, | |
| 37 int h, | |
| 38 int dw, | |
| 39 int dh, | |
| 40 uint8_t* sample, | |
| 41 size_t sample_size, | |
| 42 int64_t time_stamp, | |
| 43 webrtc::VideoRotation rotation, | |
| 44 bool apply_rotation) = 0; | |
| 45 | |
| 46 // Basic accessors. | 27 // Basic accessors. |
| 47 // Note this is the width and height without rotation applied. | 28 // Note this is the width and height without rotation applied. |
| 48 virtual size_t GetWidth() const = 0; | 29 virtual size_t GetWidth() const = 0; |
| 49 virtual size_t GetHeight() const = 0; | 30 virtual size_t GetHeight() const = 0; |
| 50 | 31 |
| 51 size_t GetChromaWidth() const { return (GetWidth() + 1) / 2; } | 32 size_t GetChromaWidth() const { return (GetWidth() + 1) / 2; } |
| 52 size_t GetChromaHeight() const { return (GetHeight() + 1) / 2; } | 33 size_t GetChromaHeight() const { return (GetHeight() + 1) / 2; } |
| 53 size_t GetChromaSize() const { return GetUPitch() * GetChromaHeight(); } | 34 size_t GetChromaSize() const { return GetUPitch() * GetChromaHeight(); } |
| 54 // These can return NULL if the object is not backed by a buffer. | 35 // These can return NULL if the object is not backed by a buffer. |
| 55 virtual const uint8_t* GetYPlane() const = 0; | 36 virtual const uint8_t* GetYPlane() const = 0; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 144 |
| 164 // Creates an empty frame. | 145 // Creates an empty frame. |
| 165 virtual VideoFrame *CreateEmptyFrame(int w, int h, | 146 virtual VideoFrame *CreateEmptyFrame(int w, int h, |
| 166 int64_t time_stamp) const = 0; | 147 int64_t time_stamp) const = 0; |
| 167 virtual void SetRotation(webrtc::VideoRotation rotation) = 0; | 148 virtual void SetRotation(webrtc::VideoRotation rotation) = 0; |
| 168 }; | 149 }; |
| 169 | 150 |
| 170 } // namespace cricket | 151 } // namespace cricket |
| 171 | 152 |
| 172 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 153 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
| OLD | NEW |