Skip to content

Commit a0a966d

Browse files
BtbNlu-zero
authored andcommitted
Add support for Cygwin
1 parent b3b0bc9 commit a0a966d

21 files changed

Lines changed: 66 additions & 50 deletions

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ AS_CASE([${host_os}],
1717
AM_CONDITIONAL([WINDOWS], [true])
1818
DLLIB=""
1919
],
20+
[*cygwin*], [
21+
AC_DEFINE([MFX_HAVE_WINDOWS])
22+
AC_DEFINE([_MAX_PATH], [MAX_PATH])
23+
AM_CONDITIONAL([WINDOWS], [true])
24+
DLLIB=""
25+
],
2026
[AC_MSG_ERROR([${host_os} not supported.])]
2127
)
2228

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ mfxStatus DISPATCHER_EXPOSED_PREFIX(MFXVideoUSER_LoadByPath)(mfxSession session,
718718
PluginDescriptionRecord record;
719719
record.sName[0] = 0;
720720

721-
#ifdef _WIN32
721+
#if defined(_WIN32) || defined(__CYGWIN__)
722722
msdk_disp_char wPath[MAX_PLUGIN_PATH];
723723
int res = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, path, len, wPath, MAX_PLUGIN_PATH);
724724
if (!res)

src/mfx_critical_section.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ File Name: mfx_critical_section.cpp
3030

3131
#include "mfx_critical_section.h"
3232

33-
#if defined(_WIN32) || defined(_WIN64)
33+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
3434

3535
#include <windows.h>
3636
// SDK re-declares the following functions with different call declarator.
@@ -85,4 +85,4 @@ void mfxLeaveCriticalSection(mfxCriticalSection *pCSection)
8585

8686
} // namespace MFX
8787

88-
#endif // #if defined(_WIN32) || defined(_WIN64)
88+
#endif // #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)

src/mfx_critical_section_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ File Name: mfx_critical_section_linux.cpp
2828
2929
\* ****************************************************************************** */
3030

31-
#if !defined(_WIN32) && !defined(_WIN64)
31+
#if !defined(_WIN32) && !defined(_WIN64) && !defined(__CYGWIN__)
3232

3333
#include "mfx_critical_section.h"
3434
#include <sched.h>
@@ -88,4 +88,4 @@ void mfxLeaveCriticalSection(mfxCriticalSection *pCSection)
8888

8989
} // namespace MFX
9090

91-
#endif // #if !defined(_WIN32) && !defined(_WIN64)
91+
#endif // #if !defined(_WIN32) && !defined(_WIN64) && !defined(__CYGWIN__)

src/mfx_dispatcher.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ File Name: mfx_dispatcher.cpp
3333
#include "mfx_load_dll.h"
3434

3535
#include <string.h>
36-
#if defined(_WIN32) || defined(_WIN64)
36+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
3737
#include <windows.h>
3838
#pragma warning(disable:4355)
3939
#else
4040

4141
#include <dlfcn.h>
4242
#include <iostream>
4343

44-
#endif // defined(_WIN32) || defined(_WIN64)
44+
#endif // defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
4545

4646
MFX_DISP_HANDLE::MFX_DISP_HANDLE(const mfxVersion requiredVersion) :
4747
apiVersion(requiredVersion),
@@ -227,7 +227,7 @@ mfxStatus MFX_DISP_HANDLE::LoadSelectedDLL(const msdk_disp_char *pPath, eMfxImpl
227227
}
228228
else
229229
{
230-
#if defined(_WIN32) || defined(_WIN64)
230+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
231231
DISPATCHER_LOG_WRN((("can't find DLL: GetLastErr()=0x%x\n"), GetLastError()))
232232
#else
233233
DISPATCHER_LOG_WRN((("can't find DLL: dlerror() = \"%s\"\n"), dlerror()));

src/mfx_dispatcher_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ File Name: mfx_dispatcher_defs.h
3737
#include <string.h>
3838
#endif
3939

40-
#if defined(_WIN32) || defined(_WIN64)
40+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
4141
typedef wchar_t msdk_disp_char;
4242
#define MSDK2WIDE(x) x
4343

src/mfx_dispatcher_log.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ File Name: mfx_dispatcher_log.h
3232

3333
#include "mfx_dispatcher_log.h"
3434
#include "mfxstructures.h"
35-
#if defined(_WIN32) || defined(_WIN64)
35+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
3636
#include <windows.h>
3737
#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER)
3838
#include <evntprov.h>
3939
#include <winmeta.h>
4040
#endif
41-
#endif // #if defined(_WIN32) || defined(_WIN64)
41+
#endif // #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
4242
#include <stdarg.h>
4343
#include <algorithm>
4444
#include <string>

src/mfx_dispatcher_log.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ enum
9191
//is a vital if mediasdk wont use
9292
#define DISPATCHER_LOG_HEAP_SINGLETONES
9393

94-
#if defined(_WIN32) || defined(_WIN64)
94+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
9595
// guid for all dispatcher events
9696
#define DISPATCHER_LOG_EVENT_GUID L"{EB0538CC-4FEE-484d-ACEE-1182E9F37A57}"
9797

@@ -102,7 +102,7 @@ enum
102102
//#define DISPATCHER_LOG_REGISTER_FILE_WRITER
103103
#define DISPACTHER_LOG_FW_PATH "c:\\dispatcher.log"
104104

105-
#endif // #if defined(_WIN32) || defined(_WIN64)
105+
#endif // #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
106106

107107
#include <stdio.h>
108108
#include <stdarg.h>
@@ -115,7 +115,7 @@ class IMsgHandler
115115
virtual void Write(int level, int opcode, const char * msg, va_list argptr) = 0;
116116
};
117117

118-
#if defined(_WIN32) || defined(_WIN64)
118+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
119119
#if DISPATCHER_LOG_USE_FORMATING
120120

121121
#define DISPATCHER_LOG(lvl, opcode, str)\
@@ -237,7 +237,7 @@ struct DispatchLogBlockHelper
237237
};
238238

239239
//----utility sinks-----
240-
#if defined(_WIN32) || defined(_WIN64)
240+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
241241
#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER)
242242
class ETWHandlerFactory
243243
: public DSSingleTone<ETWHandlerFactory>
@@ -254,7 +254,7 @@ class ETWHandlerFactory
254254
ETWHandlerFactory(){}
255255
};
256256
#endif
257-
#endif // #if defined(_WIN32) || defined(_WIN64)
257+
#endif // #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
258258

259259
#if defined(DISPATCHER_LOG_REGISTER_FILE_WRITER)
260260
class FileSink
@@ -273,7 +273,7 @@ class FileSink
273273
FILE * m_hdl;
274274
FileSink(const std::string & log_file)
275275
{
276-
#if defined(_WIN32) || defined(_WIN64)
276+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
277277
fopen_s(&m_hdl, log_file.c_str(), "a");
278278
#else
279279
m_hdl = fopen(log_file.c_str(), "a");

src/mfx_dxva2_device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ File Name: mfx_dxva2_device.cpp
2828
2929
\* ****************************************************************************** */
3030

31-
#if defined(_WIN32) || defined(_WIN64)
31+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
3232

3333
#define INITGUID
3434
#include <d3d9.h>

src/mfx_dxva2_device.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ File Name: mfx_dxva2_device.h
3131
#if !defined(__MFX_DXVA2_DEVICE_H)
3232
#define __MFX_DXVA2_DEVICE_H
3333

34-
#if defined(_WIN32) || defined(_WIN64)
34+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
3535
#include <windows.h>
3636

3737
#if !defined( WIN_TRESHOLD_MOBILE )
3838
#define MFX_D3D9_ENABLED
3939
#endif // !defined( WIN_TRESHOLD_MOBILE )
4040

41-
#endif // #if defined(_WIN32) || defined(_WIN64)
41+
#endif // #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
4242

4343
#include "mfx/mfxdefs.h"
4444

@@ -88,10 +88,10 @@ class DXDevice
8888
// Free DLL module
8989
void UnloadDLLModule(void);
9090

91-
#if defined(_WIN32) || defined(_WIN64)
91+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
9292
// Handle to the DLL library
9393
HMODULE m_hModule;
94-
#endif // #if defined(_WIN32) || defined(_WIN64)
94+
#endif // #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
9595

9696
// Number of adapters available
9797
mfxU32 m_numAdapters;
@@ -112,7 +112,7 @@ class DXDevice
112112
};
113113

114114

115-
#if defined(_WIN32) || defined(_WIN64)
115+
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
116116

117117
#ifdef MFX_D3D9_ENABLED
118118
class D3D9Device : public DXDevice
@@ -167,7 +167,7 @@ class DXGI1Device : public DXDevice
167167
void *m_pDXGIAdapter1;
168168

169169
};
170-
#endif // #if defined(_WIN32) || defined(_WIN64)
170+
#endif // #if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
171171

172172
class DXVA2Device
173173
{

0 commit comments

Comments
 (0)