win-ivcam: Add Intel RealSense plugin
This commit is contained in:
40
plugins/win-ivcam/seg_library/Dependencies.h
Normal file
40
plugins/win-ivcam/seg_library/Dependencies.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016, Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef DEPENDENCIES_H_
|
||||
#define DEPENDENCIES_H_
|
||||
|
||||
// WinAPI section
|
||||
#include <windows.h>
|
||||
|
||||
// CRT section
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <exception>
|
||||
|
||||
#endif // DEPENDENCIES_H_
|
102
plugins/win-ivcam/seg_library/SegImage.cpp
Normal file
102
plugins/win-ivcam/seg_library/SegImage.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016, Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "SegImage.h"
|
||||
|
||||
SegImage::SegImage()
|
||||
: m_width(0), m_height(0), m_pitch(0), m_data(nullptr), m_number(0), m_timestamp(0L) {}
|
||||
|
||||
SegImage::SegImage(int width, int height, int pitch, void* data, long long timestamp, int number)
|
||||
: m_width(width), m_height(height), m_pitch(pitch), m_data(new char[height*pitch]), m_timestamp(timestamp), m_number(number)
|
||||
{
|
||||
memcpy_s(m_data, height*pitch, data, height*pitch);
|
||||
}
|
||||
|
||||
SegImage::SegImage(SegImage const& src)
|
||||
: m_width(src.m_width), m_height(src.m_height), m_pitch(src.m_pitch), m_data(new char[src.m_height*src.m_pitch]),
|
||||
m_timestamp(src.m_timestamp), m_number(src.m_number)
|
||||
{
|
||||
memcpy_s(m_data, m_pitch*m_height, src.m_data, src.m_height*src.m_pitch);
|
||||
}
|
||||
|
||||
SegImage::~SegImage()
|
||||
{
|
||||
delete[] m_data;
|
||||
}
|
||||
|
||||
SegImage& SegImage::operator=(const SegImage & src)
|
||||
{
|
||||
if (this != &src)
|
||||
{
|
||||
m_width = src.m_width;
|
||||
m_height = src.m_height;
|
||||
m_pitch = src.m_pitch;
|
||||
if (m_data)
|
||||
{
|
||||
delete[] m_data;
|
||||
}
|
||||
m_data = new char[m_height*m_pitch];
|
||||
m_timestamp = src.m_timestamp;
|
||||
m_number = src.m_number;
|
||||
memcpy_s(m_data, m_pitch*m_height, src.m_data, m_height*m_pitch);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
int SegImage::Width()
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
|
||||
int SegImage::Height()
|
||||
{
|
||||
return m_height;
|
||||
}
|
||||
|
||||
int SegImage::Pitch()
|
||||
{
|
||||
return m_pitch;
|
||||
}
|
||||
|
||||
long long SegImage::TimeStamp()
|
||||
{
|
||||
return m_timestamp;
|
||||
}
|
||||
|
||||
int SegImage::Number()
|
||||
{
|
||||
return m_number;
|
||||
}
|
||||
|
||||
SegPixel SegImage::Get(int i, int j)
|
||||
{
|
||||
SegPixel result;
|
||||
result.blue = (((char*)m_data) + j*m_pitch + i * 4)[0];
|
||||
result.green = (((char*)m_data) + j*m_pitch + i * 4)[1];
|
||||
result.red = (((char*)m_data) + j*m_pitch + i * 4)[2];
|
||||
return result;
|
||||
}
|
66
plugins/win-ivcam/seg_library/SegImage.h
Normal file
66
plugins/win-ivcam/seg_library/SegImage.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016, Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SEG_IMAGE_H_
|
||||
#define SEG_IMAGE_H_
|
||||
|
||||
#include "Dependencies.h"
|
||||
|
||||
struct SegPixel
|
||||
{
|
||||
unsigned char red;
|
||||
unsigned char green;
|
||||
unsigned char blue;
|
||||
};
|
||||
|
||||
class SegImage
|
||||
{
|
||||
private:
|
||||
int m_width;
|
||||
int m_height;
|
||||
int m_pitch;
|
||||
long long m_timestamp;
|
||||
int m_number;
|
||||
void* m_data;
|
||||
public:
|
||||
SegImage();
|
||||
SegImage(SegImage const& src);
|
||||
SegImage(int width, int height, int pitch, void* data, long long timestamp, int number);
|
||||
~SegImage();
|
||||
|
||||
SegImage& operator=(const SegImage & src);
|
||||
|
||||
int Width();
|
||||
int Height();
|
||||
int Pitch();
|
||||
long long TimeStamp();
|
||||
int Number();
|
||||
SegPixel Get(int i, int j);
|
||||
void* GetData() { return m_data; };
|
||||
};
|
||||
|
||||
#endif // SEG_IMAGE_H_
|
71
plugins/win-ivcam/seg_library/SegServer.h
Normal file
71
plugins/win-ivcam/seg_library/SegServer.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016, Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SEG_SERVER_H_
|
||||
#define SEG_SERVER_H_
|
||||
|
||||
#include "Dependencies.h"
|
||||
#include "SegImage.h"
|
||||
|
||||
#define USE_DEFAULT_PROPERTY_VALUE -1
|
||||
|
||||
class SegServer
|
||||
{
|
||||
public:
|
||||
enum ServiceStatus
|
||||
{
|
||||
COM_LIB_INIT_ERROR = -1,
|
||||
SERVICE_INIT_ERROR = -2,
|
||||
SERVICE_REINIT_ERROR = -3,
|
||||
SERVICE_FUNC_ERROR = -4,
|
||||
SHARED_MEMORY_ERROR = -5,
|
||||
ALLOCATION_FAILURE = -6,
|
||||
SERVICE_NO_ERROR = 0,
|
||||
SERVICE_NOT_READY = 1
|
||||
};
|
||||
|
||||
static SegServer* CreateServer();
|
||||
static SegServer* GetServerInstance();
|
||||
|
||||
virtual ServiceStatus Init() = 0;
|
||||
virtual ServiceStatus Stop() = 0;
|
||||
|
||||
virtual ServiceStatus GetFrame(SegImage** image) = 0;
|
||||
|
||||
virtual void SetFps(int fps) = 0;
|
||||
virtual int GetFps() = 0;
|
||||
/**
|
||||
@brief Set the IVCAM motion range trade off option, ranged from 0 (short range, better motion) to 100 (far range, long exposure). Custom property value used only with 60 fps profile
|
||||
@param[in] value The motion range trade option. USE_DEFAULT_PROPERTY_VALUE to return default value
|
||||
*/
|
||||
virtual void SetIVCAMMotionRangeTradeOff(int value) = 0;
|
||||
virtual int GetIVCAMMotionRangeTradeOff() = 0;
|
||||
|
||||
virtual ~SegServer() {};
|
||||
};
|
||||
|
||||
#endif // SEG_SERVER_H_
|
202
plugins/win-ivcam/seg_library/SegServerImpl.cpp
Normal file
202
plugins/win-ivcam/seg_library/SegServerImpl.cpp
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016, Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "SegServerImpl.h"
|
||||
|
||||
SegServerImpl* SegServerImpl::instance = nullptr;
|
||||
|
||||
SegServerImpl::SegServerImpl()
|
||||
{
|
||||
m_comInit = false;
|
||||
m_serviceConnected = false;
|
||||
m_sharedBuffer = NULL;
|
||||
}
|
||||
|
||||
SegServerImpl::SegServerImpl(SegServerImpl const& src) {};
|
||||
SegServerImpl::~SegServerImpl()
|
||||
{
|
||||
if (m_server)
|
||||
{
|
||||
m_server->Release();
|
||||
m_server = nullptr;
|
||||
}
|
||||
instance = nullptr;
|
||||
};
|
||||
SegServerImpl& SegServerImpl::operator=(const SegServerImpl & src) { return *this; };
|
||||
|
||||
SegServer* SegServerImpl::CreateServer()
|
||||
{
|
||||
if (instance == nullptr)
|
||||
{
|
||||
instance = new SegServerImpl();
|
||||
return instance;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
SegServer* SegServerImpl::GetServerInstance()
|
||||
{
|
||||
return instance;
|
||||
}
|
||||
|
||||
SegServerImpl::ServiceStatus SegServerImpl::Init()
|
||||
{
|
||||
if (m_comInit && m_serviceConnected)
|
||||
return SERVICE_REINIT_ERROR;
|
||||
GUID guid = { 0 };
|
||||
m_bufferName = new wchar_t[40]();
|
||||
CoCreateGuid(&guid);
|
||||
StringFromGUID2(guid, m_bufferName, 40);
|
||||
if (!m_comInit)
|
||||
{
|
||||
HRESULT comInit = CoInitializeEx(0, COINIT_MULTITHREADED);
|
||||
if (FAILED(comInit))
|
||||
{
|
||||
comInit = CoInitialize(0);
|
||||
if (FAILED(comInit))
|
||||
{
|
||||
return COM_LIB_INIT_ERROR;
|
||||
}
|
||||
}
|
||||
m_comInit = true;
|
||||
}
|
||||
|
||||
if (!m_serviceConnected)
|
||||
{
|
||||
HRESULT instanceCreate = CoCreateInstance(CLSID_SegProc, NULL, CLSCTX_LOCAL_SERVER, IID_ISegProc, (void**)&m_server);
|
||||
if (FAILED(instanceCreate)) {
|
||||
return SERVICE_INIT_ERROR;
|
||||
}
|
||||
|
||||
HRESULT serverInit = m_server->Init(m_bufferName);
|
||||
if (FAILED(serverInit)) {
|
||||
return SERVICE_INIT_ERROR;
|
||||
}
|
||||
m_serviceConnected = true;
|
||||
}
|
||||
return SERVICE_NO_ERROR;
|
||||
}
|
||||
|
||||
SegServerImpl::ServiceStatus SegServerImpl::Stop()
|
||||
{
|
||||
HRESULT errCode = m_server->Stop();
|
||||
if (FAILED(errCode)) {
|
||||
return SERVICE_FUNC_ERROR;
|
||||
}
|
||||
return SERVICE_NO_ERROR;
|
||||
}
|
||||
|
||||
void SegServerImpl::SetFps(int fps)
|
||||
{
|
||||
m_server->SetFps(fps);
|
||||
}
|
||||
|
||||
int SegServerImpl::GetFps()
|
||||
{
|
||||
int outFps = -1;
|
||||
m_server->GetFps(&outFps);
|
||||
return outFps;
|
||||
}
|
||||
|
||||
void SegServerImpl::SetIVCAMMotionRangeTradeOff(int value)
|
||||
{
|
||||
m_server->SetIVCAMMotionRangeTradeOff(value);
|
||||
}
|
||||
|
||||
int SegServerImpl::GetIVCAMMotionRangeTradeOff()
|
||||
{
|
||||
int outPropertyValue = -1;
|
||||
m_server->GetIVCAMMotionRangeTradeOff(&outPropertyValue);
|
||||
return outPropertyValue;
|
||||
}
|
||||
|
||||
SegServerImpl::ServiceStatus SegServerImpl::GetFrame(SegImage** image)
|
||||
{
|
||||
ServiceStatus res = SERVICE_NO_ERROR;
|
||||
int frameId = -1;
|
||||
int bufferRealloc = -1;
|
||||
int frameSize = -1;
|
||||
if (FAILED(m_server->LockBuffer(&frameId, &frameSize, &bufferRealloc)))
|
||||
{
|
||||
return SHARED_MEMORY_ERROR;
|
||||
}
|
||||
if (bufferRealloc)
|
||||
{
|
||||
HANDLE hMapFile = OpenFileMapping(FILE_MAP_READ, FALSE, m_bufferName);
|
||||
|
||||
if (hMapFile == NULL)
|
||||
{
|
||||
m_server->UnlockBuffer();
|
||||
return SHARED_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
m_sharedBuffer = (LPTSTR)MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, frameSize * 2);
|
||||
|
||||
if (m_sharedBuffer == NULL)
|
||||
{
|
||||
CloseHandle(hMapFile);
|
||||
m_server->UnlockBuffer();
|
||||
return SHARED_MEMORY_ERROR;
|
||||
}
|
||||
CloseHandle(hMapFile);
|
||||
}
|
||||
|
||||
if(m_sharedBuffer && frameId != -1 && frameSize != -1)
|
||||
{
|
||||
size_t offset = (size_t)frameId * frameSize;
|
||||
//int width = ((int*)(m_sharedBuffer + offset))[0];
|
||||
//int height = ((int*)(m_sharedBuffer + offset))[1];
|
||||
//int pitch = ((int*)(m_sharedBuffer + offset))[2];
|
||||
FrameHeader* fhPtr = (FrameHeader*)(m_sharedBuffer + offset);
|
||||
int width = fhPtr->width;
|
||||
int height = fhPtr->height;
|
||||
int pitch = fhPtr->pitch;
|
||||
long long timestamp = fhPtr->timestamp;
|
||||
int frameNumber = fhPtr->frameNumber;
|
||||
void* data = (void*)(m_sharedBuffer + offset + sizeof(FrameHeader));
|
||||
SegImage* result = nullptr;
|
||||
try
|
||||
{
|
||||
result = new SegImage(width, height, pitch, data, timestamp, frameNumber);
|
||||
}
|
||||
catch (std::bad_alloc &/*e*/)
|
||||
{
|
||||
res = ALLOCATION_FAILURE;
|
||||
result = NULL;
|
||||
}
|
||||
*image = result;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = SERVICE_NOT_READY;
|
||||
}
|
||||
m_server->UnlockBuffer();
|
||||
return res;
|
||||
}
|
77
plugins/win-ivcam/seg_library/SegServerImpl.h
Normal file
77
plugins/win-ivcam/seg_library/SegServerImpl.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016, Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SEG_SERVER_IMPL_H_
|
||||
#define SEG_SERVER_IMPL_H_
|
||||
|
||||
#include "Dependencies.h"
|
||||
#include "SegImage.h"
|
||||
#include "SegServer.h"
|
||||
|
||||
#include "seg_service.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
int pitch;
|
||||
long long timestamp;
|
||||
int frameNumber;
|
||||
} FrameHeader;
|
||||
|
||||
class SegServerImpl : public SegServer
|
||||
{
|
||||
private:
|
||||
static SegServerImpl* instance;
|
||||
ISegProc* m_server;
|
||||
|
||||
bool m_comInit;
|
||||
bool m_serviceConnected;
|
||||
|
||||
LPWSTR m_bufferName;
|
||||
LPCTSTR m_sharedBuffer;
|
||||
|
||||
SegServerImpl();
|
||||
SegServerImpl(SegServerImpl const& src);
|
||||
SegServerImpl& operator=(const SegServerImpl & src);
|
||||
|
||||
public:
|
||||
virtual ~SegServerImpl();
|
||||
static SegServer* CreateServer();
|
||||
static SegServer* GetServerInstance();
|
||||
|
||||
ServiceStatus Init();
|
||||
ServiceStatus Stop();
|
||||
void SetFps(int fps) override;
|
||||
int GetFps() override;
|
||||
void SetIVCAMMotionRangeTradeOff(int value) override;
|
||||
int GetIVCAMMotionRangeTradeOff() override;
|
||||
|
||||
ServiceStatus GetFrame(SegImage** image);
|
||||
};
|
||||
|
||||
#endif // SEG_SERVER_IMPL_H_
|
34
plugins/win-ivcam/seg_library/SegService.h
Normal file
34
plugins/win-ivcam/seg_library/SegService.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016, Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SEG_SERVICE_H_
|
||||
#define SEG_SERVICE_H_
|
||||
|
||||
#include "SegImage.h"
|
||||
#include "SegServer.h"
|
||||
|
||||
#endif // SEG_SERVICE_H_
|
39
plugins/win-ivcam/seg_library/SerServer.cpp
Normal file
39
plugins/win-ivcam/seg_library/SerServer.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016, Intel Corporation
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Intel Corporation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "SegServer.h"
|
||||
#include "SegServerImpl.h"
|
||||
|
||||
SegServer* SegServer::CreateServer()
|
||||
{
|
||||
return SegServerImpl::CreateServer();
|
||||
}
|
||||
|
||||
SegServer* SegServer::GetServerInstance()
|
||||
{
|
||||
return SegServerImpl::GetServerInstance();
|
||||
}
|
Reference in New Issue
Block a user