webrtc_m130/api/video/video_frame_metadata.cc
Henrik Boström 158d5e3078 Add RTPVideoHeader::GetAsMetadata().
In preparation of adding RTPVideoHeader::SetFromMetadata() method, the
VideoFrameMetadata construct-from-RTPVideoHeader is replaced by
RTPVideoHeader::GetAsMetadata(). This serves two purposes:
1. Having "GetAs" and "SetFrom" in the same file reduces the risk of
   these two methods getting out of sync as we expand its usage.
2. This is necessary to avoid a circular dependency that would
   otherwise be introduced by RTPVideoHeader::SetFromMetadata().

Bug: webrtc:14709
Change-Id: I127b3d15f9a8c6af210449a5a50d414c9ba79930
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285080
Reviewed-by: Tony Herre <herre@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38735}
2022-11-25 14:40:30 +00:00

79 lines
2.1 KiB
C++

/*
* Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/video/video_frame_metadata.h"
namespace webrtc {
VideoFrameMetadata::VideoFrameMetadata() = default;
uint16_t VideoFrameMetadata::GetWidth() const {
return width_;
}
void VideoFrameMetadata::SetWidth(uint16_t width) {
width_ = width;
}
uint16_t VideoFrameMetadata::GetHeight() const {
return height_;
}
void VideoFrameMetadata::SetHeight(uint16_t height) {
height_ = height;
}
absl::optional<int64_t> VideoFrameMetadata::GetFrameId() const {
return frame_id_;
}
void VideoFrameMetadata::SetFrameId(absl::optional<int64_t> frame_id) {
frame_id_ = frame_id;
}
int VideoFrameMetadata::GetSpatialIndex() const {
return spatial_index_;
}
void VideoFrameMetadata::SetSpatialIndex(int spatial_index) {
spatial_index_ = spatial_index;
}
int VideoFrameMetadata::GetTemporalIndex() const {
return temporal_index_;
}
void VideoFrameMetadata::SetTemporalIndex(int temporal_index) {
temporal_index_ = temporal_index;
}
rtc::ArrayView<const int64_t> VideoFrameMetadata::GetFrameDependencies() const {
return frame_dependencies_;
}
void VideoFrameMetadata::SetFrameDependencies(
rtc::ArrayView<const int64_t> frame_dependencies) {
frame_dependencies_.assign(frame_dependencies.begin(),
frame_dependencies.end());
}
rtc::ArrayView<const DecodeTargetIndication>
VideoFrameMetadata::GetDecodeTargetIndications() const {
return decode_target_indications_;
}
void VideoFrameMetadata::SetDecodeTargetIndications(
rtc::ArrayView<const DecodeTargetIndication> decode_target_indications) {
decode_target_indications_.assign(decode_target_indications.begin(),
decode_target_indications.end());
}
} // namespace webrtc