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

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

Issue 2772033002: Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Set EncodedImage content_type from vie_encoder Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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_API_VIDEO_VIDEO_FRAME_H_ 11 #ifndef WEBRTC_API_VIDEO_VIDEO_FRAME_H_
12 #define WEBRTC_API_VIDEO_VIDEO_FRAME_H_ 12 #define WEBRTC_API_VIDEO_VIDEO_FRAME_H_
13 13
14 #include <stdint.h> 14 #include <stdint.h>
15 15
16 #include "webrtc/api/video/video_rotation.h" 16 #include "webrtc/api/video/video_rotation.h"
17 #include "webrtc/api/video/video_content_type.h"
17 #include "webrtc/api/video/video_frame_buffer.h" 18 #include "webrtc/api/video/video_frame_buffer.h"
18 19
19 // TODO(nisse): Transition hack, some downstream applications expect 20 // TODO(nisse): Transition hack, some downstream applications expect
20 // that including this file also defines base/timeutils.h constants. 21 // that including this file also defines base/timeutils.h constants.
21 // Delete after applications are fixed to include the right headers. 22 // Delete after applications are fixed to include the right headers.
22 #include "webrtc/base/timeutils.h" 23 #include "webrtc/base/timeutils.h"
23 24
24 namespace webrtc { 25 namespace webrtc {
25 26
26 class VideoFrame { 27 class VideoFrame {
27 public: 28 public:
28 // TODO(nisse): This constructor is consistent with the now deleted 29 // TODO(nisse): This constructor is consistent with the now deleted
29 // cricket::WebRtcVideoFrame. We should consider whether or not we 30 // cricket::WebRtcVideoFrame. We should consider whether or not we
30 // want to stick to this style and deprecate the other constructor. 31 // want to stick to this style and deprecate the other constructor.
31 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, 32 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
32 webrtc::VideoRotation rotation, 33 webrtc::VideoRotation rotation,
34 VideoContentTypeId content_type,
33 int64_t timestamp_us); 35 int64_t timestamp_us);
34 36
35 // Preferred constructor. 37 // Preferred constructor.
36 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, 38 VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
37 uint32_t timestamp, 39 uint32_t timestamp,
38 int64_t render_time_ms, 40 int64_t render_time_ms,
39 VideoRotation rotation); 41 VideoRotation rotation,
42 VideoContentTypeId content_type);
40 43
41 ~VideoFrame(); 44 ~VideoFrame();
42 45
43 // Support move and copy. 46 // Support move and copy.
44 VideoFrame(const VideoFrame&); 47 VideoFrame(const VideoFrame&);
45 VideoFrame(VideoFrame&&); 48 VideoFrame(VideoFrame&&);
46 VideoFrame& operator=(const VideoFrame&); 49 VideoFrame& operator=(const VideoFrame&);
47 VideoFrame& operator=(VideoFrame&&); 50 VideoFrame& operator=(VideoFrame&&);
48 51
49 // Get frame width. 52 // Get frame width.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // "pending rotation" or "pending" = a frame that has a VideoRotation > 0. 88 // "pending rotation" or "pending" = a frame that has a VideoRotation > 0.
86 // 89 //
87 // "not pending" = a frame that has a VideoRotation == 0. 90 // "not pending" = a frame that has a VideoRotation == 0.
88 // 91 //
89 // "apply rotation" = modify a frame from being "pending" to being "not 92 // "apply rotation" = modify a frame from being "pending" to being "not
90 // pending" rotation (a no-op for "unrotated"). 93 // pending" rotation (a no-op for "unrotated").
91 // 94 //
92 VideoRotation rotation() const { return rotation_; } 95 VideoRotation rotation() const { return rotation_; }
93 void set_rotation(VideoRotation rotation) { rotation_ = rotation; } 96 void set_rotation(VideoRotation rotation) { rotation_ = rotation; }
94 97
98 VideoContentTypeId content_type() const { return content_type_; }
99 void set_content_type(VideoContentTypeId content_type) {
100 content_type_ = content_type;
101 }
102
95 // Get render time in milliseconds. 103 // Get render time in milliseconds.
96 // TODO(nisse): Deprecated. Migrate all users to timestamp_us(). 104 // TODO(nisse): Deprecated. Migrate all users to timestamp_us().
97 int64_t render_time_ms() const; 105 int64_t render_time_ms() const;
98 106
99 // Return the underlying buffer. Never nullptr for a properly 107 // Return the underlying buffer. Never nullptr for a properly
100 // initialized VideoFrame. 108 // initialized VideoFrame.
101 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const; 109 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const;
102 110
103 // TODO(nisse): Deprecated. 111 // TODO(nisse): Deprecated.
104 // Return true if the frame is stored in a texture. 112 // Return true if the frame is stored in a texture.
105 bool is_texture() const { 113 bool is_texture() const {
106 return video_frame_buffer()->native_handle() != nullptr; 114 return video_frame_buffer()->native_handle() != nullptr;
107 } 115 }
108 116
109 private: 117 private:
110 // An opaque reference counted handle that stores the pixel data. 118 // An opaque reference counted handle that stores the pixel data.
111 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_; 119 rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
112 uint32_t timestamp_rtp_; 120 uint32_t timestamp_rtp_;
113 int64_t ntp_time_ms_; 121 int64_t ntp_time_ms_;
114 int64_t timestamp_us_; 122 int64_t timestamp_us_;
115 VideoRotation rotation_; 123 VideoRotation rotation_;
124 VideoContentTypeId content_type_;
116 }; 125 };
117 126
118 } // namespace webrtc 127 } // namespace webrtc
119 128
120 #endif // WEBRTC_API_VIDEO_VIDEO_FRAME_H_ 129 #endif // WEBRTC_API_VIDEO_VIDEO_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698