Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: webrtc/api/video/video_frame.h

Issue 2517173004: Move VideoFrame and related declarations to webrtc/api/video. (Closed)
Patch Set: Make rotation check clearer. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/api/video/i420_buffer.cc ('k') | webrtc/api/video/video_frame.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_API_VIDEO_VIDEO_FRAME_H_
12 #define WEBRTC_API_VIDEO_VIDEO_FRAME_H_
13
14 #include <stdint.h>
15
16 #include "webrtc/api/video/video_rotation.h"
17 #include "webrtc/api/video/video_frame_buffer.h"
18
19 // TODO(nisse): Transition hack, some downstream applications expect
20 // that including this file also defines base/timeutils.h constants.
21 // Delete after applications are fixed to include the right headers.
22 #include "webrtc/base/timeutils.h"
23
24 namespace webrtc {
25
26 class VideoFrame {
27 public:
28 // TODO(nisse): This constructor is consistent with the now deleted
29 // cricket::WebRtcVideoFrame. We should consider whether or not we
30 // want to stick to this style and deprecate the other constructor.
31 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
32 webrtc::VideoRotation rotation,
33 int64_t timestamp_us);
34
35 // Preferred constructor.
36 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
37 uint32_t timestamp,
38 int64_t render_time_ms,
39 VideoRotation rotation);
40
41 ~VideoFrame();
42
43 // Support move and copy.
44 VideoFrame(const VideoFrame&);
45 VideoFrame(VideoFrame&&);
46 VideoFrame& operator=(const VideoFrame&);
47 VideoFrame& operator=(VideoFrame&&);
48
49 // Get frame width.
50 int width() const;
51
52 // Get frame height.
53 int height() const;
54
55 // System monotonic clock, same timebase as rtc::TimeMicros().
56 int64_t timestamp_us() const { return timestamp_us_; }
57 void set_timestamp_us(int64_t timestamp_us) { timestamp_us_ = timestamp_us; }
58
59 // TODO(nisse): After the cricket::VideoFrame and webrtc::VideoFrame
60 // merge, timestamps other than timestamp_us will likely be
61 // deprecated.
62
63 // Set frame timestamp (90kHz).
64 void set_timestamp(uint32_t timestamp) { timestamp_rtp_ = timestamp; }
65
66 // Get frame timestamp (90kHz).
67 uint32_t timestamp() const { return timestamp_rtp_; }
68
69 // For now, transport_frame_id and rtp timestamp are the same.
70 // TODO(nisse): Must be handled differently for QUIC.
71 uint32_t transport_frame_id() const { return timestamp(); }
72
73 // Set capture ntp time in milliseconds.
74 void set_ntp_time_ms(int64_t ntp_time_ms) { ntp_time_ms_ = ntp_time_ms; }
75
76 // Get capture ntp time in milliseconds.
77 int64_t ntp_time_ms() const { return ntp_time_ms_; }
78
79 // Naming convention for Coordination of Video Orientation. Please see
80 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ts_126 114v120700p.pdf
81 //
82 // "pending rotation" or "pending" = a frame that has a VideoRotation > 0.
83 //
84 // "not pending" = a frame that has a VideoRotation == 0.
85 //
86 // "apply rotation" = modify a frame from being "pending" to being "not
87 // pending" rotation (a no-op for "unrotated").
88 //
89 VideoRotation rotation() const { return rotation_; }
90 void set_rotation(VideoRotation rotation) { rotation_ = rotation; }
91
92 // Set render time in milliseconds.
93 void set_render_time_ms(int64_t render_time_ms);
94
95 // Get render time in milliseconds.
96 int64_t render_time_ms() const;
97
98 // Return the underlying buffer. Never nullptr for a properly
99 // initialized VideoFrame.
100 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const;
101
102 // TODO(nisse): Deprecated.
103 // Return true if the frame is stored in a texture.
104 bool is_texture() const {
105 return video_frame_buffer()->native_handle() != nullptr;
106 }
107
108 private:
109 // An opaque reference counted handle that stores the pixel data.
110 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
111 uint32_t timestamp_rtp_;
112 int64_t ntp_time_ms_;
113 int64_t timestamp_us_;
114 VideoRotation rotation_;
115 };
116
117 } // namespace webrtc
118
119 #endif // WEBRTC_API_VIDEO_VIDEO_FRAME_H_
OLDNEW
« no previous file with comments | « webrtc/api/video/i420_buffer.cc ('k') | webrtc/api/video/video_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698