Skip to content

Commit 655becc

Browse files
committed
[Android][SimpleExtension]put back SimpleExtension example and adapte agora-simple-filter extension to latest native api.
1 parent 604b1ca commit 655becc

39 files changed

Lines changed: 3116 additions & 10752 deletions

Android/APIExample/agora-simple-filter/src/main/cpp/AgoraRtcKit/AgoraBase.h

Lines changed: 1028 additions & 846 deletions
Large diffs are not rendered by default.

Android/APIExample/agora-simple-filter/src/main/cpp/AgoraRtcKit/AgoraExtensionProviderEntry.h

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AGORA_API void AGORA_CALL registerProviderEntry(const char*, agora_ext_entry_fun
1919
static void register_##PROVIDER_NAME##_to_agora() { \
2020
auto control = getAgoraExtensionControl(); \
2121
agora::rtc::ExtensionVersion version = \
22-
agora::rtc::ExtensionInterfaceVersion<PROVIDER_INTERFACE_USED>::version(); \
22+
agora::rtc::ExtensionInterfaceVersion<PROVIDER_INTERFACE_USED>::Version(); \
2323
declareProviderVersion(#PROVIDER_NAME, version); \
2424
if (#PROVIDER_NAME && control) { \
2525
control->registerProvider(#PROVIDER_NAME, \
@@ -38,36 +38,11 @@ static void _##PROVIDER_NAME##_provider_entry() {
3838
#elif defined (_MSC_VER)
3939
#define REGISTER_AGORA_EXTENSION_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, ...) \
4040
DECLARE_CREATE_AND_REGISTER_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, __VA_ARGS__); \
41-
BOOL APIENTRY DllMain( HMODULE hModule, \
42-
DWORD ul_reason_for_call, \
43-
LPVOID lpReserved) { \
44-
switch (ul_reason_for_call) { \
45-
case DLL_PROCESS_ATTACH: \
46-
registerProviderEntry(#PROVIDER_NAME, register_##PROVIDER_NAME##_to_agora); \
47-
break; \
48-
default: \
49-
break; \
50-
} \
51-
return TRUE; \
41+
static int _##PROVIDER_NAME##_provider_entry() { \
42+
registerProviderEntry(#PROVIDER_NAME, register_##PROVIDER_NAME##_to_agora); \
43+
return 0; \
5244
} \
53-
54-
#define REGISTER_AGORA_EXTENSION_PROVIDER_WITH_CUSTOM_DLLMAIN(PROVIDER_NAME, PROVIDER_CLASS, DLLMAINFUNC, PROVIDER_INTERFACE_USED, ...) \
55-
DECLARE_CREATE_AND_REGISTER_PROVIDER(PROVIDER_NAME, PROVIDER_CLASS, PROVIDER_INTERFACE_USED, __VA_ARGS__); \
56-
BOOL APIENTRY DllMain( HMODULE hModule, \
57-
DWORD ul_reason_for_call, \
58-
LPVOID lpReserved) { \
59-
if (!DLLMAINFUNC(hModule, ul_reason_for_call, lpReserved)) { \
60-
return FALSE; \
61-
} \
62-
switch (ul_reason_for_call) { \
63-
case DLL_PROCESS_ATTACH: \
64-
registerProviderEntry(#PROVIDER_NAME, register_##PROVIDER_NAME##_to_agora); \
65-
break; \
66-
default: \
67-
break; \
68-
} \
69-
return TRUE; \
70-
} \
45+
const int DUMMY_AGORA_REGEXT_##PROVIDE_NAME##_VAR = _##PROVIDER_NAME##_provider_entry(); \
7146

7247
#else
7348
#error Unsupported Compilation Toolchain!

Android/APIExample/agora-simple-filter/src/main/cpp/AgoraRtcKit/AgoraExtensionVersion.h

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,26 @@ struct ExtensionVersion {
2222
ExtensionVersion(int majorV, int minorV = 0, int microV = 0)
2323
: major_v(majorV), minor_v(minorV), micro_v(microV) {}
2424

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+
2534
bool operator<(const ExtensionVersion& other) const {
26-
return major_v < other.major_v || minor_v < other.minor_v || micro_v < other.micro_v;
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);
2737
}
2838

29-
bool operator==(const ExtensionVersion& other) const {
30-
return major_v == other.major_v && minor_v == other.minor_v && micro_v == other.micro_v;
39+
bool operator<=(const ExtensionVersion& other) const {
40+
return !operator>(other);
41+
}
42+
43+
bool operator>=(const ExtensionVersion& other) const {
44+
return !operator<(other);
3145
}
3246
};
3347

@@ -42,36 +56,45 @@ struct ExtensionVersion {
4256

4357
class IExtensionProvider;
4458
class IExtensionProviderV2;
59+
class IExtensionProviderV3;
4560
class IAudioFilter;
4661
class IExtensionVideoFilter;
62+
class IScreenCaptureSource;
4763

4864
template <class T>
4965
struct ExtensionInterfaceVersion;
5066

5167
template <>
5268
struct ExtensionInterfaceVersion<IExtensionProvider> {
53-
static ExtensionVersion version() {
69+
static ExtensionVersion Version() {
5470
return ExtensionVersion(1, 0, 0);
5571
}
5672
};
5773

5874
template <>
5975
struct ExtensionInterfaceVersion<IExtensionProviderV2> {
60-
static ExtensionVersion version() {
61-
return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion<IExtensionProvider>::version());
76+
static ExtensionVersion Version() {
77+
return BUMP_MAJOR_VERSION(ExtensionInterfaceVersion<IExtensionProvider>::Version());
6278
}
6379
};
6480

6581
template <>
6682
struct ExtensionInterfaceVersion<IAudioFilter> {
67-
static ExtensionVersion version() {
83+
static ExtensionVersion Version() {
6884
return ExtensionVersion(1, 0, 0);
6985
}
7086
};
7187

7288
template <>
7389
struct ExtensionInterfaceVersion<IExtensionVideoFilter> {
74-
static ExtensionVersion version() {
90+
static ExtensionVersion Version() {
91+
return ExtensionVersion(1, 0, 0);
92+
}
93+
};
94+
95+
template <>
96+
struct ExtensionInterfaceVersion<IScreenCaptureSource> {
97+
static ExtensionVersion Version() {
7598
return ExtensionVersion(1, 0, 0);
7699
}
77100
};

0 commit comments

Comments
 (0)