diff --git a/Makefile b/Makefile index 58d27080..b72d1774 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -UNAME=$(shell uname | tr A-Z a-z) +UNAME=$(shell uname | tr A-Z a-z | tr -d \\-[:digit:].) LIBPREFIX=lib LIBSUFFIX=a CP=cp @@ -35,7 +35,7 @@ endif CFLAGS += -DNO_DYNAMIC_VP -DHAVE_CACHE_LINE_ALIGN LDFLAGS += -ASMFLAGS += -DNO_DYNAMIC_VP -DNOPREFIX +ASMFLAGS += -DNO_DYNAMIC_VP #### No user-serviceable parts below this line diff --git a/build/platform-darwin.mk b/build/platform-darwin.mk index 7579dd29..abd439a3 100644 --- a/build/platform-darwin.mk +++ b/build/platform-darwin.mk @@ -2,4 +2,4 @@ USE_ASM = No # We don't have ASM working on Mac yet ASM = nasm CFLAGS += -Werror -fPIC LDFLAGS += -lpthread -ASMFLAGS += -f macho --prefix _ +ASMFLAGS += -f macho --prefix _ -DNOPREFIX diff --git a/build/platform-freebsd.mk b/build/platform-freebsd.mk index daf0d564..2817cce9 100644 --- a/build/platform-freebsd.mk +++ b/build/platform-freebsd.mk @@ -1,5 +1,5 @@ ASM = nasm CFLAGS += -fPIC LDFLAGS += -lpthread -ASMFLAGS += -f elf +ASMFLAGS += -f elf -DNOPREFIX diff --git a/build/platform-linux.mk b/build/platform-linux.mk index c60c6d21..5df0e433 100644 --- a/build/platform-linux.mk +++ b/build/platform-linux.mk @@ -1,5 +1,5 @@ ASM = nasm CFLAGS += -Werror -fPIC -DLINUX -D__NO_CTYPE LDFLAGS += -lpthread -ASMFLAGS += -f elf +ASMFLAGS += -f elf -DNOPREFIX diff --git a/build/platform-mingw_nt.mk b/build/platform-mingw_nt.mk new file mode 100644 index 00000000..c4fd19c5 --- /dev/null +++ b/build/platform-mingw_nt.mk @@ -0,0 +1,5 @@ +ASM = nasm +CFLAGS += -DWIN32 -D__NO_CTYPE +LDFLAGS += +ASMFLAGS += -f win -DPREFIX + diff --git a/codec/console/dec/src/read_config.cpp b/codec/console/dec/src/read_config.cpp index ab078bcd..4314484d 100644 --- a/codec/console/dec/src/read_config.cpp +++ b/codec/console/dec/src/read_config.cpp @@ -37,7 +37,7 @@ * 08/18/2008 Created * *****************************************************************************/ -#if !defined(_WIN32) +#if !defined(_WIN32) || !defined(_MSC_VER) #include #include #endif diff --git a/codec/decoder/core/src/bit_stream.cpp b/codec/decoder/core/src/bit_stream.cpp index 7cbed62e..3499f62b 100644 --- a/codec/decoder/core/src/bit_stream.cpp +++ b/codec/decoder/core/src/bit_stream.cpp @@ -48,7 +48,7 @@ inline uint32_t EndianFix (uint32_t uiX) { } #else //WORDS_BIGENDIAN -#ifdef WIN32 +#if defined(WIN32) && defined(_MSC_VER) inline uint32_t EndianFix (uint32_t uiX) { __asm { mov eax, uiX diff --git a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp index 0e93352c..9fa668ec 100644 --- a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp +++ b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp @@ -708,7 +708,7 @@ static int32_t CavlcGetLevelVal (int32_t iLevel[16], SReadBitsCache* pBitsCache, for (; i < uiTotalCoeff; i++) { if (pBitsCache->uiRemainBits <= 16) SHIFT_BUFFER (pBitsCache); -#if defined(WIN32) && !defined(WIN64) +#if defined(WIN32) && !defined(WIN64) && defined(_MSC_VER) uiCache32Bit = pBitsCache->uiCache32Bit; WELS_GET_PREFIX_BITS (uiCache32Bit, iPrefixBits); #else @@ -811,7 +811,7 @@ static int32_t CavlcGetRunBefore (int32_t iRun[16], SReadBitsCache* pBitsCache, iRun[i] = pVlcTable->kpZeroTable[6][uiValue][0]; } else { if (pBitsCache->uiRemainBits < 16) SHIFT_BUFFER (pBitsCache); -#if defined(WIN32) && !defined(WIN64) +#if defined(WIN32) && !defined(WIN64) && defined(_MSC_VER) uiCache32Bit = pBitsCache->uiCache32Bit; WELS_GET_PREFIX_BITS (uiCache32Bit, iPrefixBits); #else @@ -1345,4 +1345,4 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M return 0; } -} // namespace WelsDec \ No newline at end of file +} // namespace WelsDec diff --git a/codec/decoder/core/src/utils.cpp b/codec/decoder/core/src/utils.cpp index 34df856c..3538d84b 100644 --- a/codec/decoder/core/src/utils.cpp +++ b/codec/decoder/core/src/utils.cpp @@ -46,10 +46,16 @@ #include #include #include +#ifndef _MSC_VER +#include +#ifndef HAVE_STRNLEN +#define strnlen(a,b) strlen(a) +#endif //!HAVE_STRNLEN +#endif //!_MSC_VER #else #include #include -#endif +#endif //_WIN32 #include "utils.h" #include "macros.h" @@ -79,7 +85,7 @@ void_t WelsLog (void_t* pPtr, int32_t iLevel, const char* kpFmt, ...) { } -#if defined(_WIN32) +#if defined(_WIN32) && defined(_MSC_VER) #if defined(_MSC_VER) && (_MSC_VER>=1500) @@ -275,4 +281,4 @@ int32_t WelsFflush (WelsFileHandle* pFp) { return fflush (pFp); } -} // namespace WelsDec \ No newline at end of file +} // namespace WelsDec diff --git a/codec/encoder/core/inc/crt_util_safe_x.h b/codec/encoder/core/inc/crt_util_safe_x.h index 23a09905..fbbe1010 100644 --- a/codec/encoder/core/inc/crt_util_safe_x.h +++ b/codec/encoder/core/inc/crt_util_safe_x.h @@ -375,9 +375,7 @@ static __inline int wels_strnlen_s (const char* dest, int dmax) { #endif//(WIN32 && _MSC_VER && _MSC_VER<1500) || __GNUC__ -#if defined(WIN32) - -#ifdef _MSC_VER +#if defined(WIN32) && defined(_MSC_VER) #if _MSC_VER >= 1500 // VS2008 #define SNPRINTF _snprintf_s #define LOCALTIME localtime_s @@ -397,7 +395,6 @@ static __inline int wels_strnlen_s (const char* dest, int dmax) { #define VSPRINTF vsprintf #define FOPEN fopen #endif//_MSC_VER >= 1500 -#endif//_MSC_VER #else//__GNUC__ diff --git a/codec/encoder/core/inc/macros.h b/codec/encoder/core/inc/macros.h index 01e3040a..8e8cf02b 100644 --- a/codec/encoder/core/inc/macros.h +++ b/codec/encoder/core/inc/macros.h @@ -273,7 +273,7 @@ return x; #else -#if defined(WIN32) && !defined(WIN64) +#if defined(WIN32) && !defined(WIN64) && defined(_MSC_VER) static inline uint32_t ENDIAN_FIX (uint32_t x) { __asm { mov eax, x diff --git a/codec/encoder/core/src/slice_multi_threading.cpp b/codec/encoder/core/src/slice_multi_threading.cpp index 40cb8082..c6599886 100644 --- a/codec/encoder/core/src/slice_multi_threading.cpp +++ b/codec/encoder/core/src/slice_multi_threading.cpp @@ -41,7 +41,7 @@ #if defined(MT_ENABLED) #include -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(_WIN32) #include #ifndef SEM_NAME_MAX // length of semaphore name should be system constrained at least on mac 10.7 @@ -441,7 +441,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara iIdx = 0; while (iIdx < iThreadNum) { -#ifdef __GNUC__ // for posix threading +#if defined(__GNUC__) && !defined(_WIN32) // for posix threading str_t name[SEM_NAME_MAX] = {0}; int32_t used_len = 0; WELS_THREAD_ERROR_CODE err = 0; @@ -852,7 +852,7 @@ int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSl } #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(_WIN32) WELS_THREAD_ROUTINE_TYPE UpdateMbListThreadProc (void* arg) { SSliceThreadPrivateData* pPrivateData = (SSliceThreadPrivateData*)arg; sWelsEncCtx* pEncPEncCtx = NULL; @@ -1243,7 +1243,7 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { // due to WelsMultipleEventsWaitSingleBlocking implememtation can not work well // in case waiting pUpdateMbListEvent and pReadySliceCodingEvent events at the same time #if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE) -#if defined(__GNUC__) +#if defined(__GNUC__) && !defined(_WIN32) WelsThreadCreate (&pCtx->pSliceThreading->pUpdateMbListThrdHandles[iIdx], UpdateMbListThreadProc, &pCtx->pSliceThreading->pThreadPEncCtx[iIdx], 0); #endif//__GNUC__ diff --git a/codec/encoder/core/src/utils.cpp b/codec/encoder/core/src/utils.cpp index 67ec9e2e..63508716 100644 --- a/codec/encoder/core/src/utils.cpp +++ b/codec/encoder/core/src/utils.cpp @@ -46,6 +46,9 @@ #include #include #include +#ifndef _MSC_VER +#include +#endif #else #include #endif @@ -147,23 +150,20 @@ void WelsLogDefault (void* pCtx, const int32_t kiLevel, const str_t* kpFmtStr, v if (pEncCtx) { time_t l_time; -#if defined(_WIN32) -#if defined(_MSC_VER) +#if defined(_WIN32) && defined(_MSC_VER) #if _MSC_VER >= 1500 struct tm t_now; #else//VC6 struct tm* t_now; #endif//_MSC_VER >= 1500 -#endif//_MSC_VER #else//__GNUC__ struct tm* t_now; #endif//WIN32 -#if defined( _WIN32 ) +#if defined( _WIN32 ) && defined(_MSC_VER) struct _timeb tb; time (&l_time); -#ifdef _MSC_VER #if _MSC_VER >= 1500 LOCALTIME (&t_now, &l_time); #else @@ -172,7 +172,6 @@ void WelsLogDefault (void* pCtx, const int32_t kiLevel, const str_t* kpFmtStr, v return; } #endif//_MSC_VER >= 1500 -#endif//_MSC_VER FTIME (&tb); #elif defined( __GNUC__ ) struct timeval tv; diff --git a/processing/src/common/typedef.h b/processing/src/common/typedef.h index 2ef3e638..22f916db 100644 --- a/processing/src/common/typedef.h +++ b/processing/src/common/typedef.h @@ -52,7 +52,7 @@ WELSVP_NAMESPACE_BEGIN -#if defined(_WIN32) || defined(_WIN32) || defined(_MSC_VER) +#if ( defined(_WIN32) || defined(_WIN32) ) && defined(_MSC_VER) typedef char int8_t ; typedef unsigned char uint8_t ;