Skip to content

Commit ae0d52d

Browse files
committed
Added OBS Studio 29 support. Cleaned things up in preparation for public release.
1 parent 12e735f commit ae0d52d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+368
-367
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.vs/
2-
bin/
3-
obj/
2+
/bin/
3+
/obj/
44
*.vcxproj.user

.gitmodules

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
[submodule "lib/obs-studio"]
2-
path = lib/obs-studio
1+
[submodule "external/obs-studio"]
2+
path = external/obs-studio
33
url = https://github.com/obsproject/obs-studio.git
4+
branch = release/29.1

ActiveMonitorTrackerTest/ActiveMonitorTrackerTest.vcxproj

-78
This file was deleted.

ActiveMonitorTrackerTest/ActiveMonitorTrackerTest.vcxproj.filters

-6
This file was deleted.

ActiveMonitorTrackerTest/Main.cpp

-38
This file was deleted.

Common.props

-12
This file was deleted.

Directory.Build.props

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<Project>
2+
<Import Project="tooling/Common.props" />
3+
<Import Project="tooling/Common$(MSBuildProjectExtension).props" Condition="Exists('tooling/Common$(MSBuildProjectExtension).props')"/>
4+
</Project>

Directory.Build.rsp

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# This file intentionally left blank.

Directory.Build.targets

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<Project>
2+
<Import Project="tooling/Common.targets" />
3+
<Import Project="tooling/Common$(MSBuildProjectExtension).targets" Condition="Exists('tooling/Common$(MSBuildProjectExtension).targets')" />
4+
</Project>

HydraCore/Event.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "Event.h"
2+
3+
namespace HydraCore
4+
{
5+
Event::~Event()
6+
{
7+
std::lock_guard<std::mutex> lock(eventHandlersMutex);
8+
9+
for (const std::pair<EventSubscriptionHandle, EventHandlerBase*>& eventHandler : eventHandlers)
10+
{
11+
delete eventHandler.second;
12+
}
13+
}
14+
15+
void Event::Unsubscribe(EventSubscriptionHandle subscriptionHandle)
16+
{
17+
std::lock_guard<std::mutex> lock(eventHandlersMutex);
18+
eventHandlers.erase(subscriptionHandle);
19+
}
20+
21+
void Event::Dispatch()
22+
{
23+
std::lock_guard<std::mutex> lock(eventHandlersMutex);
24+
25+
for (const std::pair<EventSubscriptionHandle, EventHandlerBase*>& eventHandler : eventHandlers)
26+
{
27+
eventHandler.second->Dispatch();
28+
}
29+
}
30+
}

HydraCore/Event.h

+6-28
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace HydraCore
88
{
9-
typedef char* EventSubscriptionHandle;
9+
typedef uintptr_t EventSubscriptionHandle;
1010

1111
class Event
1212
{
@@ -15,20 +15,12 @@ namespace HydraCore
1515
std::mutex eventHandlersMutex;
1616
EventSubscriptionHandle nextHandle;
1717
public:
18-
Event()
18+
inline Event()
1919
{
20-
nextHandle = (EventSubscriptionHandle)1;
20+
nextHandle = 1;
2121
}
2222

23-
~Event()
24-
{
25-
std::lock_guard<std::mutex> lock(eventHandlersMutex);
26-
27-
for (const std::pair<EventSubscriptionHandle, EventHandlerBase*>& eventHandler : eventHandlers)
28-
{
29-
delete eventHandler.second;
30-
}
31-
}
23+
~Event();
3224

3325
template<class TTarget>
3426
EventSubscriptionHandle Subscribe(TTarget* targetObject, typename EventHandler<TTarget>::TargetMethodType targetMethod)
@@ -41,21 +33,7 @@ namespace HydraCore
4133
return handle;
4234
}
4335

44-
void Unsubscribe(EventSubscriptionHandle subscriptionHandle)
45-
{
46-
std::lock_guard<std::mutex> lock(eventHandlersMutex);
47-
48-
eventHandlers.erase(subscriptionHandle);
49-
}
50-
51-
void Dispatch()
52-
{
53-
std::lock_guard<std::mutex> lock(eventHandlersMutex);
54-
55-
for (const std::pair<EventSubscriptionHandle, EventHandlerBase*>& eventHandler : eventHandlers)
56-
{
57-
eventHandler.second->Dispatch();
58-
}
59-
}
36+
void Unsubscribe(EventSubscriptionHandle subscriptionHandle);
37+
void Dispatch();
6038
};
6139
}

HydraCore/EventHandler.h

+30-27
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
#pragma once
2-
3-
class EventHandlerBase
4-
{
5-
public:
6-
virtual void Dispatch() = 0;
7-
};
8-
9-
template<class TTarget>
10-
class EventHandler : public EventHandlerBase
11-
{
12-
public:
13-
typedef void (TTarget::*TargetMethodType)();
14-
private:
15-
TTarget * targetObject;
16-
TargetMethodType targetMethod;
17-
public:
18-
EventHandler(TTarget* targetObject, TargetMethodType targetMethod)
19-
: targetObject(targetObject), targetMethod(targetMethod)
20-
{
21-
}
22-
23-
virtual void Dispatch()
24-
{
25-
(targetObject->*targetMethod)();
26-
}
27-
};
1+
#pragma once
2+
3+
namespace HydraCore
4+
{
5+
class EventHandlerBase
6+
{
7+
public:
8+
virtual void Dispatch() = 0;
9+
};
10+
11+
template<class TTarget>
12+
class EventHandler : public EventHandlerBase
13+
{
14+
public:
15+
typedef void (TTarget::*TargetMethodType)();
16+
private:
17+
TTarget * targetObject;
18+
TargetMethodType targetMethod;
19+
public:
20+
EventHandler(TTarget* targetObject, TargetMethodType targetMethod)
21+
: targetObject(targetObject), targetMethod(targetMethod)
22+
{
23+
}
24+
25+
virtual void Dispatch()
26+
{
27+
(targetObject->*targetMethod)();
28+
}
29+
};
30+
}

HydraCore/HydraCore.vcxproj

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<ItemGroup>
2727
<ClCompile Include="ActiveMonitorTracker.cpp" />
2828
<ClCompile Include="Animation.cpp" />
29+
<ClCompile Include="Event.cpp" />
2930
<ClCompile Include="Monitor.cpp" />
3031
<ClCompile Include="LinearAnimation.cpp" />
3132
<ClCompile Include="Win32Exception.cpp" />
@@ -34,19 +35,19 @@
3435
<VCProjectVersion>15.0</VCProjectVersion>
3536
<ProjectGuid>{EAD6B8B6-90BE-4F49-BC75-55F28A15F44D}</ProjectGuid>
3637
<RootNamespace>HydraCore</RootNamespace>
37-
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
38+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
3839
</PropertyGroup>
3940
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
4041
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
4142
<ConfigurationType>StaticLibrary</ConfigurationType>
4243
<UseDebugLibraries>true</UseDebugLibraries>
43-
<PlatformToolset>v141</PlatformToolset>
44+
<PlatformToolset>v143</PlatformToolset>
4445
<CharacterSet>MultiByte</CharacterSet>
4546
</PropertyGroup>
4647
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4748
<ConfigurationType>StaticLibrary</ConfigurationType>
4849
<UseDebugLibraries>false</UseDebugLibraries>
49-
<PlatformToolset>v141</PlatformToolset>
50+
<PlatformToolset>v143</PlatformToolset>
5051
<WholeProgramOptimization>true</WholeProgramOptimization>
5152
<CharacterSet>MultiByte</CharacterSet>
5253
</PropertyGroup>
@@ -57,11 +58,9 @@
5758
</ImportGroup>
5859
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
5960
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
60-
<Import Project="..\Common.props" />
6161
</ImportGroup>
6262
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
6363
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
64-
<Import Project="..\Common.props" />
6564
</ImportGroup>
6665
<PropertyGroup Label="UserMacros" />
6766
<PropertyGroup />

HydraCore/HydraCore.vcxproj.filters

+1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<ClCompile Include="ActiveMonitorTracker.cpp" />
2020
<ClCompile Include="LinearAnimation.cpp" />
2121
<ClCompile Include="Animation.cpp" />
22+
<ClCompile Include="Event.cpp" />
2223
</ItemGroup>
2324
</Project>

HydraCore/LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018 Pathogen Studios
1+
Copyright (c) 2018 David Maas
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)