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 int width() const = 0; | 29 virtual int width() const = 0; |
49 virtual int height() const = 0; | 30 virtual int height() const = 0; |
50 | 31 |
51 // Deprecated methods, for backwards compatibility. | 32 // Deprecated methods, for backwards compatibility. |
52 // TODO(nisse): Delete when usage in Chrome and other applications | 33 // TODO(nisse): Delete when usage in Chrome and other applications |
53 // have been replaced by width() and height(). | 34 // have been replaced by width() and height(). |
54 virtual size_t GetWidth() const final { return width(); } | 35 virtual size_t GetWidth() const final { return width(); } |
55 virtual size_t GetHeight() const final { return height(); } | 36 virtual size_t GetHeight() const final { return height(); } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 138 |
158 // Creates an empty frame. | 139 // Creates an empty frame. |
159 virtual VideoFrame *CreateEmptyFrame(int w, int h, | 140 virtual VideoFrame *CreateEmptyFrame(int w, int h, |
160 int64_t time_stamp) const = 0; | 141 int64_t time_stamp) const = 0; |
161 virtual void SetRotation(webrtc::VideoRotation rotation) = 0; | 142 virtual void SetRotation(webrtc::VideoRotation rotation) = 0; |
162 }; | 143 }; |
163 | 144 |
164 } // namespace cricket | 145 } // namespace cricket |
165 | 146 |
166 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ | 147 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ |
OLD | NEW |