Skip to content

Commit e28ea9a

Browse files
committed
chore: update to mono-repo LibAtem
1 parent a45245f commit e28ea9a

9 files changed

+100
-98
lines changed

Diff for: .gitmodules

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
[submodule "LibAtem.Discovery"]
2-
path = LibAtem.Discovery
3-
url = https://github.com/LibAtem/LibAtem.Discovery.git
41
[submodule "LibAtem"]
52
path = LibAtem
63
url = https://github.com/LibAtem/LibAtem.git
7-
[submodule "LibAtem.DeviceProfile"]
8-
path = LibAtem.DeviceProfile
9-
url = https://github.com/LibAtem/LibAtem.DeviceProfile.git

Diff for: AtemServer.sln

+27-27
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibAtem", "LibAtem\LibAtem\
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AtemServer", "AtemServer\AtemServer.csproj", "{87C208A6-60D7-4D03-9AF4-C537DA3D8A62}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibAtem.Discovery", "LibAtem.Discovery\LibAtem.Discovery\LibAtem.Discovery.csproj", "{026A7CA2-6613-41F9-A51F-DA4002DF11AE}"
11-
EndProject
1210
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibAtem.Test", "LibAtem\LibAtem.Test\LibAtem.Test.csproj", "{52D99257-C97B-4E11-80F8-E6C3314FFE66}"
1311
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibAtem.DeviceProfile", "LibAtem.DeviceProfile\LibAtem.DeviceProfile\LibAtem.DeviceProfile.csproj", "{F53CD32F-5A43-464C-A3B0-17640054A587}"
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibAtem.Discovery", "LibAtem\LibAtem.Discovery\LibAtem.Discovery.csproj", "{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}"
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibAtem.DeviceProfile", "LibAtem\LibAtem.DeviceProfile\LibAtem.DeviceProfile.csproj", "{B019D4D1-F598-47F5-80E6-6141CCED33E6}"
1515
EndProject
1616
Global
1717
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -50,18 +50,6 @@ Global
5050
{87C208A6-60D7-4D03-9AF4-C537DA3D8A62}.Release|x64.Build.0 = Release|Any CPU
5151
{87C208A6-60D7-4D03-9AF4-C537DA3D8A62}.Release|x86.ActiveCfg = Release|Any CPU
5252
{87C208A6-60D7-4D03-9AF4-C537DA3D8A62}.Release|x86.Build.0 = Release|Any CPU
53-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
55-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Debug|x64.ActiveCfg = Debug|Any CPU
56-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Debug|x64.Build.0 = Debug|Any CPU
57-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Debug|x86.ActiveCfg = Debug|Any CPU
58-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Debug|x86.Build.0 = Debug|Any CPU
59-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
60-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Release|Any CPU.Build.0 = Release|Any CPU
61-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Release|x64.ActiveCfg = Release|Any CPU
62-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Release|x64.Build.0 = Release|Any CPU
63-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Release|x86.ActiveCfg = Release|Any CPU
64-
{026A7CA2-6613-41F9-A51F-DA4002DF11AE}.Release|x86.Build.0 = Release|Any CPU
6553
{52D99257-C97B-4E11-80F8-E6C3314FFE66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
6654
{52D99257-C97B-4E11-80F8-E6C3314FFE66}.Debug|Any CPU.Build.0 = Debug|Any CPU
6755
{52D99257-C97B-4E11-80F8-E6C3314FFE66}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -74,17 +62,29 @@ Global
7462
{52D99257-C97B-4E11-80F8-E6C3314FFE66}.Release|x64.Build.0 = Release|Any CPU
7563
{52D99257-C97B-4E11-80F8-E6C3314FFE66}.Release|x86.ActiveCfg = Release|Any CPU
7664
{52D99257-C97B-4E11-80F8-E6C3314FFE66}.Release|x86.Build.0 = Release|Any CPU
77-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
78-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Debug|Any CPU.Build.0 = Debug|Any CPU
79-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Debug|x64.ActiveCfg = Debug|Any CPU
80-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Debug|x64.Build.0 = Debug|Any CPU
81-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Debug|x86.ActiveCfg = Debug|Any CPU
82-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Debug|x86.Build.0 = Debug|Any CPU
83-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Release|Any CPU.ActiveCfg = Release|Any CPU
84-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Release|Any CPU.Build.0 = Release|Any CPU
85-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Release|x64.ActiveCfg = Release|Any CPU
86-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Release|x64.Build.0 = Release|Any CPU
87-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Release|x86.ActiveCfg = Release|Any CPU
88-
{F53CD32F-5A43-464C-A3B0-17640054A587}.Release|x86.Build.0 = Release|Any CPU
65+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
66+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Debug|Any CPU.Build.0 = Debug|Any CPU
67+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Debug|x64.ActiveCfg = Debug|Any CPU
68+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Debug|x64.Build.0 = Debug|Any CPU
69+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Debug|x86.ActiveCfg = Debug|Any CPU
70+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Debug|x86.Build.0 = Debug|Any CPU
71+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Release|Any CPU.ActiveCfg = Release|Any CPU
72+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Release|Any CPU.Build.0 = Release|Any CPU
73+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Release|x64.ActiveCfg = Release|Any CPU
74+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Release|x64.Build.0 = Release|Any CPU
75+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Release|x86.ActiveCfg = Release|Any CPU
76+
{7D9490B5-FD0C-4C8D-BC33-46C5B39F9256}.Release|x86.Build.0 = Release|Any CPU
77+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
78+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
79+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Debug|x64.ActiveCfg = Debug|Any CPU
80+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Debug|x64.Build.0 = Debug|Any CPU
81+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Debug|x86.ActiveCfg = Debug|Any CPU
82+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Debug|x86.Build.0 = Debug|Any CPU
83+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
84+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Release|Any CPU.Build.0 = Release|Any CPU
85+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Release|x64.ActiveCfg = Release|Any CPU
86+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Release|x64.Build.0 = Release|Any CPU
87+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Release|x86.ActiveCfg = Release|Any CPU
88+
{B019D4D1-F598-47F5-80E6-6141CCED33E6}.Release|x86.Build.0 = Release|Any CPU
8989
EndGlobalSection
9090
EndGlobal

Diff for: AtemServer/AtemRepository.cs

-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ public bool AddDevice(string address, int port)
184184

185185
return true;
186186
}
187-
188-
return false;
189187
}
190188
}
191189

Diff for: AtemServer/AtemServer.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
</ItemGroup>
2020

2121
<ItemGroup>
22-
<ProjectReference Include="..\LibAtem.DeviceProfile\LibAtem.DeviceProfile\LibAtem.DeviceProfile.csproj" />
23-
<ProjectReference Include="..\LibAtem.Discovery\LibAtem.Discovery\LibAtem.Discovery.csproj" />
22+
<ProjectReference Include="..\LibAtem\LibAtem.DeviceProfile\LibAtem.DeviceProfile.csproj" />
23+
<ProjectReference Include="..\LibAtem\LibAtem.Discovery\LibAtem.Discovery.csproj" />
2424
<ProjectReference Include="..\LibAtem\LibAtem\LibAtem.csproj" />
2525
</ItemGroup>
2626

Diff for: AtemServer/Controllers/SpecController.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections.Generic;
32
using LibAtem.Commands.MixEffects;
43
using LibAtem.Common;
@@ -47,9 +46,10 @@ public CommandsSpec Get()
4746
AudioMonitor = true,
4847
VideoModes = new VideoModeSet()
4948
{
50-
DownConvertAbove = VideoModeStandard.SDI3G,
49+
SupportedModes = {},
50+
/*DownConvertAbove = VideoModeStandard.SDI3G,
5151
MaximumSupported = VideoModeStandard.SDI6G,
52-
MinimumSupported = VideoModeStandard.SDISD,
52+
MinimumSupported = VideoModeStandard.SDISD,*/
5353
MaxFrames = new MaxFramesSet()
5454
{
5555
_720 = 1000,

Diff for: AtemServer/Controllers/SpecGenerator.cs

+67-55
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Reflection;
55
using System.Xml.Serialization;
6+
using LibAtem;
67
using LibAtem.Commands;
78
using LibAtem.Common;
89
using LibAtem.DeviceProfile;
@@ -41,6 +42,8 @@ public CommandSpec()
4142
public string FullName { get; set; }
4243
public string Name { get; set; }
4344

45+
public ProtocolVersion InitialVersion { get; set; }
46+
4447
public bool IsValid { get; set; }
4548

4649
public List<CommandProperty> Properties { get; set; }
@@ -77,75 +80,84 @@ public static CommandsSpec CompileData(DeviceProfile profile)
7780
{
7881
var res = new CommandsSpec();
7982

80-
foreach (var cmd in CommandManager.GetAllTypes())
83+
foreach (var cmdSet in CommandManager.GetAllTypes())
8184
{
82-
var spec = res.Commands[cmd.Value.FullName] = new CommandSpec
83-
{
84-
FullName = cmd.Value.FullName,
85-
Name = cmd.Value.Name
86-
};
87-
88-
if (typeof(SerializableCommandBase).GetTypeInfo().IsAssignableFrom(cmd.Value))
85+
foreach (var cmd in cmdSet.Value)
8986
{
90-
spec.IsValid = true;
87+
var spec = res.Commands[cmd.Item2.FullName] = new CommandSpec
88+
{
89+
FullName = cmd.Item2.FullName,
90+
Name = cmd.Item2.Name,
91+
InitialVersion = cmd.Item1
92+
};
9193

92-
foreach (PropertyInfo prop in cmd.Value.GetProperties(
93-
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
94+
if (typeof(SerializableCommandBase).GetTypeInfo().IsAssignableFrom(cmd.Item2))
9495
{
95-
// If prop cannot be deserialized, then ignore
96-
if (!prop.CanWrite || prop.GetSetMethod() == null)
97-
continue;
96+
spec.IsValid = true;
9897

99-
if (prop.GetCustomAttribute<NoSerializeAttribute>() != null)
100-
continue;
101-
102-
//TODO
103-
var resProp = new CommandProperty
104-
{
105-
Name = prop.Name,
106-
IsId = prop.GetCustomAttributes<CommandIdAttribute>().Any()
107-
};
108-
109-
if (prop.GetCustomAttribute<BoolAttribute>() != null)
110-
{
111-
resProp.Type = CommandPropertyType.Bool;
112-
}
113-
else if (prop.GetCustomAttribute<Enum8Attribute>() != null || prop.GetCustomAttribute<Enum16Attribute>() != null || prop.GetCustomAttribute<Enum32Attribute>() != null)
98+
foreach (PropertyInfo prop in cmd.Item2.GetProperties(
99+
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
114100
{
115-
resProp.Type = prop.PropertyType.GetCustomAttribute<FlagsAttribute>() != null ? CommandPropertyType.Flags : CommandPropertyType.Enum;
101+
// If prop cannot be deserialized, then ignore
102+
if (!prop.CanWrite || prop.GetSetMethod() == null)
103+
continue;
116104

117-
/* string mappedTypeName = TypeMappings.MapType(prop.PropertyType.FullName);
118-
Type mappedType = prop.PropertyType;
119-
if (mappedTypeName != mappedType.FullName && mappedTypeName.IndexOf("System.") != 0)
120-
mappedType = GetType(mappedTypeName);
105+
if (prop.GetCustomAttribute<NoSerializeAttribute>() != null)
106+
continue;
121107

108+
//TODO
109+
var resProp = new CommandProperty
110+
{
111+
Name = prop.Name,
112+
IsId = prop.GetCustomAttributes<CommandIdAttribute>().Any()
113+
};
122114

123-
foreach (object val in Enum.GetValues(mappedType))
115+
if (prop.GetCustomAttribute<BoolAttribute>() != null)
116+
{
117+
resProp.Type = CommandPropertyType.Bool;
118+
}
119+
else if (prop.GetCustomAttribute<Enum8Attribute>() != null ||
120+
prop.GetCustomAttribute<Enum16Attribute>() != null ||
121+
prop.GetCustomAttribute<Enum32Attribute>() != null)
124122
{
125-
string id = val.ToString();
126-
var xmlAttr = mappedType.GetMember(val.ToString())[0].GetCustomAttribute<XmlEnumAttribute>();
127-
if (xmlAttr != null)
128-
id = xmlAttr.Name;
123+
resProp.Type = prop.PropertyType.GetCustomAttribute<FlagsAttribute>() != null
124+
? CommandPropertyType.Flags
125+
: CommandPropertyType.Enum;
129126

130-
if (!AvailabilityChecker.IsAvailable(profile, val))
131-
continue;
127+
/* string mappedTypeName = TypeMappings.MapType(prop.PropertyType.FullName);
128+
Type mappedType = prop.PropertyType;
129+
if (mappedTypeName != mappedType.FullName && mappedTypeName.IndexOf("System.") != 0)
130+
mappedType = GetType(mappedTypeName);
131+
132+
133+
foreach (object val in Enum.GetValues(mappedType))
134+
{
135+
string id = val.ToString();
136+
var xmlAttr = mappedType.GetMember(val.ToString())[0].GetCustomAttribute<XmlEnumAttribute>();
137+
if (xmlAttr != null)
138+
id = xmlAttr.Name;
139+
140+
if (!AvailabilityChecker.IsAvailable(profile, val))
141+
continue;
142+
143+
// TODO check value is available for usage location
144+
xmlField.Values.Add(new MacroFieldValueSpec()
145+
{
146+
Id = id,
147+
Name = val.ToString(),
148+
});
149+
}*/
150+
}
151+
else
152+
{
153+
SetNumericProps(profile, cmd.Item2, resProp, prop);
154+
}
132155

133-
// TODO check value is available for usage location
134-
xmlField.Values.Add(new MacroFieldValueSpec()
135-
{
136-
Id = id,
137-
Name = val.ToString(),
138-
});
139-
}*/
140-
}
141-
else
142-
{
143-
SetNumericProps(profile, cmd.Value, resProp, prop);
156+
spec.Properties.Add(resProp);
144157
}
145-
146-
spec.Properties.Add(resProp);
147158
}
148159
}
160+
149161
/*
150162
var xmlOp = new MacroOperationSpec() {Id = op.Key.ToString()};
151163
res.Operations.Add(xmlOp);
@@ -279,7 +291,7 @@ private static void SetNumericProps(DeviceProfile profile, Type cmdType, Command
279291

280292
private static T GetDefaultForField<T>(DeviceProfile profile, Type cmdType, CommandProperty field)
281293
{
282-
return (T) AvailabilityChecker.GetMaxForCommandProperty(profile, string.Format("{0}.{1}", cmdType.Name, field.Name));
294+
return (T) AvailabilityChecker.GetMaxForCommandProperty(profile, $"{cmdType.Name}.{field.Name}");
283295
}
284296
}
285297
}

Diff for: LibAtem

Submodule LibAtem updated 370 files

Diff for: LibAtem.DeviceProfile

-1
This file was deleted.

Diff for: LibAtem.Discovery

-1
This file was deleted.

0 commit comments

Comments
 (0)