blob: 21019652870f899ee96da90d6c37b600de63fa64 [file] [log] [blame]
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +00001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_
12#define COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000013
sprang@webrtc.org09315702014-02-07 12:06:29 +000014#include <stddef.h>
Peter Boströme4499152016-02-05 11:13:28 +010015#include <stdint.h>
sprang@webrtc.org09315702014-02-07 12:06:29 +000016
Mirko Bonadei71207422017-09-15 13:58:09 +020017#include "common_types.h" // NOLINT(build/include)
sprang@webrtc.org40709352013-11-26 11:41:59 +000018
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000019namespace webrtc {
20
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070021class VideoFrame;
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000022
sprang@webrtc.org40709352013-11-26 11:41:59 +000023struct EncodedFrame {
24 public:
ilnik3dd5ad92017-02-09 04:58:53 -080025 EncodedFrame()
26 : data_(nullptr),
27 length_(0),
28 frame_type_(kEmptyFrame),
ilnikcb8c1462017-03-09 09:23:30 -080029 stream_id_(0),
ilnik3dd5ad92017-02-09 04:58:53 -080030 timestamp_(0) {}
31 EncodedFrame(const uint8_t* data,
32 size_t length,
33 FrameType frame_type,
ilnikcb8c1462017-03-09 09:23:30 -080034 size_t stream_id,
ilnik3dd5ad92017-02-09 04:58:53 -080035 uint32_t timestamp)
36 : data_(data),
37 length_(length),
38 frame_type_(frame_type),
ilnikcb8c1462017-03-09 09:23:30 -080039 stream_id_(stream_id),
ilnik3dd5ad92017-02-09 04:58:53 -080040 timestamp_(timestamp) {}
sprang@webrtc.org40709352013-11-26 11:41:59 +000041
42 const uint8_t* data_;
43 const size_t length_;
44 const FrameType frame_type_;
ilnikcb8c1462017-03-09 09:23:30 -080045 const size_t stream_id_;
ilnik3dd5ad92017-02-09 04:58:53 -080046 const uint32_t timestamp_;
sprang@webrtc.org40709352013-11-26 11:41:59 +000047};
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000048
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000049class EncodedFrameObserver {
50 public:
51 virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) = 0;
Peter Boströme4499152016-02-05 11:13:28 +010052 virtual void OnEncodeTiming(int64_t capture_ntp_ms, int encode_duration_ms) {}
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000053
54 protected:
55 virtual ~EncodedFrameObserver() {}
56};
sprang@webrtc.org40709352013-11-26 11:41:59 +000057
pbos@webrtc.org1ecee9a2013-05-29 11:34:32 +000058} // namespace webrtc
59
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020060#endif // COMMON_VIDEO_INCLUDE_FRAME_CALLBACK_H_