xref: /aosp_15_r20/external/webrtc/api/video/video_frame_metadata.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2020 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 #include "api/video/video_frame_metadata.h"
12 
13 namespace webrtc {
14 
15 VideoFrameMetadata::VideoFrameMetadata() = default;
16 
GetFrameType() const17 VideoFrameType VideoFrameMetadata::GetFrameType() const {
18   return frame_type_;
19 }
20 
SetFrameType(VideoFrameType frame_type)21 void VideoFrameMetadata::SetFrameType(VideoFrameType frame_type) {
22   frame_type_ = frame_type;
23 }
24 
GetWidth() const25 uint16_t VideoFrameMetadata::GetWidth() const {
26   return width_;
27 }
28 
SetWidth(uint16_t width)29 void VideoFrameMetadata::SetWidth(uint16_t width) {
30   width_ = width;
31 }
32 
GetHeight() const33 uint16_t VideoFrameMetadata::GetHeight() const {
34   return height_;
35 }
36 
SetHeight(uint16_t height)37 void VideoFrameMetadata::SetHeight(uint16_t height) {
38   height_ = height;
39 }
40 
GetRotation() const41 VideoRotation VideoFrameMetadata::GetRotation() const {
42   return rotation_;
43 }
44 
SetRotation(VideoRotation rotation)45 void VideoFrameMetadata::SetRotation(VideoRotation rotation) {
46   rotation_ = rotation;
47 }
48 
GetContentType() const49 VideoContentType VideoFrameMetadata::GetContentType() const {
50   return content_type_;
51 }
52 
SetContentType(VideoContentType content_type)53 void VideoFrameMetadata::SetContentType(VideoContentType content_type) {
54   content_type_ = content_type;
55 }
56 
GetFrameId() const57 absl::optional<int64_t> VideoFrameMetadata::GetFrameId() const {
58   return frame_id_;
59 }
60 
SetFrameId(absl::optional<int64_t> frame_id)61 void VideoFrameMetadata::SetFrameId(absl::optional<int64_t> frame_id) {
62   frame_id_ = frame_id;
63 }
64 
GetSpatialIndex() const65 int VideoFrameMetadata::GetSpatialIndex() const {
66   return spatial_index_;
67 }
68 
SetSpatialIndex(int spatial_index)69 void VideoFrameMetadata::SetSpatialIndex(int spatial_index) {
70   spatial_index_ = spatial_index;
71 }
72 
GetTemporalIndex() const73 int VideoFrameMetadata::GetTemporalIndex() const {
74   return temporal_index_;
75 }
76 
SetTemporalIndex(int temporal_index)77 void VideoFrameMetadata::SetTemporalIndex(int temporal_index) {
78   temporal_index_ = temporal_index;
79 }
80 
GetFrameDependencies() const81 rtc::ArrayView<const int64_t> VideoFrameMetadata::GetFrameDependencies() const {
82   return frame_dependencies_;
83 }
84 
SetFrameDependencies(rtc::ArrayView<const int64_t> frame_dependencies)85 void VideoFrameMetadata::SetFrameDependencies(
86     rtc::ArrayView<const int64_t> frame_dependencies) {
87   frame_dependencies_.assign(frame_dependencies.begin(),
88                              frame_dependencies.end());
89 }
90 
91 rtc::ArrayView<const DecodeTargetIndication>
GetDecodeTargetIndications() const92 VideoFrameMetadata::GetDecodeTargetIndications() const {
93   return decode_target_indications_;
94 }
95 
SetDecodeTargetIndications(rtc::ArrayView<const DecodeTargetIndication> decode_target_indications)96 void VideoFrameMetadata::SetDecodeTargetIndications(
97     rtc::ArrayView<const DecodeTargetIndication> decode_target_indications) {
98   decode_target_indications_.assign(decode_target_indications.begin(),
99                                     decode_target_indications.end());
100 }
101 
GetIsLastFrameInPicture() const102 bool VideoFrameMetadata::GetIsLastFrameInPicture() const {
103   return is_last_frame_in_picture_;
104 }
105 
SetIsLastFrameInPicture(bool is_last_frame_in_picture)106 void VideoFrameMetadata::SetIsLastFrameInPicture(
107     bool is_last_frame_in_picture) {
108   is_last_frame_in_picture_ = is_last_frame_in_picture;
109 }
110 
GetSimulcastIdx() const111 uint8_t VideoFrameMetadata::GetSimulcastIdx() const {
112   return simulcast_idx_;
113 }
114 
SetSimulcastIdx(uint8_t simulcast_idx)115 void VideoFrameMetadata::SetSimulcastIdx(uint8_t simulcast_idx) {
116   simulcast_idx_ = simulcast_idx;
117 }
118 
GetCodec() const119 VideoCodecType VideoFrameMetadata::GetCodec() const {
120   return codec_;
121 }
122 
SetCodec(VideoCodecType codec)123 void VideoFrameMetadata::SetCodec(VideoCodecType codec) {
124   codec_ = codec;
125 }
126 
127 }  // namespace webrtc
128