Skip to content
Permalink
Browse files

Some fixes after testing the raw option

  • Loading branch information...
jarikomppa committed May 19, 2016
1 parent 27f3f3d commit fb1369d9b467150cd847a786ee97de2f5bda78f4
Showing with 11 additions and 4 deletions.
  1. +4 −2 common/escapi.h
  2. +5 −0 escapi_dll/capture.cpp
  3. +2 −2 escapi_dll/escapi_dll.cpp
@@ -97,8 +97,10 @@ typedef int (*getCaptureErrorCodeProc)(unsigned int deviceno);
typedef int (*initCaptureWithOptionsProc)(unsigned int deviceno, struct SimpleCapParams *aParams, unsigned int aOptions);

// Options accepted by above:
#define CAPTURE_OPTION_RAWDATA 1 // return raw data instead of converted rgb
#define CAPTURE_OPTIONS_MASK (CAPTURE_OPTION_RAWDATA) // mask to check for valid options - OR all options together here
// Return raw data instead of converted rgb. Using this option assumes you know what you're doing.
#define CAPTURE_OPTION_RAWDATA 1
// Mask to check for valid options - all options OR:ed together.
#define CAPTURE_OPTIONS_MASK (CAPTURE_OPTION_RAWDATA)


#ifndef ESCAPI_DEFINITIONS_ONLY
@@ -152,6 +152,11 @@ STDMETHODIMP CaptureClass::OnReadSample(
BYTE *scanline0 = NULL;
LONG stride = 0;
hr = buffer.LockBuffer(mDefaultStride, mCaptureBufferHeight, &scanline0, &stride);
if (stride < 0)
{
scanline0 += stride * mCaptureBufferHeight;
stride = -stride;
}
LONG bytes = stride * mCaptureBufferHeight;
CopyMemory(mCaptureBuffer, scanline0, bytes);
}
@@ -62,7 +62,7 @@ extern "C" int __declspec(dllexport) initCapture(unsigned int deviceno, struct S
{
if (deviceno > MAXDEVICES)
return 0;
if (aParams == NULL || aParams->mHeight <= 0 || aParams->mWidth <= 0)
if (aParams == NULL || aParams->mHeight <= 0 || aParams->mWidth <= 0 || aParams->mTargetBuf == 0)
return 0;
gDoCapture[deviceno] = 0;
gParams[deviceno] = *aParams;
@@ -135,7 +135,7 @@ extern "C" int __declspec(dllexport) initCaptureWithOptions(unsigned int devicen
{
if (deviceno > MAXDEVICES)
return 0;
if (aParams == NULL || aParams->mHeight <= 0 || aParams->mWidth <= 0)
if (aParams == NULL || aParams->mHeight <= 0 || aParams->mWidth <= 0 || aParams->mTargetBuf == 0)
return 0;
if ((aOptions & CAPTURE_OPTIONS_MASK) != aOptions)
return 0;

0 comments on commit fb1369d

Please sign in to comment.
You can’t perform that action at this time.