1 /* 2 * Copyright 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 #ifndef API_VIDEO_VIDEO_FRAME_METADATA_H_ 12 #define API_VIDEO_VIDEO_FRAME_METADATA_H_ 13 14 #include <cstdint> 15 16 #include "absl/container/inlined_vector.h" 17 #include "absl/types/optional.h" 18 #include "api/array_view.h" 19 #include "api/transport/rtp/dependency_descriptor.h" 20 21 namespace webrtc { 22 23 struct RTPVideoHeader; 24 25 // A subset of metadata from the RTP video header, exposed in insertable streams 26 // API. 27 class VideoFrameMetadata { 28 public: 29 explicit VideoFrameMetadata(const RTPVideoHeader& header); 30 VideoFrameMetadata(const VideoFrameMetadata&) = default; 31 VideoFrameMetadata& operator=(const VideoFrameMetadata&) = default; 32 GetWidth()33 uint16_t GetWidth() const { return width_; } GetHeight()34 uint16_t GetHeight() const { return height_; } GetFrameId()35 absl::optional<int64_t> GetFrameId() const { return frame_id_; } GetSpatialIndex()36 int GetSpatialIndex() const { return spatial_index_; } GetTemporalIndex()37 int GetTemporalIndex() const { return temporal_index_; } 38 GetFrameDependencies()39 rtc::ArrayView<const int64_t> GetFrameDependencies() const { 40 return frame_dependencies_; 41 } 42 GetDecodeTargetIndications()43 rtc::ArrayView<const DecodeTargetIndication> GetDecodeTargetIndications() 44 const { 45 return decode_target_indications_; 46 } 47 48 private: 49 int16_t width_; 50 int16_t height_; 51 absl::optional<int64_t> frame_id_; 52 int spatial_index_ = 0; 53 int temporal_index_ = 0; 54 absl::InlinedVector<int64_t, 5> frame_dependencies_; 55 absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications_; 56 }; 57 } // namespace webrtc 58 59 #endif // API_VIDEO_VIDEO_FRAME_METADATA_H_ 60