video_frame_metadata.h 1.9 KB

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