forked from milaq/kodi-headless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kodi-headless.patch
895 lines (835 loc) · 32.3 KB
/
kodi-headless.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
From 658e9c38abc57d9bc6a85d02e96e41a8883f3c8c Mon Sep 17 00:00:00 2001
From: sinopsysHK <[email protected]>
Date: Fri, 1 Mar 2019 00:18:37 +0800
Subject: [PATCH] create a dedicated Headless WinSystem which does nothing and
avoid rendering - working only on linux X11 or GBM
---
xbmc/AppParamParser.cpp | 3 +
xbmc/AppParamParser.h | 1 +
xbmc/Application.cpp | 16 ++--
xbmc/Application.h | 2 +
xbmc/platform/xbmc.cpp | 0
xbmc/windowing/CMakeLists.txt | 4 +-
xbmc/windowing/WinSystem.h | 2 +-
xbmc/windowing/WinSystemHeadless.cpp | 57 +++++++++++++
xbmc/windowing/WinSystemHeadless.h | 78 ++++++++++++++++++
xbmc/windowing/X11/CMakeLists.txt | 2 +
xbmc/windowing/X11/WinSystemHeadlessX11.cpp | 50 ++++++++++++
xbmc/windowing/X11/WinSystemHeadlessX11.h | 81 +++++++++++++++++++
xbmc/windowing/X11/WinSystemX11GLContext.cpp | 9 ++-
.../amlogic/WinSystemAmlogicGLESContext.cpp | 12 ++-
.../android/WinSystemAndroidGLESContext.cpp | 12 ++-
xbmc/windowing/gbm/WinSystemGbmGLContext.cpp | 9 ++-
.../windowing/gbm/WinSystemGbmGLESContext.cpp | 9 ++-
xbmc/windowing/osx/WinSystemIOS.mm | 12 ++-
xbmc/windowing/osx/WinSystemOSXGL.mm | 13 ++-
.../windowing/rpi/WinSystemRpiGLESContext.cpp | 12 ++-
.../wayland/WinSystemWaylandEGLContextGL.cpp | 12 ++-
.../WinSystemWaylandEGLContextGLES.cpp | 12 ++-
xbmc/windowing/win10/WinSystemWin10DX.cpp | 13 ++-
xbmc/windowing/windows/WinSystemWin32DX.cpp | 12 ++-
24 files changed, 401 insertions(+), 32 deletions(-)
mode change 100644 => 100755 xbmc/Application.cpp
mode change 100644 => 100755 xbmc/platform/xbmc.cpp
mode change 100644 => 100755 xbmc/windowing/CMakeLists.txt
mode change 100644 => 100755 xbmc/windowing/WinSystem.h
create mode 100755 xbmc/windowing/WinSystemHeadless.cpp
create mode 100755 xbmc/windowing/WinSystemHeadless.h
mode change 100644 => 100755 xbmc/windowing/X11/CMakeLists.txt
create mode 100755 xbmc/windowing/X11/WinSystemHeadlessX11.cpp
create mode 100755 xbmc/windowing/X11/WinSystemHeadlessX11.h
mode change 100644 => 100755 xbmc/windowing/X11/WinSystemX11GLContext.cpp
mode change 100644 => 100755 xbmc/windowing/amlogic/WinSystemAmlogicGLESContext.cpp
mode change 100644 => 100755 xbmc/windowing/android/WinSystemAndroidGLESContext.cpp
mode change 100644 => 100755 xbmc/windowing/gbm/WinSystemGbmGLContext.cpp
mode change 100644 => 100755 xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp
mode change 100644 => 100755 xbmc/windowing/osx/WinSystemIOS.mm
mode change 100644 => 100755 xbmc/windowing/osx/WinSystemOSXGL.mm
mode change 100644 => 100755 xbmc/windowing/rpi/WinSystemRpiGLESContext.cpp
mode change 100644 => 100755 xbmc/windowing/wayland/WinSystemWaylandEGLContextGL.cpp
mode change 100644 => 100755 xbmc/windowing/wayland/WinSystemWaylandEGLContextGLES.cpp
mode change 100644 => 100755 xbmc/windowing/win10/WinSystemWin10DX.cpp
mode change 100644 => 100755 xbmc/windowing/windows/WinSystemWin32DX.cpp
diff --git a/xbmc/AppParamParser.cpp b/xbmc/AppParamParser.cpp
index 63920101d0a8..d1daa4618734 100644
--- a/xbmc/AppParamParser.cpp
+++ b/xbmc/AppParamParser.cpp
@@ -54,6 +54,7 @@ void CAppParamParser::DisplayHelp()
printf("Arguments:\n");
printf(" -fs\t\t\tRuns %s in full screen\n", CSysInfo::GetAppName().c_str());
printf(" --standalone\t\t%s runs in a stand alone environment without a window \n", CSysInfo::GetAppName().c_str());
+ printf(" --headless\t\t%s runs in headless mode without a window \n", CSysInfo::GetAppName().c_str());
printf("\t\t\tmanager and supporting applications. For example, that\n");
printf("\t\t\tenables network settings.\n");
printf(" -p or --portable\t%s will look for configurations in install folder instead of ~/.%s\n", CSysInfo::GetAppName().c_str(), lcAppName.c_str());
@@ -75,6 +76,8 @@ void CAppParamParser::ParseArg(const std::string &arg)
DisplayVersion();
else if (arg == "--standalone")
m_standAlone = true;
+ else if (arg == "--headless")
+ m_headLess = true;
else if (arg == "-p" || arg == "--portable")
m_platformDirectories = false;
else if (arg == "--debug")
diff --git a/xbmc/AppParamParser.h b/xbmc/AppParamParser.h
index a0823364e5ca..dbb3509fd88d 100644
--- a/xbmc/AppParamParser.h
+++ b/xbmc/AppParamParser.h
@@ -30,6 +30,7 @@ class CAppParamParser
bool m_platformDirectories = true;
bool m_testmode = false;
bool m_standAlone = false;
+ bool m_headLess = false;
private:
void ParseArg(const std::string &arg);
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
old mode 100644
new mode 100755
index 1a6b8fa3aa3b..5b464d562d72
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -367,6 +367,7 @@ bool CApplication::Create(const CAppParamParser ¶ms)
m_bPlatformDirectories = params.m_platformDirectories;
m_bTestMode = params.m_testmode;
m_bStandalone = params.m_standAlone;
+ m_bHeadless = params.m_headLess;
m_pSettingsComponent.reset(new CSettingsComponent());
m_pSettingsComponent->Init(params);
@@ -561,7 +562,7 @@ bool CApplication::Create(const CAppParamParser ¶ms)
m_pAppPort = std::make_shared<CAppInboundProtocol>(*this);
CServiceBroker::RegisterAppPort(m_pAppPort);
- m_pWinSystem = CWinSystemBase::CreateWinSystem();
+ m_pWinSystem = CWinSystemBase::CreateWinSystem(!m_bHeadless);
CServiceBroker::RegisterWinSystem(m_pWinSystem.get());
if (!m_ServiceManager->InitStageTwo(params, m_pSettingsComponent->GetProfileManager()->GetProfileUserDataFolder()))
@@ -608,7 +609,7 @@ bool CApplication::CreateGUI()
{
m_frameMoveGuard.lock();
- m_renderGUI = true;
+ m_renderGUI = !m_bHeadless;
if (!CServiceBroker::GetWinSystem()->InitWindowSystem())
{
@@ -762,7 +763,7 @@ bool CApplication::Initialize()
// Init DPMS, before creating the corresponding setting control.
m_dpms.reset(new DPMSSupport());
bool uiInitializationFinished = false;
- if (CServiceBroker::GetGUI()->GetWindowManager().Initialized())
+ if (!m_bHeadless && CServiceBroker::GetGUI()->GetWindowManager().Initialized())
{
const std::shared_ptr<CSettings> settings = CServiceBroker::GetSettingsComponent()->GetSettings();
settings->GetSetting(CSettings::SETTING_POWERMANAGEMENT_DISPLAYSOFF)->SetRequirementsMet(m_dpms->IsSupported());
@@ -873,9 +874,12 @@ bool CApplication::Initialize()
CLog::Log(LOGNOTICE, "initialize done");
- CheckOSScreenSaverInhibitionSetting();
- // reset our screensaver (starts timers etc.)
- ResetScreenSaver();
+ if (!m_bHeadless)
+ {
+ CheckOSScreenSaverInhibitionSetting();
+ // reset our screensaver (starts timers etc.)
+ ResetScreenSaver();
+ }
// if the user interfaces has been fully initialized let everyone know
if (uiInitializationFinished)
diff --git a/xbmc/Application.h b/xbmc/Application.h
index 30cf6e7d3246..4cebb7703e04 100644
--- a/xbmc/Application.h
+++ b/xbmc/Application.h
@@ -309,6 +309,7 @@ friend class CAppInboundProtocol;
bool PlatformDirectoriesEnabled() { return m_bPlatformDirectories; }
bool IsStandAlone() { return m_bStandalone; }
+ bool IsHeadLess() { return m_bHeadless; }
bool IsEnableTestMode() { return m_bTestMode; }
bool IsAppFocused() const { return m_AppFocused; }
@@ -439,6 +440,7 @@ friend class CAppInboundProtocol;
bool m_skipGuiRender = false;
bool m_bStandalone = false;
+ bool m_bHeadless = false;
bool m_bTestMode = false;
bool m_bSystemScreenSaverEnable = false;
diff --git a/xbmc/platform/xbmc.cpp b/xbmc/platform/xbmc.cpp
old mode 100644
new mode 100755
diff --git a/xbmc/windowing/CMakeLists.txt b/xbmc/windowing/CMakeLists.txt
old mode 100644
new mode 100755
index 1904e2c0ff38..16267bb759b7
--- a/xbmc/windowing/CMakeLists.txt
+++ b/xbmc/windowing/CMakeLists.txt
@@ -1,13 +1,15 @@
set(SOURCES GraphicContext.cpp
OSScreenSaver.cpp
Resolution.cpp
- WinSystem.cpp)
+ WinSystem.cpp
+ WinSystemHeadless.cpp)
set(HEADERS GraphicContext.h
OSScreenSaver.h
Resolution.h
WinEvents.h
WinSystem.h
+ WinSystemHeadless.h
XBMC_events.h
VideoSync.h)
diff --git a/xbmc/windowing/WinSystem.h b/xbmc/windowing/WinSystem.h
old mode 100644
new mode 100755
index 6e84c49e5fd5..aabd4529d7eb
--- a/xbmc/windowing/WinSystem.h
+++ b/xbmc/windowing/WinSystem.h
@@ -40,7 +40,7 @@ class CWinSystemBase
CWinSystemBase();
virtual ~CWinSystemBase();
- static std::unique_ptr<CWinSystemBase> CreateWinSystem();
+ static std::unique_ptr<CWinSystemBase> CreateWinSystem(bool render);
// Access render system interface
virtual CRenderSystemBase *GetRenderSystem() { return nullptr; }
diff --git a/xbmc/windowing/WinSystemHeadless.cpp b/xbmc/windowing/WinSystemHeadless.cpp
new file mode 100755
index 000000000000..3f057f78fc13
--- /dev/null
+++ b/xbmc/windowing/WinSystemHeadless.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "WinSystemHeadless.h"
+
+#include "utils/log.h"
+
+#include <vector>
+#include <string>
+
+//using namespace KODI::MESSAGING;
+using namespace KODI::WINDOWING;
+
+#define EGL_NO_CONFIG (EGLConfig)0
+
+CWinSystemHeadless::CWinSystemHeadless() : CWinSystemBase(), CRenderSystemBase()
+{
+}
+
+CWinSystemHeadless::~CWinSystemHeadless() = default;
+
+// bool CWinSystemHeadless::MessagePump()
+// {
+// return m_winEvents->MessagePump();
+// }
+
+bool CWinSystemHeadless::InitWindowSystem() {return true;};
+bool CWinSystemHeadless::DestroyWindowSystem() {return true;};
+bool CWinSystemHeadless::CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) {return true;};
+bool CWinSystemHeadless::DestroyWindow() {return true;};
+bool CWinSystemHeadless::ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) {return true;};
+void CWinSystemHeadless::FinishWindowResize(int newWidth, int newHeight) {};
+bool CWinSystemHeadless::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) {return true;};
+void CWinSystemHeadless::UpdateResolutions() {};
+void CWinSystemHeadless::ShowOSMouse(bool show) {};
+
+void CWinSystemHeadless::NotifyAppActiveChange(bool bActivated) {};
+void CWinSystemHeadless::NotifyAppFocusChange(bool bGaining) {};
+
+bool CWinSystemHeadless::Minimize() {return true;};
+bool CWinSystemHeadless::Restore() {return true;};
+bool CWinSystemHeadless::Hide() {return true;};
+bool CWinSystemHeadless::Show(bool raise) {return true;};
+void CWinSystemHeadless::Register(IDispResource *resource) {};
+void CWinSystemHeadless::Unregister(IDispResource *resource) {};
+bool CWinSystemHeadless::HasCalibration(const RESOLUTION_INFO &resInfo) {return true;};
+bool CWinSystemHeadless::UseLimitedColor() {return true;};
+
+void CWinSystemHeadless::ShowSplash(const std::string& message)
+{
+ CLog::Log(LOGDEBUG, message.c_str());
+};
diff --git a/xbmc/windowing/WinSystemHeadless.h b/xbmc/windowing/WinSystemHeadless.h
new file mode 100755
index 000000000000..839fb0982679
--- /dev/null
+++ b/xbmc/windowing/WinSystemHeadless.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "rendering/RenderSystem.h"
+#include "WinSystem.h"
+
+#include <string>
+#include <vector>
+
+
+class CWinSystemHeadless : public CWinSystemBase, public CRenderSystemBase
+{
+public:
+ CWinSystemHeadless();
+ ~CWinSystemHeadless() override;
+
+ // CWinSystemBase
+ CRenderSystemBase *GetRenderSystem() override { return this; }
+ bool InitWindowSystem() override;
+ bool DestroyWindowSystem() override;
+ bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override;
+ bool DestroyWindow() override;
+ bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override;
+ void FinishWindowResize(int newWidth, int newHeight) override;
+ bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
+ void UpdateResolutions() override;
+ void ShowOSMouse(bool show) override;
+
+ void NotifyAppActiveChange(bool bActivated) override;
+ void NotifyAppFocusChange(bool bGaining) override;
+
+ bool Minimize() override;
+ bool Restore() override;
+ bool Hide() override;
+ bool Show(bool raise = true) override;
+ void Register(IDispResource *resource) override;
+ void Unregister(IDispResource *resource) override;
+ bool HasCalibration(const RESOLUTION_INFO &resInfo) override;
+ bool UseLimitedColor() override;
+
+ // winevents override
+ //bool MessagePump() override;
+
+ // render
+ bool InitRenderSystem() override { return true;} ;
+ bool DestroyRenderSystem() override { return true;} ;
+ bool ResetRenderSystem(int width, int height) override { return true;} ;
+
+ bool BeginRender() override { return true;} ;
+ bool EndRender() override { return true;} ;
+ void PresentRender(bool rendered, bool videoLayer) override {} ;
+ bool ClearBuffers(UTILS::Color color) override { return true;} ;
+ bool IsExtSupported(const char* extension) const override { return false;} ;
+
+ void SetViewPort(const CRect& viewPort) override {} ;
+ void GetViewPort(CRect& viewPort) override {} ;
+
+ void SetScissors(const CRect &rect) override {} ;
+ void ResetScissors() override {} ;
+
+ void CaptureStateBlock() override {} ;
+ void ApplyStateBlock() override {} ;
+
+ void SetCameraPosition(const CPoint &camera, int screenWidth, int screenHeight, float stereoFactor = 0.f) override {} ;
+ void ShowSplash(const std::string& message) override;
+
+protected:
+
+private:
+
+};
diff --git a/xbmc/windowing/X11/CMakeLists.txt b/xbmc/windowing/X11/CMakeLists.txt
old mode 100644
new mode 100755
index 282e96fa3457..c23ad4be8cb6
--- a/xbmc/windowing/X11/CMakeLists.txt
+++ b/xbmc/windowing/X11/CMakeLists.txt
@@ -4,6 +4,7 @@ set(SOURCES GLContextEGL.cpp
OSScreenSaverX11.cpp
WinEventsX11.cpp
WinSystemX11.cpp
+ WinSystemHeadlessX11.cpp
WinSystemX11GLContext.cpp
XRandR.cpp
VideoSyncOML.cpp)
@@ -14,6 +15,7 @@ set(HEADERS GLContext.h
OSScreenSaverX11.h
WinEventsX11.h
WinSystemX11.h
+ WinSystemHeadlessX11.h
WinSystemX11GLContext.h
XRandR.h
VideoSyncOML.h)
diff --git a/xbmc/windowing/X11/WinSystemHeadlessX11.cpp b/xbmc/windowing/X11/WinSystemHeadlessX11.cpp
new file mode 100755
index 000000000000..3eb5681051a4
--- /dev/null
+++ b/xbmc/windowing/X11/WinSystemHeadlessX11.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "WinSystemHeadlessX11.h"
+#include "utils/log.h"
+#include <vector>
+#include <string>
+
+//using namespace KODI::MESSAGING;
+using namespace KODI::WINDOWING;
+
+CWinSystemHeadlessX11::CWinSystemHeadlessX11() :
+ CWinSystemX11(),
+ CRenderSystemBase()
+{
+}
+
+CWinSystemHeadlessX11::~CWinSystemHeadlessX11() = default;
+
+bool CWinSystemHeadlessX11::InitWindowSystem() {return true;};
+bool CWinSystemHeadlessX11::DestroyWindowSystem() {return true;};
+bool CWinSystemHeadlessX11::CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) {return true;};
+bool CWinSystemHeadlessX11::DestroyWindow() {return true;};
+bool CWinSystemHeadlessX11::ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) {return true;};
+void CWinSystemHeadlessX11::FinishWindowResize(int newWidth, int newHeight) {};
+bool CWinSystemHeadlessX11::SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) {return true;};
+void CWinSystemHeadlessX11::UpdateResolutions() {};
+void CWinSystemHeadlessX11::ShowOSMouse(bool show) {};
+
+void CWinSystemHeadlessX11::NotifyAppActiveChange(bool bActivated) {};
+void CWinSystemHeadlessX11::NotifyAppFocusChange(bool bGaining) {};
+
+bool CWinSystemHeadlessX11::Minimize() {return true;};
+bool CWinSystemHeadlessX11::Restore() {return true;};
+bool CWinSystemHeadlessX11::Hide() {return true;};
+bool CWinSystemHeadlessX11::Show(bool raise) {return true;};
+void CWinSystemHeadlessX11::Register(IDispResource *resource) {};
+void CWinSystemHeadlessX11::Unregister(IDispResource *resource) {};
+bool CWinSystemHeadlessX11::HasCalibration(const RESOLUTION_INFO &resInfo) {return true;};
+bool CWinSystemHeadlessX11::UseLimitedColor() {return true;};
+
+void CWinSystemHeadlessX11::ShowSplash(const std::string& message)
+{
+ CLog::Log(LOGDEBUG, message.c_str());
+};
diff --git a/xbmc/windowing/X11/WinSystemHeadlessX11.h b/xbmc/windowing/X11/WinSystemHeadlessX11.h
new file mode 100755
index 000000000000..c77aa9a1c143
--- /dev/null
+++ b/xbmc/windowing/X11/WinSystemHeadlessX11.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "windowing/WinSystemHeadless.h"
+#include "WinSystemX11.h"
+
+#include <string>
+#include <vector>
+
+class CWinSystemHeadlessX11 : public CWinSystemX11, public CRenderSystemBase
+{
+public:
+ CWinSystemHeadlessX11();
+ ~CWinSystemHeadlessX11() override;
+
+ // CWinSystemBase
+ CRenderSystemBase *GetRenderSystem() override { return this; }
+ bool InitWindowSystem() override;
+ bool DestroyWindowSystem() override;
+ bool CreateNewWindow(const std::string& name, bool fullScreen, RESOLUTION_INFO& res) override;
+ bool DestroyWindow() override;
+ bool ResizeWindow(int newWidth, int newHeight, int newLeft, int newTop) override;
+ void FinishWindowResize(int newWidth, int newHeight) override;
+ bool SetFullScreen(bool fullScreen, RESOLUTION_INFO& res, bool blankOtherDisplays) override;
+ void UpdateResolutions() override;
+ void ShowOSMouse(bool show) override;
+
+ void NotifyAppActiveChange(bool bActivated) override;
+ void NotifyAppFocusChange(bool bGaining) override;
+
+ bool Minimize() override;
+ bool Restore() override;
+ bool Hide() override;
+ bool Show(bool raise = true) override;
+ void Register(IDispResource *resource) override;
+ void Unregister(IDispResource *resource) override;
+ bool HasCalibration(const RESOLUTION_INFO &resInfo) override;
+ bool UseLimitedColor() override;
+
+ // winevents override
+ //bool MessagePump() override;
+
+ // render
+ bool InitRenderSystem() override { return true;} ;
+ bool DestroyRenderSystem() override { return true;} ;
+ bool ResetRenderSystem(int width, int height) override { return true;} ;
+
+ bool BeginRender() override { return true;} ;
+ bool EndRender() override { return true;} ;
+ void PresentRender(bool rendered, bool videoLayer) override {} ;
+ bool ClearBuffers(UTILS::Color color) override { return true;} ;
+ bool IsExtSupported(const char* extension) const override { return false;} ;
+
+ void SetViewPort(const CRect& viewPort) override {} ;
+ void GetViewPort(CRect& viewPort) override {} ;
+
+ void SetScissors(const CRect &rect) override {} ;
+ void ResetScissors() override {} ;
+
+ void CaptureStateBlock() override {} ;
+ void ApplyStateBlock() override {} ;
+
+ void SetCameraPosition(const CPoint &camera, int screenWidth, int screenHeight, float stereoFactor = 0.f) override {} ;
+ void ShowSplash(const std::string& message) override;
+
+ // CWinSystemX11
+ virtual bool SetWindow(int width, int height, bool fullscreen, const std::string &output, int *winstate = NULL) override {return true;};
+ virtual XVisualInfo* GetVisual() override {return (XVisualInfo*) nullptr;};
+
+protected:
+
+private:
+
+};
diff --git a/xbmc/windowing/X11/WinSystemX11GLContext.cpp b/xbmc/windowing/X11/WinSystemX11GLContext.cpp
old mode 100644
new mode 100755
index 5b0b155736b9..b454ffd9cc60
--- a/xbmc/windowing/X11/WinSystemX11GLContext.cpp
+++ b/xbmc/windowing/X11/WinSystemX11GLContext.cpp
@@ -9,6 +9,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "WinSystemHeadlessX11.h"
#include "WinSystemX11GLContext.h"
#include "GLContextEGL.h"
#include "utils/log.h"
@@ -32,9 +33,13 @@
using namespace KODI;
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemX11GLContext());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemX11GLContext());
+ else
+ winSystem.reset(new CWinSystemHeadlessX11());
return winSystem;
}
diff --git a/xbmc/windowing/amlogic/WinSystemAmlogicGLESContext.cpp b/xbmc/windowing/amlogic/WinSystemAmlogicGLESContext.cpp
old mode 100644
new mode 100755
index 076f7718f0d1..43ff6da6a935
--- a/xbmc/windowing/amlogic/WinSystemAmlogicGLESContext.cpp
+++ b/xbmc/windowing/amlogic/WinSystemAmlogicGLESContext.cpp
@@ -7,13 +7,21 @@
*/
#include "VideoSyncAML.h"
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemAmlogicGLESContext.h"
#include "utils/log.h"
#include "threads/SingleLock.h"
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemAmlogicGLESContext());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemAmlogicGLESContext());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
return winSystem;
}
diff --git a/xbmc/windowing/android/WinSystemAndroidGLESContext.cpp b/xbmc/windowing/android/WinSystemAndroidGLESContext.cpp
old mode 100644
new mode 100755
index db326d62ae60..b163038673eb
--- a/xbmc/windowing/android/WinSystemAndroidGLESContext.cpp
+++ b/xbmc/windowing/android/WinSystemAndroidGLESContext.cpp
@@ -7,14 +7,22 @@
*/
#include "VideoSyncAndroid.h"
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemAndroidGLESContext.h"
#include "utils/log.h"
#include "threads/SingleLock.h"
#include "platform/android/activity/XBMCApp.h"
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemAndroidGLESContext());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemAndroidGLESContext());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
return winSystem;
}
diff --git a/xbmc/windowing/gbm/WinSystemGbmGLContext.cpp b/xbmc/windowing/gbm/WinSystemGbmGLContext.cpp
old mode 100644
new mode 100755
index 7dc31f3fb361..1eb92acbb986
--- a/xbmc/windowing/gbm/WinSystemGbmGLContext.cpp
+++ b/xbmc/windowing/gbm/WinSystemGbmGLContext.cpp
@@ -14,6 +14,7 @@
#include "cores/VideoPlayer/VideoRenderers/RenderFactory.h"
#include "EGL/egl.h"
#include "EGL/eglext.h"
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemGbmGLContext.h"
#include "OptionalsReg.h"
#include "platform/linux/XTimeUtils.h"
@@ -25,9 +26,13 @@ CWinSystemGbmGLContext::CWinSystemGbmGLContext()
: CWinSystemGbmEGLContext(EGL_PLATFORM_GBM_MESA, "EGL_MESA_platform_gbm")
{}
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemGbmGLContext());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemGbmGLContext());
+ else
+ winSystem.reset(new CWinSystemHeadless());
return winSystem;
}
diff --git a/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp b/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp
old mode 100644
new mode 100755
index c24cb919aec9..dce9fb7ac3df
--- a/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp
+++ b/xbmc/windowing/gbm/WinSystemGbmGLESContext.cpp
@@ -20,6 +20,7 @@
#include "OptionalsReg.h"
#include "platform/linux/XTimeUtils.h"
#include "utils/log.h"
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemGbmGLESContext.h"
#include <gbm.h>
@@ -32,9 +33,13 @@ CWinSystemGbmGLESContext::CWinSystemGbmGLESContext()
: CWinSystemGbmEGLContext(EGL_PLATFORM_GBM_MESA, "EGL_MESA_platform_gbm")
{}
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemGbmGLESContext());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemGbmGLESContext());
+ else
+ winSystem.reset(new CWinSystemHeadless());
return winSystem;
}
diff --git a/xbmc/windowing/osx/WinSystemIOS.mm b/xbmc/windowing/osx/WinSystemIOS.mm
old mode 100644
new mode 100755
index 7f849ba31282..a889e4fe66e3
--- a/xbmc/windowing/osx/WinSystemIOS.mm
+++ b/xbmc/windowing/osx/WinSystemIOS.mm
@@ -7,6 +7,7 @@
*/
#include "VideoSyncIos.h"
+#include "windowing/WinSystemHeadless.h"
#include "WinEventsIOS.h"
#include "WinSystemIOS.h"
#include "cores/AudioEngine/Sinks/AESinkDARWINIOS.h"
@@ -63,9 +64,16 @@ - (void) runDisplayLink;
IOSDisplayLinkCallback *callbackClass;
};
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemIOS());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemIOS());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
return winSystem;
}
diff --git a/xbmc/windowing/osx/WinSystemOSXGL.mm b/xbmc/windowing/osx/WinSystemOSXGL.mm
old mode 100644
new mode 100755
index 9ec4ffe49e30..8f4056bd1fba
--- a/xbmc/windowing/osx/WinSystemOSXGL.mm
+++ b/xbmc/windowing/osx/WinSystemOSXGL.mm
@@ -7,15 +7,24 @@
*/
#include "guilib/Texture.h"
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemOSXGL.h"
#include "rendering/gl/RenderSystemGL.h"
+#include "utils/log.h"
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemOSXGL());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemOSXGL());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
return winSystem;
}
diff --git a/xbmc/windowing/rpi/WinSystemRpiGLESContext.cpp b/xbmc/windowing/rpi/WinSystemRpiGLESContext.cpp
old mode 100644
new mode 100755
index a949c85e8b35..8689c178f703
--- a/xbmc/windowing/rpi/WinSystemRpiGLESContext.cpp
+++ b/xbmc/windowing/rpi/WinSystemRpiGLESContext.cpp
@@ -8,6 +8,7 @@
#include "Application.h"
#include "VideoSyncPi.h"
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemRpiGLESContext.h"
#include "guilib/GUIComponent.h"
#include "guilib/GUIWindowManager.h"
@@ -24,9 +25,16 @@
using namespace KODI;
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemRpiGLESContext());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemRpiGLESContext());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
return winSystem;
}
diff --git a/xbmc/windowing/wayland/WinSystemWaylandEGLContextGL.cpp b/xbmc/windowing/wayland/WinSystemWaylandEGLContextGL.cpp
old mode 100644
new mode 100755
index 9d5f0e3d9e56..dbbe558d57c8
--- a/xbmc/windowing/wayland/WinSystemWaylandEGLContextGL.cpp
+++ b/xbmc/windowing/wayland/WinSystemWaylandEGLContextGL.cpp
@@ -6,6 +6,7 @@
* See LICENSES/README.md for more information.
*/
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemWaylandEGLContextGL.h"
#include "OptionalsReg.h"
@@ -19,9 +20,16 @@
using namespace KODI::WINDOWING::WAYLAND;
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemWaylandEGLContextGL());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemWaylandEGLContextGL());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
return winSystem;
}
diff --git a/xbmc/windowing/wayland/WinSystemWaylandEGLContextGLES.cpp b/xbmc/windowing/wayland/WinSystemWaylandEGLContextGLES.cpp
old mode 100644
new mode 100755
index dc7de3e8ab65..4dfb15b8f746
--- a/xbmc/windowing/wayland/WinSystemWaylandEGLContextGLES.cpp
+++ b/xbmc/windowing/wayland/WinSystemWaylandEGLContextGLES.cpp
@@ -6,6 +6,7 @@
* See LICENSES/README.md for more information.
*/
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemWaylandEGLContextGLES.h"
#include "OptionalsReg.h"
@@ -19,9 +20,16 @@
using namespace KODI::WINDOWING::WAYLAND;
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemWaylandEGLContextGLES());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemWaylandEGLContextGLES());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
return winSystem;
}
diff --git a/xbmc/windowing/win10/WinSystemWin10DX.cpp b/xbmc/windowing/win10/WinSystemWin10DX.cpp
old mode 100644
new mode 100755
index 2ac39b1d818f..c8fdf151535f
--- a/xbmc/windowing/win10/WinSystemWin10DX.cpp
+++ b/xbmc/windowing/win10/WinSystemWin10DX.cpp
@@ -10,11 +10,20 @@
#include "input/touch/generic/GenericTouchInputHandler.h"
#include "rendering/dx/DirectXHelper.h"
#include "utils/log.h"
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemWin10DX.h"
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- return std::make_unique<CWinSystemWin10DX>();
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemWin10DX());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
+ return winSystem;
}
CWinSystemWin10DX::CWinSystemWin10DX() : CRenderSystemDX()
diff --git a/xbmc/windowing/windows/WinSystemWin32DX.cpp b/xbmc/windowing/windows/WinSystemWin32DX.cpp
old mode 100644
new mode 100755
index 2270a65000f0..17fdb5ebca97
--- a/xbmc/windowing/windows/WinSystemWin32DX.cpp
+++ b/xbmc/windowing/windows/WinSystemWin32DX.cpp
@@ -6,6 +6,7 @@
* See LICENSES/README.md for more information.
*/
+#include "windowing/WinSystemHeadless.h"
#include "WinSystemWin32DX.h"
#include "commons/ilog.h"
#include "platform/win32/CharsetConverter.h"
@@ -40,9 +41,16 @@ static PFND3D10DDI_OPENADAPTER s_fnOpenAdapter10_2{ nullptr };
static PFND3D10DDI_CREATEDEVICE s_fnCreateDeviceOrig{ nullptr };
static PFND3D10DDI_CREATERESOURCE s_fnCreateResourceOrig{ nullptr };
-std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem()
+std::unique_ptr<CWinSystemBase> CWinSystemBase::CreateWinSystem(bool render)
{
- std::unique_ptr<CWinSystemBase> winSystem(new CWinSystemWin32DX());
+ std::unique_ptr<CWinSystemBase> winSystem(nullptr);
+ if (render)
+ winSystem.reset(new CWinSystemWin32DX());
+ else
+ {
+ winSystem.reset(new CWinSystemHeadless());
+ CLog::Log(LOGWARNING, "HEADLESS MOD NOT TESTED ON THIS BUILD");
+ }
return winSystem;
}