From 84327a4b264040a6ad5bb1e202620dc279fe7871 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 27 Nov 2010 14:53:07 +0000 Subject: fix a few conflicts with : - prefix log-constants with LOG_ - remove already defined WAIT_TIMEOUT - use more portable _WIN32 instead of __WIN32__ - define types for MSVC git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2755 b956fd51-792f-4845-bead-9b4dfca2ff2c --- .../src/mediaplugins/ffmpeg/ffmpeg_core.cpp | 4 +- mediaplugin/src/mediaplugins/include/core/logger.h | 10 ++--- .../src/mediaplugins/include/core/plugin_core.h | 47 +++++++++++++++++----- 3 files changed, 42 insertions(+), 19 deletions(-) (limited to 'mediaplugin') diff --git a/mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_core.cpp b/mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_core.cpp index 13aae4a6..d33af650 100644 --- a/mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_core.cpp +++ b/mediaplugin/src/mediaplugins/ffmpeg/ffmpeg_core.cpp @@ -359,8 +359,6 @@ void* PacketQueue::getStatusInfo(AVPacket *packet) { } int PacketQueue::get(AVPacket *packet, bool blocking) { - const int WAIT_TIMEOUT = 10; // timeout in ms - { Mutex::RegionLock lock(_mutex); while (true) { @@ -384,7 +382,7 @@ int PacketQueue::get(AVPacket *packet, bool blocking) { } else { // block until a new package arrives, // but do not wait till infinity to avoid deadlocks - if (_condition.waitTimeout(_mutex, WAIT_TIMEOUT) == MUTEX_TIMEDOUT) { + if (_condition.waitTimeout(_mutex, 10) == MUTEX_TIMEDOUT) { return 0; } } diff --git a/mediaplugin/src/mediaplugins/include/core/logger.h b/mediaplugin/src/mediaplugins/include/core/logger.h index c9924b83..91cac10e 100644 --- a/mediaplugin/src/mediaplugins/include/core/logger.h +++ b/mediaplugin/src/mediaplugins/include/core/logger.h @@ -48,23 +48,23 @@ public: } void info(const std::string &msg, const std::string &context) const { - log(INFO, msg, context); + log(LOG_INFO, msg, context); } void status(const std::string &msg, const std::string &context) const { - log(STATUS, msg, context); + log(LOG_STATUS, msg, context); } void warn(const std::string &msg, const std::string &context) const { - log(WARN, msg, context); + log(LOG_WARN, msg, context); } void error(const std::string &msg, const std::string &context) const { - log(ERROR, msg, context); + log(LOG_ERROR, msg, context); } void critical(const std::string &msg, const std::string &context) const { - log(CRITICAL, msg, context); + log(LOG_CRITICAL, msg, context); } }; diff --git a/mediaplugin/src/mediaplugins/include/core/plugin_core.h b/mediaplugin/src/mediaplugins/include/core/plugin_core.h index 67eca5f7..a4839909 100644 --- a/mediaplugin/src/mediaplugins/include/core/plugin_core.h +++ b/mediaplugin/src/mediaplugins/include/core/plugin_core.h @@ -25,7 +25,29 @@ #ifndef _PLUGIN_CORE_H_ #define _PLUGIN_CORE_H_ -#include "inttypes.h" +#ifdef _MSC_VER +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; +#ifdef _WIN64 + typedef __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // !_WIN64 + typedef _W64 int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 +#else +#include +#endif + +#ifdef _WIN32 +#include +#endif /* * C Interface @@ -36,7 +58,7 @@ extern "C" { #endif /* declaration for export */ -#if defined(__WIN32__) +#if defined(_WIN32) # define DECLSPEC_EXPORT __declspec(dllexport) #else # if defined(__GNUC__) && __GNUC__ >= 4 @@ -48,7 +70,7 @@ extern "C" { /* use C calling convention */ #ifndef CDECL -#if defined(__WIN32__) && !defined(__GNUC__) +#if defined(_WIN32) && !defined(__GNUC__) #define CDECL __cdecl #else #define CDECL @@ -57,18 +79,21 @@ extern "C" { #define PLUGIN_CALL CDECL -// VERSION: AAABBBCCC (A: Major, B: Minor, C: Revision) +/* VERSION: AAABBBCCC (A: Major, B: Minor, C: Revision) */ #define MAKE_VERSION(a,b,c) ((((a) * 1000 + (b)) * 1000) + (c)) +#ifndef _WIN32 +/* already defined in windows.h */ typedef enum { FALSE , TRUE } BOOL; +#endif typedef enum log_level { - DEBUG, - INFO, - STATUS, - WARN, - ERROR, - CRITICAL + LOG_DEBUG, + LOG_INFO, + LOG_STATUS, + LOG_WARN, + LOG_ERROR, + LOG_CRITICAL } log_level; typedef struct{} fileStream_t; @@ -87,7 +112,7 @@ typedef struct pluginCore_t { int version; void PLUGIN_CALL (*log)(int level, const char *msg, const char *context); - uint32_t PLUGIN_CALL (*ticksMillis); + uint32_t PLUGIN_CALL (*ticksMillis)(); fileStream_t* PLUGIN_CALL (*fileOpen)(const char *utf8Filename, int mode); void PLUGIN_CALL (*fileClose)(fileStream_t *stream); -- cgit v1.2.3