blob: 790929106e2368489592fd7cd9416d214de0f19a [file] [log] [blame]
philipel9df33532019-03-04 15:37:501/*
2 * Copyright (c) 2019 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 COMMON_VIDEO_GENERIC_FRAME_DESCRIPTOR_GENERIC_FRAME_INFO_H_
12#define COMMON_VIDEO_GENERIC_FRAME_DESCRIPTOR_GENERIC_FRAME_INFO_H_
13
14#include <initializer_list>
15#include <vector>
16
17#include "absl/container/inlined_vector.h"
18#include "absl/strings/string_view.h"
19#include "api/array_view.h"
20
21namespace webrtc {
22
23struct GenericFrameInfo {
philipel361855b2019-03-28 13:12:1024 enum class DecodeTargetIndication {
philipelb19f27a2019-03-28 15:09:5225 kNotPresent, // DecodeTargetInfo symbol '-'
26 kDiscardable, // DecodeTargetInfo symbol 'D'
27 kSwitch, // DecodeTargetInfo symbol 'S'
28 kRequired // DecodeTargetInfo symbol 'R'
philipel9df33532019-03-04 15:37:5029 };
30
philipelb19f27a2019-03-28 15:09:5231 static absl::InlinedVector<DecodeTargetIndication, 10> DecodeTargetInfo(
32 absl::string_view indication_symbols);
33
philipel9df33532019-03-04 15:37:5034 class Builder;
35
36 GenericFrameInfo();
37 GenericFrameInfo(const GenericFrameInfo&);
38 ~GenericFrameInfo();
39
40 int temporal_id = 0;
41 int spatial_id = 0;
42 absl::InlinedVector<int, 10> frame_diffs;
philipel361855b2019-03-28 13:12:1043 absl::InlinedVector<DecodeTargetIndication, 10> decode_target_indications;
philipel9df33532019-03-04 15:37:5044};
45
46class GenericFrameInfo::Builder {
47 public:
48 Builder();
49 ~Builder();
50
51 GenericFrameInfo Build() const;
52 Builder& T(int temporal_id);
53 Builder& S(int spatial_id);
54 Builder& Dtis(absl::string_view indication_symbols);
55 Builder& Fdiffs(std::initializer_list<int> frame_diffs);
56
57 private:
58 GenericFrameInfo info_;
59};
60
61struct TemplateStructure {
62 TemplateStructure();
63 TemplateStructure(const TemplateStructure&);
64 TemplateStructure(TemplateStructure&&);
65 TemplateStructure& operator=(const TemplateStructure&);
66 ~TemplateStructure();
67
philipel361855b2019-03-28 13:12:1068 int num_decode_targets = 0;
philipel9df33532019-03-04 15:37:5069 std::vector<GenericFrameInfo> templates;
70};
71} // namespace webrtc
72
73#endif // COMMON_VIDEO_GENERIC_FRAME_DESCRIPTOR_GENERIC_FRAME_INFO_H_