blob: 5b56561efbe825e0f99b671688db4784f3c133a4 [file] [log] [blame]
Markus Handell9982efa2019-11-21 10:56:501/*
2 * Copyright (c) 2019 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 API_VIDEO_RECORDABLE_ENCODED_FRAME_H_
12#define API_VIDEO_RECORDABLE_ENCODED_FRAME_H_
13
Dor Hen9fb83a12024-08-18 14:36:0214#include "absl/types/optional.h"
Markus Handell9982efa2019-11-21 10:56:5015#include "api/scoped_refptr.h"
16#include "api/units/timestamp.h"
17#include "api/video/color_space.h"
18#include "api/video/encoded_image.h"
19#include "api/video/video_codec_type.h"
Markus Handell9982efa2019-11-21 10:56:5020
21namespace webrtc {
22
23// Interface for accessing recordable elements of an encoded frame.
24class RecordableEncodedFrame {
25 public:
26 // Encoded resolution in pixels
Jonas Oreland0deda152022-09-23 10:08:5727 // TODO(bugs.webrtc.org/12114) : remove in favor of Resolution.
Markus Handell9982efa2019-11-21 10:56:5028 struct EncodedResolution {
Markus Handell588f9b32021-04-08 17:19:5029 bool empty() const { return width == 0 && height == 0; }
30
31 unsigned width = 0;
32 unsigned height = 0;
Markus Handell9982efa2019-11-21 10:56:5033 };
34
35 virtual ~RecordableEncodedFrame() = default;
36
37 // Provides access to encoded data
38 virtual rtc::scoped_refptr<const EncodedImageBufferInterface> encoded_buffer()
39 const = 0;
40
41 // Optionally returns the colorspace of the encoded frame. This can differ
42 // from the eventually decoded frame's colorspace.
43 virtual absl::optional<webrtc::ColorSpace> color_space() const = 0;
44
45 // Returns the codec of the encoded frame
46 virtual VideoCodecType codec() const = 0;
47
48 // Returns whether the encoded frame is a key frame
49 virtual bool is_key_frame() const = 0;
50
51 // Returns the frame's encoded resolution. May be 0x0 if the frame
52 // doesn't contain resolution information
53 virtual EncodedResolution resolution() const = 0;
54
55 // Returns the computed render time
56 virtual Timestamp render_time() const = 0;
57};
58
59} // namespace webrtc
60
61#endif // API_VIDEO_RECORDABLE_ENCODED_FRAME_H_