1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright 2020 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker #ifndef API_VIDEO_VIDEO_FRAME_METADATA_H_ 12*d9f75844SAndroid Build Coastguard Worker #define API_VIDEO_VIDEO_FRAME_METADATA_H_ 13*d9f75844SAndroid Build Coastguard Worker 14*d9f75844SAndroid Build Coastguard Worker #include <cstdint> 15*d9f75844SAndroid Build Coastguard Worker 16*d9f75844SAndroid Build Coastguard Worker #include "absl/container/inlined_vector.h" 17*d9f75844SAndroid Build Coastguard Worker #include "absl/types/optional.h" 18*d9f75844SAndroid Build Coastguard Worker #include "api/array_view.h" 19*d9f75844SAndroid Build Coastguard Worker #include "api/transport/rtp/dependency_descriptor.h" 20*d9f75844SAndroid Build Coastguard Worker #include "api/video/video_codec_type.h" 21*d9f75844SAndroid Build Coastguard Worker #include "api/video/video_content_type.h" 22*d9f75844SAndroid Build Coastguard Worker #include "api/video/video_frame_type.h" 23*d9f75844SAndroid Build Coastguard Worker #include "api/video/video_rotation.h" 24*d9f75844SAndroid Build Coastguard Worker #include "rtc_base/system/rtc_export.h" 25*d9f75844SAndroid Build Coastguard Worker 26*d9f75844SAndroid Build Coastguard Worker namespace webrtc { 27*d9f75844SAndroid Build Coastguard Worker 28*d9f75844SAndroid Build Coastguard Worker // A subset of metadata from the RTP video header, exposed in insertable streams 29*d9f75844SAndroid Build Coastguard Worker // API. 30*d9f75844SAndroid Build Coastguard Worker class RTC_EXPORT VideoFrameMetadata { 31*d9f75844SAndroid Build Coastguard Worker public: 32*d9f75844SAndroid Build Coastguard Worker VideoFrameMetadata(); 33*d9f75844SAndroid Build Coastguard Worker VideoFrameMetadata(const VideoFrameMetadata&) = default; 34*d9f75844SAndroid Build Coastguard Worker VideoFrameMetadata& operator=(const VideoFrameMetadata&) = default; 35*d9f75844SAndroid Build Coastguard Worker 36*d9f75844SAndroid Build Coastguard Worker VideoFrameType GetFrameType() const; 37*d9f75844SAndroid Build Coastguard Worker void SetFrameType(VideoFrameType frame_type); 38*d9f75844SAndroid Build Coastguard Worker 39*d9f75844SAndroid Build Coastguard Worker uint16_t GetWidth() const; 40*d9f75844SAndroid Build Coastguard Worker void SetWidth(uint16_t width); 41*d9f75844SAndroid Build Coastguard Worker 42*d9f75844SAndroid Build Coastguard Worker uint16_t GetHeight() const; 43*d9f75844SAndroid Build Coastguard Worker void SetHeight(uint16_t height); 44*d9f75844SAndroid Build Coastguard Worker 45*d9f75844SAndroid Build Coastguard Worker VideoRotation GetRotation() const; 46*d9f75844SAndroid Build Coastguard Worker void SetRotation(VideoRotation rotation); 47*d9f75844SAndroid Build Coastguard Worker 48*d9f75844SAndroid Build Coastguard Worker VideoContentType GetContentType() const; 49*d9f75844SAndroid Build Coastguard Worker void SetContentType(VideoContentType content_type); 50*d9f75844SAndroid Build Coastguard Worker 51*d9f75844SAndroid Build Coastguard Worker absl::optional<int64_t> GetFrameId() const; 52*d9f75844SAndroid Build Coastguard Worker void SetFrameId(absl::optional<int64_t> frame_id); 53*d9f75844SAndroid Build Coastguard Worker 54*d9f75844SAndroid Build Coastguard Worker int GetSpatialIndex() const; 55*d9f75844SAndroid Build Coastguard Worker void SetSpatialIndex(int spatial_index); 56*d9f75844SAndroid Build Coastguard Worker 57*d9f75844SAndroid Build Coastguard Worker int GetTemporalIndex() const; 58*d9f75844SAndroid Build Coastguard Worker void SetTemporalIndex(int temporal_index); 59*d9f75844SAndroid Build Coastguard Worker 60*d9f75844SAndroid Build Coastguard Worker rtc::ArrayView<const int64_t> GetFrameDependencies() const; 61*d9f75844SAndroid Build Coastguard Worker void SetFrameDependencies(rtc::ArrayView<const int64_t> frame_dependencies); 62*d9f75844SAndroid Build Coastguard Worker 63*d9f75844SAndroid Build Coastguard Worker rtc::ArrayView<const DecodeTargetIndication> GetDecodeTargetIndications() 64*d9f75844SAndroid Build Coastguard Worker const; 65*d9f75844SAndroid Build Coastguard Worker void SetDecodeTargetIndications( 66*d9f75844SAndroid Build Coastguard Worker rtc::ArrayView<const DecodeTargetIndication> decode_target_indications); 67*d9f75844SAndroid Build Coastguard Worker 68*d9f75844SAndroid Build Coastguard Worker bool GetIsLastFrameInPicture() const; 69*d9f75844SAndroid Build Coastguard Worker void SetIsLastFrameInPicture(bool is_last_frame_in_picture); 70*d9f75844SAndroid Build Coastguard Worker 71*d9f75844SAndroid Build Coastguard Worker uint8_t GetSimulcastIdx() const; 72*d9f75844SAndroid Build Coastguard Worker void SetSimulcastIdx(uint8_t simulcast_idx); 73*d9f75844SAndroid Build Coastguard Worker 74*d9f75844SAndroid Build Coastguard Worker VideoCodecType GetCodec() const; 75*d9f75844SAndroid Build Coastguard Worker void SetCodec(VideoCodecType codec); 76*d9f75844SAndroid Build Coastguard Worker 77*d9f75844SAndroid Build Coastguard Worker private: 78*d9f75844SAndroid Build Coastguard Worker VideoFrameType frame_type_ = VideoFrameType::kEmptyFrame; 79*d9f75844SAndroid Build Coastguard Worker int16_t width_ = 0; 80*d9f75844SAndroid Build Coastguard Worker int16_t height_ = 0; 81*d9f75844SAndroid Build Coastguard Worker VideoRotation rotation_ = VideoRotation::kVideoRotation_0; 82*d9f75844SAndroid Build Coastguard Worker VideoContentType content_type_ = VideoContentType::UNSPECIFIED; 83*d9f75844SAndroid Build Coastguard Worker 84*d9f75844SAndroid Build Coastguard Worker // Corresponding to GenericDescriptorInfo. 85*d9f75844SAndroid Build Coastguard Worker absl::optional<int64_t> frame_id_; 86*d9f75844SAndroid Build Coastguard Worker int spatial_index_ = 0; 87*d9f75844SAndroid Build Coastguard Worker int temporal_index_ = 0; 88*d9f75844SAndroid Build Coastguard Worker absl::InlinedVector<int64_t, 5> frame_dependencies_; 89*d9f75844SAndroid Build Coastguard Worker absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications_; 90*d9f75844SAndroid Build Coastguard Worker 91*d9f75844SAndroid Build Coastguard Worker bool is_last_frame_in_picture_ = true; 92*d9f75844SAndroid Build Coastguard Worker uint8_t simulcast_idx_ = 0; 93*d9f75844SAndroid Build Coastguard Worker VideoCodecType codec_ = VideoCodecType::kVideoCodecGeneric; 94*d9f75844SAndroid Build Coastguard Worker }; 95*d9f75844SAndroid Build Coastguard Worker } // namespace webrtc 96*d9f75844SAndroid Build Coastguard Worker 97*d9f75844SAndroid Build Coastguard Worker #endif // API_VIDEO_VIDEO_FRAME_METADATA_H_ 98