Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2016-05-19 21:56:51 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2016-05-19 21:56:51 +0300
commit5fea6ca52f8586a7201c62f4926762b906453899 (patch)
tree3294ac6a861203caa467176d930a870f40d0ca8a /source/gameengine/VideoTexture
parenta7c8327c8ac3aae86bc441d8c2c311d57decae3e (diff)
Fix MSVC compilation error after merge
Diffstat (limited to 'source/gameengine/VideoTexture')
-rw-r--r--source/gameengine/VideoTexture/DeckLink.cpp27
-rw-r--r--source/gameengine/VideoTexture/VideoDeckLink.cpp32
-rw-r--r--source/gameengine/VideoTexture/VideoDeckLink.h20
3 files changed, 48 insertions, 31 deletions
diff --git a/source/gameengine/VideoTexture/DeckLink.cpp b/source/gameengine/VideoTexture/DeckLink.cpp
index 0bd4329379c..a9cd622e68b 100644
--- a/source/gameengine/VideoTexture/DeckLink.cpp
+++ b/source/gameengine/VideoTexture/DeckLink.cpp
@@ -33,6 +33,17 @@
// implementation
+// FFmpeg defines its own version of stdint.h on Windows.
+// Decklink needs FFmpeg, so it uses its version of stdint.h
+// this is necessary for INT64_C macro
+#ifndef __STDC_CONSTANT_MACROS
+#define __STDC_CONSTANT_MACROS
+#endif
+// this is necessary for UINTPTR_MAX (used by atomic-ops)
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#endif
+
#include "atomic_ops.h"
#include "EXP_PyObjectPlus.h"
@@ -142,7 +153,7 @@ HRESULT decklink_ReadDisplayMode(const char *format, size_t len, BMDDisplayMode
if (len != 4)
THRWEXCP(DeckLinkBadDisplayMode, S_OK);
// assume the user entered directly the mode value as a 4 char string
- *displayMode = (BMDDisplayMode)((((u_int)format[0]) << 24) + (((u_int)format[1]) << 16) + (((u_int)format[2]) << 8) + ((u_int)format[3]));
+ *displayMode = (BMDDisplayMode)((((uint32_t)format[0]) << 24) + (((uint32_t)format[1]) << 16) + (((uint32_t)format[2]) << 8) + ((uint32_t)format[3]));
return S_OK;
}
@@ -164,7 +175,7 @@ HRESULT decklink_ReadPixelFormat(const char *format, size_t len, BMDPixelFormat
if (len != 4)
THRWEXCP(DeckLinkBadPixelFormat, S_OK);
// assume the user entered directly the mode value as a 4 char string
- *pixelFormat = (BMDPixelFormat)((((u_int)format[0]) << 24) + (((u_int)format[1]) << 16) + (((u_int)format[2]) << 8) + ((u_int)format[3]));
+ *pixelFormat = (BMDPixelFormat)((((uint32_t)format[0]) << 24) + (((uint32_t)format[1]) << 16) + (((uint32_t)format[2]) << 8) + ((uint32_t)format[3]));
return S_OK;
}
@@ -279,11 +290,11 @@ static void decklink_Reset(DeckLink *self)
// adapt the pixel format from VideoTexture (RGBA) to DeckLink (BGRA)
// return false if no conversion at all is necessary
-static bool decklink_ConvImage(u_int *dest, const short *destSize, const u_int *source, const short *srcSize, bool extend, bool swap)
+static bool decklink_ConvImage(uint32_t *dest, const short *destSize, const uint32_t *source, const short *srcSize, bool extend, bool swap)
{
short w, h, x, y;
- const u_int *s;
- u_int *d, p;
+ const uint32_t *s;
+ uint32_t *d, p;
bool sameSize = (destSize[0] == srcSize[0] && destSize[1] == srcSize[1]);
if (sameSize || !extend)
@@ -416,10 +427,10 @@ static int DeckLink_init(DeckLink *self, PyObject *args, PyObject *kwds)
BOOL flag;
size_t len;
int i;
- u_int displayFlags;
+ uint32_t displayFlags;
BMDVideoOutputFlags outputFlags;
BMDDisplayModeSupport support;
- u_int* bytes;
+ uint32_t* bytes;
// material ID
@@ -600,7 +611,7 @@ static PyObject *DeckLink_refresh(DeckLink *self, PyObject *args)
// we must adapt the image to the frame 1) in size 2) in byte order
// VideoTexture frame are RGBA, DecklinkBGRA
short * srcSize = self->m_leftEye->m_image->getSize();
- u_int *dest;
+ uint32_t *dest;
self->mLeftFrame->GetBytes((void **)&dest);
bool leftConverted = decklink_ConvImage(dest, self->mSize, leftEye, srcSize, self->mUseExtend, self->mUseSwap);
if (self->mUse3D)
diff --git a/source/gameengine/VideoTexture/VideoDeckLink.cpp b/source/gameengine/VideoTexture/VideoDeckLink.cpp
index 45c80af4f8e..54907b7bf79 100644
--- a/source/gameengine/VideoTexture/VideoDeckLink.cpp
+++ b/source/gameengine/VideoTexture/VideoDeckLink.cpp
@@ -31,10 +31,16 @@
#ifdef WITH_DECKLINK
-// INT64_C fix for some linux machines (C99ism)
+// FFmpeg defines its own version of stdint.h on Windows.
+// Decklink needs FFmpeg, so it uses its version of stdint.h
+// this is necessary for INT64_C macro
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
+// this is necessary for UINTPTR_MAX (used by atomic-ops)
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#endif
#include <stdint.h>
#include <string.h>
#ifndef WIN32
@@ -115,7 +121,7 @@ struct SyncInfo
class TextureTransferDvp : public TextureTransfer
{
public:
- TextureTransferDvp(DVPBufferHandle dvpTextureHandle, TextureDesc *pDesc, void *address, u_int allocatedSize)
+ TextureTransferDvp(DVPBufferHandle dvpTextureHandle, TextureDesc *pDesc, void *address, uint32_t allocatedSize)
{
DVPSysmemBufferDesc sysMemBuffersDesc;
@@ -234,8 +240,8 @@ private:
SyncInfo* mGpuSync;
DVPBufferHandle mDvpSysMemHandle;
DVPBufferHandle mDvpTextureHandle;
- u_int mTextureHeight;
- u_int mAllocatedSize;
+ uint32_t mTextureHeight;
+ uint32_t mAllocatedSize;
void* mBuffer;
};
@@ -300,7 +306,7 @@ private:
class TextureTransferPMD : public TextureTransfer
{
public:
- TextureTransferPMD(GLuint texId, TextureDesc *pDesc, void *address, u_int allocatedSize)
+ TextureTransferPMD(GLuint texId, TextureDesc *pDesc, void *address, uint32_t allocatedSize)
{
memcpy(&mDesc, pDesc, sizeof(mDesc));
mTexId = texId;
@@ -343,12 +349,12 @@ private:
// buffer
void *mBuffer;
// the allocated size
- u_int mAllocatedSize;
+ uint32_t mAllocatedSize;
// characteristic of the image
TextureDesc mDesc;
};
-bool TextureTransfer::_PinBuffer(void *address, u_int size)
+bool TextureTransfer::_PinBuffer(void *address, uint32_t size)
{
#ifdef WIN32
return VirtualLock(address, size);
@@ -357,7 +363,7 @@ bool TextureTransfer::_PinBuffer(void *address, u_int size)
#endif
}
-void TextureTransfer::_UnpinBuffer(void* address, u_int size)
+void TextureTransfer::_UnpinBuffer(void* address, uint32_t size)
{
#ifdef WIN32
VirtualUnlock(address, size);
@@ -480,7 +486,7 @@ PinnedMemoryAllocator::~PinnedMemoryAllocator()
void PinnedMemoryAllocator::TransferBuffer(void* address, TextureDesc* texDesc, GLuint texId)
{
- u_int allocatedSize = 0;
+ uint32_t allocatedSize = 0;
TextureTransfer *pTransfer = NULL;
Lock();
@@ -784,7 +790,7 @@ void VideoDeckLink::openCam (char *format, short camIdx)
BMDTimeValue frameDuration;
BMDTimeScale frameTimescale;
IDeckLink* pDL;
- u_int displayFlags, inputFlags;
+ uint32_t displayFlags, inputFlags;
char *pPixel, *p3D, *pEnd, *pSize;
size_t len;
int i, modeIdx, cacheSize;
@@ -830,7 +836,7 @@ void VideoDeckLink::openCam (char *format, short camIdx)
// found a valid mode, remember that we do not look for an index
modeIdx = -1;
}
- catch (Exception & exp)
+ catch (Exception &)
{
// accept also purely numerical mode as a mode index
modeIdx = strtol(format, &pEnd, 10);
@@ -1077,8 +1083,8 @@ void VideoDeckLink::calcImage (unsigned int texId, double ts)
// it is crucial that we release the frame to keep the reference count right on the DeckLink device
try
{
- u_int rowSize = pFrame->GetRowBytes();
- u_int textureSize = rowSize * pFrame->GetHeight();
+ uint32_t rowSize = pFrame->GetRowBytes();
+ uint32_t textureSize = rowSize * pFrame->GetHeight();
void* videoPixels = NULL;
void* rightEyePixels = NULL;
if (!mTextureDesc.stride)
diff --git a/source/gameengine/VideoTexture/VideoDeckLink.h b/source/gameengine/VideoTexture/VideoDeckLink.h
index 5dc97bd1993..cd87d4afbdc 100644
--- a/source/gameengine/VideoTexture/VideoDeckLink.h
+++ b/source/gameengine/VideoTexture/VideoDeckLink.h
@@ -58,10 +58,10 @@ class PinnedMemoryAllocator;
struct TextureDesc
{
- u_int width;
- u_int height;
- u_int stride;
- u_int size;
+ uint32_t width;
+ uint32_t height;
+ uint32_t stride;
+ uint32_t size;
GLenum internalFormat;
GLenum format;
GLenum type;
@@ -129,8 +129,8 @@ private:
BMDDisplayMode mDisplayMode;
BMDPixelFormat mPixelFormat;
bool mUse3D;
- u_int mFrameWidth;
- u_int mFrameHeight;
+ uint32_t mFrameWidth;
+ uint32_t mFrameHeight;
TextureDesc mTextureDesc;
PinnedMemoryAllocator* mpAllocator;
CaptureDelegate* mpCaptureDelegate;
@@ -159,8 +159,8 @@ public:
virtual void PerformTransfer() = 0;
protected:
- static bool _PinBuffer(void *address, u_int size);
- static void _UnpinBuffer(void* address, u_int size);
+ static bool _PinBuffer(void *address, uint32_t size);
+ static void _UnpinBuffer(void* address, uint32_t size);
};
////////////////////////////////////////////
@@ -219,7 +219,7 @@ private:
// protect the cache and the allocated map,
// not the pinnedBuffer map as it is only used from main thread
pthread_mutex_t mMutex;
- std::map<void*, u_int> mAllocatedSize;
+ std::map<void*, uint32_t> mAllocatedSize;
std::vector<void*> mBufferCache;
std::map<void *, TextureTransfer*> mPinnedBuffer;
#ifdef WIN32
@@ -227,7 +227,7 @@ private:
#endif
// target texture in GPU
GLuint mTexId;
- u_int mBufferCacheSize;
+ uint32_t mBufferCacheSize;
};
////////////////////////////////////////////