Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
AgoraExtensionVersion.h
1//
2// Copyright (c) 2021 Agora.io. All rights reserved
3
4// This program is confidential and proprietary to Agora.io.
5// And may not be copied, reproduced, modified, disclosed to others, published
6// or used, in whole or in part, without the express prior written permission
7// of Agora.io.
8
9#pragma once
10
11 namespace agora {
12 namespace rtc {
13
14 struct ExtensionVersion {
15 // Extension Framework Version : major.minor.micro
16 int major_v;
17 int minor_v;
18 int micro_v;
19
20 ExtensionVersion()
21 : major_v(0), minor_v(0), micro_v(0) {}
22 ExtensionVersion(int majorV, int minorV = 0, int microV = 0)
23 : major_v(majorV), minor_v(minorV), micro_v(microV) {}
24
25 bool operator==(const ExtensionVersion& other) const {
26 return major_v == other.major_v && minor_v == other.minor_v && micro_v == other.micro_v;
27 }
28
29 bool operator>(const ExtensionVersion& other) const {
30 return major_v > other.major_v || (major_v == other.major_v && minor_v > other.minor_v)
31 || (major_v == other.major_v && minor_v == other.minor_v && micro_v > other.micro_v);
32 }
33
34 bool operator<(const ExtensionVersion& other) const {
35 return major_v < other.major_v || (major_v == other.major_v && minor_v < other.minor_v)
36 || (major_v == other.major_v && minor_v == other.minor_v && micro_v < other.micro_v);
37 }
38
39 bool operator<=(const ExtensionVersion& other) const {
40 return !operator>(other);
41 }
42
43 bool operator>=(const ExtensionVersion& other) const {
44 return !operator<(other);
45 }
46};
47
48#define BUMP_MAJOR_VERSION(VERSION) \
49 ExtensionVersion(VERSION.major_v + 1, 0, 0); \
50
51#define BUMP_MINOR_VERSION(VERSION) \
52 ExtensionVersion(VERSION.major_v, VERSION.minor_v + 1, 0); \
53
54#define BUMP_MICRO_VERSION(VERSION) \
55 ExtensionVersion(VERSION.major_v, VERSION.minor_v, VERSION.micro_v + 1); \
56
57 class IExtensionProvider;
58 class IExtensionProviderV2;
59 class IExtensionProviderV3;
60 class IAudioFilter;
61 class IAudioFilterV2;
62 class IExtensionVideoFilter;
63 class IScreenCaptureSource;
64
65 template <class T>
66 struct ExtensionInterfaceVersion;
67
68 template <>
69 struct ExtensionInterfaceVersion<IExtensionProvider> {
70 static ExtensionVersion Version() {
71 return ExtensionVersion(1, 0, 0);
72 }
73};
74
75 template <>
76 struct ExtensionInterfaceVersion<IExtensionProviderV2> {
77 static ExtensionVersion Version() {
78 return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion<IExtensionProvider>::Version());
79 }
80};
81
82 template <>
83 struct ExtensionInterfaceVersion<IAudioFilter> {
84 static ExtensionVersion Version() {
85 return ExtensionVersion(1, 0, 0);
86 }
87};
88
89 template <>
90 struct ExtensionInterfaceVersion<IAudioFilterV2> {
91 static ExtensionVersion Version() {
92 return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion<IAudioFilter>::Version());
93 }
94};
95
96 template <>
97 struct ExtensionInterfaceVersion<IExtensionVideoFilter> {
98 static ExtensionVersion Version() {
99 return ExtensionVersion(1, 0, 0);
100 }
101};
102
103 template <>
104 struct ExtensionInterfaceVersion<IScreenCaptureSource> {
105 static ExtensionVersion Version() {
106 return ExtensionVersion(1, 0, 0);
107 }
108};
109
110} // namespace rtc
111} // namespace agora
agora::rtc::IAudioFilter
Definition AgoraExtensions.h:12
agora::rtc::IAudioFilterV2
Definition AgoraExtensions.h:83
agora::rtc::IExtensionProvider
Definition NGIAgoraExtensionProvider.h:35
agora::rtc::IExtensionProviderV2
Definition NGIAgoraExtensionProvider.h:139
agora::rtc::IExtensionVideoFilter
Definition AgoraExtensions.h:114
agora::rtc::IScreenCaptureSource
Definition NGIAgoraExtensionScreenSource.h:41
agora::rtc
Definition AgoraExtensions.h:5
agora
Definition AgoraAtomicOps.h:21
agora::rtc::ExtensionInterfaceVersion< IAudioFilter >::Version
static ExtensionVersion Version()
Definition AgoraExtensionVersion.h:84
agora::rtc::ExtensionInterfaceVersion< IAudioFilterV2 >::Version
static ExtensionVersion Version()
Definition AgoraExtensionVersion.h:91
agora::rtc::ExtensionInterfaceVersion< IExtensionProvider >::Version
static ExtensionVersion Version()
Definition AgoraExtensionVersion.h:70
agora::rtc::ExtensionInterfaceVersion< IExtensionProviderV2 >::Version
static ExtensionVersion Version()
Definition AgoraExtensionVersion.h:77
agora::rtc::ExtensionInterfaceVersion< IExtensionVideoFilter >::Version
static ExtensionVersion Version()
Definition AgoraExtensionVersion.h:98
agora::rtc::ExtensionInterfaceVersion< IScreenCaptureSource >::Version
static ExtensionVersion Version()
Definition AgoraExtensionVersion.h:105
agora::rtc::ExtensionInterfaceVersion
Definition AgoraExtensionVersion.h:66
agora::rtc::ExtensionVersion
Definition AgoraExtensionVersion.h:14
agora::rtc::ExtensionVersion::micro_v
int micro_v
Definition AgoraExtensionVersion.h:18
agora::rtc::ExtensionVersion::operator==
bool operator==(const ExtensionVersion &other) const
Definition AgoraExtensionVersion.h:25
agora::rtc::ExtensionVersion::operator<
bool operator<(const ExtensionVersion &other) const
Definition AgoraExtensionVersion.h:34
agora::rtc::ExtensionVersion::ExtensionVersion
ExtensionVersion()
Definition AgoraExtensionVersion.h:20
agora::rtc::ExtensionVersion::operator>
bool operator>(const ExtensionVersion &other) const
Definition AgoraExtensionVersion.h:29
agora::rtc::ExtensionVersion::operator<=
bool operator<=(const ExtensionVersion &other) const
Definition AgoraExtensionVersion.h:39
agora::rtc::ExtensionVersion::operator>=
bool operator>=(const ExtensionVersion &other) const
Definition AgoraExtensionVersion.h:43
agora::rtc::ExtensionVersion::major_v
int major_v
Definition AgoraExtensionVersion.h:16
agora::rtc::ExtensionVersion::ExtensionVersion
ExtensionVersion(int majorV, int minorV=0, int microV=0)
Definition AgoraExtensionVersion.h:22
agora::rtc::ExtensionVersion::minor_v
int minor_v
Definition AgoraExtensionVersion.h:17