OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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_COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ | 11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ |
12 #define WEBRTC_COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ | 12 #define WEBRTC_COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ |
13 | 13 |
14 #include <stddef.h> | 14 #include <stddef.h> |
15 #include <stdint.h> | 15 #include <stdint.h> |
16 | 16 |
17 #include "webrtc/common_types.h" | 17 #include "webrtc/common_types.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 class VideoFrame; | 21 class VideoFrame; |
22 | 22 |
23 struct EncodedFrame { | 23 struct EncodedFrame { |
24 public: | 24 public: |
25 EncodedFrame() | 25 EncodedFrame() |
26 : data_(nullptr), | 26 : data_(nullptr), |
27 length_(0), | 27 length_(0), |
28 frame_type_(kEmptyFrame), | 28 frame_type_(kEmptyFrame), |
29 encoded_width_(0), | 29 stream_id_(0), |
30 encoded_height_(0), | |
31 timestamp_(0) {} | 30 timestamp_(0) {} |
32 EncodedFrame(const uint8_t* data, | 31 EncodedFrame(const uint8_t* data, |
33 size_t length, | 32 size_t length, |
34 FrameType frame_type, | 33 FrameType frame_type, |
35 uint32_t encoded_width, | 34 size_t stream_id, |
36 uint32_t encoded_height, | |
37 uint32_t timestamp) | 35 uint32_t timestamp) |
38 : data_(data), | 36 : data_(data), |
39 length_(length), | 37 length_(length), |
40 frame_type_(frame_type), | 38 frame_type_(frame_type), |
41 encoded_width_(encoded_width), | 39 stream_id_(stream_id), |
42 encoded_height_(encoded_height), | |
43 timestamp_(timestamp) {} | 40 timestamp_(timestamp) {} |
44 | 41 |
45 const uint8_t* data_; | 42 const uint8_t* data_; |
46 const size_t length_; | 43 const size_t length_; |
47 const FrameType frame_type_; | 44 const FrameType frame_type_; |
48 const uint32_t encoded_width_; | 45 const size_t stream_id_; |
49 const uint32_t encoded_height_; | |
50 const uint32_t timestamp_; | 46 const uint32_t timestamp_; |
51 }; | 47 }; |
52 | 48 |
53 class EncodedFrameObserver { | 49 class EncodedFrameObserver { |
54 public: | 50 public: |
55 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) = 0; | 51 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) = 0; |
56 virtual void OnEncodeTiming(int64_t capture_ntp_ms, int encode_duration_ms) {} | 52 virtual void OnEncodeTiming(int64_t capture_ntp_ms, int encode_duration_ms) {} |
57 | 53 |
58 protected: | 54 protected: |
59 virtual ~EncodedFrameObserver() {} | 55 virtual ~EncodedFrameObserver() {} |
60 }; | 56 }; |
61 | 57 |
62 } // namespace webrtc | 58 } // namespace webrtc |
63 | 59 |
64 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ | 60 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ |
OLD | NEW |