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 #include "api/video/video_codec_type.h" 21 #include "api/video/video_content_type.h" 22 #include "api/video/video_frame_type.h" 23 #include "api/video/video_rotation.h" 24 #include "rtc_base/system/rtc_export.h" 25 26 namespace webrtc { 27 28 // A subset of metadata from the RTP video header, exposed in insertable streams 29 // API. 30 class RTC_EXPORT VideoFrameMetadata { 31 public: 32 VideoFrameMetadata(); 33 VideoFrameMetadata(const VideoFrameMetadata&) = default; 34 VideoFrameMetadata& operator=(const VideoFrameMetadata&) = default; 35 36 VideoFrameType GetFrameType() const; 37 void SetFrameType(VideoFrameType frame_type); 38 39 uint16_t GetWidth() const; 40 void SetWidth(uint16_t width); 41 42 uint16_t GetHeight() const; 43 void SetHeight(uint16_t height); 44 45 VideoRotation GetRotation() const; 46 void SetRotation(VideoRotation rotation); 47 48 VideoContentType GetContentType() const; 49 void SetContentType(VideoContentType content_type); 50 51 absl::optional<int64_t> GetFrameId() const; 52 void SetFrameId(absl::optional<int64_t> frame_id); 53 54 int GetSpatialIndex() const; 55 void SetSpatialIndex(int spatial_index); 56 57 int GetTemporalIndex() const; 58 void SetTemporalIndex(int temporal_index); 59 60 rtc::ArrayView<const int64_t> GetFrameDependencies() const; 61 void SetFrameDependencies(rtc::ArrayView<const int64_t> frame_dependencies); 62 63 rtc::ArrayView<const DecodeTargetIndication> GetDecodeTargetIndications() 64 const; 65 void SetDecodeTargetIndications( 66 rtc::ArrayView<const DecodeTargetIndication> decode_target_indications); 67 68 bool GetIsLastFrameInPicture() const; 69 void SetIsLastFrameInPicture(bool is_last_frame_in_picture); 70 71 uint8_t GetSimulcastIdx() const; 72 void SetSimulcastIdx(uint8_t simulcast_idx); 73 74 VideoCodecType GetCodec() const; 75 void SetCodec(VideoCodecType codec); 76 77 private: 78 VideoFrameType frame_type_ = VideoFrameType::kEmptyFrame; 79 int16_t width_ = 0; 80 int16_t height_ = 0; 81 VideoRotation rotation_ = VideoRotation::kVideoRotation_0; 82 VideoContentType content_type_ = VideoContentType::UNSPECIFIED; 83 84 // Corresponding to GenericDescriptorInfo. 85 absl::optional<int64_t> frame_id_; 86 int spatial_index_ = 0; 87 int temporal_index_ = 0; 88 absl::InlinedVector<int64_t, 5> frame_dependencies_; 89 absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications_; 90 91 bool is_last_frame_in_picture_ = true; 92 uint8_t simulcast_idx_ = 0; 93 VideoCodecType codec_ = VideoCodecType::kVideoCodecGeneric; 94 }; 95 } // namespace webrtc 96 97 #endif // API_VIDEO_VIDEO_FRAME_METADATA_H_ 98