pbos@webrtc.org | 1ecee9a | 2013-05-29 11:34:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ |
| 12 | #define COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ |
pbos@webrtc.org | 1ecee9a | 2013-05-29 11:34:32 +0000 | [diff] [blame] | 13 | |
sprang@webrtc.org | 0931570 | 2014-02-07 12:06:29 +0000 | [diff] [blame] | 14 | #include <stddef.h> |
Peter Boström | e449915 | 2016-02-05 11:13:28 +0100 | [diff] [blame] | 15 | #include <stdint.h> |
sprang@webrtc.org | 0931570 | 2014-02-07 12:06:29 +0000 | [diff] [blame] | 16 | |
Mirko Bonadei | 7120742 | 2017-09-15 13:58:09 +0200 | [diff] [blame^] | 17 | #include "common_types.h" // NOLINT(build/include) |
sprang@webrtc.org | 4070935 | 2013-11-26 11:41:59 +0000 | [diff] [blame] | 18 | |
pbos@webrtc.org | 1ecee9a | 2013-05-29 11:34:32 +0000 | [diff] [blame] | 19 | namespace webrtc { |
| 20 | |
Miguel Casas-Sanchez | 4765070 | 2015-05-29 17:21:40 -0700 | [diff] [blame] | 21 | class VideoFrame; |
pbos@webrtc.org | 1ecee9a | 2013-05-29 11:34:32 +0000 | [diff] [blame] | 22 | |
sprang@webrtc.org | 4070935 | 2013-11-26 11:41:59 +0000 | [diff] [blame] | 23 | struct EncodedFrame { |
| 24 | public: |
ilnik | 3dd5ad9 | 2017-02-09 04:58:53 -0800 | [diff] [blame] | 25 | EncodedFrame() |
| 26 | : data_(nullptr), |
| 27 | length_(0), |
| 28 | frame_type_(kEmptyFrame), |
ilnik | cb8c146 | 2017-03-09 09:23:30 -0800 | [diff] [blame] | 29 | stream_id_(0), |
ilnik | 3dd5ad9 | 2017-02-09 04:58:53 -0800 | [diff] [blame] | 30 | timestamp_(0) {} |
| 31 | EncodedFrame(const uint8_t* data, |
| 32 | size_t length, |
| 33 | FrameType frame_type, |
ilnik | cb8c146 | 2017-03-09 09:23:30 -0800 | [diff] [blame] | 34 | size_t stream_id, |
ilnik | 3dd5ad9 | 2017-02-09 04:58:53 -0800 | [diff] [blame] | 35 | uint32_t timestamp) |
| 36 | : data_(data), |
| 37 | length_(length), |
| 38 | frame_type_(frame_type), |
ilnik | cb8c146 | 2017-03-09 09:23:30 -0800 | [diff] [blame] | 39 | stream_id_(stream_id), |
ilnik | 3dd5ad9 | 2017-02-09 04:58:53 -0800 | [diff] [blame] | 40 | timestamp_(timestamp) {} |
sprang@webrtc.org | 4070935 | 2013-11-26 11:41:59 +0000 | [diff] [blame] | 41 | |
| 42 | const uint8_t* data_; |
| 43 | const size_t length_; |
| 44 | const FrameType frame_type_; |
ilnik | cb8c146 | 2017-03-09 09:23:30 -0800 | [diff] [blame] | 45 | const size_t stream_id_; |
ilnik | 3dd5ad9 | 2017-02-09 04:58:53 -0800 | [diff] [blame] | 46 | const uint32_t timestamp_; |
sprang@webrtc.org | 4070935 | 2013-11-26 11:41:59 +0000 | [diff] [blame] | 47 | }; |
pbos@webrtc.org | 1ecee9a | 2013-05-29 11:34:32 +0000 | [diff] [blame] | 48 | |
pbos@webrtc.org | 1ecee9a | 2013-05-29 11:34:32 +0000 | [diff] [blame] | 49 | class EncodedFrameObserver { |
| 50 | public: |
| 51 | virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) = 0; |
Peter Boström | e449915 | 2016-02-05 11:13:28 +0100 | [diff] [blame] | 52 | virtual void OnEncodeTiming(int64_t capture_ntp_ms, int encode_duration_ms) {} |
pbos@webrtc.org | 1ecee9a | 2013-05-29 11:34:32 +0000 | [diff] [blame] | 53 | |
| 54 | protected: |
| 55 | virtual ~EncodedFrameObserver() {} |
| 56 | }; |
sprang@webrtc.org | 4070935 | 2013-11-26 11:41:59 +0000 | [diff] [blame] | 57 | |
pbos@webrtc.org | 1ecee9a | 2013-05-29 11:34:32 +0000 | [diff] [blame] | 58 | } // namespace webrtc |
| 59 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 60 | #endif // COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_ |