添加项目文件。

This commit is contained in:
CaiXiang 2025-01-20 10:30:01 +08:00
parent 77371da5d7
commit 752be79e06
1010 changed files with 610100 additions and 0 deletions

Binary file not shown.

BIN
3rdparty/can/dll/ControlCAN.dll vendored Normal file

Binary file not shown.

95
3rdparty/can/inc/ControlCAN.h vendored Normal file
View File

@ -0,0 +1,95 @@
#ifndef CONTROLCAN_H
#define CONTROLCAN_H
////文件版本v2.01 20190410
//#include <cvidef.h> //使用CVI平台开发请使用该语句。
//接口卡类型定义
#define VCI_USBCAN1 3
#define VCI_USBCAN2 4
#define VCI_USBCAN2A 4
#define VCI_USBCAN_E_U 20
#define VCI_USBCAN_2E_U 21
//函数调用返回状态值
#define STATUS_OK 1
#define STATUS_ERR 0
/*------------------------------------------------兼容ZLG的函数及数据类型------------------------------------------------*/
//1.ZLGCAN系列接口卡信息的数据类型。
typedef struct _VCI_BOARD_INFO{
USHORT hw_Version;
USHORT fw_Version;
USHORT dr_Version;
USHORT in_Version;
USHORT irq_Num;
BYTE can_Num;
CHAR str_Serial_Num[20];
CHAR str_hw_Type[40];
USHORT Reserved[4];
} VCI_BOARD_INFO,*PVCI_BOARD_INFO;
//2.定义CAN信息帧的数据类型。
typedef struct _VCI_CAN_OBJ{
UINT ID;
UINT TimeStamp;
BYTE TimeFlag;
BYTE SendType;
BYTE RemoteFlag;//是否是远程帧
BYTE ExternFlag;//是否是扩展帧
BYTE DataLen;
BYTE Data[8];
BYTE Reserved[3];
}VCI_CAN_OBJ,*PVCI_CAN_OBJ;
//3.定义初始化CAN的数据类型
typedef struct _VCI_INIT_CONFIG{
DWORD AccCode;
DWORD AccMask;
DWORD Reserved;
UCHAR Filter;
UCHAR Timing0;
UCHAR Timing1;
UCHAR Mode;
}VCI_INIT_CONFIG,*PVCI_INIT_CONFIG;
///////// new add struct for filter /////////
typedef struct _VCI_FILTER_RECORD{
DWORD ExtFrame; //是否为扩展帧
DWORD Start;
DWORD End;
}VCI_FILTER_RECORD,*PVCI_FILTER_RECORD;
#define EXTERNC extern "C"
EXTERNC DWORD __stdcall VCI_OpenDevice(DWORD DeviceType,DWORD DeviceInd,DWORD Reserved);
EXTERNC DWORD __stdcall VCI_CloseDevice(DWORD DeviceType,DWORD DeviceInd);
EXTERNC DWORD __stdcall VCI_InitCAN(DWORD DeviceType, DWORD DeviceInd, DWORD CANInd, PVCI_INIT_CONFIG pInitConfig);
EXTERNC DWORD __stdcall VCI_ReadBoardInfo(DWORD DeviceType,DWORD DeviceInd,PVCI_BOARD_INFO pInfo);
EXTERNC DWORD __stdcall VCI_SetReference(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,DWORD RefType,PVOID pData);
EXTERNC ULONG __stdcall VCI_GetReceiveNum(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
EXTERNC DWORD __stdcall VCI_ClearBuffer(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
EXTERNC DWORD __stdcall VCI_StartCAN(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
EXTERNC DWORD __stdcall VCI_ResetCAN(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
EXTERNC ULONG __stdcall VCI_Transmit(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_CAN_OBJ pSend,ULONG Len);
EXTERNC ULONG __stdcall VCI_Receive(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_CAN_OBJ pReceive,ULONG Len,INT WaitTime);
/*------------------------------------------------其他补充函数及数据结构描述------------------------------------------------*/
#define EXTERNC extern "C"
EXTERNC DWORD __stdcall VCI_UsbDeviceReset(DWORD DevType,DWORD DevIndex,DWORD Reserved);
EXTERNC DWORD __stdcall VCI_FindUsbDevice2(PVCI_BOARD_INFO pInfo);
#endif

BIN
3rdparty/can/lib/ControlCAN.lib vendored Normal file

Binary file not shown.

BIN
3rdparty/can/vs2008_vcredist_x64.exe vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,132 @@
;---------------------------------------------------------------------------------
;Note: When the driver package is signed, any modifications to this .inf file will
;break the signature, and the driver package will need to be re-signed.
;---------------------------------------------------------------------------------
; Windows Custom/Vendor Class WinUSB Setup File
; Copyright (C) 2012 Microchip Technology Inc.
;---------------------------------------------------------------------------------
; This .inf file is a modified version of the example INF provided
; in the Microsoft document:
; "How to Use WinUSB to Communicate with a USB Device"
;---------------------------------------------------------------------------------
[Version]
Signature = "$Windows NT$"
Class = CustomUSBDevices
ClassGuid= {a503e2d3-a031-49dc-b684-c99085dbfe92}
Provider = %MFGNAME%
DriverVer=12/03/2012,1.0.0.7
CatalogFile=mchpwinusb.cat ;CAT file needed for a signed driver pacakage
;------------------------------------------------------------------------------
; ========== Manufacturer/Models sections ===========
;------------------------------------------------------------------------------
[Manufacturer]
%MFGNAME% = MyDevice_WinUSB,NTx86,NTamd64
;------------------------------------------------------------------------------
; Vendor and Product ID Definitions
;------------------------------------------------------------------------------
; When developing your custom USB device, the VID and PID used in the PC side
; application program and the firmware on the microcontroller must match.
; Modify the below lines to use your VID and PID. Use the format as shown below.
; Note: One INF file can be used for multiple devices with different VID and PIDs.
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
; There is a maximum number of devices that can be supported per line however.
; If you append a large number of VID/PIDs to the end of the line, and get a:
; "The data area passed to a system call is too small." error when trying to install
; the INF, try removing some of the VIDs/PIDs.
;------------------------------------------------------------------------------
[MyDevice_WinUSB.NTx86]
%DESCRIPTION% =USB_Install, USB\VID_04d8&PID_0053,USB\VID_04d8&PID_0052,USB\VID_04d8&PID_020A,USB\VID_04d8&PID_020B,USB\VID_04d8&PID_020F,USB\VID_04d8&PID_005F&MI_01,USB\VID_04d8&PID_020C&MI_01,USB\VID_04d8&PID_020D&MI_02
[MyDevice_WinUSB.NTamd64]
%DESCRIPTION% =USB_Install, USB\VID_04d8&PID_0053,USB\VID_04d8&PID_0052,USB\VID_04d8&PID_020A,USB\VID_04d8&PID_020B,USB\VID_04d8&PID_020F,USB\VID_04d8&PID_005F&MI_01,USB\VID_04d8&PID_020C&MI_01,USB\VID_04d8&PID_020D&MI_02
;=========================================================================================
;ClassInstall32 and ClassInstall_AddReg sections used to make new device manager category.
;=========================================================================================
[ClassInstall32]
AddReg=ClassInstall_AddReg
[ClassInstall_AddReg]
HKR,,,,%DEVICEMANAGERCATEGORY%
HKR,,Icon,,"-20"
; =================== Installation ===================
[USB_Install]
Include=winusb.inf
Needs=WINUSB.NT
[USB_Install.Services]
Include=winusb.inf
AddService=WinUSB,0x00000002,WinUSB_ServiceInstall
[WinUSB_ServiceInstall]
DisplayName = %WinUSB_SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys
[USB_Install.Wdf]
KmdfService=WINUSB, WinUsb_Install
[WinUSB_Install]
KmdfLibraryVersion=1.11
[USB_Install.HW]
AddReg=Dev_AddReg
;------------------------------------------------------------------------------
;When editing the GUID (the big hex number with dashes inside the squiggly
;braces), make sure to write the intended PC application to use the same GUID.
;Otherwise the application won't be able to find the USB device properly.
;The GUID is intended to be a "Globablly Unique Identifier". When making a new
;product, the VID, PID, and GUID should be updated, to avoid potential conflicts
;with any existing products.
;------------------------------------------------------------------------------
[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{58D07210-27C1-11DD-BD0B-0800200C9A66}"
[USB_Install.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles
[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01011.dll,WdfCoInstaller","WinUSBCoInstaller2.dll"
[CoInstallers_CopyFiles]
WinUSBCoInstaller2.dll
WdfCoInstaller01011.dll
[DestinationDirs]
CoInstallers_CopyFiles=11
; ================= Source Media Section =====================
[SourceDisksNames]
1 = %DISK_NAME%,,,\i386
2 = %DISK_NAME%,,,\amd64
[SourceDisksFiles.x86]
WinUSBCoInstaller2.dll=1
WdfCoInstaller01011.dll=1
[SourceDisksFiles.amd64]
WinUSBCoInstaller2.dll=2
WdfCoInstaller01011.dll=2
; =================== Strings ===================
[Strings]
MFGNAME="Microchip Technology, Inc."
DESCRIPTION="WinUSB Device"
WinUSB_SvcDesc="WinUSB Device"
DISK_NAME="WinUSB Device Install Disk"
DEVICEMANAGERCATEGORY="Custom USB Devices"

2774
3rdparty/curl/inc/curl.h vendored Normal file

File diff suppressed because it is too large Load Diff

586
3rdparty/curl/inc/curlbuild.h vendored Normal file
View File

@ -0,0 +1,586 @@
#ifndef __CURL_CURLBUILD_H
#define __CURL_CURLBUILD_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* ================================================================ */
/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
/* ================================================================ */
/*
* NOTE 1:
* -------
*
* See file include/curl/curlbuild.h.in, run configure, and forget
* that this file exists it is only used for non-configure systems.
* But you can keep reading if you want ;-)
*
*/
/* ================================================================ */
/* NOTES FOR NON-CONFIGURE SYSTEMS */
/* ================================================================ */
/*
* NOTE 1:
* -------
*
* Nothing in this file is intended to be modified or adjusted by the
* curl library user nor by the curl library builder.
*
* If you think that something actually needs to be changed, adjusted
* or fixed in this file, then, report it on the libcurl development
* mailing list: https://cool.haxx.se/mailman/listinfo/curl-library/
*
* Try to keep one section per platform, compiler and architecture,
* otherwise, if an existing section is reused for a different one and
* later on the original is adjusted, probably the piggybacking one can
* be adversely changed.
*
* In order to differentiate between platforms/compilers/architectures
* use only compiler built in predefined preprocessor symbols.
*
* This header file shall only export symbols which are 'curl' or 'CURL'
* prefixed, otherwise public name space would be polluted.
*
* NOTE 2:
* -------
*
* For any given platform/compiler curl_off_t must be typedef'ed to a
* 64-bit wide signed integral data type. The width of this data type
* must remain constant and independent of any possible large file
* support settings.
*
* As an exception to the above, curl_off_t shall be typedef'ed to a
* 32-bit wide signed integral data type if there is no 64-bit type.
*
* As a general rule, curl_off_t shall not be mapped to off_t. This
* rule shall only be violated if off_t is the only 64-bit data type
* available and the size of off_t is independent of large file support
* settings. Keep your build on the safe side avoiding an off_t gating.
* If you have a 64-bit off_t then take for sure that another 64-bit
* data type exists, dig deeper and you will find it.
*
* NOTE 3:
* -------
*
* Right now you might be staring at file include/curl/curlbuild.h.dist or
* at file include/curl/curlbuild.h, this is due to the following reason:
* file include/curl/curlbuild.h.dist is renamed to include/curl/curlbuild.h
* when the libcurl source code distribution archive file is created.
*
* File include/curl/curlbuild.h.dist is not included in the distribution
* archive. File include/curl/curlbuild.h is not present in the git tree.
*
* The distributed include/curl/curlbuild.h file is only intended to be used
* on systems which can not run the also distributed configure script.
*
* On systems capable of running the configure script, the configure process
* will overwrite the distributed include/curl/curlbuild.h file with one that
* is suitable and specific to the library being configured and built, which
* is generated from the include/curl/curlbuild.h.in template file.
*
* If you check out from git on a non-configure platform, you must run the
* appropriate buildconf* script to set up curlbuild.h and other local files.
*
*/
/* ================================================================ */
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
/* ================================================================ */
#ifdef CURL_SIZEOF_LONG
# error "CURL_SIZEOF_LONG shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
#endif
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
#endif
#ifdef CURL_SIZEOF_CURL_SOCKLEN_T
# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
#endif
#ifdef CURL_TYPEOF_CURL_OFF_T
# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
#endif
#ifdef CURL_FORMAT_CURL_OFF_T
# error "CURL_FORMAT_CURL_OFF_T shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_already_defined
#endif
#ifdef CURL_FORMAT_CURL_OFF_TU
# error "CURL_FORMAT_CURL_OFF_TU shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_already_defined
#endif
#ifdef CURL_FORMAT_OFF_T
# error "CURL_FORMAT_OFF_T shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_FORMAT_OFF_T_already_defined
#endif
#ifdef CURL_SIZEOF_CURL_OFF_T
# error "CURL_SIZEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_already_defined
#endif
#ifdef CURL_SUFFIX_CURL_OFF_T
# error "CURL_SUFFIX_CURL_OFF_T shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_already_defined
#endif
#ifdef CURL_SUFFIX_CURL_OFF_TU
# error "CURL_SUFFIX_CURL_OFF_TU shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_already_defined
#endif
/* ================================================================ */
/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
/* ================================================================ */
#if defined(__DJGPP__) || defined(__GO32__)
# if defined(__DJGPP__) && (__DJGPP__ > 1)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# else
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__SALFORDC__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__BORLANDC__)
# if (__BORLANDC__ < 0x520)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_FORMAT_OFF_T "%I64d"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__TURBOC__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__WATCOMC__)
# if defined(__386__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_FORMAT_OFF_T "%I64d"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# else
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__POCC__)
# if (__POCC__ < 280)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# elif defined(_MSC_VER)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_FORMAT_OFF_T "%I64d"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# else
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__LCC__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__SYMBIAN32__)
# if defined(__EABI__) /* Treat all ARM compilers equally */
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__CW32__)
# pragma longlong on
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__VC32__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__MWERKS__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(_WIN32_WCE)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_FORMAT_OFF_T "%I64d"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__MINGW32__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_FORMAT_OFF_T "%I64d"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__VMS)
# if defined(__VAX)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
#elif defined(__OS400__)
# if defined(__ILEC400__)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# endif
#elif defined(__MVS__)
# if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_ILP32)
# define CURL_SIZEOF_LONG 4
# elif defined(_LP64)
# define CURL_SIZEOF_LONG 8
# endif
# if defined(_LONG_LONG)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(_LP64)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# endif
#elif defined(__370__)
# if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_ILP32)
# define CURL_SIZEOF_LONG 4
# elif defined(_LP64)
# define CURL_SIZEOF_LONG 8
# endif
# if defined(_LONG_LONG)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(_LP64)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# endif
#elif defined(TPF)
# define CURL_SIZEOF_LONG 8
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
/* ===================================== */
/* KEEP MSVC THE PENULTIMATE ENTRY */
/* ===================================== */
#elif defined(_MSC_VER)
# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_FORMAT_OFF_T "%I64d"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# else
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 4
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
/* ===================================== */
/* KEEP GENERIC GCC THE LAST ENTRY */
/* ===================================== */
#elif defined(__GNUC__)
# if !defined(__LP64__) && (defined(__ILP32__) || \
defined(__i386__) || defined(__ppc__) || defined(__arm__) || \
defined(__sparc__) || defined(__mips__) || defined(__sh__))
# define CURL_SIZEOF_LONG 4
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_FORMAT_OFF_T "%lld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__)
# define CURL_SIZEOF_LONG 8
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_FORMAT_OFF_T "%ld"
# define CURL_SIZEOF_CURL_OFF_T 8
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_SIZEOF_CURL_SOCKLEN_T 4
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#else
# error "Unknown non-configure build target!"
Error Compilation_aborted_Unknown_non_configure_build_target
#endif
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
/* sys/types.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_SYS_TYPES_H
# include <sys/types.h>
#endif
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
/* sys/socket.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_SYS_SOCKET_H
# include <sys/socket.h>
#endif
/* Data type definition of curl_socklen_t. */
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
#endif
/* Data type definition of curl_off_t. */
#ifdef CURL_TYPEOF_CURL_OFF_T
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
#endif
#endif /* __CURL_CURLBUILD_H */

262
3rdparty/curl/inc/curlrules.h vendored Normal file
View File

@ -0,0 +1,262 @@
#ifndef __CURL_CURLRULES_H
#define __CURL_CURLRULES_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* ================================================================ */
/* COMPILE TIME SANITY CHECKS */
/* ================================================================ */
/*
* NOTE 1:
* -------
*
* All checks done in this file are intentionally placed in a public
* header file which is pulled by curl/curl.h when an application is
* being built using an already built libcurl library. Additionally
* this file is also included and used when building the library.
*
* If compilation fails on this file it is certainly sure that the
* problem is elsewhere. It could be a problem in the curlbuild.h
* header file, or simply that you are using different compilation
* settings than those used to build the library.
*
* Nothing in this file is intended to be modified or adjusted by the
* curl library user nor by the curl library builder.
*
* Do not deactivate any check, these are done to make sure that the
* library is properly built and used.
*
* You can find further help on the libcurl development mailing list:
* https://cool.haxx.se/mailman/listinfo/curl-library/
*
* NOTE 2
* ------
*
* Some of the following compile time checks are based on the fact
* that the dimension of a constant array can not be a negative one.
* In this way if the compile time verification fails, the compilation
* will fail issuing an error. The error description wording is compiler
* dependent but it will be quite similar to one of the following:
*
* "negative subscript or subscript is too large"
* "array must have at least one element"
* "-1 is an illegal array size"
* "size of array is negative"
*
* If you are building an application which tries to use an already
* built libcurl library and you are getting this kind of errors on
* this file, it is a clear indication that there is a mismatch between
* how the library was built and how you are trying to use it for your
* application. Your already compiled or binary library provider is the
* only one who can give you the details you need to properly use it.
*/
/*
* Verify that some macros are actually defined.
*/
#ifndef CURL_SIZEOF_LONG
# error "CURL_SIZEOF_LONG definition is missing!"
Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing
#endif
#ifndef CURL_TYPEOF_CURL_SOCKLEN_T
# error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!"
Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing
#endif
#ifndef CURL_SIZEOF_CURL_SOCKLEN_T
# error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!"
Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing
#endif
#ifndef CURL_TYPEOF_CURL_OFF_T
# error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing
#endif
#ifndef CURL_FORMAT_CURL_OFF_T
# error "CURL_FORMAT_CURL_OFF_T definition is missing!"
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing
#endif
#ifndef CURL_FORMAT_CURL_OFF_TU
# error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing
#endif
#ifndef CURL_FORMAT_OFF_T
# error "CURL_FORMAT_OFF_T definition is missing!"
Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing
#endif
#ifndef CURL_SIZEOF_CURL_OFF_T
# error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing
#endif
#ifndef CURL_SUFFIX_CURL_OFF_T
# error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing
#endif
#ifndef CURL_SUFFIX_CURL_OFF_TU
# error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing
#endif
/*
* Macros private to this header file.
*/
#define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1
#define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
/*
* Verify that the size previously defined and expected for long
* is the same as the one reported by sizeof() at compile time.
*/
typedef char
__curl_rule_01__
[CurlchkszEQ(long, CURL_SIZEOF_LONG)];
/*
* Verify that the size previously defined and expected for
* curl_off_t is actually the the same as the one reported
* by sizeof() at compile time.
*/
typedef char
__curl_rule_02__
[CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)];
/*
* Verify at compile time that the size of curl_off_t as reported
* by sizeof() is greater or equal than the one reported for long
* for the current compilation.
*/
typedef char
__curl_rule_03__
[CurlchkszGE(curl_off_t, long)];
/*
* Verify that the size previously defined and expected for
* curl_socklen_t is actually the the same as the one reported
* by sizeof() at compile time.
*/
typedef char
__curl_rule_04__
[CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)];
/*
* Verify at compile time that the size of curl_socklen_t as reported
* by sizeof() is greater or equal than the one reported for int for
* the current compilation.
*/
typedef char
__curl_rule_05__
[CurlchkszGE(curl_socklen_t, int)];
/* ================================================================ */
/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
/* ================================================================ */
/*
* CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
* these to be visible and exported by the external libcurl interface API,
* while also making them visible to the library internals, simply including
* curl_setup.h, without actually needing to include curl.h internally.
* If some day this section would grow big enough, all this should be moved
* to its own header file.
*/
/*
* Figure out if we can use the ## preprocessor operator, which is supported
* by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
* or __cplusplus so we need to carefully check for them too.
*/
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
defined(__ILEC400__)
/* This compiler is believed to have an ISO compatible preprocessor */
#define CURL_ISOCPP
#else
/* This compiler is believed NOT to have an ISO compatible preprocessor */
#undef CURL_ISOCPP
#endif
/*
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
*/
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
# define __CURL_OFF_T_C_HLPR2(x) x
# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
#else
# ifdef CURL_ISOCPP
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
# else
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
# endif
# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
#endif
/*
* Get rid of macros private to this header file.
*/
#undef CurlchkszEQ
#undef CurlchkszGE
/*
* Get rid of macros not intended to exist beyond this point.
*/
#undef CURL_PULL_WS2TCPIP_H
#undef CURL_PULL_SYS_TYPES_H
#undef CURL_PULL_SYS_SOCKET_H
#undef CURL_PULL_SYS_POLL_H
#undef CURL_PULL_STDINT_H
#undef CURL_PULL_INTTYPES_H
#undef CURL_TYPEOF_CURL_SOCKLEN_T
#undef CURL_TYPEOF_CURL_OFF_T
#ifdef CURL_NO_OLDIES
#undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */
#endif
#endif /* __CURL_CURLRULES_H */

77
3rdparty/curl/inc/curlver.h vendored Normal file
View File

@ -0,0 +1,77 @@
#ifndef __CURL_CURLVER_H
#define __CURL_CURLVER_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* This header file contains nothing but libcurl version info, generated by
a script at release-time. This was made its own header file in 7.11.2 */
/* This is the global package copyright */
#define LIBCURL_COPYRIGHT "1996 - 2018 Daniel Stenberg, <daniel@haxx.se>."
/* This is the version number of the libcurl package from which this header
file origins: */
#define LIBCURL_VERSION "7.59.0"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 59
#define LIBCURL_VERSION_PATCH 0
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
always follow this syntax:
0xXXYYZZ
Where XX, YY and ZZ are the main version, release and patch numbers in
hexadecimal (using 8 bits each). All three numbers are always represented
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
appears as "0x090b07".
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.
Note: This define is the full hex number and _does not_ use the
CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number.
*/
#define LIBCURL_VERSION_NUM 0x073b00
/*
* This is the date and time when the full source package was created. The
* timestamp is not stored in git, as the timestamp is properly set in the
* tarballs by the maketgz script.
*
* The format of the date follows this template:
*
* "2007-11-23"
*/
#define LIBCURL_TIMESTAMP "2018-03-14"
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
#define CURL_AT_LEAST_VERSION(x,y,z) \
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
#endif /* __CURL_CURLVER_H */

102
3rdparty/curl/inc/easy.h vendored Normal file
View File

@ -0,0 +1,102 @@
#ifndef __CURL_EASY_H
#define __CURL_EASY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
CURL_EXTERN CURL *curl_easy_init(void);
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
/*
* NAME curl_easy_getinfo()
*
* DESCRIPTION
*
* Request internal information from the curl session with this function. The
* third argument MUST be a pointer to a long, a pointer to a char * or a
* pointer to a double (as the documentation describes elsewhere). The data
* pointed to will be filled in accordingly and can be relied upon only if the
* function returns CURLE_OK. This function is intended to get used *AFTER* a
* performed transfer, all results from this function are undefined until the
* transfer is completed.
*/
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
/*
* NAME curl_easy_duphandle()
*
* DESCRIPTION
*
* Creates a new curl session handle with the same options set for the handle
* passed in. Duplicating a handle could only be a matter of cloning data and
* options, internal state info and things like persistent connections cannot
* be transferred. It is useful in multithreaded applications when you can run
* curl_easy_duphandle() for each new thread to avoid a series of identical
* curl_easy_setopt() invokes in every thread.
*/
CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
/*
* NAME curl_easy_reset()
*
* DESCRIPTION
*
* Re-initializes a CURL handle to the default values. This puts back the
* handle to the same state as it was in when it was just created.
*
* It does keep: live connections, the Session ID cache, the DNS cache and the
* cookies.
*/
CURL_EXTERN void curl_easy_reset(CURL *curl);
/*
* NAME curl_easy_recv()
*
* DESCRIPTION
*
* Receives data from the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
size_t *n);
/*
* NAME curl_easy_send()
*
* DESCRIPTION
*
* Sends data over the connected socket. Use after successful
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
*/
CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
size_t buflen, size_t *n);
#ifdef __cplusplus
}
#endif
#endif

50
3rdparty/curl/inc/mprintf.h vendored Normal file
View File

@ -0,0 +1,50 @@
#ifndef __CURL_MPRINTF_H
#define __CURL_MPRINTF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include <stdarg.h>
#include <stdio.h> /* needed for FILE */
#include "curl.h" /* for CURL_EXTERN */
#ifdef __cplusplus
extern "C" {
#endif
CURL_EXTERN int curl_mprintf(const char *format, ...);
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
const char *format, ...);
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
const char *format, va_list args);
CURL_EXTERN char *curl_maprintf(const char *format, ...);
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
#ifdef __cplusplus
}
#endif
#endif /* __CURL_MPRINTF_H */

441
3rdparty/curl/inc/multi.h vendored Normal file
View File

@ -0,0 +1,441 @@
#ifndef __CURL_MULTI_H
#define __CURL_MULTI_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/*
This is an "external" header file. Don't give away any internals here!
GOALS
o Enable a "pull" interface. The application that uses libcurl decides where
and when to ask libcurl to get/send data.
o Enable multiple simultaneous transfers in the same thread without making it
complicated for the application.
o Enable the application to select() on its own file descriptors and curl's
file descriptors simultaneous easily.
*/
/*
* This header file should not really need to include "curl.h" since curl.h
* itself includes this file and we expect user applications to do #include
* <curl/curl.h> without the need for especially including multi.h.
*
* For some reason we added this include here at one point, and rather than to
* break existing (wrongly written) libcurl applications, we leave it as-is
* but with this warning attached.
*/
#include "curl.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
typedef struct Curl_multi CURLM;
#else
typedef void CURLM;
#endif
typedef enum {
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
curl_multi_socket*() soon */
CURLM_OK,
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
attempted to get added - again */
CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
callback */
CURLM_LAST
} CURLMcode;
/* just to make code nicer when using curl_multi_socket() you can now check
for CURLM_CALL_MULTI_SOCKET too in the same style it works for
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
/* bitmask bits for CURLMOPT_PIPELINING */
#define CURLPIPE_NOTHING 0L
#define CURLPIPE_HTTP1 1L
#define CURLPIPE_MULTIPLEX 2L
typedef enum {
CURLMSG_NONE, /* first, not used */
CURLMSG_DONE, /* This easy handle has completed. 'result' contains
the CURLcode of the transfer */
CURLMSG_LAST /* last, not used */
} CURLMSG;
struct CURLMsg {
CURLMSG msg; /* what this message means */
CURL *easy_handle; /* the handle it concerns */
union {
void *whatever; /* message-specific data */
CURLcode result; /* return code for transfer */
} data;
};
typedef struct CURLMsg CURLMsg;
/* Based on poll(2) structure and values.
* We don't use pollfd and POLL* constants explicitly
* to cover platforms without poll(). */
#define CURL_WAIT_POLLIN 0x0001
#define CURL_WAIT_POLLPRI 0x0002
#define CURL_WAIT_POLLOUT 0x0004
struct curl_waitfd {
curl_socket_t fd;
short events;
short revents; /* not supported yet */
};
/*
* Name: curl_multi_init()
*
* Desc: inititalize multi-style curl usage
*
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
*/
CURL_EXTERN CURLM *curl_multi_init(void);
/*
* Name: curl_multi_add_handle()
*
* Desc: add a standard curl handle to the multi stack
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
CURL *curl_handle);
/*
* Name: curl_multi_remove_handle()
*
* Desc: removes a curl handle from the multi stack again
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
CURL *curl_handle);
/*
* Name: curl_multi_fdset()
*
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
* poll() on. We want curl_multi_perform() called as soon as one of
* them are ready.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
fd_set *read_fd_set,
fd_set *write_fd_set,
fd_set *exc_fd_set,
int *max_fd);
/*
* Name: curl_multi_wait()
*
* Desc: Poll on all fds within a CURLM set as well as any
* additional fds passed to the function.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
struct curl_waitfd extra_fds[],
unsigned int extra_nfds,
int timeout_ms,
int *ret);
/*
* Name: curl_multi_perform()
*
* Desc: When the app thinks there's data available for curl it calls this
* function to read/write whatever there is right now. This returns
* as soon as the reads and writes are done. This function does not
* require that there actually is data available for reading or that
* data can be written, it can be called just in case. It returns
* the number of handles that still transfer data in the second
* argument's integer-pointer.
*
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
* returns errors etc regarding the whole multi stack. There might
* still have occurred problems on individual transfers even when
* this returns OK.
*/
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
int *running_handles);
/*
* Name: curl_multi_cleanup()
*
* Desc: Cleans up and removes a whole multi stack. It does not free or
* touch any individual easy handles in any way. We need to define
* in what state those handles will be if this function is called
* in the middle of a transfer.
*
* Returns: CURLMcode type, general multi error code.
*/
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
/*
* Name: curl_multi_info_read()
*
* Desc: Ask the multi handle if there's any messages/informationals from
* the individual transfers. Messages include informationals such as
* error code from the transfer or just the fact that a transfer is
* completed. More details on these should be written down as well.
*
* Repeated calls to this function will return a new struct each
* time, until a special "end of msgs" struct is returned as a signal
* that there is no more to get at this point.
*
* The data the returned pointer points to will not survive calling
* curl_multi_cleanup().
*
* The 'CURLMsg' struct is meant to be very simple and only contain
* very basic information. If more involved information is wanted,
* we will provide the particular "transfer handle" in that struct
* and that should/could/would be used in subsequent
* curl_easy_getinfo() calls (or similar). The point being that we
* must never expose complex structs to applications, as then we'll
* undoubtably get backwards compatibility problems in the future.
*
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
* of structs. It also writes the number of messages left in the
* queue (after this read) in the integer the second argument points
* to.
*/
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
int *msgs_in_queue);
/*
* Name: curl_multi_strerror()
*
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
* value into the equivalent human readable error string. This is
* useful for printing meaningful error messages.
*
* Returns: A pointer to a zero-terminated error message.
*/
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
/*
* Name: curl_multi_socket() and
* curl_multi_socket_all()
*
* Desc: An alternative version of curl_multi_perform() that allows the
* application to pass in one of the file descriptors that have been
* detected to have "action" on them and let libcurl perform.
* See man page for details.
*/
#define CURL_POLL_NONE 0
#define CURL_POLL_IN 1
#define CURL_POLL_OUT 2
#define CURL_POLL_INOUT 3
#define CURL_POLL_REMOVE 4
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
#define CURL_CSELECT_IN 0x01
#define CURL_CSELECT_OUT 0x02
#define CURL_CSELECT_ERR 0x04
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
int what, /* see above */
void *userp, /* private callback
pointer */
void *socketp); /* private socket
pointer */
/*
* Name: curl_multi_timer_callback
*
* Desc: Called by libcurl whenever the library detects a change in the
* maximum number of milliseconds the app is allowed to wait before
* curl_multi_socket() or curl_multi_perform() must be called
* (to allow libcurl's timed events to take place).
*
* Returns: The callback should return zero.
*/
typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
long timeout_ms, /* see above */
void *userp); /* private callback
pointer */
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
int *running_handles);
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
curl_socket_t s,
int ev_bitmask,
int *running_handles);
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
int *running_handles);
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
/* This macro below was added in 7.16.3 to push users who recompile to use
the new curl_multi_socket_action() instead of the old curl_multi_socket()
*/
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
#endif
/*
* Name: curl_multi_timeout()
*
* Desc: Returns the maximum number of milliseconds the app is allowed to
* wait before curl_multi_socket() or curl_multi_perform() must be
* called (to allow libcurl's timed events to take place).
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
long *milliseconds);
#undef CINIT /* re-using the same name as in curl.h */
#ifdef CURL_ISOCPP
#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
#else
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
#define LONG CURLOPTTYPE_LONG
#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
#define OFF_T CURLOPTTYPE_OFF_T
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
#endif
typedef enum {
/* This is the socket callback function pointer */
CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
/* This is the argument passed to the socket callback */
CINIT(SOCKETDATA, OBJECTPOINT, 2),
/* set to 1 to enable pipelining for this multi handle */
CINIT(PIPELINING, LONG, 3),
/* This is the timer callback function pointer */
CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
/* This is the argument passed to the timer callback */
CINIT(TIMERDATA, OBJECTPOINT, 5),
/* maximum number of entries in the connection cache */
CINIT(MAXCONNECTS, LONG, 6),
/* maximum number of (pipelining) connections to one host */
CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
/* maximum number of requests in a pipeline */
CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
/* a connection with a content-length longer than this
will not be considered for pipelining */
CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
/* a connection with a chunk length longer than this
will not be considered for pipelining */
CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
/* a list of site names(+port) that are blacklisted from
pipelining */
CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
/* a list of server types that are blacklisted from
pipelining */
CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
/* maximum number of open connections in total */
CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
/* This is the server push callback function pointer */
CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
/* This is the argument passed to the server push callback */
CINIT(PUSHDATA, OBJECTPOINT, 15),
CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption;
/*
* Name: curl_multi_setopt()
*
* Desc: Sets options for the multi handle.
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
CURLMoption option, ...);
/*
* Name: curl_multi_assign()
*
* Desc: This function sets an association in the multi handle between the
* given socket and a private pointer of the application. This is
* (only) useful for curl_multi_socket uses.
*
* Returns: CURLM error code.
*/
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
curl_socket_t sockfd, void *sockp);
/*
* Name: curl_push_callback
*
* Desc: This callback gets called when a new stream is being pushed by the
* server. It approves or denies the new stream.
*
* Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
*/
#define CURL_PUSH_OK 0
#define CURL_PUSH_DENY 1
struct curl_pushheaders; /* forward declaration only */
CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
size_t num);
CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
const char *name);
typedef int (*curl_push_callback)(CURL *parent,
CURL *easy,
size_t num_headers,
struct curl_pushheaders *headers,
void *userp);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif

33
3rdparty/curl/inc/stdcheaders.h vendored Normal file
View File

@ -0,0 +1,33 @@
#ifndef __STDC_HEADERS_H
#define __STDC_HEADERS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include <sys/types.h>
size_t fread(void *, size_t, size_t, FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
#endif /* __STDC_HEADERS_H */

473
3rdparty/curl/inc/system.h vendored Normal file
View File

@ -0,0 +1,473 @@
#ifndef __CURL_SYSTEM_H
#define __CURL_SYSTEM_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/*
* Try to keep one section per platform, compiler and architecture, otherwise,
* if an existing section is reused for a different one and later on the
* original is adjusted, probably the piggybacking one can be adversely
* changed.
*
* In order to differentiate between platforms/compilers/architectures use
* only compiler built in predefined preprocessor symbols.
*
* curl_off_t
* ----------
*
* For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
* wide signed integral data type. The width of this data type must remain
* constant and independent of any possible large file support settings.
*
* As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
* wide signed integral data type if there is no 64-bit type.
*
* As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
* only be violated if off_t is the only 64-bit data type available and the
* size of off_t is independent of large file support settings. Keep your
* build on the safe side avoiding an off_t gating. If you have a 64-bit
* off_t then take for sure that another 64-bit data type exists, dig deeper
* and you will find it.
*
*/
#if defined(__DJGPP__) || defined(__GO32__)
# if defined(__DJGPP__) && (__DJGPP__ > 1)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__SALFORDC__)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__BORLANDC__)
# if (__BORLANDC__ < 0x520)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__TURBOC__)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__WATCOMC__)
# if defined(__386__)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__POCC__)
# if (__POCC__ < 280)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# elif defined(_MSC_VER)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# else
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__LCC__)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__SYMBIAN32__)
# if defined(__EABI__) /* Treat all ARM compilers equally */
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__CW32__)
# pragma longlong on
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__VC32__)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
#elif defined(__MWERKS__)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(_WIN32_WCE)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__MINGW32__)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_WS2TCPIP_H 1
#elif defined(__VMS)
# if defined(__VAX)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
#elif defined(__OS400__)
# if defined(__ILEC400__)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# endif
#elif defined(__MVS__)
# if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_ILP32)
# elif defined(_LP64)
# endif
# if defined(_LONG_LONG)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(_LP64)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# endif
#elif defined(__370__)
# if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_ILP32)
# elif defined(_LP64)
# endif
# if defined(_LONG_LONG)
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(_LP64)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
# endif
#elif defined(TPF)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#elif defined(__TINYC__) /* also known as tcc */
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#elif defined(__SUNPRO_C) /* Oracle Solaris Studio */
# if !defined(__LP64) && (defined(__ILP32) || \
defined(__i386) || defined(__sparcv8))
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__LP64) || \
defined(__amd64) || defined(__sparcv9)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
/* ===================================== */
/* KEEP MSVC THE PENULTIMATE ENTRY */
/* ===================================== */
#elif defined(_MSC_VER)
# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
# define CURL_TYPEOF_CURL_OFF_T __int64
# define CURL_FORMAT_CURL_OFF_T "I64d"
# define CURL_FORMAT_CURL_OFF_TU "I64u"
# define CURL_SUFFIX_CURL_OFF_T i64
# define CURL_SUFFIX_CURL_OFF_TU ui64
# else
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T int
/* ===================================== */
/* KEEP GENERIC GCC THE LAST ENTRY */
/* ===================================== */
#elif defined(__GNUC__)
# if !defined(__LP64__) && \
(defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \
defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \
defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
defined(__XTENSA__) || \
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \
(defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
# define CURL_TYPEOF_CURL_OFF_T long long
# define CURL_FORMAT_CURL_OFF_T "lld"
# define CURL_FORMAT_CURL_OFF_TU "llu"
# define CURL_SUFFIX_CURL_OFF_T LL
# define CURL_SUFFIX_CURL_OFF_TU ULL
# elif defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
(defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# endif
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
# define CURL_PULL_SYS_TYPES_H 1
# define CURL_PULL_SYS_SOCKET_H 1
#else
/* generic "safe guess" on old 32 bit style */
# define CURL_TYPEOF_CURL_OFF_T long
# define CURL_FORMAT_CURL_OFF_T "ld"
# define CURL_FORMAT_CURL_OFF_TU "lu"
# define CURL_SUFFIX_CURL_OFF_T L
# define CURL_SUFFIX_CURL_OFF_TU UL
# define CURL_TYPEOF_CURL_SOCKLEN_T int
#endif
#ifdef _AIX
/* AIX needs <sys/poll.h> */
#define CURL_PULL_SYS_POLL_H
#endif
/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
/* ws2tcpip.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_WS2TCPIP_H
# include <winsock2.h>
# include <windows.h>
# include <ws2tcpip.h>
#endif
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
/* sys/types.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_SYS_TYPES_H
# include <sys/types.h>
#endif
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
/* sys/socket.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_SYS_SOCKET_H
# include <sys/socket.h>
#endif
/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
/* sys/poll.h is required here to properly make type definitions below. */
#ifdef CURL_PULL_SYS_POLL_H
# include <sys/poll.h>
#endif
/* Data type definition of curl_socklen_t. */
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
#endif
/* Data type definition of curl_off_t. */
#ifdef CURL_TYPEOF_CURL_OFF_T
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
#endif
/*
* CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
* these to be visible and exported by the external libcurl interface API,
* while also making them visible to the library internals, simply including
* curl_setup.h, without actually needing to include curl.h internally.
* If some day this section would grow big enough, all this should be moved
* to its own header file.
*/
/*
* Figure out if we can use the ## preprocessor operator, which is supported
* by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
* or __cplusplus so we need to carefully check for them too.
*/
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
defined(__ILEC400__)
/* This compiler is believed to have an ISO compatible preprocessor */
#define CURL_ISOCPP
#else
/* This compiler is believed NOT to have an ISO compatible preprocessor */
#undef CURL_ISOCPP
#endif
/*
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
*/
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
# define __CURL_OFF_T_C_HLPR2(x) x
# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
#else
# ifdef CURL_ISOCPP
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
# else
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
# endif
# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
#endif
#endif /* __CURL_SYSTEM_H */

696
3rdparty/curl/inc/typecheck-gcc.h vendored Normal file
View File

@ -0,0 +1,696 @@
#ifndef __CURL_TYPECHECK_GCC_H
#define __CURL_TYPECHECK_GCC_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* wraps curl_easy_setopt() with typechecking */
/* To add a new kind of warning, add an
* if(_curl_is_sometype_option(_curl_opt))
* if(!_curl_is_sometype(value))
* _curl_easy_setopt_err_sometype();
* block and define _curl_is_sometype_option, _curl_is_sometype and
* _curl_easy_setopt_err_sometype below
*
* NOTE: We use two nested 'if' statements here instead of the && operator, in
* order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
* when compiling with -Wlogical-op.
*
* To add an option that uses the same type as an existing option, you'll just
* need to extend the appropriate _curl_*_option macro
*/
#define curl_easy_setopt(handle, option, value) \
__extension__ ({ \
__typeof__(option) _curl_opt = option; \
if(__builtin_constant_p(_curl_opt)) { \
if(_curl_is_long_option(_curl_opt)) \
if(!_curl_is_long(value)) \
_curl_easy_setopt_err_long(); \
if(_curl_is_off_t_option(_curl_opt)) \
if(!_curl_is_off_t(value)) \
_curl_easy_setopt_err_curl_off_t(); \
if(_curl_is_string_option(_curl_opt)) \
if(!_curl_is_string(value)) \
_curl_easy_setopt_err_string(); \
if(_curl_is_write_cb_option(_curl_opt)) \
if(!_curl_is_write_cb(value)) \
_curl_easy_setopt_err_write_callback(); \
if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \
if(!_curl_is_resolver_start_callback(value)) \
_curl_easy_setopt_err_resolver_start_callback(); \
if((_curl_opt) == CURLOPT_READFUNCTION) \
if(!_curl_is_read_cb(value)) \
_curl_easy_setopt_err_read_cb(); \
if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
if(!_curl_is_ioctl_cb(value)) \
_curl_easy_setopt_err_ioctl_cb(); \
if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
if(!_curl_is_sockopt_cb(value)) \
_curl_easy_setopt_err_sockopt_cb(); \
if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
if(!_curl_is_opensocket_cb(value)) \
_curl_easy_setopt_err_opensocket_cb(); \
if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
if(!_curl_is_progress_cb(value)) \
_curl_easy_setopt_err_progress_cb(); \
if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
if(!_curl_is_debug_cb(value)) \
_curl_easy_setopt_err_debug_cb(); \
if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
if(!_curl_is_ssl_ctx_cb(value)) \
_curl_easy_setopt_err_ssl_ctx_cb(); \
if(_curl_is_conv_cb_option(_curl_opt)) \
if(!_curl_is_conv_cb(value)) \
_curl_easy_setopt_err_conv_cb(); \
if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
if(!_curl_is_seek_cb(value)) \
_curl_easy_setopt_err_seek_cb(); \
if(_curl_is_cb_data_option(_curl_opt)) \
if(!_curl_is_cb_data(value)) \
_curl_easy_setopt_err_cb_data(); \
if((_curl_opt) == CURLOPT_ERRORBUFFER) \
if(!_curl_is_error_buffer(value)) \
_curl_easy_setopt_err_error_buffer(); \
if((_curl_opt) == CURLOPT_STDERR) \
if(!_curl_is_FILE(value)) \
_curl_easy_setopt_err_FILE(); \
if(_curl_is_postfields_option(_curl_opt)) \
if(!_curl_is_postfields(value)) \
_curl_easy_setopt_err_postfields(); \
if((_curl_opt) == CURLOPT_HTTPPOST) \
if(!_curl_is_arr((value), struct curl_httppost)) \
_curl_easy_setopt_err_curl_httpost(); \
if((_curl_opt) == CURLOPT_MIMEPOST) \
if(!_curl_is_ptr((value), curl_mime)) \
_curl_easy_setopt_err_curl_mimepost(); \
if(_curl_is_slist_option(_curl_opt)) \
if(!_curl_is_arr((value), struct curl_slist)) \
_curl_easy_setopt_err_curl_slist(); \
if((_curl_opt) == CURLOPT_SHARE) \
if(!_curl_is_ptr((value), CURLSH)) \
_curl_easy_setopt_err_CURLSH(); \
} \
curl_easy_setopt(handle, _curl_opt, value); \
})
/* wraps curl_easy_getinfo() with typechecking */
/* FIXME: don't allow const pointers */
#define curl_easy_getinfo(handle, info, arg) \
__extension__ ({ \
__typeof__(info) _curl_info = info; \
if(__builtin_constant_p(_curl_info)) { \
if(_curl_is_string_info(_curl_info)) \
if(!_curl_is_arr((arg), char *)) \
_curl_easy_getinfo_err_string(); \
if(_curl_is_long_info(_curl_info)) \
if(!_curl_is_arr((arg), long)) \
_curl_easy_getinfo_err_long(); \
if(_curl_is_double_info(_curl_info)) \
if(!_curl_is_arr((arg), double)) \
_curl_easy_getinfo_err_double(); \
if(_curl_is_slist_info(_curl_info)) \
if(!_curl_is_arr((arg), struct curl_slist *)) \
_curl_easy_getinfo_err_curl_slist(); \
if(_curl_is_tlssessioninfo_info(_curl_info)) \
if(!_curl_is_arr((arg), struct curl_tlssessioninfo *)) \
_curl_easy_getinfo_err_curl_tlssesssioninfo(); \
if(_curl_is_certinfo_info(_curl_info)) \
if(!_curl_is_arr((arg), struct curl_certinfo *)) \
_curl_easy_getinfo_err_curl_certinfo(); \
if(_curl_is_socket_info(_curl_info)) \
if(!_curl_is_arr((arg), curl_socket_t)) \
_curl_easy_getinfo_err_curl_socket(); \
if(_curl_is_off_t_info(_curl_info)) \
if(!_curl_is_arr((arg), curl_off_t)) \
_curl_easy_getinfo_err_curl_off_t(); \
} \
curl_easy_getinfo(handle, _curl_info, arg); \
})
/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
* for now just make sure that the functions are called with three
* arguments
*/
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
* functions */
/* To define a new warning, use _CURL_WARNING(identifier, "message") */
#define _CURL_WARNING(id, message) \
static void __attribute__((__warning__(message))) \
__attribute__((__unused__)) __attribute__((__noinline__)) \
id(void) { __asm__(""); }
_CURL_WARNING(_curl_easy_setopt_err_long,
"curl_easy_setopt expects a long argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
"curl_easy_setopt expects a curl_off_t argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_string,
"curl_easy_setopt expects a "
"string ('char *' or char[]) argument for this option"
)
_CURL_WARNING(_curl_easy_setopt_err_write_callback,
"curl_easy_setopt expects a curl_write_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_resolver_start_callback,
"curl_easy_setopt expects a "
"curl_resolver_start_callback argument for this option"
)
_CURL_WARNING(_curl_easy_setopt_err_read_cb,
"curl_easy_setopt expects a curl_read_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
"curl_easy_setopt expects a curl_ioctl_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
"curl_easy_setopt expects a curl_sockopt_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
"curl_easy_setopt expects a "
"curl_opensocket_callback argument for this option"
)
_CURL_WARNING(_curl_easy_setopt_err_progress_cb,
"curl_easy_setopt expects a curl_progress_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_debug_cb,
"curl_easy_setopt expects a curl_debug_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_conv_cb,
"curl_easy_setopt expects a curl_conv_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_seek_cb,
"curl_easy_setopt expects a curl_seek_callback argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_cb_data,
"curl_easy_setopt expects a "
"private data pointer as argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_error_buffer,
"curl_easy_setopt expects a "
"char buffer of CURL_ERROR_SIZE as argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_FILE,
"curl_easy_setopt expects a 'FILE *' argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_postfields,
"curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
"curl_easy_setopt expects a 'struct curl_httppost *' "
"argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_curl_mimepost,
"curl_easy_setopt expects a 'curl_mime *' "
"argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_curl_slist,
"curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
_CURL_WARNING(_curl_easy_setopt_err_CURLSH,
"curl_easy_setopt expects a CURLSH* argument for this option")
_CURL_WARNING(_curl_easy_getinfo_err_string,
"curl_easy_getinfo expects a pointer to 'char *' for this info")
_CURL_WARNING(_curl_easy_getinfo_err_long,
"curl_easy_getinfo expects a pointer to long for this info")
_CURL_WARNING(_curl_easy_getinfo_err_double,
"curl_easy_getinfo expects a pointer to double for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
"curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
"curl_easy_getinfo expects a pointer to "
"'struct curl_tlssessioninfo *' for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo,
"curl_easy_getinfo expects a pointer to "
"'struct curl_certinfo *' for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_socket,
"curl_easy_getinfo expects a pointer to curl_socket_t for this info")
_CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
"curl_easy_getinfo expects a pointer to curl_off_t for this info")
/* groups of curl_easy_setops options that take the same type of argument */
/* To add a new option to one of the groups, just add
* (option) == CURLOPT_SOMETHING
* to the or-expression. If the option takes a long or curl_off_t, you don't
* have to do anything
*/
/* evaluates to true if option takes a long argument */
#define _curl_is_long_option(option) \
(0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
#define _curl_is_off_t_option(option) \
((option) > CURLOPTTYPE_OFF_T)
/* evaluates to true if option takes a char* argument */
#define _curl_is_string_option(option) \
((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
(option) == CURLOPT_ACCEPT_ENCODING || \
(option) == CURLOPT_CAINFO || \
(option) == CURLOPT_CAPATH || \
(option) == CURLOPT_COOKIE || \
(option) == CURLOPT_COOKIEFILE || \
(option) == CURLOPT_COOKIEJAR || \
(option) == CURLOPT_COOKIELIST || \
(option) == CURLOPT_CRLFILE || \
(option) == CURLOPT_CUSTOMREQUEST || \
(option) == CURLOPT_DEFAULT_PROTOCOL || \
(option) == CURLOPT_DNS_INTERFACE || \
(option) == CURLOPT_DNS_LOCAL_IP4 || \
(option) == CURLOPT_DNS_LOCAL_IP6 || \
(option) == CURLOPT_DNS_SERVERS || \
(option) == CURLOPT_EGDSOCKET || \
(option) == CURLOPT_FTPPORT || \
(option) == CURLOPT_FTP_ACCOUNT || \
(option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
(option) == CURLOPT_INTERFACE || \
(option) == CURLOPT_ISSUERCERT || \
(option) == CURLOPT_KEYPASSWD || \
(option) == CURLOPT_KRBLEVEL || \
(option) == CURLOPT_LOGIN_OPTIONS || \
(option) == CURLOPT_MAIL_AUTH || \
(option) == CURLOPT_MAIL_FROM || \
(option) == CURLOPT_NETRC_FILE || \
(option) == CURLOPT_NOPROXY || \
(option) == CURLOPT_PASSWORD || \
(option) == CURLOPT_PINNEDPUBLICKEY || \
(option) == CURLOPT_PRE_PROXY || \
(option) == CURLOPT_PROXY || \
(option) == CURLOPT_PROXYPASSWORD || \
(option) == CURLOPT_PROXYUSERNAME || \
(option) == CURLOPT_PROXYUSERPWD || \
(option) == CURLOPT_PROXY_CAINFO || \
(option) == CURLOPT_PROXY_CAPATH || \
(option) == CURLOPT_PROXY_CRLFILE || \
(option) == CURLOPT_PROXY_KEYPASSWD || \
(option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
(option) == CURLOPT_PROXY_SERVICE_NAME || \
(option) == CURLOPT_PROXY_SSLCERT || \
(option) == CURLOPT_PROXY_SSLCERTTYPE || \
(option) == CURLOPT_PROXY_SSLKEY || \
(option) == CURLOPT_PROXY_SSLKEYTYPE || \
(option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
(option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
(option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
(option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
(option) == CURLOPT_RANDOM_FILE || \
(option) == CURLOPT_RANGE || \
(option) == CURLOPT_REFERER || \
(option) == CURLOPT_RTSP_SESSION_ID || \
(option) == CURLOPT_RTSP_STREAM_URI || \
(option) == CURLOPT_RTSP_TRANSPORT || \
(option) == CURLOPT_SERVICE_NAME || \
(option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
(option) == CURLOPT_SSH_KNOWNHOSTS || \
(option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
(option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
(option) == CURLOPT_SSLCERT || \
(option) == CURLOPT_SSLCERTTYPE || \
(option) == CURLOPT_SSLENGINE || \
(option) == CURLOPT_SSLKEY || \
(option) == CURLOPT_SSLKEYTYPE || \
(option) == CURLOPT_SSL_CIPHER_LIST || \
(option) == CURLOPT_TLSAUTH_PASSWORD || \
(option) == CURLOPT_TLSAUTH_TYPE || \
(option) == CURLOPT_TLSAUTH_USERNAME || \
(option) == CURLOPT_UNIX_SOCKET_PATH || \
(option) == CURLOPT_URL || \
(option) == CURLOPT_USERAGENT || \
(option) == CURLOPT_USERNAME || \
(option) == CURLOPT_USERPWD || \
(option) == CURLOPT_XOAUTH2_BEARER || \
0)
/* evaluates to true if option takes a curl_write_callback argument */
#define _curl_is_write_cb_option(option) \
((option) == CURLOPT_HEADERFUNCTION || \
(option) == CURLOPT_WRITEFUNCTION)
/* evaluates to true if option takes a curl_conv_callback argument */
#define _curl_is_conv_cb_option(option) \
((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
(option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
(option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
/* evaluates to true if option takes a data argument to pass to a callback */
#define _curl_is_cb_data_option(option) \
((option) == CURLOPT_CHUNK_DATA || \
(option) == CURLOPT_CLOSESOCKETDATA || \
(option) == CURLOPT_DEBUGDATA || \
(option) == CURLOPT_FNMATCH_DATA || \
(option) == CURLOPT_HEADERDATA || \
(option) == CURLOPT_INTERLEAVEDATA || \
(option) == CURLOPT_IOCTLDATA || \
(option) == CURLOPT_OPENSOCKETDATA || \
(option) == CURLOPT_PRIVATE || \
(option) == CURLOPT_PROGRESSDATA || \
(option) == CURLOPT_READDATA || \
(option) == CURLOPT_SEEKDATA || \
(option) == CURLOPT_SOCKOPTDATA || \
(option) == CURLOPT_SSH_KEYDATA || \
(option) == CURLOPT_SSL_CTX_DATA || \
(option) == CURLOPT_WRITEDATA || \
(option) == CURLOPT_RESOLVER_START_DATA || \
0)
/* evaluates to true if option takes a POST data argument (void* or char*) */
#define _curl_is_postfields_option(option) \
((option) == CURLOPT_POSTFIELDS || \
(option) == CURLOPT_COPYPOSTFIELDS || \
0)
/* evaluates to true if option takes a struct curl_slist * argument */
#define _curl_is_slist_option(option) \
((option) == CURLOPT_HTTP200ALIASES || \
(option) == CURLOPT_HTTPHEADER || \
(option) == CURLOPT_MAIL_RCPT || \
(option) == CURLOPT_POSTQUOTE || \
(option) == CURLOPT_PREQUOTE || \
(option) == CURLOPT_PROXYHEADER || \
(option) == CURLOPT_QUOTE || \
(option) == CURLOPT_RESOLVE || \
(option) == CURLOPT_TELNETOPTIONS || \
0)
/* groups of curl_easy_getinfo infos that take the same type of argument */
/* evaluates to true if info expects a pointer to char * argument */
#define _curl_is_string_info(info) \
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
/* evaluates to true if info expects a pointer to long argument */
#define _curl_is_long_info(info) \
(CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
/* evaluates to true if info expects a pointer to double argument */
#define _curl_is_double_info(info) \
(CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
/* true if info expects a pointer to struct curl_slist * argument */
#define _curl_is_slist_info(info) \
(((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
#define _curl_is_tlssessioninfo_info(info) \
(((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
/* true if info expects a pointer to struct curl_certinfo * argument */
#define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
/* true if info expects a pointer to struct curl_socket_t argument */
#define _curl_is_socket_info(info) \
(CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
/* true if info expects a pointer to curl_off_t argument */
#define _curl_is_off_t_info(info) \
(CURLINFO_OFF_T < (info))
/* typecheck helpers -- check whether given expression has requested type*/
/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
* otherwise define a new macro. Search for __builtin_types_compatible_p
* in the GCC manual.
* NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
* the actual expression passed to the curl_easy_setopt macro. This
* means that you can only apply the sizeof and __typeof__ operators, no
* == or whatsoever.
*/
/* XXX: should evaluate to true iff expr is a pointer */
#define _curl_is_any_ptr(expr) \
(sizeof(expr) == sizeof(void *))
/* evaluates to true if expr is NULL */
/* XXX: must not evaluate expr, so this check is not accurate */
#define _curl_is_NULL(expr) \
(__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
/* evaluates to true if expr is type*, const type* or NULL */
#define _curl_is_ptr(expr, type) \
(_curl_is_NULL(expr) || \
__builtin_types_compatible_p(__typeof__(expr), type *) || \
__builtin_types_compatible_p(__typeof__(expr), const type *))
/* evaluates to true if expr is one of type[], type*, NULL or const type* */
#define _curl_is_arr(expr, type) \
(_curl_is_ptr((expr), type) || \
__builtin_types_compatible_p(__typeof__(expr), type []))
/* evaluates to true if expr is a string */
#define _curl_is_string(expr) \
(_curl_is_arr((expr), char) || \
_curl_is_arr((expr), signed char) || \
_curl_is_arr((expr), unsigned char))
/* evaluates to true if expr is a long (no matter the signedness)
* XXX: for now, int is also accepted (and therefore short and char, which
* are promoted to int when passed to a variadic function) */
#define _curl_is_long(expr) \
(__builtin_types_compatible_p(__typeof__(expr), long) || \
__builtin_types_compatible_p(__typeof__(expr), signed long) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
__builtin_types_compatible_p(__typeof__(expr), int) || \
__builtin_types_compatible_p(__typeof__(expr), signed int) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
__builtin_types_compatible_p(__typeof__(expr), short) || \
__builtin_types_compatible_p(__typeof__(expr), signed short) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
__builtin_types_compatible_p(__typeof__(expr), char) || \
__builtin_types_compatible_p(__typeof__(expr), signed char) || \
__builtin_types_compatible_p(__typeof__(expr), unsigned char))
/* evaluates to true if expr is of type curl_off_t */
#define _curl_is_off_t(expr) \
(__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
/* XXX: also check size of an char[] array? */
#define _curl_is_error_buffer(expr) \
(_curl_is_NULL(expr) || \
__builtin_types_compatible_p(__typeof__(expr), char *) || \
__builtin_types_compatible_p(__typeof__(expr), char[]))
/* evaluates to true if expr is of type (const) void* or (const) FILE* */
#if 0
#define _curl_is_cb_data(expr) \
(_curl_is_ptr((expr), void) || \
_curl_is_ptr((expr), FILE))
#else /* be less strict */
#define _curl_is_cb_data(expr) \
_curl_is_any_ptr(expr)
#endif
/* evaluates to true if expr is of type FILE* */
#define _curl_is_FILE(expr) \
(_curl_is_NULL(expr) || \
(__builtin_types_compatible_p(__typeof__(expr), FILE *)))
/* evaluates to true if expr can be passed as POST data (void* or char*) */
#define _curl_is_postfields(expr) \
(_curl_is_ptr((expr), void) || \
_curl_is_arr((expr), char))
/* FIXME: the whole callback checking is messy...
* The idea is to tolerate char vs. void and const vs. not const
* pointers in arguments at least
*/
/* helper: __builtin_types_compatible_p distinguishes between functions and
* function pointers, hide it */
#define _curl_callback_compatible(func, type) \
(__builtin_types_compatible_p(__typeof__(func), type) || \
__builtin_types_compatible_p(__typeof__(func) *, type))
/* evaluates to true if expr is of type curl_resolver_start_callback */
#define _curl_is_resolver_start_callback(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_resolver_start_callback))
/* evaluates to true if expr is of type curl_read_callback or "similar" */
#define _curl_is_read_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), __typeof__(fread) *) || \
_curl_callback_compatible((expr), curl_read_callback) || \
_curl_callback_compatible((expr), _curl_read_callback1) || \
_curl_callback_compatible((expr), _curl_read_callback2) || \
_curl_callback_compatible((expr), _curl_read_callback3) || \
_curl_callback_compatible((expr), _curl_read_callback4) || \
_curl_callback_compatible((expr), _curl_read_callback5) || \
_curl_callback_compatible((expr), _curl_read_callback6))
typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
/* evaluates to true if expr is of type curl_write_callback or "similar" */
#define _curl_is_write_cb(expr) \
(_curl_is_read_cb(expr) || \
_curl_callback_compatible((expr), __typeof__(fwrite) *) || \
_curl_callback_compatible((expr), curl_write_callback) || \
_curl_callback_compatible((expr), _curl_write_callback1) || \
_curl_callback_compatible((expr), _curl_write_callback2) || \
_curl_callback_compatible((expr), _curl_write_callback3) || \
_curl_callback_compatible((expr), _curl_write_callback4) || \
_curl_callback_compatible((expr), _curl_write_callback5) || \
_curl_callback_compatible((expr), _curl_write_callback6))
typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
const void *);
typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
const void *);
typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
#define _curl_is_ioctl_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_ioctl_callback) || \
_curl_callback_compatible((expr), _curl_ioctl_callback1) || \
_curl_callback_compatible((expr), _curl_ioctl_callback2) || \
_curl_callback_compatible((expr), _curl_ioctl_callback3) || \
_curl_callback_compatible((expr), _curl_ioctl_callback4))
typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
#define _curl_is_sockopt_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_sockopt_callback) || \
_curl_callback_compatible((expr), _curl_sockopt_callback1) || \
_curl_callback_compatible((expr), _curl_sockopt_callback2))
typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
curlsocktype);
/* evaluates to true if expr is of type curl_opensocket_callback or
"similar" */
#define _curl_is_opensocket_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_opensocket_callback) || \
_curl_callback_compatible((expr), _curl_opensocket_callback1) || \
_curl_callback_compatible((expr), _curl_opensocket_callback2) || \
_curl_callback_compatible((expr), _curl_opensocket_callback3) || \
_curl_callback_compatible((expr), _curl_opensocket_callback4))
typedef curl_socket_t (*_curl_opensocket_callback1)
(void *, curlsocktype, struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback2)
(void *, curlsocktype, const struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback3)
(const void *, curlsocktype, struct curl_sockaddr *);
typedef curl_socket_t (*_curl_opensocket_callback4)
(const void *, curlsocktype, const struct curl_sockaddr *);
/* evaluates to true if expr is of type curl_progress_callback or "similar" */
#define _curl_is_progress_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_progress_callback) || \
_curl_callback_compatible((expr), _curl_progress_callback1) || \
_curl_callback_compatible((expr), _curl_progress_callback2))
typedef int (*_curl_progress_callback1)(void *,
double, double, double, double);
typedef int (*_curl_progress_callback2)(const void *,
double, double, double, double);
/* evaluates to true if expr is of type curl_debug_callback or "similar" */
#define _curl_is_debug_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_debug_callback) || \
_curl_callback_compatible((expr), _curl_debug_callback1) || \
_curl_callback_compatible((expr), _curl_debug_callback2) || \
_curl_callback_compatible((expr), _curl_debug_callback3) || \
_curl_callback_compatible((expr), _curl_debug_callback4) || \
_curl_callback_compatible((expr), _curl_debug_callback5) || \
_curl_callback_compatible((expr), _curl_debug_callback6) || \
_curl_callback_compatible((expr), _curl_debug_callback7) || \
_curl_callback_compatible((expr), _curl_debug_callback8))
typedef int (*_curl_debug_callback1) (CURL *,
curl_infotype, char *, size_t, void *);
typedef int (*_curl_debug_callback2) (CURL *,
curl_infotype, char *, size_t, const void *);
typedef int (*_curl_debug_callback3) (CURL *,
curl_infotype, const char *, size_t, void *);
typedef int (*_curl_debug_callback4) (CURL *,
curl_infotype, const char *, size_t, const void *);
typedef int (*_curl_debug_callback5) (CURL *,
curl_infotype, unsigned char *, size_t, void *);
typedef int (*_curl_debug_callback6) (CURL *,
curl_infotype, unsigned char *, size_t, const void *);
typedef int (*_curl_debug_callback7) (CURL *,
curl_infotype, const unsigned char *, size_t, void *);
typedef int (*_curl_debug_callback8) (CURL *,
curl_infotype, const unsigned char *, size_t, const void *);
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
/* this is getting even messier... */
#define _curl_is_ssl_ctx_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_ssl_ctx_callback) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \
_curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
const void *);
#ifdef HEADER_SSL_H
/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
* this will of course break if we're included before OpenSSL headers...
*/
typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
const void *);
#else
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
#endif
/* evaluates to true if expr is of type curl_conv_callback or "similar" */
#define _curl_is_conv_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_conv_callback) || \
_curl_callback_compatible((expr), _curl_conv_callback1) || \
_curl_callback_compatible((expr), _curl_conv_callback2) || \
_curl_callback_compatible((expr), _curl_conv_callback3) || \
_curl_callback_compatible((expr), _curl_conv_callback4))
typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
/* evaluates to true if expr is of type curl_seek_callback or "similar" */
#define _curl_is_seek_cb(expr) \
(_curl_is_NULL(expr) || \
_curl_callback_compatible((expr), curl_seek_callback) || \
_curl_callback_compatible((expr), _curl_seek_callback1) || \
_curl_callback_compatible((expr), _curl_seek_callback2))
typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
#endif /* __CURL_TYPECHECK_GCC_H */

28
3rdparty/dahua/inc/avglobal.h vendored Normal file
View File

@ -0,0 +1,28 @@
#ifndef AVGLOBAL_H
#define AVGLOBAL_H
typedef int AV_int32;
typedef unsigned int AV_uint32;
#ifndef __OBJC__
typedef int AV_BOOL;
#else
typedef BOOL AV_BOOL;
#endif
typedef void* AV_HANDLE;
typedef unsigned char AV_BYTE;
typedef float AV_float;
#ifdef WIN32
typedef __int64 AV_int64;
typedef unsigned __int64 AV_uint64;
#else
typedef long long AV_int64;
typedef unsigned long long AV_uint64;
#endif
#endif

187
3rdparty/dahua/inc/dhassistant.h vendored Normal file
View File

@ -0,0 +1,187 @@
#ifndef DHSYSABLE_H
#define DHSYSABLE_H
//////////////////////////////////////////////////////////////////////////
// 查询类型
typedef enum
{
ABILITY_DYNAMIC_CONNECT = 1, // 查询动态多连接能力
ABILITY_WATERMARK_CFG = 17, // 水印配置能力
ABILITY_WIRELESS_CFG = 18, // wireless配置能力
ABILITY_DEVALL_INFO = 26, // 设备的能力列表
ABILITY_CARD_QUERY = 0x0100, // 卡号查询能力
ABILITY_MULTIPLAY = 0x0101, // 多画面预览能力
ABILITY_QUICK_QUERY_CFG = 0x0102, // 快速查询配置能力
ABILITY_INFRARED = 0x0121, // 无线报警能力
ABILITY_TRIGGER_MODE = 0x0131, // 报警输出触发方式能力
ABILITY_DISK_SUBAREA = 0x0141, // 网络硬盘分区能力
ABILITY_DSP_CFG = 0x0151, // 查询DSP能力
ABILITY_STREAM_MEDIA = 0x0161, // 查询SIP,RTSP能力
ABILITY_INTELLI_TRACKER = 0x0171, // 查询智能跟踪能力
} DH_SYS_ABILITY;
//////////////////////////////////////////////////////////////////////////
// 设备支持功能列表
enum
{
EN_FTP = 0, // FTP 按位1传送录像文件 2传送抓图文件
EN_SMTP, // SMTP 按位1报警传送文本邮件 2报警传送图片 3:支持健康邮件功能
EN_NTP, // NTP 按位1调整系统时间
EN_AUTO_MAINTAIN, // 自动维护 按位1重启 2关闭 3:删除文件
EN_VIDEO_COVER, // 区域遮挡 按位1多区域遮挡
EN_AUTO_REGISTER, // 主动注册 按位1注册后sdk主动登陆
EN_DHCP, // DHCP 按位1DHCP
EN_UPNP, // UPNP 按位1UPNP
EN_COMM_SNIFFER, // 串口抓包 按位1:CommATM
EN_NET_SNIFFER, // 网络抓包 按位: 1NetSniffer
EN_BURN, // 刻录功能 按位1查询刻录状态
EN_VIDEO_MATRIX, // 视频矩阵 按位1是否支持视频矩阵 2:是否支持SPOT视频矩阵 3:是否支持HDMI视频矩阵
EN_AUDIO_DETECT, // 音频检测 按位1是否支持音频检测
EN_STORAGE_STATION, // 存储位置 按位1Ftp服务器(Ips) 2SMB 3NFS 4ISCSI 16DISK 17U盘
EN_IPSSEARCH, // IPS存储查询 按位1IPS存储查询
EN_SNAP, // 抓图 按位1分辨率2帧率3抓图方式4抓图文件格式5图画质量
EN_DEFAULTNIC, // 支持默认网卡查询 按位 1支持
EN_SHOWQUALITY, // CBR模式下显示画质配置项 按位 1:支持
EN_CONFIG_IMEXPORT, // 配置导入导出功能能力 按位 1:支持
EN_LOG, // 是否支持分页方式的日志查询 按位 1支持
EN_SCHEDULE, // 录像设置的一些能力 按位 1:冗余 2:预录 3:录像时间段
EN_NETWORK_TYPE, // 网络类型按位表示 1:以态网 2:无线局域 3:CDMA/GPRS 4:CDMA/GPRS多网卡配置
EN_MARK_IMPORTANTRECORD, // 标识重要录像 按位:1设置重要录像标识
EN_ACFCONTROL, // 活动帧率控制 按位1支持活动帧率控制, 2:支持定时报警类型活动帧率控制(不支持动检),该能力与ACF能力互斥
EN_MULTIASSIOPTION, // 多路辅码流 按位1支持三路辅码流, 2:支持辅码流编码压缩格式独立设置
EN_DAVINCIMODULE, // 组件化模块 按位1时间表分开处理 2:标准I帧间隔设置
EN_GPS, // GPS功能 按位1Gps定位功能
EN_MULTIETHERNET, // 支持多网卡查询 按位 1支持
EN_LOGIN_ATTRIBUTE, // Login属性 按位1支持Login属性查询
EN_RECORD_GENERAL, // 录像相关 按位1普通录像2报警录像3动态检测录像4本地存储5远程存储6冗余存储7本地紧急存储8支持区分主辅码流的远程存储
EN_JSON_CONFIG, // Json格式配置:按位1支持Json格式, 2: 使用F6的NAS配置, 3: 使用F6的Raid配置, 4使用F6的MotionDetect配置, 5完整支持三代配置(V3)通过F6命令访问
EN_HIDE_FUNCTION, // 屏蔽功能按位1屏蔽PTZ云台功能, 2: 屏蔽3G的保活时段功能
EN_DISK_DAMAGE, // 硬盘坏道信息支持能力: 按位1硬盘坏道信息查询支持能力
EN_PLAYBACK_SPEED_CTRL, // 支持回放网传速度控制:按位:1支持回放加速
EN_HOLIDAYSCHEDULE, // 支持假期时间段配置:按位:1支持假期时间段配置
EN_FETCH_MONEY_TIMEOUT, // ATM取钱超时
EN_BACKUP_VIDEO_FORMAT, // 备份支持的格式按位1:DAV, 2:ASF
EN_QUERY_DISK_TYPE, // 支持硬盘类型查询
EN_CONFIG_DISPLAY_OUTPUT, // 支持设备显示输出VGA等配置,按位: 1:画面分割轮巡配置
EN_SUBBITRATE_RECORD_CTRL, // 支持扩展码流录像控制设置, 按位1-辅码流录像控制设置
EN_IPV6, // 支持IPV6设置, 按位1-IPV6配置
EN_SNMP, // SNMP简单网络管理协议
EN_QUERY_URL, // 支持获取设备URL地址, 按位: 1-查询配置URL地址
EN_ISCSI, // ISCSIInternet小型计算机系统接口配置
EN_RAID, // 支持Raid功能
EN_HARDDISK_INFO, // 支持磁盘信息F5查询
EN_PICINPIC, // 支持画中画功能 按位:1,画中画设置; 2,画中画预览、录像存储、查询、下载;3,支持画中画编码配置,同时支持画中画通道查询
EN_PLAYBACK_SPEED_CTRL_SUPPORT, // 同 EN_PLAYBACK_SPEED_CTRL ,只为了兼容协议
EN_LF_XDEV, // 支持24、32、64路LF-X系列标注这类设备特殊的编码能力计算方式
EN_DSP_ENCODE_CAP, // F5 DSP编码能力查询
EN_MULTICAST, // 组播能力查询
EM_NET_LIMIT, // 网络限制能力查询按位1-网络发送码流大小限
EM_COM422, // 串口422
EM_PROTOCAL_FRAMEWORK, // 是否支持三代协议框架需要实现listMethod(),listService()通过F6命令访问
EM_WRITE_DISK_OSD, // 刻录OSD叠加, 按位, 1-刻录OSD叠加配置
EM_DYNAMIC_MULTI_CONNECT, // 动态多连接, 按位, 1-请求视频数据应答
EM_CLOUDSERVICE, // 云服务,按位1-支持私有云服务
EM_RECORD_INFO, // 录像信息上报, 按位, 1-录像信息主动上报, 2-支持录像帧数查询
EN_DYNAMIC_REG, // 主动注册能力按位1-支持动态主动注册
};
typedef struct
{
DWORD IsFucEnable[512]; // 功能列表能力集,下标对应上述的枚举值,按位表示子功能
} DH_DEV_ENABLE_INFO;
//////////////////////////////////////////////////////////////////////////
// 卡号查询能力结构体
typedef struct
{
char IsCardQueryEnable;
char iRev[3];
} DH_CARD_QUERY_EN;
//////////////////////////////////////////////////////////////////////////
// wireless能力结构体
typedef struct
{
char IsWirelessEnable;
char iRev[3];
} DH_WIRELESS_EN;
//////////////////////////////////////////////////////////////////////////
// 图象水印能力结构体
typedef struct
{
char isSupportWM; // 1 支持0 不支持
char supportWhat; // 0文字水印1图片水印2同时支持文字水印和图片水印
char reserved[2];
} DH_WATERMAKE_EN;
//////////////////////////////////////////////////////////////////////////
// 多画面预览能力结构体
typedef struct
{
int nEnable; // 1 支持0 不支持
DWORD dwMultiPlayMask; // 多画面预览掩码
char reserved[4]; // 保留
} DH_MULTIPLAY_EN;
//////////////////////////////////////////////////////////////////////////
// 无线报警能力结构体
typedef struct
{
BOOL bSupport; // 是否支持
int nAlarmInCount; // 输入个数
int nAlarmOutCount; // 输出个数
int nRemoteAddrCount; // 遥控器个数
BYTE reserved[32];
} DH_WIRELESS_ALARM_INFO;
//////////////////////////////////////////////////////////////////////////
// 网络硬盘分区能力结构体
typedef struct
{
BOOL bSupported; // 是否支持网络硬盘分区
int nSupportNum; // 支持分区的数目
BYTE bReserved[32]; // 保留字节
} DH_DISK_SUBAREA_EN;
// DSP能力查询当DSP能力算法标识为2时使用。
typedef struct
{
BYTE bMainFrame[32]; // 以分辨率枚举值(CAPTURE_SIZE)为索引,主码流分辨率对应支持的最大帧率,如果不支持此分辨率,则值为0.
BYTE bExtraFrame_1[32]; // 辅码流1,使用同bMainFrame
BYTE bReserved[128]; // 预留给辅码流2和3.
} DH_DSP_CFG_ITEM;
typedef struct
{
int nItemNum; // DH_DSP_CFG_ITEM的有效个数,等于通道数
DH_DSP_CFG_ITEM stuDspCfgItem[32]; // 主码流的信息
BYTE bReserved[128]; // 保留
} DH_DSP_CFG;
//////////////////////////////////////////////////////////////////////////
// 快速查询配置能力结构体
typedef struct
{
char IsQuickQueryEnable; // 1是设备支持配置命令快速返回请设置配置时间足够长以保证窄带下配置的正常读取。建议设置60S
char iRev[3];
} DH_QUICK_QUERY_CFG_EN;
typedef struct
{
int nStreamType; // 0,无 1,SIP 2,RTSP
BYTE bReserved[16]; // 保留
} DH_STREAM_MEDIA_EN;
//智能球跟踪能力查询
typedef struct
{
char IsIntelliTrackerEnable; // 大于0表示具有智能球跟踪能力
BYTE bReserved[3];
}DH_INTELLI_TRACKER_EN;
#endif // DHSYSABLE_H

17653
3rdparty/dahua/inc/dhconfigsdk.h vendored Normal file

File diff suppressed because it is too large Load Diff

80681
3rdparty/dahua/inc/dhnetsdk.h vendored Normal file

File diff suppressed because it is too large Load Diff

2727
3rdparty/dahua/inc/dhplay.h vendored Normal file

File diff suppressed because it is too large Load Diff

BIN
3rdparty/dahua/lib/win64/dhconfigsdk.lib vendored Normal file

Binary file not shown.

BIN
3rdparty/dahua/lib/win64/dhnetsdk.lib vendored Normal file

Binary file not shown.

BIN
3rdparty/dahua/lib/win64/dhplay.lib vendored Normal file

Binary file not shown.

111
3rdparty/hikvision/camera/inc/DataType.h vendored Normal file
View File

@ -0,0 +1,111 @@
#ifndef DATA_TYPE_H
#define DATA_TYPE_H
#define FRAME_HEAD_MAGIC 0x03211546
#define SYSTEM_SYNC_ID 2
#ifdef __LINUX__
typedef unsigned char UCHAR;
typedef unsigned char* PBYTE;
typedef char* LPTSTR;
typedef unsigned short USHORT;
typedef int HANDLE;
typedef unsigned long ULONG;
typedef unsigned long DWORD;
#endif //#ifdef __LINUX__
typedef struct tagFrameInfo{
ULONG SyncId; /* 00000000000000000000000000010b */
ULONG Magic;
USHORT FrameType; /* I frames , P frames or BBP frames Audio frames or dsp status etc */
ULONG Length; /*lenth include this header */
ULONG FrameNumber; /* serial number of this frame */
UCHAR Breakable; /* indicate if stream breakable, you could restart new file(with PktSysHeader) if true */
/*ULONG Ack;*/
ULONG PTS; /* system clock when this frames is processed */
}TMFRAME_HEADER, *PTMFRAME_HEADER;
typedef enum {
StandardNone = 0x80000000,
StandardNTSC = 0x00000001,
StandardPAL = 0x00000002,
StandardSECAM = 0x00000004,
} VideoStandard_t;
typedef enum {
PktError = 0,
PktIFrames = 0x0001,
PktPFrames = 0x0002,
PktBBPFrames = 0x0004,
PktAudioFrames = 0x0008,
PktMotionDetection = 0x00010,
PktDspStatus = 0x00020,
PktOrigImage = 0x00040,
PktSysHeader = 0x00080,
PktBPFrames = 0x00100,
PktSFrames = 0x00200,
PktSubIFrames = 0x00400,
PktSubPFrames = 0x00800,
PktSubBBPFrames = 0x01000,
PktSubSysHeader = 0x02000
}FrameType_t;
typedef struct tagVersion{
ULONG DspVersion, DspBuildNum;
ULONG DriverVersion, DriverBuildNum;
ULONG SDKVersion, SDKBuildNum;
}VERSION_INFO, *PVERSION_INFO;
typedef enum {
ENC_CIF_FORMAT = 0,
ENC_QCIF_FORMAT = 1,
ENC_2CIF_FORMAT = 2,
ENC_4CIF_FORMAT = 3,
ENC_QQCIF_FORMAT = 4,
ENC_CIFQCIF_FORMAT =5,
ENC_CIFQQCIF_FORMAT =6,
ENC_DCIF_FORMAT =7,
ENC_VGA_FORMAT=8
}PictureFormat_t;
typedef struct tagMotionData{
PictureFormat_t PicFormat;
ULONG HorizeBlocks;
ULONG VerticalBlocks;
ULONG BlockSize;
}MOTION_DATA_HEADER, *PMOTION_DATA_HEADER;
#define _OSD_BASE 0x9000 /*base address of special character*/
#define _OSD_YEAR4 (_OSD_BASE+0) /*show year time by length of 4 , for example: 2005*/
#define _OSD_YEAR2 (_OSD_BASE+1) /*show year time by length of 2, for example: 05 */
#define _OSD_MONTH3 (_OSD_BASE+2) /*show month time in English, for example: Jan*/
#define _OSD_MONTH2 (_OSD_BASE+3) /*show month time by two Arabic numerals, for example: 07*/
#define _OSD_DAY (_OSD_BASE+4) /*show day time by two Arabic numerals, for example: 31*/
#define _OSD_WEEK3 (_OSD_BASE+5) /*show week time in English: MON¡«SUN*/
#define _OSD_CWEEK1 (_OSD_BASE+6) /*show week time in Chinese GB code*/
#define _OSD_HOUR24 (_OSD_BASE+7) /*show 24 hours clock: 00¡«23 */
#define _OSD_HOUR12 (_OSD_BASE+8) /*show 12 hours clock: 00¡«12*/
#define _OSD_MINUTE (_OSD_BASE+9) /*show minute time by length of 2: 00¡«59*/
#define _OSD_SECOND (_OSD_BASE+10) /*show second time by length of 2: 00¡«59*/
#define _OSD_MILISECOND (_OSD_BASE+11) /*show millisecond time by length of 3: 000~999*/
#define _OSD_APM (_OSD_BASE+14) /*show a.m. or p.m. by length of 2 bit, AM or PM*/
//For new added APIs to set OSD: SetEncoderOsdDisplayMode, SetDecoderOsdDisplayMode and SetDisplayOsdDisplayMode in v6.0 SDK, we use new basic address of special character.
#define _OSD_BASE_EX 0x90000 /*base address of special character*/
#define _OSD_YEAR4_EX (_OSD_BASE_EX+0) /*the same as _OSD_YEAR4*/
#define _OSD_YEAR2_EX (_OSD_BASE_EX+1) /*the same as _OSD_YEAR2*/
#define _OSD_MONTH3_EX (_OSD_BASE_EX+2) /*the same as _OSD_MONTH3*/
#define _OSD_MONTH2_EX (_OSD_BASE_EX+3) /*the same as _OSD_MONTH2*/
#define _OSD_DAY_EX (_OSD_BASE_EX+4) /*the same as _OSD_DAY*/
#define _OSD_WEEK3_EX (_OSD_BASE_EX+5) /*the same as _OSD_WEEK3*/
#define _OSD_CWEEK1_EX (_OSD_BASE_EX+6) /*the same as _OSD_CWEEK1*/
#define _OSD_HOUR24_EX (_OSD_BASE_EX+7) /*the same as _OSD_HOUR24*/
#define _OSD_HOUR12_EX (_OSD_BASE_EX+8) /*the same as _OSD_HOUR12*/
#define _OSD_MINUTE_EX (_OSD_BASE_EX+9) /*the same as _OSD_MINUTE*/
#define _OSD_SECOND_EX (_OSD_BASE_EX+10) /*the same as _OSD_SECOND*/
#define _OSD_MILISECOND_EX (_OSD_BASE_EX+11) /*the same as _OSD_MILISECOND*/
#define _OSD_APM_EX (_OSD_BASE_EX+14) /*the same as _OSD_APM*/
#endif

View File

@ -0,0 +1,451 @@
///////////////////////////////////////////////////////////////////////////
// DS-40xxHC/HF BOARD SYSTEM SDK //
///////////////////////////////////////////////////////////////////////////
#ifndef DECODECARD_SDK_H
#define DECODECARD_SDK_H
#include "datatype.h"
#define DLLEXPORT_API extern "C" __declspec(dllexport)
#define ERR_WAIT_TIMEOUT 0xc0000001
#define ERR_INVALID_HANDLE 0xc0000002
#define ERR_INVALID_ARGUMENT 0xc0000003
#define ERR_DDRAW_CREATE_FAILED 0xc0000004
#define ERR_DDRAW_CAPS_FAULT 0xc0000005
#define ERR_SET_COOPERATIVELEVEL_FAILED 0xc0000006
#define ERR_PRIMARY_SURFACE_CREATE_FAILED 0xc0000007
#define ERR_GET_OVERLAY_ADDRESS_FAILED 0xc0000008
#define ERR_OVERLAY_SURFACE_CREATE_FAILED 0xc0000009
#define ERR_OVERLAY_UPDATE_FAILED 0xc000000a
#define ERR_TMMAN_FAILURE 0xc000000b
#define ERR_CHANNELMAGIC_MISMATCH 0xc000000c
#define ERR_CALLBACK_REGISTERED 0xc000000d
#define ERR_QUEUE_OVERFLOW 0xc000000e
#define ERR_STREAM_THREAD_FAILURE 0xc000000f
#define ERR_THREAD_STOP_ERROR 0xc0000010
#define ERR_NOT_SUPPORT 0xc0000011
#define ERR_OUTOF_MEMORY 0xc0000012
#define ERR_DSP_BUSY 0xc0000013
#define ERR_DATA_ERROR 0xc0000014
#define ERR_KERNEL 0xc0000016
#define ERR_OFFSCREEN_CREATE_FAILED 0xc0000017
#define ERR_MULTICLOCK_FAILURE 0xc0000018
#define ERR_INVALID_DEVICE 0xc0000019
#define ERR_INVALID_DRIVER 0xc000001a
//error code for MD card
#define HWERR_SUCCESS 0
#define HWERR_ALLOCATE_MEMORY 0xc1000001
#define HWERR_INVALID_HANDLE 0xc1000002
#define HWERR_DDRAW_CREATE_FAILED 0xc1000003
#define HWERR_DDRAW_CAPS_FAULT 0xc1000004
#define HWERR_SET_COOPERATIVELEVEL_FAILED 0xc1000005
#define HWERR_PRIMARY_SURFACE_CREATE_FAILED 0xc1000006
#define HWERR_OVERLAY_CREATE_FAILED 0xc1000007
#define HWERR_GET_OVERLAY_ADDRESS_FAILED 0xc1000008
#define HWERR_OVERLAY_UPDATE_FAILED 0xc1000009
#define HWERR_SURFACE_NULL 0xc100000a
#define HWERR_FILEHEADER_UNKNOWN 0xc100000b
#define HWERR_CREATE_FILE_FAILED 0xc100000c
#define HWERR_FILE_SIZE_ZERO 0xc100000d
#define HWERR_FILE_SIZE_INVALID 0xc100000d
#define HWERR_CREATE_OBJ_FAILED 0xc100000e
#define HWERR_CHANNELMAGIC_MISMATCH 0xc100000f
#define HWERR_PARA_OVER 0xc1000010
#define HWERR_ORDER 0xc1000011
#define HWERR_COMMAND 0xc1000012
#define HWERR_UNSUPPORTED 0xc1000013
#define HWERR_DSPOPEN 0xc1000014
#define HWERR_DSPLOAD 0xc1000015
#define HWERR_ALLOCATE_DSPMEMORY 0xc1000016
#define HWERR_DSPCHECHER 0xc1000017
#define HWERR_IMGFILE_UNKNOWN 0xc1000018
#define HWERR_INVALID_FILE 0xc1000019
//standart
#define HW_PAL 2
#define HW_NTSC 1
//jump direction
#define HW_JUMP_FORWARD 309
#define HW_JUMP_BACKWARD 310
typedef enum tagTypeVideoFormat
{
vdfRGB8A_233 = 0x00000001,
vdfRGB8R_332 = 0x00000002,
vdfRGB15Alpha = 0x00000004,
vdfRGB16 = 0x00000008,
vdfRGB24 = 0x00000010,
vdfRGB24Alpha = 0x00000020,
vdfYUV420Planar = 0x00000040,
vdfYUV422Planar = 0x00000080,
vdfYUV411Planar = 0x00000100,
vdfYUV420Interspersed = 0x00000200,
vdfYUV422Interspersed = 0x00000400,
vdfYUV411Interspersed = 0x00000800,
vdfYUV422Sequence = 0x00001000, /* U0, Y0, V0, Y1: For VO overlay */
vdfYUV422SequenceAlpha = 0x00002000,
/* U0, Y0, V0, Y1: For VO overlay, with low bit for alpha blending */
vdfMono = 0x00004000, /* 8 bit monochrome */
vdfYUV444Planar = 0x00008000,
}TypeVideoFormat;
typedef enum _BitrateControlType_t
{
brCBR = 0,
brVBR = 1,
}BitrateControlType_t;
typedef enum _BOARD_TYPE_DS
{
DS400XM =0,
DS400XH =1,
DS4004HC =2,
DS4008HC =3,
DS4016HC =4,
DS4001HF =5,
DS4004HF =6,
DS4002MD =7,
DS4004MD =8, //4004MD
DS4016HCS =9, //4016HCS
DS4002HT =10, //4002HT
DS4004HT =11, //4004HT
DS4008HT =12, //4008HT
DS4004HC_PLUS =13, //4004HC+
DS4008HC_PLUS =14, //4008HC+
DS4016HC_PLUS =15, //4016HC+
DS4008HF =16, //4008HF
DS4008MD =17, //4008MD
DS4008HS =18, //4008HS
DS4016HS =19, //4016HS
INVALID_BOARD_TYPE =0xffffffff,
}BOARD_TYPE_DS;
#define STREAM_TYPE_VIDEO 1
#define STREAM_TYPE_AUDIO 2
#define STREAM_TYPE_AVSYNC 3
#define DRAWFUN(x) void (CALLBACK* x)(long nPort,HDC hDc,LONG nUser)
typedef void (*LOGRECORD_CALLBACK)(char *str, void *context);
typedef int (*STREAM_READ_CALLBACK)(ULONG channelNumber, void *context);
typedef int (*STREAM_DIRECT_READ_CALLBACK)(ULONG channelNumber,void *DataBuf,DWORD Length,int FrameType,void *context);
typedef struct tagChannelCapability{
UCHAR bAudioPreview;
UCHAR bAlarmIO;
UCHAR bWatchDog;
}CHANNEL_CAPABILITY, *PCHANNEL_CAPABILITY;
typedef struct tagFramsStatistics{
ULONG VideoFrames;
ULONG AudioFrames;
ULONG FramesLost;
ULONG QueueOverflow;
ULONG CurBps;
}FRAMES_STATISTICS, *PFRAMES_STATISTICS;
DLLEXPORT_API int __stdcall InitDSPs();
DLLEXPORT_API int __stdcall DeInitDSPs();
DLLEXPORT_API HANDLE __stdcall ChannelOpen(int ChannelNum);
DLLEXPORT_API int __stdcall ChannelClose(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetTotalChannels();
DLLEXPORT_API int __stdcall GetTotalDSPs();
DLLEXPORT_API int __stdcall StartVideoPreview(HANDLE hChannelHandle,HWND WndHandle, RECT *rect, BOOLEAN bOverlay, int VideoFormat, int FrameRate);
DLLEXPORT_API int __stdcall StopVideoPreview(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetVideoPara(HANDLE hChannelHandle, int Brightness, int Contrast, int Saturation, int Hue);
DLLEXPORT_API int __stdcall GetVideoPara(HANDLE hChannelHandle, VideoStandard_t *VideoStandard, int *Brightness, int *Contrast, int *Saturation, int *Hue);
DLLEXPORT_API int __stdcall GetVideoSignal(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetSDKVersion(PVERSION_INFO VersionInfo);
DLLEXPORT_API int __stdcall GetCapability(HANDLE hChannelHandle, CHANNEL_CAPABILITY *Capability);
DLLEXPORT_API int __stdcall GetLastErrorNum(HANDLE hChannelHandle, ULONG *DspError, ULONG *SdkError);
DLLEXPORT_API int __stdcall SetStreamType(HANDLE hChannelHandle, USHORT Type);
DLLEXPORT_API int __stdcall GetStreamType(HANDLE hChannelHandle, USHORT *StreamType);
DLLEXPORT_API int __stdcall GetFramesStatistics(HANDLE hChannelHandle, PFRAMES_STATISTICS framesStatistics);
DLLEXPORT_API int __stdcall StartMotionDetection(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetBoardInfo(HANDLE hChannelHandle, ULONG *BoardType, UCHAR *SerialNo);
DLLEXPORT_API int __stdcall StopMotionDetection(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall GetOriginalImage(HANDLE hChannelHandle, UCHAR *ImageBuf, ULONG *Size);
DLLEXPORT_API int __stdcall RegisterLogRecordCallback(LOGRECORD_CALLBACK LogRecordFunc, void *Context);
DLLEXPORT_API int __stdcall SetAudioPreview(HANDLE hChannelHandle, BOOL bEnable);
DLLEXPORT_API int __stdcall ReadStreamData(HANDLE hChannelHandle, void *DataBuf, DWORD *Length, int *FrameType);
DLLEXPORT_API int __stdcall RegisterMessageNotifyHandle(HWND hWnd, UINT MessageId);
DLLEXPORT_API int __stdcall StartVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall StopVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetIBPMode(HANDLE hChannelHandle, int KeyFrameIntervals, int BFrames, int PFrames, int FrameRate);
DLLEXPORT_API int __stdcall SetDefaultQuant(HANDLE hChannelHandle, int IQuantVal, int PQuantVal, int BQuantVal);
DLLEXPORT_API int __stdcall SetOsd(HANDLE hChannelHandle, BOOL Enable);
DLLEXPORT_API int __stdcall SetLogo(HANDLE hChannelHandle, int x, int y, int w, int h, unsigned char *yuv);
DLLEXPORT_API int __stdcall StopLogo(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetupMotionDetection(HANDLE hChannelHandle, RECT *RectList, int iAreas);
DLLEXPORT_API int __stdcall MotionAnalyzer(HANDLE hChannelHandle, char *MotionData, int iThreshold, int *iResult);
DLLEXPORT_API int __stdcall LoadYUVFromBmpFile(char *FileName, unsigned char *yuv, int BufLen, int *Width, int *Height);
DLLEXPORT_API int __stdcall SaveYUVToBmpFile(char *FileName, unsigned char *yuv, int Width, int Height);
DLLEXPORT_API int __stdcall CaptureIFrame(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall RegisterStreamReadCallback(STREAM_READ_CALLBACK StreamReadCallback, void *Context);
DLLEXPORT_API int __stdcall AdjustMotionDetectPrecision(HANDLE hChannelHandle,
int iGrade, int iFastMotionDetectFps,
int iSlowMotionDetectFps);
DLLEXPORT_API int __stdcall SetupBitrateControl(HANDLE hChannelHandle, ULONG MaxBps);
DLLEXPORT_API int __stdcall SetOverlayColorKey(COLORREF DestColorKey);
DLLEXPORT_API int __stdcall SetOsdDisplayMode(HANDLE hChannelHandle, int Brightness, BOOL Translucent, int parameter, USHORT *Format1, USHORT *Format2);
DLLEXPORT_API int __stdcall SetLogoDisplayMode(HANDLE hChannelHandle, COLORREF ColorKey, BOOL Translucent, int TwinkleInterval);
DLLEXPORT_API int __stdcall SetEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat);
DLLEXPORT_API int __stdcall SetVideoStandard(HANDLE hChannelHandle, VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall RestoreOverlay();
DLLEXPORT_API int __stdcall ResetDSP(int DspNumber);
DLLEXPORT_API int __stdcall GetSoundLevel(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetBitrateControlMode(HANDLE hChannelHandle, BitrateControlType_t brc);
DLLEXPORT_API int __stdcall SetupNotifyThreshold(HANDLE hChannelHandle, int iFramesThreshold);
DLLEXPORT_API int __stdcall SetupSubChannel(HANDLE hChannelHandle, int iSubChannel);
DLLEXPORT_API int __stdcall GetSubChannelStreamType(void *DataBuf, int FrameType);
//add for HC/HF
DLLEXPORT_API int __stdcall RegisterStreamDirectReadCallback(STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback,void *Context);
DLLEXPORT_API int __stdcall RegisterDrawFun(DWORD nport, DRAWFUN(DrawFun),LONG nUser);
DLLEXPORT_API int __stdcall SetupMask(HANDLE hChannelHandle, RECT *rectList, int iAreas);
DLLEXPORT_API int __stdcall StopMask(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetSubEncoderPictureFormat(HANDLE hChannelHandle, PictureFormat_t PictureFormat);
DLLEXPORT_API int __stdcall StartSubVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall StopSubVideoCapture(HANDLE hChannelHandle);
DLLEXPORT_API int __stdcall SetupDateTime(HANDLE hChannelHandle, SYSTEMTIME *now);
/*
1.7
*/
//原始图像流设置
typedef void (*IMAGE_STREAM_CALLBACK)(UINT channelNumber,void *context );
DLLEXPORT_API int __stdcall SetImageStream(HANDLE hChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer);
DLLEXPORT_API int __stdcall RegisterImageStreamCallback(IMAGE_STREAM_CALLBACK,void *context);
/*
(x,y)
x必须为2的整数倍
(x,y)
*/
DLLEXPORT_API int __stdcall SetInputVideoPosition(HANDLE hChannel,UINT x,UINT y);
DLLEXPORT_API int __stdcall StopRegisterDrawFun(DWORD nport);
/*
3.0
*/
#define SERIAL_NUMBER_LENGTH 12 //板卡序列号长度
typedef struct tagDS_BOARD_DETAIL
{
BOARD_TYPE_DS type; //板卡类型
BYTE sn[16]; //序列号
UINT dspCount; //板卡包含的DSP个数
UINT firstDspIndex; //板卡上第一个DSP的索引
UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DS_BOARD_DETAIL;
typedef struct tagDSP_DETAIL
{
UINT encodeChannelCount; //板卡包含的编码通道个数
UINT firstEncodeChannelIndex; //板卡上第一个编码通道的索引
UINT decodeChannelCount; //板卡包含的解码通道个数
UINT firstDecodeChannelIndex; //板卡上第一个解码通道的索引
UINT displayChannelCount; //板卡包含的视频输出通道个数
UINT firstDisplayChannelIndex; //板卡上第一个视频输出通道的索引
UINT reserved1;
UINT reserved2;
UINT reserved3;
UINT reserved4;
}DSP_DETAIL;
DLLEXPORT_API unsigned int __stdcall GetBoardCount();
DLLEXPORT_API int __stdcall GetBoardDetail(UINT boardNum,DS_BOARD_DETAIL *pBoardDetail);
DLLEXPORT_API unsigned int __stdcall GetDspCount();
DLLEXPORT_API int __stdcall GetDspDetail(UINT dspNum,DSP_DETAIL *pDspDetail);
DLLEXPORT_API unsigned int __stdcall GetEncodeChannelCount();
DLLEXPORT_API unsigned int __stdcall GetDecodeChannelCount();
DLLEXPORT_API unsigned int __stdcall GetDisplayChannelCount();
DLLEXPORT_API int __stdcall SetDefaultVideoStandard(VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall SetVideoDetectPrecision(HANDLE hChannel,unsigned int value);
DLLEXPORT_API int __stdcall SetSubStreamType(HANDLE hChannelHandle, USHORT Type);
DLLEXPORT_API int __stdcall GetSubStreamType(HANDLE hChannelHandle, USHORT *StreamType);
#define MAX_DISPLAY_REGION 16
typedef struct tagREGION_PARAM
{
UINT left;
UINT top;
UINT width;
UINT height;
COLORREF color;
UINT param;
}REGION_PARAM;
DLLEXPORT_API int __stdcall SetDisplayStandard(UINT nDisplayChannel,VideoStandard_t VideoStandard);
DLLEXPORT_API int __stdcall SetDisplayRegion(UINT nDisplayChannel,UINT nRegionCount,REGION_PARAM *pParam,UINT nReserved);
DLLEXPORT_API int __stdcall ClearDisplayRegion(UINT nDisplayChannel,UINT nRegionFlag);
DLLEXPORT_API int __stdcall SetDisplayRegionPosition(UINT nDisplayChannel,UINT nRegion,UINT nLeft,UINT nTop);
DLLEXPORT_API int __stdcall FillDisplayRegion(UINT nDisplayChannel,UINT nRegion,unsigned char *pImage);
DLLEXPORT_API int __stdcall SetEncoderVideoExtOutput(UINT nEncodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderVideoExtOutput(UINT nDecodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderVideoOutput(UINT nDecodeChannel,UINT nPort,BOOL bOpen,UINT nDisplayChannel,UINT nDisplayRegion,UINT nReserved);
DLLEXPORT_API int __stdcall SetDecoderAudioOutput(UINT nDecodeChannel,BOOL bOpen,UINT nOutputChannel);
//3.1
DLLEXPORT_API int __stdcall SetDeInterlace(HANDLE hChannelHandle,UINT mode,UINT level);
DLLEXPORT_API int __stdcall SetPreviewOverlayMode(BOOL bTrue);
//DECODE functions for DS4002MD
#if defined( _WINDLL)
#define PLAYER_API extern "C"__declspec(dllexport)
#else
#define PLAYER_API extern "C" __declspec(dllimport)
#endif
typedef struct tagDISPLAY_PARA
{
long bToScreen;
long bToVideoOut;
long nLeft;
long nTop;
long nWidth;
long nHeight;
long nReserved;
}DISPLAY_PARA,*PDISPLAY_PARA;
//Version info
typedef struct tagVERSION{
ULONG DspVersion, DspBuildNum;
ULONG DriverVersion, DriverBuildNum;
ULONG SDKVersion, SDKBuildNum;
}HW_VERSION, *PHW_VERSION;
//init part
PLAYER_API int __stdcall HW_InitDirectDraw(HWND hParent,COLORREF colorKey);
PLAYER_API int __stdcall HW_ReleaseDirectDraw();
PLAYER_API int __stdcall HW_InitDecDevice(long *pDeviceTotal);
PLAYER_API int __stdcall HW_ReleaseDecDevice();
PLAYER_API int __stdcall HW_ChannelOpen(long nChannelNum,HANDLE* phChannel);
PLAYER_API int __stdcall HW_ChannelClose(HANDLE hChannel);
//open part
PLAYER_API int __stdcall HW_OpenStream(HANDLE hChannel,PBYTE pFileHeadBuf,DWORD nSize);
DLLEXPORT_API int __stdcall HW_ResetStream(HANDLE hChannel);
PLAYER_API int __stdcall HW_CloseStream(HANDLE hChannel);
PLAYER_API int __stdcall HW_InputData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
PLAYER_API int __stdcall HW_OpenFile(HANDLE hChannel,LPTSTR sFileName);
PLAYER_API int __stdcall HW_CloseFile(HANDLE hChannel);
//play part
PLAYER_API int __stdcall HW_SetDisplayPara(HANDLE hChannel,DISPLAY_PARA *pPara);
PLAYER_API int __stdcall HW_Play(HANDLE hChannel);
PLAYER_API int __stdcall HW_Stop(HANDLE hChannel);
PLAYER_API int __stdcall HW_Pause(HANDLE hChannel,ULONG bPause);
//sound part
PLAYER_API int __stdcall HW_PlaySound(HANDLE hChannel);
PLAYER_API int __stdcall HW_StopSound(HANDLE hChannel);
PLAYER_API int __stdcall HW_SetVolume(HANDLE hChannel,ULONG nVolume);
//overlay part
PLAYER_API int __stdcall HW_RefreshSurface();
PLAYER_API int __stdcall HW_RestoreSurface();
PLAYER_API int __stdcall HW_ClearSurface();
PLAYER_API int __stdcall HW_ZoomOverlay(RECT* pSrcClientRect, RECT* pDecScreenRect);
//cut file
PLAYER_API int __stdcall HW_StartCapFile(HANDLE hChannel,LPTSTR sFileName);
PLAYER_API int __stdcall HW_StopCapFile(HANDLE hChannel);
//capture picture
PLAYER_API int __stdcall HW_GetYV12Image(HANDLE hChannel, PBYTE pBuffer, ULONG nSize);
PLAYER_API int __stdcall HW_GetPictureSize(HANDLE hChannel,ULONG* pWidth, ULONG* pHeight);
PLAYER_API int __stdcall HW_ConvertToBmpFile(BYTE * pBuf,ULONG nSize,ULONG nWidth,ULONG nHeight,char *sFileName,ULONG nReserved);
//setting and getting part
PLAYER_API int __stdcall HW_Jump(HANDLE hChannel,ULONG nDirection);
PLAYER_API int __stdcall HW_SetJumpInterval(HANDLE hChannel,ULONG nSecond);
PLAYER_API int __stdcall HW_GetSpeed(HANDLE hChannel,long *pSpeed);
PLAYER_API int __stdcall HW_SetSpeed(HANDLE hChannel,long nSpeed);
PLAYER_API int __stdcall HW_SetPlayPos(HANDLE hChannel,ULONG nPos);
PLAYER_API int __stdcall HW_GetPlayPos(HANDLE hChannel,ULONG* pPos);
PLAYER_API int __stdcall HW_GetVersion(PHW_VERSION pVersion);
PLAYER_API int __stdcall HW_GetCurrentFrameRate(HANDLE hChannel,ULONG* pFrameRate);
PLAYER_API int __stdcall HW_GetCurrentFrameNum(HANDLE hChannel,ULONG* pFrameNum);
PLAYER_API int __stdcall HW_GetFileTotalFrames(HANDLE hChannel,ULONG* pTotalFrames);
PLAYER_API int __stdcall HW_GetFileTime(HANDLE hChannel, ULONG* pFileTime);
PLAYER_API int __stdcall HW_GetCurrentFrameTime(HANDLE hChannel,ULONG* pFrameTime);
PLAYER_API int __stdcall HW_GetPlayedFrames(HANDLE hChannel,ULONG *pDecVFrames);
PLAYER_API int __stdcall HW_GetDeviceSerialNo(HANDLE hChannel,ULONG *pDeviceSerialNo);
PLAYER_API int __stdcall HW_SetFileEndMsg(HANDLE hChannel,HWND hWnd,UINT nMsg);
PLAYER_API int __stdcall HW_SetStreamOpenMode(HANDLE hChannel,ULONG nMode);
PLAYER_API int __stdcall HW_GetStreamOpenMode(HANDLE hChannel,ULONG *pMode);
PLAYER_API int __stdcall HW_SetVideoOutStandard(HANDLE hChannel,ULONG nStandard);
PLAYER_API int __stdcall HW_SetDspDeadlockMsg(HWND hWnd,UINT nMsg);
PLAYER_API int __stdcall HW_GetChannelNum(long nDspNum,long *pChannelNum,ULONG nNumsToGet,ULONG * pNumsGotten);
PLAYER_API int __stdcall HW_ResetDsp(long nDspNum);
PLAYER_API int __stdcall HW_SetAudioPreview(HANDLE hChannel, BOOL bEnable);
//////////////////////////////////////////////
PLAYER_API int __stdcall HW_OpenStreamEx(HANDLE hChannel,PBYTE pFileHeadBuf,DWORD nSize);
PLAYER_API int __stdcall HW_CloseStreamEx(HANDLE hChannel);
PLAYER_API int __stdcall HW_InputVideoData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
PLAYER_API int __stdcall HW_InputAudioData(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
//4.0
PLAYER_API int __stdcall SetOsdDisplayModeEx(HANDLE hChannelHandle,int color,BOOL Translucent,int param,int nLineCount,USHORT **Format);
typedef void (*MOTION_DETECTION_CALLBACK)(ULONG channelNumber,BOOL bMotionDetected,void *context);
PLAYER_API int __stdcall SetupMotionDetectionEx(HANDLE hChannelHandle,int iGrade,int iFastMotionDetectFps,
int iSlowMotionDetectFps,UINT delay,RECT *RectList, int iAreas,
MOTION_DETECTION_CALLBACK MotionDetectionCallback,int reserved);
PLAYER_API int __stdcall GetJpegImage(HANDLE hChannelHandle,UCHAR *ImageBuf,ULONG *Size,UINT nQuality);
//WatchDog
PLAYER_API int __stdcall SetWatchDog(UINT boardNumber,BOOL bEnable);
//4.1
typedef void (*FILE_REF_DONE_CALLBACK)(UINT nChannel,UINT nSize);
PLAYER_API int __stdcall HW_SetFileRef(HANDLE hChannel,BOOL bEnable,FILE_REF_DONE_CALLBACK FileRefDoneCallback);
PLAYER_API int __stdcall HW_LocateByAbsoluteTime(HANDLE hChannel,SYSTEMTIME time);
PLAYER_API int __stdcall HW_LocateByFrameNumber(HANDLE hChannel,UINT frmNum);
PLAYER_API int __stdcall HW_GetCurrentAbsoluteTime(HANDLE hChannel,SYSTEMTIME *pTime);
PLAYER_API int __stdcall HW_GetFileAbsoluteTime(HANDLE hChannel,SYSTEMTIME *pStartTime,SYSTEMTIME *pEndTime);
//4.2
DLLEXPORT_API int __stdcall HW_ImportFileRef(HANDLE hChannel,char *pBuffer,UINT nSize);
DLLEXPORT_API int __stdcall HW_ExportFileRef(HANDLE hChannel,char *pBuffer,UINT nSize);
DLLEXPORT_API int __stdcall SetDisplayVideoCapture(UINT nDisplayChannel,BOOL bStart,UINT fps,UINT width,UINT height,unsigned char *imageBuffer);
DLLEXPORT_API int __stdcall RegisterDisplayVideoCaptureCallback(IMAGE_STREAM_CALLBACK DisplayVideoCaptureCallback,void *context);
DLLEXPORT_API int __stdcall SetDisplayVideoBrightness(UINT chan,int Brightness);
DLLEXPORT_API int __stdcall SetChannelStreamCRC(HANDLE hChannel,BOOL bEnable);
DLLEXPORT_API int __stdcall SetSubChannelStreamCRC(HANDLE hChannel,BOOL bEnable);
DLLEXPORT_API int __stdcall HW_SetDecoderPostProcess(HANDLE hChannel,UINT param);
//
typedef void (*DECODER_VIDEO_CAPTURE_CALLBACK)(UINT nChannelNumber,void *DataBuf,UINT width,UINT height,UINT nFrameNum,UINT nFrameTime,SYSTEMTIME *pFrameAbsoluteTime,void *context);
DLLEXPORT_API int __stdcall RegisterDecoderVideoCaptureCallback(DECODER_VIDEO_CAPTURE_CALLBACK DecoderVideoCaptureCallback,void *context);
DLLEXPORT_API int __stdcall HW_SetDecoderVideoCapture(HANDLE hChannel,BOOL bStart,UINT param);
DLLEXPORT_API int __stdcall HW_InputDataByFrame(HANDLE hChannel,PBYTE pBuf,DWORD nSize);
/*
:
*/
typedef struct
{
short x,y,width,height;
}FACE_AREA_DEMO;
typedef struct
{
FACE_AREA_DEMO faceArea;
FACE_AREA_DEMO leftEyeArea;
FACE_AREA_DEMO rightEyeArea;
FACE_AREA_DEMO leftPupilArea;
FACE_AREA_DEMO rightPupilArea;
FACE_AREA_DEMO noseArea;
FACE_AREA_DEMO mouthArea;
}FACE_INFO_DEMO;
typedef void (*FACE_DETECTION_DEMO_CALLBACK)(UINT nChannel,UINT nFaceCount,FACE_INFO_DEMO *pFaceInfo,
char *pData,UINT nDataSize,UINT nImageWidth,UINT nImageHeight);
DLLEXPORT_API int __stdcall SetFaceDetectionDemo(HANDLE hChannelHandle,BOOL bEnable,
UINT nFrameInterval,FACE_DETECTION_DEMO_CALLBACK pFunc,
BOOL bCompress,UINT nCompressQuality,BOOL bLocateEyePos);
#endif

52612
3rdparty/hikvision/camera/inc/HCNetSDK.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,760 @@
#ifndef _PLAYM4_H_
#define _PLAYM4_H_
#if defined( _WINDLL)
#define PLAYM4_API extern "C" __declspec(dllexport)
#else
#define PLAYM4_API extern "C" __declspec(dllimport)
#endif
//Max channel numbers
#define PLAYM4_MAX_SUPPORTS 500
//Wave coef range;
#define MIN_WAVE_COEF -100
#define MAX_WAVE_COEF 100
//Timer type
#define TIMER_1 1 //Only 16 timers for every process.Default TIMER;
#define TIMER_2 2 //Not limit;But the precision less than TIMER_1;
//BUFFER AND DATA TYPE
#define BUF_VIDEO_SRC (1) //mixed input,total src buffer size;splited input,video src buffer size
#define BUF_AUDIO_SRC (2) //mixed input,not defined;splited input,audio src buffer size
#define BUF_VIDEO_RENDER (3) //video render node count
#define BUF_AUDIO_RENDER (4) //audio render node count
#define BUF_VIDEO_DECODED (5) //video decoded node count to render
#define BUF_AUDIO_DECODED (6) //audio decoded node count to render
#define BUF_DISPLAY_NODE (7) //display node
//Error code
#define PLAYM4_NOERROR 0 //no error
#define PLAYM4_PARA_OVER 1 //input parameter is invalid;
#define PLAYM4_ORDER_ERROR 2 //The order of the function to be called is error.
#define PLAYM4_TIMER_ERROR 3 //Create multimedia clock failed;
#define PLAYM4_DEC_VIDEO_ERROR 4 //Decode video data failed.
#define PLAYM4_DEC_AUDIO_ERROR 5 //Decode audio data failed.
#define PLAYM4_ALLOC_MEMORY_ERROR 6 //Allocate memory failed.
#define PLAYM4_OPEN_FILE_ERROR 7 //Open the file failed.
#define PLAYM4_CREATE_OBJ_ERROR 8 //Create thread or event failed
#define PLAYM4_CREATE_DDRAW_ERROR 9 //Create DirectDraw object failed.
#define PLAYM4_CREATE_OFFSCREEN_ERROR 10 //failed when creating off-screen surface.
#define PLAYM4_BUF_OVER 11 //buffer is overflow
#define PLAYM4_CREATE_SOUND_ERROR 12 //failed when creating audio device.
#define PLAYM4_SET_VOLUME_ERROR 13 //Set volume failed
#define PLAYM4_SUPPORT_FILE_ONLY 14 //The function only support play file.
#define PLAYM4_SUPPORT_STREAM_ONLY 15 //The function only support play stream.
#define PLAYM4_SYS_NOT_SUPPORT 16 //System not support.
#define PLAYM4_FILEHEADER_UNKNOWN 17 //No file header.
#define PLAYM4_VERSION_INCORRECT 18 //The version of decoder and encoder is not adapted.
#define PLAYM4_INIT_DECODER_ERROR 19 //Initialize decoder failed.
#define PLAYM4_CHECK_FILE_ERROR 20 //The file data is unknown.
#define PLAYM4_INIT_TIMER_ERROR 21 //Initialize multimedia clock failed.
#define PLAYM4_BLT_ERROR 22 //Blt failed.
#define PLAYM4_UPDATE_ERROR 23 //Update failed.
#define PLAYM4_OPEN_FILE_ERROR_MULTI 24 //openfile error, streamtype is multi
#define PLAYM4_OPEN_FILE_ERROR_VIDEO 25 //openfile error, streamtype is video
#define PLAYM4_JPEG_COMPRESS_ERROR 26 //JPEG compress error
#define PLAYM4_EXTRACT_NOT_SUPPORT 27 //Don't support the version of this file.
#define PLAYM4_EXTRACT_DATA_ERROR 28 //extract video data failed.
#define PLAYM4_SECRET_KEY_ERROR 29 //Secret key is error //add 20071218
#define PLAYM4_DECODE_KEYFRAME_ERROR 30 //add by hy 20090318
#define PLAYM4_NEED_MORE_DATA 31 //add by hy 20100617
#define PLAYM4_INVALID_PORT 32 //add by cj 20100913
#define PLAYM4_NOT_FIND 33 //add by cj 20110428
#define PLAYM4_NEED_LARGER_BUFFER 34 //add by pzj 20130528
#define PLAYM4_FAIL_UNKNOWN 99 //Fail, but the reason is unknown;
//鱼眼功能错误码
#define PLAYM4_FEC_ERR_ENABLEFAIL 100 // 鱼眼模块加载失败
#define PLAYM4_FEC_ERR_NOTENABLE 101 // 鱼眼模块没有加载
#define PLAYM4_FEC_ERR_NOSUBPORT 102 // 子端口没有分配
#define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // 没有初始化对应端口的参数
#define PLAYM4_FEC_ERR_SUBPORTOVER 104 // 子端口已经用完
#define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // 该安装方式下这种效果不支持
#define PLAYM4_FEC_ERR_INVALIDWND 106 // 非法的窗口
#define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZ位置越界
#define PLAYM4_FEC_ERR_RADIUSINVALID 108 // 圆心参数非法
#define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // 指定的安装方式和矫正效果,该参数更新不支持
#define PLAYM4_FEC_ERR_NOPLAYPORT 110 // 播放库端口没有启用
#define PLAYM4_FEC_ERR_PARAMVALID 111 // 参数为空
#define PLAYM4_FEC_ERR_INVALIDPORT 112 // 非法子端口
#define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ矫正范围越界
#define PLAYM4_FEC_ERR_OVERMAXPORT 114 // 矫正通道饱和,最大支持的矫正通道为四个
#define PLAYM4_FEC_ERR_ENABLED 115 //该端口已经启用了鱼眼模块
#define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D加速没有开启
//Max display regions.
#define MAX_DISPLAY_WND 4
//Display type
#define DISPLAY_NORMAL 0x00000001
#define DISPLAY_QUARTER 0x00000002
#define DISPLAY_YC_SCALE 0x00000004 //add by gb 20091116
#define DISPLAY_NOTEARING 0x00000008
//Display buffers
#define MAX_DIS_FRAMES 50
#define MIN_DIS_FRAMES 1
//Locate by
#define BY_FRAMENUM 1
#define BY_FRAMETIME 2
//Source buffer
#define SOURCE_BUF_MAX 1024*100000
#define SOURCE_BUF_MIN 1024*50
//Stream type
#define STREAME_REALTIME 0
#define STREAME_FILE 1
//frame type
#define T_AUDIO16 101
#define T_AUDIO8 100
#define T_UYVY 1
#define T_YV12 3
#define T_RGB32 7
//capability
#define SUPPORT_DDRAW 1
#define SUPPORT_BLT 2
#define SUPPORT_BLTFOURCC 4
#define SUPPORT_BLTSHRINKX 8
#define SUPPORT_BLTSHRINKY 16
#define SUPPORT_BLTSTRETCHX 32
#define SUPPORT_BLTSTRETCHY 64
#define SUPPORT_SSE 128
#define SUPPORT_MMX 256
// 以下宏定义用于HIK_MEDIAINFO结构
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO结构标记
// 系统封装格式
#define SYSTEM_NULL 0x0 // 没有系统层,纯音频流或视频流
#define SYSTEM_HIK 0x1 // 海康文件层
#define SYSTEM_MPEG2_PS 0x2 // PS封装
#define SYSTEM_MPEG2_TS 0x3 // TS封装
#define SYSTEM_RTP 0x4 // rtp封装
#define SYSTEM_RTPHIK 0x401 // rtp封装
// 视频编码类型
#define VIDEO_NULL 0x0 // 没有视频
#define VIDEO_H264 0x1 // 海康H.264
#define VIDEO_MPEG4 0x3 // 标准MPEG4
#define VIDEO_MJPEG 0x4
#define VIDEO_AVC264 0x0100
// 音频编码类型
#define AUDIO_NULL 0x0000 // 没有音频
#define AUDIO_ADPCM 0x1000 // ADPCM
#define AUDIO_MPEG 0x2000 // MPEG 系列音频解码器能自适应各种MPEG音频
#define AUDIO_AAC 0X2001 // AAC 编码
// G系列音频
#define AUDIO_RAW_DATA8 0x7000 //采样率为8k的原始数据
#define AUDIO_RAW_UDATA16 0x7001 //采样率为16k的原始数据即L16
#define AUDIO_G711_U 0x7110
#define AUDIO_G711_A 0x7111
#define AUDIO_G722_1 0x7221
#define AUDIO_G723_1 0x7231
#define AUDIO_G726_U 0x7260
#define AUDIO_G726_A 0x7261
#define AUDIO_G726_16 0x7262
#define AUDIO_G729 0x7290
#define AUDIO_AMR_NB 0x3000
#define SYNCDATA_VEH 1 //同步数据:车载信息
#define SYNCDATA_IVS 2 //同步数据:智能信息
//motion flow type
#define MOTION_FLOW_NONE 0
#define MOTION_FLOW_CPU 1
#define MOTION_FLOW_GPU 2
//音视频加密类型
#define ENCRYPT_AES_3R_VIDEO 1
#define ENCRYPT_AES_10R_VIDEO 2
#define ENCRYPT_AES_3R_AUDIO 1
#define ENCRYPT_AES_10R_AUDIO 2
//Frame position
typedef struct{
long nFilePos;
long nFrameNum;
long nFrameTime;
long nErrorFrameNum;
SYSTEMTIME *pErrorTime;
long nErrorLostFrameNum;
long nErrorFrameSize;
}FRAME_POS,*PFRAME_POS;
//Frame Info
typedef struct{
long nWidth;
long nHeight;
long nStamp;
long nType;
long nFrameRate;
DWORD dwFrameNum;
}FRAME_INFO;
typedef struct
{
long nPort; //通道号
char *pBuf; //返回的第一路图像数据指针
unsigned int nBufLen; //返回的第一路图像数据大小
char *pBuf1; //返回的第二路图像数据指针
unsigned int nBufLen1; //返回的第二路图像数据大小
char *pBuf2; //返回的第三路图像数据指针
unsigned int nBufLen2; //返回的第三路图像数据大小
unsigned int nWidth; //画面宽
unsigned int nHeight; //画面高
unsigned int nStamp; //时标信息,单位毫秒
unsigned int nType; //数据类型
void *pUser; //用户数据
unsigned int reserved[4]; //保留
}DISPLAY_INFO_YUV;
//Frame
typedef struct{
char *pDataBuf;
long nSize;
long nFrameNum;
BOOL bIsAudio;
long nReserved;
}FRAME_TYPE;
//Watermark Info //add by gb 080119
typedef struct{
char *pDataBuf;
long nSize;
long nFrameNum;
BOOL bRsaRight;
long nReserved;
}WATERMARK_INFO;
typedef struct SYNCDATA_INFO
{
DWORD dwDataType; //和码流数据同步的附属信息类型,目前有:智能信息,车载信息
DWORD dwDataLen; //附属信息数据长度
BYTE* pData; //指向附属信息数据结构的指针,比如IVS_INFO结构
} SYNCDATA_INFO;
#ifndef _HIK_MEDIAINFO_FLAG_
#define _HIK_MEDIAINFO_FLAG_
typedef struct _HIK_MEDIAINFO_ // modified by gb 080425
{
unsigned int media_fourcc; // "HKMI": 0x484B4D49 Hikvision Media Information
unsigned short media_version; // 版本号指本信息结构版本号目前为0x0101,即1.01版本01主版本号01子版本号。
unsigned short device_id; // 设备ID便于跟随/分析
unsigned short system_format; // 系统封装层
unsigned short video_format; // 视频编码类型
unsigned short audio_format; // 音频编码类型
unsigned char audio_channels; // 通道数
unsigned char audio_bits_per_sample; // 样位率
unsigned int audio_samplesrate; // 采样率
unsigned int audio_bitrate; // 压缩音频码率,单位bit
unsigned int reserved[4]; // 保留
}HIK_MEDIAINFO;
#endif
typedef struct
{
long nPort;
char * pBuf;
long nBufLen;
long nWidth;
long nHeight;
long nStamp;
long nType;
long nUser;
}DISPLAY_INFO;
typedef struct
{
long nPort;
char *pVideoBuf;
long nVideoBufLen;
char *pPriBuf;
long nPriBufLen;
long nWidth;
long nHeight;
long nStamp;
long nType;
long nUser;
}DISPLAY_INFOEX;
typedef struct PLAYM4_SYSTEM_TIME //绝对时间
{
DWORD dwYear; //年
DWORD dwMon; //月
DWORD dwDay; //日
DWORD dwHour; //时
DWORD dwMin; //分
DWORD dwSec; //秒
DWORD dwMs; //毫秒
} PLAYM4_SYSTEM_TIME;
//ENCRYPT Info
typedef struct{
long nVideoEncryptType; //视频加密类型
long nAudioEncryptType; //音频加密类型
long nSetSecretKey; //是否设置1表示设置密钥0表示没有设置密钥
}ENCRYPT_INFO;
//////////////////////////////////////////////////////////////////////////////
//API
//////////////////////////////////////////////////////////////////////////////
////////////////ver 1.0///////////////////////////////////////
//Initialize DirecDraw.Now invalid.
PLAYM4_API BOOL __stdcall PlayM4_InitDDraw(HWND hWnd);
//Release directDraw; Now invalid.
PLAYM4_API BOOL __stdcall PlayM4_RealeseDDraw();
PLAYM4_API BOOL __stdcall PlayM4_OpenFile(LONG nPort,LPSTR sFileName);
PLAYM4_API BOOL __stdcall PlayM4_CloseFile(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_Play(LONG nPort, HWND hWnd);
PLAYM4_API BOOL __stdcall PlayM4_Stop(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_Pause(LONG nPort,DWORD nPause);
PLAYM4_API BOOL __stdcall PlayM4_Fast(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_Slow(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OneByOne(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetPlayPos(LONG nPort,float fRelativePos);
PLAYM4_API float __stdcall PlayM4_GetPlayPos(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetFileEndMsg(LONG nPort,HWND hWnd,UINT nMsg);
PLAYM4_API BOOL __stdcall PlayM4_SetVolume(LONG nPort,WORD nVolume);
PLAYM4_API BOOL __stdcall PlayM4_StopSound();
PLAYM4_API BOOL __stdcall PlayM4_PlaySound(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OpenStream(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
PLAYM4_API BOOL __stdcall PlayM4_InputData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_CloseStream(LONG nPort);
PLAYM4_API int __stdcall PlayM4_GetCaps();
PLAYM4_API DWORD __stdcall PlayM4_GetFileTime(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTime(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedFrames(LONG nPort);
//23
////////////////ver 2.0 added///////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBack(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2));
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBackYUV(LONG nPort, void (CALLBACK* DisplayCBFun)(DISPLAY_INFO_YUV *pstDisplayInfo), BOOL bTrue, void* pUser);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBack(LONG nPort,void (CALLBACK* DisplayCBFun)(long nPort,char * pBuf,long nSize,long nWidth,long nHeight,long nStamp,long nType,long nReserved));
PLAYM4_API BOOL __stdcall PlayM4_ConvertToBmpFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName);
PLAYM4_API DWORD __stdcall PlayM4_GetFileTotalFrames(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetCurrentFrameRate(LONG nPort);
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTimeEx(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetPlayedTimeEx(LONG nPort,DWORD nTime);
PLAYM4_API DWORD __stdcall PlayM4_GetCurrentFrameNum(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetStreamOpenMode(LONG nPort,DWORD nMode);
PLAYM4_API DWORD __stdcall PlayM4_GetFileHeadLength();
PLAYM4_API DWORD __stdcall PlayM4_GetSdkVersion();
//11
////////////////ver 2.2 added///////////////////////////////////////
PLAYM4_API DWORD __stdcall PlayM4_GetLastError(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_RefreshPlay(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayMode(LONG nPort,BOOL bOverlay,COLORREF colorKey);
PLAYM4_API BOOL __stdcall PlayM4_GetPictureSize(LONG nPort,LONG *pWidth,LONG *pHeight);
PLAYM4_API BOOL __stdcall PlayM4_SetPicQuality(LONG nPort,BOOL bHighQuality);
PLAYM4_API BOOL __stdcall PlayM4_PlaySoundShare(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_StopSoundShare(LONG nPort);
//7
////////////////ver 2.4 added///////////////////////////////////////
PLAYM4_API LONG __stdcall PlayM4_GetStreamOpenMode(LONG nPort);
PLAYM4_API LONG __stdcall PlayM4_GetOverlayMode(LONG nPort);
PLAYM4_API COLORREF __stdcall PlayM4_GetColorKey(LONG nPort);
PLAYM4_API WORD __stdcall PlayM4_GetVolume(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_GetPictureQuality(LONG nPort,BOOL *bHighQuality);
PLAYM4_API DWORD __stdcall PlayM4_GetSourceBufferRemain(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBuffer(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetSourceBufCallBack(LONG nPort,DWORD nThreShold,void (CALLBACK * SourceBufCallBack)(long nPort,DWORD nBufSize,DWORD dwUser,void*pResvered),DWORD dwUser,void *pReserved);
PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBufFlag(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayBuf(LONG nPort,DWORD nNum);
PLAYM4_API DWORD __stdcall PlayM4_GetDisplayBuf(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_OneByOneBack(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetFileRefCallBack(LONG nPort, void (__stdcall *pFileRefDone)(DWORD nPort,DWORD nUser),DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetCurrentFrameNum(LONG nPort,DWORD nFrameNum);
PLAYM4_API BOOL __stdcall PlayM4_GetKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos);
PLAYM4_API BOOL __stdcall PlayM4_GetNextKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos);
#if (WINVER >= 0x0400)
//Note: These funtion must be builded under win2000 or above with Microsoft Platform sdk.
// You can download the sdk from "http://www.microsoft.com/msdownload/platformsdk/sdkupdate/";
PLAYM4_API BOOL __stdcall PlayM4_InitDDrawDevice();
PLAYM4_API void __stdcall PlayM4_ReleaseDDrawDevice();
PLAYM4_API DWORD __stdcall PlayM4_GetDDrawDeviceTotalNums();
PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDevice(LONG nPort,DWORD nDeviceNum);
//PLAYM4_API BOOL __stdcall PlayM4_GetDDrawDeviceInfo(DWORD nDeviceNum,LPSTR lpDriverDescription,DWORD nDespLen,LPSTR lpDriverName ,DWORD nNameLen,HMONITOR *hhMonitor);
PLAYM4_API int __stdcall PlayM4_GetCapsEx(DWORD nDDrawDeviceNum);
#endif
PLAYM4_API BOOL __stdcall PlayM4_ThrowBFrameNum(LONG nPort,DWORD nNum);
//23
////////////////ver 2.5 added///////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayType(LONG nPort,LONG nType);
PLAYM4_API long __stdcall PlayM4_GetDisplayType(LONG nPort);
//2
////////////////ver 3.0 added///////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_SetDecCBStream(LONG nPort,DWORD nStream);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayRegion(LONG nPort,DWORD nRegionNum, RECT *pSrcRect, HWND hDestWnd, BOOL bEnable);
PLAYM4_API BOOL __stdcall PlayM4_RefreshPlayEx(LONG nPort,DWORD nRegionNum);
#if (WINVER >= 0x0400)
//Note: The funtion must be builded under win2000 or above with Microsoft Platform sdk.
// You can download the sdk from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/;
PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDeviceEx(LONG nPort,DWORD nRegionNum,DWORD nDeviceNum);
#endif
//4
/////////////////v3.2 added/////////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_GetRefValue(LONG nPort,BYTE *pBuffer, DWORD *pSize);
PLAYM4_API BOOL __stdcall PlayM4_SetRefValue(LONG nPort,BYTE *pBuffer, DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_OpenStreamEx(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
PLAYM4_API BOOL __stdcall PlayM4_CloseStreamEx(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_InputVideoData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_InputAudioData(LONG nPort,PBYTE pBuf,DWORD nSize);
PLAYM4_API BOOL __stdcall PlayM4_RegisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser);
PLAYM4_API BOOL __stdcall PlayM4_RigisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser);
//8
//////////////////v3.4/////////////////////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_SetTimerType(LONG nPort,DWORD nTimerType,DWORD nReserved);
PLAYM4_API BOOL __stdcall PlayM4_GetTimerType(LONG nPort,DWORD *pTimerType,DWORD *pReserved);
PLAYM4_API BOOL __stdcall PlayM4_ResetBuffer(LONG nPort,DWORD nBufType);
PLAYM4_API DWORD __stdcall PlayM4_GetBufferValue(LONG nPort,DWORD nBufType);
//////////////////V3.6/////////////////////////////////////////////////////////
PLAYM4_API BOOL __stdcall PlayM4_AdjustWaveAudio(LONG nPort,LONG nCoefficient);
PLAYM4_API BOOL __stdcall PlayM4_SetVerifyCallBack(LONG nPort, DWORD nBeginTime, DWORD nEndTime, void (__stdcall * funVerify)(long nPort, FRAME_POS * pFilePos, DWORD bIsVideo, DWORD nUser), DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetAudioCallBack(LONG nPort, void (__stdcall * funAudio)(long nPort, char * pAudioBuf, long nSize, long nStamp, long nType, long nUser), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetEncTypeChangeCallBack(LONG nPort,void(CALLBACK *funEncChange)(long nPort,long nUser),long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetColor(LONG nPort, DWORD nRegionNum, int nBrightness, int nContrast, int nSaturation, int nHue);
PLAYM4_API BOOL __stdcall PlayM4_GetColor(LONG nPort, DWORD nRegionNum, int *pBrightness, int *pContrast, int *pSaturation, int *pHue);
PLAYM4_API BOOL __stdcall PlayM4_SetEncChangeMsg(LONG nPort,HWND hWnd,UINT nMsg);
PLAYM4_API BOOL __stdcall PlayM4_GetOriginalFrameCallBack(LONG nPort, BOOL bIsChange,BOOL bNormalSpeed,long nStartFrameNum,long nStartStamp,long nFileHeader,void(CALLBACK *funGetOrignalFrame)(long nPort,FRAME_TYPE *frameType, long nUser),long nUser);
PLAYM4_API BOOL __stdcall PlayM4_GetFileSpecialAttr(LONG nPort, DWORD *pTimeStamp,DWORD *pFileNum ,DWORD *pReserved);
PLAYM4_API DWORD __stdcall PlayM4_GetSpecialData(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetCheckWatermarkCallBack(LONG nPort,void(CALLBACK* funCheckWatermark)(long nPort,WATERMARK_INFO* pWatermarkInfo,DWORD nUser),DWORD nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetImageSharpen(LONG nPort,DWORD nLevel);
PLAYM4_API BOOL __stdcall PlayM4_SetDecodeFrameType(LONG nPort,DWORD nFrameType);
PLAYM4_API BOOL __stdcall PlayM4_SetPlayMode(LONG nPort,BOOL bNormal);
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayFlipMode(LONG nPort,BOOL bTrue);
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayPriInfoFlag(LONG nPort, DWORD nIntelType, BOOL bTrue,const char *pFontPath);
//PLAYM4_API DWORD __stdcall PlayM4_GetAbsFrameNum(LONG nPort);
//////////////////V4.7.0.0//////////////////////////////////////////////////////
////convert yuv to jpeg
PLAYM4_API BOOL __stdcall PlayM4_ConvertToJpegFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName);
PLAYM4_API BOOL __stdcall PlayM4_SetJpegQuality(long nQuality);
//set deflash
PLAYM4_API BOOL __stdcall PlayM4_SetDeflash(LONG nPort,BOOL bDefalsh);
//PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackEx(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2), char* pDest, long nDestSize);
//////////////////V4.8.0.0/////////////////////////////////////////////////////////
//check discontinuous frame number as error data?
PLAYM4_API BOOL __stdcall PlayM4_CheckDiscontinuousFrameNum(LONG nPort, BOOL bCheck);
//get bmp or jpeg
PLAYM4_API BOOL __stdcall PlayM4_GetBMP(LONG nPort,PBYTE pBitmap,DWORD nBufSize,DWORD* pBmpSize);
PLAYM4_API BOOL __stdcall PlayM4_GetJPEG(LONG nPort,PBYTE pJpeg,DWORD nBufSize,DWORD* pJpegSize);
//dec call back mend
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackMend(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nUser,long nReserved2), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SetSecretKey(LONG nPort, LONG lKeyType, char *pSecretKey, LONG lKeyLen);
// add by gb 2007-12-23
PLAYM4_API BOOL __stdcall PlayM4_SetFileEndCallback(LONG nPort, void(CALLBACK*FileEndCallback)(long nPort, void *pUser), void *pUser);
// add by gb 080131 version 4.9.0.1
PLAYM4_API BOOL __stdcall PlayM4_GetPort(LONG* nPort);
PLAYM4_API BOOL __stdcall PlayM4_FreePort(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBackEx(LONG nPort,void (CALLBACK* DisplayCBFun)(DISPLAY_INFO *pstDisplayInfo), long nUser);
PLAYM4_API BOOL __stdcall PlayM4_SkipErrorData(LONG nPort, BOOL bSkip);
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackExMend(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char* pBuf, long nSize, FRAME_INFO* pFrameInfo,
long nUser, long nReserved2), char* pDest, long nDestSize, long nUser);
//reverse play add by chenjie 110609
PLAYM4_API BOOL __stdcall PlayM4_ReversePlay(LONG nPort);
PLAYM4_API BOOL __stdcall PlayM4_GetSystemTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
//PLAYM4_API BOOL __stdcall PlayM4_SetDecodeERC(long nPort, unsigned int nLevel);
#ifndef PLAYM4_SESSION_INFO_TAG
#define PLAYM4_SESSION_INFO_TAG
//nProtocolType
#define PLAYM4_PROTOCOL_RTSP 1
//nSessionInfoType
#define PLAYM4_SESSION_INFO_SDP 1
typedef struct _PLAYM4_SESSION_INFO_ //交互信息结构
{
int nSessionInfoType; //交互信息类型比如SDP比如海康私有信息头
int nSessionInfoLen; //交互信息长度
unsigned char* pSessionInfoData; //交互信息数据
} PLAYM4_SESSION_INFO;
#endif
PLAYM4_API BOOL __stdcall PlayM4_OpenStreamAdvanced(LONG nPort, int nProtocolType, PLAYM4_SESSION_INFO* pstSessionInfo, DWORD nBufPoolSize);
#define R_ANGLE_0 -1 //不旋转
#define R_ANGLE_L90 0 //向左旋转90度
#define R_ANGLE_R90 1 //向右旋转90度
#define R_ANGLE_180 2 //旋转180度
PLAYM4_API BOOL __stdcall PlayM4_SetRotateAngle(LONG nPort, DWORD nRegionNum, DWORD dwType);
#ifndef PLAYM4_ADDITION_INFO_TAG
#define PLAYM4_ADDITION_INFO_TAG
typedef struct _PLAYM4_ADDITION_INFO_ //交互信息结构
{
BYTE* pData; //附件数据
DWORD dwDatalen; //附件数据长度
DWORD dwDataType; //数据类型
DWORD dwTimeStamp; //相对时间戳
} PLAYM4_ADDITION_INFO;
#endif
//dwGroupIndex 暂约定取值0~3第一版本取消同步只能同个closestream处理
PLAYM4_API BOOL __stdcall PlayM4_SetSycGroup(LONG nPort, DWORD dwGroupIndex);
//暂不实现此函数,同个组设置的起始时间不一致,以最小的时间作为播放起点,同一组可只设一路
PLAYM4_API BOOL __stdcall PlayM4_SetSycStartTime(LONG nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
// 以下实现鱼眼相关的接口
#ifndef FISH_EYE_TAG
#define FISH_EYE_TAG
// 安装类型
typedef enum tagFECPlaceType
{
FEC_PLACE_WALL = 0x1, // 壁装方式 (法线水平)
FEC_PLACE_FLOOR = 0x2, // 地面安装 (法线向上)
FEC_PLACE_CEILING = 0x3, // 顶装方式 (法线向下)
}FECPLACETYPE;
typedef enum tagFECCorrectType
{
FEC_CORRECT_PTZ = 0x100, // PTZ
FEC_CORRECT_180 = 0x200, // 180度矫正 对应2P
FEC_CORRECT_360 = 0x300, // 360全景矫正 对应1P
FEC_CORRECT_LAT = 0x400 //纬度展开
}FECCORRECTTYPE;
typedef struct tagCycleParam
{
float fRadiusLeft; // 圆的最左边X坐标
float fRadiusRight; // 圆的最右边X坐标
float fRadiusTop; // 圆的最上边Y坐标
float fRadiusBottom; // 圆的最下边Y坐标
}CYCLEPARAM;
typedef struct tagPTZParam
{
float fPTZPositionX; // PTZ 显示的中心位置 X坐标
float fPTZPositionY; // PTZ 显示的中心位置 Y坐标
}PTZPARAM;
// 错误码
/*********************************************
********************************************/
// 更新标记变量定义
#define FEC_UPDATE_RADIUS 0x1
#define FEC_UPDATE_PTZZOOM 0x2
#define FEC_UPDATE_WIDESCANOFFSET 0x4
#define FEC_UPDATE_PTZPARAM 0x8
typedef struct tagFECParam
{
unsigned int nUpDateType; // 更新的类型
unsigned int nPlaceAndCorrect; // 安装方式和矫正方式只能用于获取SetParam的时候无效,该值表示安装方式和矫正方式的和
PTZPARAM stPTZParam; // PTZ 校正的参数
CYCLEPARAM stCycleParam; // 鱼眼图像圆心参数
float fZoom; // PTZ 显示的范围参数
float fWideScanOffset; // 180或者360度校正的偏移角度
int nResver[16]; // 保留字段
}FISHEYEPARAM;
typedef void (__stdcall * FISHEYE_CallBack )( void* pUser , unsigned int nSubPort , unsigned int nCBType , void * hDC , unsigned int nWidth , unsigned int nHeight);
#endif
// 启用鱼眼
PLAYM4_API BOOL __stdcall PlayM4_FEC_Enable(LONG nPort);
// 关闭鱼眼模块
PLAYM4_API BOOL __stdcall PlayM4_FEC_Disable(LONG nPort);
// 获取鱼眼矫正处理子端口 [1~31]
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetPort(LONG nPort, unsigned int* nSubPort,FECPLACETYPE emPlaceType,FECCORRECTTYPE emCorrectType);
// 删除鱼眼矫正处理子端口
PLAYM4_API BOOL __stdcall PlayM4_FEC_DelPort(LONG nPort , unsigned int nSubPort);
// 设置鱼眼矫正参数
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// 获取鱼眼矫正参数
PLAYM4_API BOOL __stdcall PlayM4_FEC_GetParam(LONG nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
// 设置显示窗口,可以随时切换
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetWnd(LONG nPort , unsigned int nSubPort , void * hWnd);
// 设置鱼眼窗口的绘图回调
PLAYM4_API BOOL __stdcall PlayM4_FEC_SetCallBack(LONG nPort , unsigned int nSubPort , FISHEYE_CallBack cbFunc , void * pUser);
//motionflow
PLAYM4_API BOOL __stdcall PlayM4_MotionFlow(LONG nPort, DWORD dwAdjustType);
//图像增强相关
#ifndef PLAYM4_HIKVIE_TAG
#define PLAYM4_HIKVIE_TAG
typedef struct _PLAYM4_VIE_DYNPARAM_
{
int moduFlag; //启用的算法处理模块在PLAYM4_VIE_MODULES中定义
//如 PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN
//模块启用后,必须设置相应的参数;
//PLAYM4_VIE_MODU_ADJ
int brightVal; //亮度调节值,[-255, 255]
int contrastVal; //对比度调节值,[-256, 255]
int colorVal; //饱和度调节值,[-256, 255]
//PLAYM4_VIE_MODU_EHAN
int toneScale; //滤波范围,[0, 100]
int toneGain; //对比度调节,全局对比度增益值,[-256, 255]
int toneOffset; //亮度调节,亮度平均值偏移,[-255, 255]
int toneColor; //颜色调节,颜色保真值,[-256, 255]
//PLAYM4_VIE_MODU_DEHAZE
int dehazeLevel; //去雾强度,[0, 255]
int dehazeTrans; //透射值,[0, 255]
int dehazeBright; //亮度补偿,[0, 255]
//PLAYM4_VIE_MODU_DENOISE
int denoiseLevel; //去噪强度,[0, 255]
//PLAYM4_VIE_MODU_SHARPEN
int usmAmount; //锐化强度,[0, 255]
int usmRadius; //锐化半径,[1, 15]
int usmThreshold; //锐化阈值,[0, 255]
//PLAYM4_VIE_MODU_DEBLOCK
int deblockLevel; //去块强度,[0, 100]
//PLAYM4_VIE_MODU_LENS
int lensWarp; //畸变量,[-256, 255]
int lensZoom; //缩放量,[-256, 255]
//PLAYM4_VIE_MODU_CRB
//无响应参数
} PLAYM4_VIE_PARACONFIG;
typedef enum _PLAYM4_VIE_MODULES
{
PLAYM4_VIE_MODU_ADJ = 0x00000001, //图像基本调节
PLAYM4_VIE_MODU_EHAN = 0x00000002, //局部增强模块
PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //去雾模块
PLAYM4_VIE_MODU_DENOISE = 0x00000008, //去噪模块
PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //锐化模块
PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //去块滤波模块
PLAYM4_VIE_MODU_CRB = 0x00000040, //色彩平衡模块
PLAYM4_VIE_MODU_LENS = 0x00000080, //镜头畸变矫正模块
}PLAYM4_VIE_MODULES;
#endif
//设置关闭/开启模块
//dwModuFlag对应PLAYM4_VIE_MODULES宏,可组合
//先设置模块开启,再设置模块参数;期间采用默认的参数;
//关闭模块后,上次设置的参数清空
//其他接口调用,必须在该接口开启模块后;否则,返回错误
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetModuConfig(LONG lPort,int nModuFlag,BOOL bEnable);
//设置图像增强区域NULL全图超过全图采用全图最小区域16*16像素
//可支持设置区域最多比较说4个第一个版本可以只支持一个。多个区域要求不能重叠有重叠就报错
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetRegion(LONG lPort,LONG lRegNum,RECT* pRect);
//获取开启模块
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetModuConfig(LONG lPort,int* pdwModuFlag);
//设置参数
//未开启模块的参数设置被忽略
PLAYM4_API BOOL __stdcall PlayM4_VIE_SetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//获取开启模块的参数
PLAYM4_API BOOL __stdcall PlayM4_VIE_GetParaConfig(LONG lPort,PLAYM4_VIE_PARACONFIG* pParaConfig);
//音视频同步接口
PLAYM4_API BOOL __stdcall PlayM4_SyncToAudio(LONG nPort, BOOL bSyncToAudio);
// 私有信息模块类型
typedef enum _PLAYM4_PRIDATA_RENDER
{
PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //智能分析
PLAYM4_RENDER_MD = 0x00000002, //移动侦测
PLAYM4_RENDER_ADD_POS = 0x00000004, //POS信息后叠加
PLAYM4_RENDER_ADD_PIC = 0x00000008, //图片叠加
PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //热成像信息
PLAYM4_RENDER_TEM = 0x00000020, //温度信息
PLAYM4_RENDER_TRACK_TEM = 0x00000040, //轨迹信息
PLAYM4_RENDER_THERMAL = 0x00000080 //废气检测和烟火屏蔽信息
}PLAYM4_PRIDATA_RENDER;
typedef enum _PLAYM4_THERMAL_FLAG
{
PLAYM4_THERMAL_FIREMASK = 0x00000001, //烟火屏蔽
PLAYM4_THERMAL_RULEGAS = 0x00000002, //规则废气检测
PLAYM4_THERMAL_TARGETGAS = 0x00000004 //目标废气检测
}PLAYM4_THERMAL_FLAG;
typedef enum _PLAYM4_FIRE_ALARM{
PLAYM4_FIRE_FRAME_DIS = 0x00000001, //火点框显示
PLAYM4_FIRE_MAX_TEMP = 0x00000002, //最高温度
PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //最高温度位置显示
PLAYM4_FIRE_DISTANCE = 0x00000008, //最高温度距离}PLAYM4_FIRE_ALARM
}PLAYM4_FIRE_ALARM;
typedef enum _PLAYM4_TEM_FLAG{
PLAYM4_TEM_REGION_BOX = 0x00000001, //框测温
PLAYM4_TEM_REGION_LINE = 0x00000002, //线测温
PLAYM4_TEM_REGION_POINT = 0x00000004, //点测温}PLAYM4_TEM_FLAG
}PLAYM4_TEM_FLAG;
typedef enum _PLAYM4_TRACK_FLAG
{
PLAYM4_TRACK_PEOPLE = 0x00000001, //人轨迹
PLAYM4_TRACK_VEHICLE = 0x00000002, //车轨迹
}PLAYM4_TRACK_FLAG;
typedef struct TI_PTZ_INFO_
{
unsigned short dwDefVer; //结构体版本
unsigned short dwLength; //PTZ_info长度以8字节为单位
DWORD dwP; //P0~3600
DWORD dwT; //T0~3600
DWORD dwZ; //Z0~3600
BYTE chFSMState; //跟随状态
BYTE bClearFocusState; //聚焦清晰状态0,1
BYTE reserved[6]; //6个字节保留
}PTZ_INFO;
// 智能信息开关
PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateData(LONG nPort, int nIntelType, BOOL bTrue);
PLAYM4_API BOOL __stdcall PlayM4_RenderPrivateDataEx(LONG nPort, int nIntelType, int nSubType, BOOL bTrue);
// 加密码流回调,nType=0表示码流加密标记位发生变化就回调nType=1表示码流有加密位发生回调
PLAYM4_API BOOL __stdcall PlayM4_SetEncryptTypeCallBack(LONG nPort, DWORD nType,
void (CALLBACK* EncryptTypeCBFun)(long nPort, ENCRYPT_INFO* pEncryptInfo, long nUser, long nReserved2), long nUser);
//lType: 1 表示获取当前显示帧PTZ信息。以特定结构体形式存储在pInfo内plLen返回长度信息
PLAYM4_API BOOL __stdcall PlayM4_GetStreamAdditionalInfo(LONG nPort, LONG lType, BYTE* pInfo, LONG* plLen);
#endif //_PLAYM4_H_

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,118 @@
#ifndef _MV_CODEREADER_ERROR_DEFINE_H_
#define _MV_CODEREADER_ERROR_DEFINE_H_
// ch:正确码定义
#define MV_CODEREADER_OK 0x00000000 ///< 成功,无错误
//通用错误码定义:范围0x80020000-0x800200FF
#define MV_CODEREADER_E_HANDLE 0x80020000 ///< 错误或无效的句柄
#define MV_CODEREADER_E_SUPPORT 0x80020001 ///< 不支持的功能
#define MV_CODEREADER_E_BUFOVER 0x80020002 ///< 缓存已满
#define MV_CODEREADER_E_CALLORDER 0x80020003 ///< 函数调用顺序错误
#define MV_CODEREADER_E_PARAMETER 0x80020004 ///< 错误的参数
#define MV_CODEREADER_E_RESOURCE 0x80020005 ///< 资源申请失败
#define MV_CODEREADER_E_NODATA 0x80020006 ///< 无数据
#define MV_CODEREADER_E_PRECONDITION 0x80020007 ///< 前置条件有误,或运行环境已发生变化
#define MV_CODEREADER_E_VERSION 0x80020008 ///< 版本不匹配
#define MV_CODEREADER_E_NOENOUGH_BUF 0x80020009 ///< 传入的内存空间不足
#define MV_CODEREADER_E_ABNORMAL_IMAGE 0x8002000A ///< 异常图像,可能是丢包导致图像不完整
#define MV_CODEREADER_E_LOAD_LIBRARY 0x8002000B ///< 动态导入DLL失败
#define MV_CODEREADER_E_NOOUTBUF 0x8002000C ///< 没有可输出的缓存
#define MV_CODEREADER_E_FILE_PATH 0x8002000F ///< 文件路径错误
#define MV_CODEREADER_E_UNKNOW 0x800200FF ///< 未知的错误
// GenICam系列错误:范围0x80020100-0x800201FF
#define MV_CODEREADER_E_GC_GENERIC 0x80020100 ///< 通用错误
#define MV_CODEREADER_E_GC_ARGUMENT 0x80020101 ///< 参数非法
#define MV_CODEREADER_E_GC_RANGE 0x80020102 ///< 值超出范围
#define MV_CODEREADER_E_GC_PROPERTY 0x80020103 ///< 属性错误
#define MV_CODEREADER_E_GC_RUNTIME 0x80020104 ///< 运行环境有问题
#define MV_CODEREADER_E_GC_LOGICAL 0x80020105 ///< 逻辑错误
#define MV_CODEREADER_E_GC_ACCESS 0x80020106 ///< 节点访问条件有误
#define MV_CODEREADER_E_GC_TIMEOUT 0x80020107 ///< 超时
#define MV_CODEREADER_E_GC_DYNAMICCAST 0x80020108 ///< 转换异常
#define MV_CODEREADER_E_GC_UNKNOW 0x800201FF ///< GenICam未知错误
//GigE_STATUS对应的错误码:范围0x80000200-0x800002FF
#define MV_CODEREADER_E_NOT_IMPLEMENTED 0x80020200 ///< 命令不被设备支持
#define MV_CODEREADER_E_INVALID_ADDRESS 0x80020201 ///< 访问的目标地址不存在
#define MV_CODEREADER_E_WRITE_PROTECT 0x80020202 ///< 目标地址不可写
#define MV_CODEREADER_E_ACCESS_DENIED 0x80020203 ///< 设备无访问权限
#define MV_CODEREADER_E_BUSY 0x80020204 ///< 设备忙,或网络断开
#define MV_CODEREADER_E_PACKET 0x80020205 ///< 网络包数据错误
#define MV_CODEREADER_E_NETER 0x80020206 ///< 网络相关错误
// GigE相机特有的错误码
#define MV_CODEREADER_E_IP_CONFLICT 0x80020221 ///< 设备IP冲突
//USB_STATUS对应的错误码:范围0x80000300-0x800003FF
#define MV_CODEREADER_E_USB_READ 0x80020300 ///< 读usb出错
#define MV_CODEREADER_E_USB_WRITE 0x80020301 ///< 写usb出错
#define MV_CODEREADER_E_USB_DEVICE 0x80020302 ///< 设备异常
#define MV_CODEREADER_E_USB_GENICAM 0x80020303 ///< GenICam相关错误
#define MV_CODEREADER_E_USB_BANDWIDTH 0x80020304 ///< 带宽不足
#define MV_CODEREADER_E_USB_DRIVER 0x80020305 ///< 驱动不匹配或者未装驱动
#define MV_CODEREADER_E_USB_UNKNOW 0x800203FF ///< USB未知的错误
//升级时对应的错误码:范围0x80020400-0x800204FF
#define MV_CODEREADER_E_UPG_MIN_ERRCODE 0x80020400 ///< 升级模块错误码最小值
#define MV_CODEREADER_E_UPG_FILE_MISMATCH 0x80020400 ///< 升级固件不匹配
#define MV_CODEREADER_E_UPG_LANGUSGE_MISMATCH 0x80020401 ///< 升级固件语言不匹配
#define MV_CODEREADER_E_UPG_CONFLICT 0x80020402 ///< 升级冲突
#define MV_CODEREADER_E_UPG_INNER_ERR 0x80020403 ///< 升级时相机内部出现错误
#define MV_CODEREADER_E_UPG_REGRESH_TYPE_ERR 0x80020404 ///< 获取相机型号失败
#define MV_CODEREADER_E_UPG_COPY_FPGABIN_ERR 0x80020405 ///< 复制FPGA文件失败
#define MV_CODEREADER_E_UPG_ZIPEXTRACT_ERR 0x80020406 ///< ZIP文件解压失败
#define MV_CODEREADER_E_UPG_DAVEXTRACT_ERR 0x80020407 ///< DAV文件解压失败
#define MV_CODEREADER_E_UPG_DAVCOMPRESS_ERR 0x80020408 ///< DAV文件压缩失败
#define MV_CODEREADER_E_UPG_ZIPCOMPRESS_ERR 0x80020409 ///< ZIP文件压缩失败
#define MV_CODEREADER_E_UPG_GET_PROGRESS_TIMEOUT_ERR 0x80020410 ///< 获取升级进度超时
#define MV_CODEREADER_E_UPG_SEND_QUERY_PROGRESS_ERR 0x80020411 ///< 发送进度查询指令失败
#define MV_CODEREADER_E_UPG_RECV_QUERY_PROGRESS_ERR 0x80020412 ///< 接收进度查询指令失败
#define MV_CODEREADER_E_UPG_GET_QUERY_PROGRESS_ERR 0x80020413 ///< 获取查询进度失败
#define MV_CODEREADER_E_UPG_GET_MAX_QUERY_PROGRESS_ERR 0x80020414 ///< 获得最大进度失败
#define MV_CODEREADER_E_UPG_CHECKT_PACKET_FAILED 0x80020465 ///< 文件验证失败
#define MV_CODEREADER_E_UPG_FPGA_PROGRAM_FAILED 0x80020466 ///< FPGA程序升级失败
#define MV_CODEREADER_E_UPG_WATCHDOG_FAILED 0x80020467 ///< 看门狗升级失败
#define MV_CODEREADER_E_UPG_CAMERA_AND_BARE_FAILED 0x80020468 ///< 裸相机升级失败
#define MV_CODEREADER_E_UPG_RETAIN_CONFIG_FAILED 0x80020469 ///< 保留配置文件失败
#define MV_CODEREADER_E_UPG_FPGA_DRIVER_FAILED 0x8002046A ///< FPGA驱动升级失败
#define MV_CODEREADER_E_UPG_SPI_DRIVER_FAILED 0x8002046B ///< SPI驱动升级失败
#define MV_CODEREADER_E_UPG_REBOOT_SYSTEM_FAILED 0x8002046C ///< 重新启动失败
#define MV_CODEREADER_E_UPG_UPSELF_FAILED 0x8002046D ///< 升级服务升级失败
#define MV_CODEREADER_E_UPG_STOP_RELATION_PROGRAM_FAILED 0x8002046E ///< 停止相关服务失败
#define MV_CODEREADER_E_UPG_DEVCIE_TYPE_INCONSISTENT 0x8002046F ///< 设备类型不一致
#define MV_CODEREADER_E_UPG_READ_ENCRYPT_INFO_FAILED 0x80020470 ///< 读取加密信息失败
#define MV_CODEREADER_E_UPG_PLAT_TYPE_INCONSISTENT 0x80020471 ///< 设备平台错误
#define MV_CODEREADER_E_UPG_CAMERA_TYPE_INCONSISTENT 0x80020472 ///< 相机型号错误
#define MV_CODEREADER_E_UPG_DEVICE_UPGRADING 0x80020473 ///< 相机正在升级
#define MV_CODEREADER_E_UPG_UNZIP_FAILED 0x80020474 ///< 升级包解压失败
#define MV_CODEREADER_E_UPG_BLE_DISCONNECT 0x80020475 ///< 巴枪蓝牙未连接
#define MV_CODEREADER_E_UPG_BATTERY_NOTENOUGH 0x80020476 ///< 电量不足
#define MV_CODEREADER_E_UPG_RTC_NOT_PRESENT 0x80020477 ///< 巴枪未放在底座上
#define MV_CODEREADER_E_UPG_APP_ERR 0x80020478 ///< APP升级失败
#define MV_CODEREADER_E_UPG_L3_ERR 0x80020479 ///< L3升级失败
#define MV_CODEREADER_E_UPG_MCU_ERR 0x8002047A ///< MCU升级失败
#define MV_CODEREADER_E_UPG_PLATFORM_DISMATCH 0x8002047B ///< 平台不匹配
#define MV_CODEREADER_E_UPG_TYPE_DISMATCH 0x8002047C ///< 型号不匹配
#define MV_CODEREADER_E_UPG_SPACE_DISMATCH 0x8002047D ///< 空间不匹配
#define MV_CODEREADER_E_UPG_MEM_DISMATCH 0x8002047E ///< 内存不匹配
#define MV_CODEREADER_E_UPG_NET_TRANS_ERROR 0x8002047F ///< 网络传输异常,请重新升级
#define MV_CODEREADER_E_UPG_UNKNOW 0x800204FF ///< 升级时未知错误
//网络组件对应的错误码:范围0x80020500-0x800205FF
#define MV_CODEREADER_E_CREAT_SOCKET 0x80020500 ///< 创建Socket错误
#define MV_CODEREADER_E_BIND_SOCKET 0x80020501 ///< 绑定错误
#define MV_CODEREADER_E_CONNECT_SOCKET 0x80020502 ///< 连接错误
#define MV_CODEREADER_E_GET_HOSTNAME 0x80020503 ///< 获取主机名错误
#define MV_CODEREADER_E_NET_WRITE 0x80020504 ///< 写入数据错误
#define MV_CODEREADER_E_NET_READ 0x80020505 ///< 读取数据错误
#define MV_CODEREADER_E_NET_SELECT 0x80020506 ///< Select错误
#define MV_CODEREADER_E_NET_TIMEOUT 0x80020507 ///< 超时
#define MV_CODEREADER_E_NET_ACCEPT 0x80020508 ///< 接收错误
#define MV_CODEREADER_E_NET_UNKNOW 0x800205FF ///< 网络未知错误
#endif //_MVCODEREADER_ERROR_DEFINE_H_

View File

@ -0,0 +1,878 @@
#ifndef _MV_CODEREADER_PARAMS_H_
#define _MV_CODEREADER_PARAMS_H_
#include "MvCodeReaderPixelType.h"
#ifndef __cplusplus
typedef char bool;
#define true 1
#define false 0
#endif
/********************************宏定义类型************************************************************/
// 设备类型定义
#define MV_CODEREADER_UNKNOW_DEVICE 0x00000000 // 未知设备类型
#define MV_CODEREADER_GIGE_DEVICE 0x00000001 // GigE设备
#define MV_CODEREADER_1394_DEVICE 0x00000002 // 1394-a/b 设备
#define MV_CODEREADER_USB_DEVICE 0x00000004 // USB3.0 设备
#define MV_CODEREADER_CAMERALINK_DEVICE 0x00000008 // CameraLink设备
#define MV_CODEREADER_ID_DEVICE 0x00000010
// 异常消息类型
#define MV_CODEREADER_EXCEPTION_DEV_DISCONNECT 0x00008001 // 设备断开连接
#define MV_CODEREADER_EXCEPTION_VERSION_CHECK 0x00008002 // SDK与驱动版本不匹配
// 设备的访问模式
// 独占权限其他APP只允许读CCP寄存器
#define MV_CODEREADER_ACCESS_Exclusive 1
// 可以从5模式下抢占权限然后以独占权限打开
#define MV_CODEREADER_ACCESS_ExclusiveWithSwitch 2
// 控制权限其他APP允许读所有寄存器
#define MV_CODEREADER_ACCESS_Control 3
// 可以从5的模式下抢占权限然后以控制权限打开
#define MV_CODEREADER_ACCESS_ControlWithSwitch 4
// 以可被抢占的控制权限打开
#define MV_CODEREADER_ACCESS_ControlSwitchEnable 5
// 可以从5的模式下抢占权限然后以可被抢占的控制权限打开
#define MV_CODEREADER_ACCESS_ControlSwitchEnableWithKey 6
// 读模式打开设备,适用于控制权限下
#define MV_CODEREADER_ACCESS_Monitor 7
// 设备信息最大长度
#define INFO_MAX_BUFFER_SIZE 64 // 最大信息长度
// 最大支持的设备个数
#define MV_CODEREADER_MAX_DEVICE_NUM 256
// 最大类型个数(适用于枚举类型)
#define MV_CODEREADER_MAX_XML_SYMBOLIC_NUM 64 // 支持最大枚举类型最大参数
// GigEVision IP配置方式
#define MV_CODEREADER_IP_CFG_STATIC 0x05000000 // 静态IP
#define MV_CODEREADER_IP_CFG_DHCP 0x06000000 // DHCP
#define MV_CODEREADER_IP_CFG_LLA 0x04000000 // LLA
// Event事件回调信息
#define MV_CODEREADER_MAX_EVENT_NAME_SIZE 128 // 相机Event事件名称最大长度
// 最大条码长度
#define MV_CODEREADER_MAX_BCR_CODE_LEN 256
// 最大条码长度扩展
#define MV_CODEREADER_MAX_BCR_CODE_LEN_EX 4096
// 最大OCR长度
#define MV_CODEREADER_MAX_OCR_LEN 128
// 一次最多输出条码个数
#define MAX_CODEREADER_BCR_COUNT 200
// 一次最多输出条码个数
#define MAX_CODEREADER_BCR_COUNT_EX 300
// 最大数据缓存
#define MV_CODEREADER_MAX_RESULT_SIZE (1024*64)
// 一次输出最大抠图个数
#define MAX_CODEREADER_WAYBILL_COUNT 50
// 一次输出最大OCR个数
#define MAX_CODEREADER_OCR_COUNT 100
// 输出协议类型
#define CommuPtlSmartSDK 1 // SamrtSDK协议
#define CommuPtlTcpIP 2 // TCPIP协议
#define CommuPtlSerial 3 // Serial协议
// 升级最大支持的设备个数
#define MV_CODEREADER_MAX_UPGARDEDEVICE_NUM 100
/************************************************************************/
/* 抠图参数,内部有默认值,可以不设置 */
/************************************************************************/
#define KEY_WAYBILL_ABILITY "WAYBILL_Ability" // 算法能力集,含面单提取[0x1],图像增强[0x2],码提取[0x4]Box拷贝模块[0x8],面单提取模块[0x10],模块最大编号[0x3F]
#define KEY_WAYBILL_MAX_WIDTH "WAYBILL_Max_Width" // 算法最大宽度默认5472范围[0,65535]
#define KEY_WAYBILL_MAX_HEIGHT "WAYBILL_Max_Height" // 算法最大高度默认3648范围[0,65535]
#define KEY_WAYBILL_OUTPUTIMAGETYPE "WAYBILL_OutputImageType" // 面单抠图输出的图片格式默认Jpg范围[1,3],1为Mono82为Jpg3为Bmp
#define KEY_WAYBILL_JPGQUALITY "WAYBILL_JpgQuality" // jpg编码质量默认80范围[1,100]
#define KEY_WAYBILL_ENHANCEENABLE "WAYBILL_EnhanceEnable" // 图像增强使能默认0范围[0,1]
#define KEY_WAYBILL_MINWIDTH "WAYBILL_MinWidth" // waybill最小宽, 宽是长边, 高是短边默认100范围[15,2592]
#define KEY_WAYBILL_MINHEIGHT "WAYBILL_MinHeight" // waybill最小高默认100范围[10,2048]
#define KEY_WAYBILL_MAXWIDTH "WAYBILL_MaxWidth" // waybill最大宽, 宽是长边, 高是短边默认3072最小值15
#define KEY_WAYBILL_MAXHEIGHT "WAYBILL_MaxHeight" // waybill最大高默认2048最小值10
#define KEY_WAYBILL_MORPHTIMES "WAYBILL_MorphTimes" // 膨胀次数默认0范围[0,10]
#define KEY_WAYBILL_GRAYLOW "WAYBILL_GrayLow" // 面单上条码和字符灰度最小值默认0范围[0,255]
#define KEY_WAYBILL_GRAYMID "WAYBILL_GrayMid" // 面单上灰度中间值用于区分条码和背景默认70范围[0,255]
#define KEY_WAYBILL_GRAYHIGH "WAYBILL_GrayHigh" // 面单上背景灰度最大值默认130范围[0,255]
#define KEY_WAYBILL_BINARYADAPTIVE "WAYBILL_BinaryAdaptive" // 自适应二值化默认1范围[0,1]
#define KEY_WAYBILL_BOUNDARYROW "WAYBILL_BoundaryRow" // 面单抠图行方向扩边默认0范围[0,2000]
#define KEY_WAYBILL_BOUNDARYCOL "WAYBILL_BoundaryCol" // 面单抠图列方向扩边默认0范围[0,2000]
#define KEY_WAYBILL_MAXBILLBARHEIGTHRATIO "WAYBILL_MaxBillBarHightRatio" // 最大面单和条码高度比例默认20范围[1,100]
#define KEY_WAYBILL_MAXBILLBARWIDTHRATIO "WAYBILL_MaxBillBarWidthRatio" // 最大面单和条码宽度比例默认5范围[1,100]
#define KEY_WAYBILL_MINBILLBARHEIGTHRATIO "WAYBILL_MinBillBarHightRatio" // 最小面单和条码高度比例默认5范围[1,100]
#define KEY_WAYBILL_MINBILLBARWIDTHRATIO "WAYBILL_MinBillBarWidthRatio" // 最小面单和条码宽度比例默认2范围[1,100]
#define KEY_WAYBILL_ENHANCEMETHOD "WAYBILL_EnhanceMethod" // 增强方法,最小值/默认值/不进行增强[0x1],线性拉伸[0x2],直方图拉伸[0x3],直方图均衡化[0x4],亮度校正/最大值[0x5]
#define KEY_WAYBILL_ENHANCECLIPRATIOLOW "WAYBILL_ClipRatioLow" // 增强拉伸低阈值比例默认1范围[0,100]
#define KEY_WAYBILL_ENHANCECLIPRATIOHIGH "WAYBILL_ClipRatioHigh" // 增强拉伸高阈值比例默认99范围[0,100]
#define KEY_WAYBILL_ENHANCECONTRASTFACTOR "WAYBILL_ContrastFactor" // 对比度系数默认100范围[1,10000]
#define KEY_WAYBILL_ENHANCESHARPENFACTOR "WAYBILL_SharpenFactor" // 锐化系数默认0范围[0,10000]
#define KEY_WAYBILL_SHARPENKERNELSIZE "WAYBILL_KernelSize" // 锐化滤波核大小默认3范围[3,15]
#define KEY_WAYBILL_CODEBOUNDARYROW "WAYBILL_CodeBoundaryRow" // 码单抠图行方向扩边默认0范围[0,2000]
#define KEY_WAYBILL_CODEBOUNDARYCOL "WAYBILL_CodeBoundaryCol" // 码单抠图列方向扩边默认0范围[0,2000]
/************************************************结构体类型**************************************************************/
// GigE设备信息
typedef struct _MV_CODEREADER_GIGE_DEVICE_INFO_
{
unsigned int nIpCfgOption; // 设备支持的IP类型
unsigned int nIpCfgCurrent; // 设备当前IP类型
unsigned int nCurrentIp; // 设备当前IP
unsigned int nCurrentSubNetMask; // 设备当前子网掩码
unsigned int nDefultGateWay; // 设备默认网关
unsigned char chManufacturerName[32]; // 设备厂商
unsigned char chModelName[32]; // 设备型号
unsigned char chDeviceVersion[32]; // 设备版本
unsigned char chManufacturerSpecificInfo[48]; // 设备厂商特殊信息
unsigned char chSerialNumber[16]; // 设备序列号
unsigned char chUserDefinedName[16]; // 设备用户自定义名称
unsigned int nNetExport; // 主机网口IP地址
unsigned int nCurUserIP; // 当前占用设备的用户IP
unsigned int nReserved[3]; // 保留字节
}MV_CODEREADER_GIGE_DEVICE_INFO;
// U3V设备信息
typedef struct _MV_CODEREADER_USB3_DEVICE_INFO_
{
unsigned char CrtlInEndPoint; // 控制输入端点
unsigned char CrtlOutEndPoint; // 控制输出端点
unsigned char StreamEndPoint; // 流端点
unsigned char EventEndPoint; // 事件端点
unsigned short idVendor; // 供应商ID号
unsigned short idProduct; // 产品ID号
unsigned int nDeviceNumber; // 设备序列号
unsigned char chDeviceGUID[INFO_MAX_BUFFER_SIZE]; // 设备GUID号
unsigned char chVendorName[INFO_MAX_BUFFER_SIZE]; // 供应商名称
unsigned char chModelName[INFO_MAX_BUFFER_SIZE]; // 设备型号
unsigned char chFamilyName[INFO_MAX_BUFFER_SIZE]; // 设备家族名称
unsigned char chDeviceVersion[INFO_MAX_BUFFER_SIZE]; // 设备版本
unsigned char chManufacturerName[INFO_MAX_BUFFER_SIZE]; // 设备厂商
unsigned char chSerialNumber[INFO_MAX_BUFFER_SIZE]; // 设备序列号
unsigned char chUserDefinedName[INFO_MAX_BUFFER_SIZE]; // 设备用户自定义名称
unsigned int nbcdUSB; // 设备支持的USB协议
unsigned int nReserved[3]; // 保留字节
}MV_CODEREADER_USB3_DEVICE_INFO;
// 设备信息
typedef struct _MV_CODEREADER_DEVICE_INFO_
{
unsigned short nMajorVer; // 设备主版本号
unsigned short nMinorVer; // 设备次版本号
unsigned int nMacAddrHigh; // 设备MAC地址高位
unsigned int nMacAddrLow; // 设备MAC地址低位
unsigned int nTLayerType; // 设备传输层协议类型
// 是否为指定系列型号相机
// true -指定系列型号相机 false- 非指定系列型号相机
bool bSelectDevice; // ch:选择设备 |en:Choose device
unsigned int nReserved[3]; // 保留字节
union
{
MV_CODEREADER_GIGE_DEVICE_INFO stGigEInfo; // GigE设备信息
MV_CODEREADER_USB3_DEVICE_INFO stUsb3VInfo; // U3V设备信息
// more ...
}SpecialInfo;
}MV_CODEREADER_DEVICE_INFO;
// 设备信息列表
typedef struct _MV_CODEREADER_DEVICE_INFO_LIST_
{
unsigned int nDeviceNum; // 在线设备数量
MV_CODEREADER_DEVICE_INFO* pDeviceInfo[MV_CODEREADER_MAX_DEVICE_NUM]; // 设备信息(支持最多256个设备)
}MV_CODEREADER_DEVICE_INFO_LIST;
// 输出帧信息
typedef struct _MV_CODEREADER_FRAME_OUT_INFO_
{
unsigned short nWidth; // 图像宽
unsigned short nHeight; // 图像高
enum MvCodeReaderGvspPixelType enPixelType; // 像素格式
unsigned int nFrameNum; // 帧号
unsigned int nDevTimeStampHigh; // 时间戳高32位
unsigned int nDevTimeStampLow; // 时间戳低32位
unsigned int nReserved0; // 保留8字节对齐
int64_t nHostTimeStamp; // 主机生成的时间戳
unsigned int nFrameLen; // 图像长度
unsigned int nLostPacket; // 本帧丢包数
unsigned int nReserved[2]; // 保留字节
}MV_CODEREADER_FRAME_OUT_INFO;
// ch:Chunk内容 | en:The content of ChunkData
typedef struct _MV_CODEREADER_CHUNK_DATA_CONTENT_
{
unsigned char* pChunkData;
unsigned int nChunkID;
unsigned int nChunkLen;
unsigned int nReserved[8]; // 保留
}MV_CODEREADER_CHUNK_DATA_CONTENT;
// 输出帧信息
typedef struct _MV_CODEREADER_FRAME_OUT_INFO_EX_
{
unsigned short nWidth; // 图像宽
unsigned short nHeight; // 图像高
enum MvCodeReaderGvspPixelType enPixelType; // 像素格式
unsigned int nFrameNum; // 帧号
unsigned int nDevTimeStampHigh; // 时间戳高32位
unsigned int nDevTimeStampLow; // 时间戳低32位
unsigned int nReserved0; // 保留8字节对齐
int64_t nHostTimeStamp; // 主机生成的时间戳
unsigned int nFrameLen; // 图像长度
// chunk新增水印信息
// 设备水印时标
unsigned int nSecondCount; // 秒数
unsigned int nCycleCount; // 循环计数
unsigned int nCycleOffset; // 循环计数偏移量
float fGain; // 增益
float fExposureTime; // 曝光时间
unsigned int nAverageBrightness; // 平均亮度
// 白平衡相关
unsigned int nRed; // 红色数据
unsigned int nGreen; // 绿色数据
unsigned int nBlue; // 蓝色数据
unsigned int nFrameCounter; // 图像数量计数
unsigned int nTriggerIndex; // 触发计数
// Line 输入/输出
unsigned int nInput; // 输入
unsigned int nOutput; // 输出
// ROI区域
unsigned short nOffsetX; // ROI X轴偏移
unsigned short nOffsetY; // ROI Y轴偏移
unsigned short nChunkWidth; // Chunk宽度
unsigned short nChunkHeight; // Chunk高度
unsigned int nLostPacket; // 本帧丢包数
unsigned int nUnparsedChunkNum; //未解析的Chunkdata个数
union
{
MV_CODEREADER_CHUNK_DATA_CONTENT* pUnparsedChunkContent;
int64_t nAligning;
}UnparsedChunkList;
unsigned int nReserved[36]; // 保留字节
}MV_CODEREADER_FRAME_OUT_INFO_EX;
// 图像显示信息
typedef struct _MV_CODEREADER_DISPLAY_FRAME_INFO_
{
void* hWnd; // 显示窗口句柄
unsigned char* pData; // 源图像数据
unsigned int nDataLen; // 源图像数据长度
unsigned short nWidth; // 源图像宽
unsigned short nHeight; // 源图像高
enum MvCodeReaderGvspPixelType enPixelType; // 源图像像素格式
unsigned int nRes[4]; // 保留字节
}MV_CODEREADER_DISPLAY_FRAME_INFO;
// 保存图片格式
enum MV_CODEREADER_IAMGE_TYPE
{
MV_CODEREADER_Image_Undefined = 0,
MV_CODEREADER_Image_Mono8 = 1,
MV_CODEREADER_Image_Jpeg = 2,
MV_CODEREADER_Image_Bmp = 3,
MV_CODEREADER_Image_RGB24 = 4,
MV_CODEREADER_Image_Png = 5, // Png图像(暂不支持)
MV_CODEREADER_Image_Tif = 6, // Tif图像(暂不支持)
};
// 保存图片参数
typedef struct _MV_CODEREADER_SAVE_IMAGE_PARAM_T_
{
unsigned char* pData; // 输入数据缓存
unsigned int nDataLen; // 输入数据大小
enum MvCodeReaderGvspPixelType enPixelType; // 输入数据的像素格式
unsigned short nWidth; // 图像宽
unsigned short nHeight; // 图像高
unsigned char* pImageBuffer; // 输出图片缓存
unsigned int nImageLen; // 输出图片大小
unsigned int nBufferSize; // 提供的输出缓冲区大小
enum MV_CODEREADER_IAMGE_TYPE enImageType; // 输出图片格式
}MV_CODEREADER_SAVE_IMAGE_PARAM;
// 图片保存参数
typedef struct _MV_CODEREADER_SAVE_IMAGE_PARAM_T_EX_
{
unsigned char* pData; // 输入数据缓存
unsigned int nDataLen; // 输入数据大小
enum MvCodeReaderGvspPixelType enPixelType; // 输入数据的像素格式
unsigned short nWidth; // 图像宽
unsigned short nHeight; // 图像高
unsigned char* pImageBuffer; // 输出图片缓存
unsigned int nImageLen; // 输出图片大小
unsigned int nBufferSize; // 提供的输出缓冲区大小
enum MV_CODEREADER_IAMGE_TYPE enImageType; // 输出图片格式
unsigned int nJpgQuality; // 编码质量, (50-99]
// 格式转为RGB24的插值方法 0-最近邻 1-双线性 2-Hamilton (如果传入其它值则默认为最近邻)
unsigned int iMethodValue; // 插值方式
unsigned int nReserved[3]; // 保留字节
}MV_CODEREADER_SAVE_IMAGE_PARAM_EX;
// 事件回调信息
typedef struct _MV_CODEREADER_EVENT_OUT_INFO_
{
char EventName[MV_CODEREADER_MAX_EVENT_NAME_SIZE]; // Event名称
unsigned short nEventID; // Event号
unsigned short nStreamChannel; // 流通道序号
unsigned int nBlockIdHigh; // 帧号高位
unsigned int nBlockIdLow; // 帧号低位
unsigned int nTimestampHigh; // 时间戳高位
unsigned int nTimestampLow; // 时间戳低位
void * pEventData; // Event数据
unsigned int nEventDataSize; // Event数据长度
unsigned int nReserved[16]; // 预留
}MV_CODEREADER_EVENT_OUT_INFO;
// 文件存取
typedef struct _MV_CODEREADER_FILE_ACCESS_T
{
const char * pUserFileName; // 用户文件名
const char * pDevFileName; // 设备文件名
unsigned int nReserved[32]; // 预留字节
}MV_CODEREADER_FILE_ACCESS;
// 文件存取进度
typedef struct _MV_CODEREADER_FILE_ACCESS_PROGRESS_T
{
int64_t nCompleted; // 已完成的长度
int64_t nTotal; // 总长度
unsigned int nReserved[8]; // 预留字节
}MV_CODEREADER_FILE_ACCESS_PROGRESS;
// Enum类型值
typedef struct _MV_CODEREADER_ENUMVALUE_T
{
unsigned int nCurValue; // 当前值
unsigned int nSupportedNum; // 有效数据个数
unsigned int nSupportValue[MV_CODEREADER_MAX_XML_SYMBOLIC_NUM]; // 支持的枚举类型
unsigned int nReserved[4]; // 保留字节
}MV_CODEREADER_ENUMVALUE;
// Int类型值
typedef struct _MV_CODEREADER_INTVALUE_T
{
unsigned int nCurValue; // 当前值
unsigned int nMax; // 最大值
unsigned int nMin; // 最小值
unsigned int nInc; // 增量值
unsigned int nReserved[4]; // 保留字节
}MV_CODEREADER_INTVALUE;
// Int类型值
typedef struct _MV_CODEREADER_INTVALUE_EX_T
{
int64_t nCurValue; // 当前值
int64_t nMax; // 最大值
int64_t nMin; // 最小值
int64_t nInc; // 增量值
unsigned int nReserved[16]; // 保留字节
}MV_CODEREADER_INTVALUE_EX;
// Float类型值
typedef struct _MV_CODEREADER_FLOATVALUE_T
{
float fCurValue; // 当前值
float fMax; // 最大值
float fMin; // 最小值
unsigned int nReserved[4]; // 保留字节
}MV_CODEREADER_FLOATVALUE;
// String类型值
typedef struct _MV_CODEREADER_STRINGVALUE_T
{
char chCurValue[256]; // 当前值
int64_t nMaxLength; // 最大长度
unsigned int nReserved[2]; // 保留字节
}MV_CODEREADER_STRINGVALUE;
// Int型坐标
typedef struct _MV_CODEREADER_POINT_I_
{
int x; // x坐标
int y; // y坐标
}MV_CODEREADER_POINT_I;
// Float型坐标
typedef struct _MV_CODEREADER_POINT_F_
{
float x; // x坐标
float y; // y坐标
}MV_CODEREADER_POINT_F;
// 输出帧信息
typedef struct _MV_CODEREADER_IMAGE_OUT_INFO_
{
unsigned short nWidth; // 图像宽
unsigned short nHeight; // 图像高
enum MvCodeReaderGvspPixelType enPixelType; // 像素或图片格式
unsigned int nTriggerIndex; // 触发序号
unsigned int nFrameNum; // 帧号
unsigned int nFrameLen; // 当前帧数据大小
unsigned int nTimeStampHigh; // 时间戳高32位
unsigned int nTimeStampLow; // 时间戳低32位
unsigned int nResultType; // 输出消息类型
unsigned char chResult[MV_CODEREADER_MAX_RESULT_SIZE]; // 根据消息类型对应不同结构体
bool bIsGetCode; // 是否读到条码
unsigned char* pImageWaybill; // 面单图像
unsigned int nImageWaybillLen; // 面单数据大小
enum MV_CODEREADER_IAMGE_TYPE enWaybillImageType; // 面单图像类型
unsigned int bFlaseTrigger; // 是否误触发
unsigned int nFocusScore; // 聚焦得分
unsigned int nChannelID; // 对应Stream通道序号
unsigned int nImageCost; // 帧图像在相机内部的处理耗时
unsigned int nReserved[6]; // 保留字节
}MV_CODEREADER_IMAGE_OUT_INFO;
// 条码信息
typedef struct _MV_CODEREADER_BCR_INFO_
{
unsigned int nID; // 条码ID
char chCode[MV_CODEREADER_MAX_BCR_CODE_LEN]; // 字符
unsigned int nLen; // 字符长度
unsigned int nBarType; // 条码类型
MV_CODEREADER_POINT_I pt[4]; // 条码位置
// 一维码以图像x正轴为基准顺时针0-3600度二维码以图像x正轴为基准逆时针0-3600度
int nAngle; // 条码角度(10倍)0~3600
unsigned int nMainPackageId; // 主包ID
unsigned int nSubPackageId; // 次包ID
unsigned short sAppearCount; // 条码被识别的次数
unsigned short sPPM; // PPM(10倍)
unsigned short sAlgoCost; // 算法耗时
unsigned short sSharpness; // 图像清晰度(10倍)
} MV_CODEREADER_BCR_INFO;
// 条码信息列表
typedef struct _MV_CODEREADER_RESULT_BCR_
{
unsigned int nCodeNum; // 条码数量
MV_CODEREADER_BCR_INFO stBcrInfo[MAX_CODEREADER_BCR_COUNT]; // 条码信息
unsigned int nReserved[4]; // 保留字节
}MV_CODEREADER_RESULT_BCR;
// 条码质量质量分5等[0,4], 越高等质量越好; 1D指一维码2D指二维码
typedef struct _MV_CODEREADER_CODE_INFO_
{
// 等级
int nOverQuality; // 总体质量评分1D/2D共用
int nDeCode; // 译码评分1D/2D共用
int nSCGrade; // Symbol Contrast对比度质量评分1D/2D共用
int nModGrade; // modulation模块均匀性评分1D/2D共用
// 2D等级
int nFPDGrade; // fixed_pattern_damage评分
int nANGrade; // axial_nonuniformity码轴规整性评分
int nGNGrade; // grid_nonuniformity基础grid均匀性质量评分
int nUECGrade; // unused_error_correction未使用纠错功能评分
int nPGHGrade; // Print Growth Horizontal 打印伸缩(水平)评分
int nPGVGrade; // Print Growth Veritical 打印伸缩(垂直)评分
// 分数
float fSCScore; // Symbol Contrast对比度质量分数1D/2D共用
float fModScore; // modulation模块均匀性分数1D/2D共用
// 2D分数
float fFPDScore; // fixed_pattern_damage分数
float fAnScore; // axial_nonuniformity码轴规整性分数
float fGNScore; // grid_nonuniformity基础grid均匀性质量分数
float fUECScore; // unused_error_correction未使用纠错功能分数
float fPGHScore; // Print Growth Horizontal 打印伸缩(水平)分数
float fPGVScore; // Print Growth Veritical 打印伸缩(垂直)分数
int nRMGrade; // reflectance margin反射率余量评分
float fRMScore; // reflectance margin反射率余量分数
// 1D等级
int n1DEdgeGrade; // edge determination 边缘确定度质量等级
int n1DMinRGrade; // minimum reflectance 最小反射率质量等级
int n1DMinEGrade; // minimum edge contrast 最小边缘对比度质量等级
int n1DDcdGrade; // decodability 可译码性质量等级
int n1DDefGrade; // defects 缺陷质量等级
int n1DQZGrade; // quiet zone 静区质量等级
// 1D分数
float f1DEdgeScore; // edge determination 边缘确定度分数
float f1DMinRScore; // minimum reflectance 最小反射率分数
float f1DMinEScore; // minimum edge contrast 最小边缘对比度分数
float f1DDcdScore; // decodability 可译码性分数
float f1DDefScore; // defects 缺陷分数
float f1DQZScore; // quiet zone 静区分数
int nReserved[18]; //预留
} MV_CODEREADER_CODE_INFO;
// 带质量信息的BCR信息
typedef struct _MV_CODEREADER_BCR_INFO_EX_
{
unsigned int nID; // 条码ID
char chCode[MV_CODEREADER_MAX_BCR_CODE_LEN]; // 字符识别长度为256
unsigned int nLen; // 字符长度
unsigned int nBarType; // 条码类型
MV_CODEREADER_POINT_I pt[4]; // 条码位置
MV_CODEREADER_CODE_INFO stCodeQuality; // 条码质量评价
// 一维码以图像x正轴为基准顺时针0-3600度二维码以图像x正轴为基准逆时针0-3600度
int nAngle; // 条码角度(10倍)0~3600
unsigned int nMainPackageId; // 主包ID
unsigned int nSubPackageId; // 次包ID
unsigned short sAppearCount; // 条码被识别的次数
unsigned short sPPM; // PPM(10倍)
unsigned short sAlgoCost; // 算法耗时(ms)
unsigned short sSharpness; // 清晰度
bool bIsGetQuality; // 是否支持二维码质量评级
unsigned int nIDRScore; // 读码评分
unsigned int n1DIsGetQuality; // 是否支持一维码质量评级(0-不支持 1-支持)
unsigned int nTotalProcCost; // 从触发开始到APP输出时间统计(ms)
unsigned int nTriggerTimeTvHigh; // 触发开始时间高32位(s)
unsigned int nTriggerTimeTvLow; // 触发开始时间低32位(s)
unsigned int nTriggerTimeUtvHigh; // 触发开始时间低32位(us)
unsigned int nTriggerTimeUtvLow; // 触发开始时间低32位(us)
unsigned int nReserved[24]; // 预留
} MV_CODEREADER_BCR_INFO_EX;
// 条码信息加条码质量列表
typedef struct _MV_CODEREADER_RESULT_BCR_EX_
{
unsigned int nCodeNum; // 条码数量
MV_CODEREADER_BCR_INFO_EX stBcrInfoEx[MAX_CODEREADER_BCR_COUNT]; // 条码信息
unsigned int nReserved[4]; // 保留字节
}MV_CODEREADER_RESULT_BCR_EX;
// 带质量信息且条码字符扩展的BCR信息
typedef struct _MV_CODEREADER_BCR_INFO_EX_2_
{
unsigned int nID; // 条码ID
char chCode[MV_CODEREADER_MAX_BCR_CODE_LEN_EX]; // 字符可识别长度扩展至4096
unsigned int nLen; // 字符实际真实长度
unsigned int nBarType; // 条码类型
MV_CODEREADER_POINT_I pt[4]; // 条码位置
MV_CODEREADER_CODE_INFO stCodeQuality; // 条码质量评价
// 一维码以图像x正轴为基准顺时针0-3600度二维码以图像x正轴为基准逆时针0-3600度
int nAngle; // 条码角度(10倍)0~3600
unsigned int nMainPackageId; // 主包ID
unsigned int nSubPackageId; // 次包ID
unsigned short sAppearCount; // 条码被识别的次数
unsigned short sPPM; // PPM(10倍)
unsigned short sAlgoCost; // 算法耗时(ms)
unsigned short sSharpness; // 清晰度
bool bIsGetQuality; // 是否支持二维码质量评级
unsigned int nIDRScore; // 读码评分
unsigned int n1DIsGetQuality; // 是否支持一维码质量评级(0-不支持 1-支持)
unsigned int nTotalProcCost; // 从触发开始到APP输出时间统计(ms)
unsigned int nTriggerTimeTvHigh; // 触发开始时间高32位(s)
unsigned int nTriggerTimeTvLow; // 触发开始时间低32位(s)
unsigned int nTriggerTimeUtvHigh; // 触发开始时间低32位(us)
unsigned int nTriggerTimeUtvLow; // 触发开始时间低32位(us)
int nReserved[59]; // 预留
} MV_CODEREADER_BCR_INFO_EX2;
// 条码信息字符扩展加条码质量列表
typedef struct _MV_CODEREADER_RESULT_BCR_EX_2_
{
unsigned int nCodeNum; // 条码数量(扩展)
MV_CODEREADER_BCR_INFO_EX2 stBcrInfoEx2[MAX_CODEREADER_BCR_COUNT_EX]; // 条码信息(条码字符扩展)
unsigned int nReserved[8]; // 保留字节
}MV_CODEREADER_RESULT_BCR_EX2;
// 抠图面单信息
typedef struct _MV_CODEREADER_WAYBILL_INFO_
{
// 面单坐标信息
float fCenterX; // 中心点列坐标
float fCenterY; // 中心点行坐标
float fWidth; // 矩形宽度,宽度为长半轴
float fHeight; // 矩形高度,高度为短半轴
float fAngle; // 矩形角度
float fConfidence; // 置信度
// 面单图片
unsigned char* pImageWaybill;
unsigned int nImageLen;
unsigned int nOcrRowNum; // 当前面单内的ocr行数
unsigned int nReserved[11];
}MV_CODEREADER_WAYBILL_INFO;
// 面单信息列表
typedef struct _MV_CODEREADER_WAYBILL_LIST_
{
unsigned int nWaybillNum; // 面单数量
enum MV_CODEREADER_IAMGE_TYPE enWaybillImageType; // 面单图像类型可选择bmp、raw、jpg输出
MV_CODEREADER_WAYBILL_INFO stWaybillInfo[MAX_CODEREADER_WAYBILL_COUNT]; // 面单信息
unsigned int nOcrAllNum; // 所有面单内的OCR总行数 面单1(ocr)+面单2(ocr)+...
unsigned int nReserved[3]; // 保留字节
}MV_CODEREADER_WAYBILL_LIST;
// OCR基础信息
typedef struct _MV_CODEREADER_OCR_ROW_INFO_
{
unsigned int nID; // OCR ID
unsigned int nOcrLen; // OCR字符实际真实长度
char chOcr[MV_CODEREADER_MAX_OCR_LEN]; // 识别到的OCR字符
float fCharConfidence; // 字符行整体置信度
unsigned int nOcrRowCenterX; // 单行OCR中心点列坐标
unsigned int nOcrRowCenterY; // 单行OCR中心点行坐标
unsigned int nOcrRowWidth; // 单行OCR矩形宽度宽度为长半轴
unsigned int nOcrRowHeight; // 单行OCR矩形高度高度为短半轴
float fOcrRowAngle; // 单行OCR矩形角度
float fDeteConfidence; // 单行OCR定位置信度
unsigned short sOcrAlgoCost; // OCR算法耗时 单位ms
unsigned short sReserved; // 预留
int nReserved[31];
}MV_CODEREADER_OCR_ROW_INFO;
// OCR信息列表
typedef struct _MV_CODEREADER_OCR_INFO_LIST_
{
unsigned int nOCRAllNum; // 所有面单内的OCR总行数
MV_CODEREADER_OCR_ROW_INFO stOcrRowInfo[MAX_CODEREADER_OCR_COUNT]; // OCR行基础信息
int nReserved[8]; // 保留字节
}MV_CODEREADER_OCR_INFO_LIST;
// 图像输出信息扩展(OCR信息)
typedef struct _MV_CODEREADER_IMAGE_OUT_INFO_EX_
{
unsigned short nWidth; // 图像宽
unsigned short nHeight; // 图像高
enum MvCodeReaderGvspPixelType enPixelType; // 像素或图片格式
unsigned int nTriggerIndex; // 触发序号
unsigned int nFrameNum; // 帧号
unsigned int nFrameLen; // 当前帧数据大小
unsigned int nTimeStampHigh; // 时间戳高32位
unsigned int nTimeStampLow; // 时间戳低32位
unsigned int bFlaseTrigger; // 是否误触发
unsigned int nFocusScore; // 聚焦得分
bool bIsGetCode; // 是否读到条码
MV_CODEREADER_RESULT_BCR* pstCodeList; // 条码信息列表
MV_CODEREADER_WAYBILL_LIST* pstWaybillList; // 面单信息
unsigned int nEventID; // 事件ID
unsigned int nChannelID; // 对应Stream通道序号
unsigned int nImageCost; // 帧图像在相机内部的处理耗时
union
{
MV_CODEREADER_OCR_INFO_LIST* pstOcrList; // OCR信息
int64_t nAligning;
}UnparsedOcrList;
unsigned int nReserved[4]; // 保留字节
}MV_CODEREADER_IMAGE_OUT_INFO_EX;
// 图像输出信息扩展(条码信息扩展条码最大个数条码字符长度扩展为4096)
typedef struct _MV_CODEREADER_IMAGE_OUT_INFO_EX_2_
{
unsigned short nWidth; // 图像宽
unsigned short nHeight; // 图像高
enum MvCodeReaderGvspPixelType enPixelType; // 像素或图片格式
unsigned int nTriggerIndex; // 触发序号
unsigned int nFrameNum; // 帧号
unsigned int nFrameLen; // 当前帧数据大小
unsigned int nTimeStampHigh; // 时间戳高32位
unsigned int nTimeStampLow; // 时间戳低32位
unsigned int bFlaseTrigger; // 是否误触发
unsigned int nFocusScore; // 聚焦得分
bool bIsGetCode; // 是否读到条码
MV_CODEREADER_RESULT_BCR_EX* pstCodeListEx; // 条码信息列表
MV_CODEREADER_WAYBILL_LIST* pstWaybillList; // 面单信息
unsigned int nEventID; // 事件ID
unsigned int nChannelID; // 对应Stream通道序号
unsigned int nImageCost; // 帧图像在相机内部的处理耗时
union
{
MV_CODEREADER_RESULT_BCR_EX2* pstCodeListEx2; // 条码信息(条码字符长度扩展)建议以该扩展条码字符的条码信息解析条码
int64_t nAligning;
}UnparsedBcrList;
union
{
MV_CODEREADER_OCR_INFO_LIST* pstOcrList; // OCR信息
int64_t nAligning;
}UnparsedOcrList;
unsigned int nReserved[26]; // 保留字节
}MV_CODEREADER_IMAGE_OUT_INFO_EX2;
// 触发信息
typedef struct _MV_CODEREADER_TRIGGER_INFO_DATA_
{
unsigned int nTriggerIndex; // 触发序号 即同步触发号
unsigned int nTriggerFlag; //触发状态 1开始 0结束
// 当前的触发状态对应的时间戳分高、低位传输各4个字节
unsigned int nTriggerTimeHigh; // 触发时间高4位
unsigned int nTriggerTimeLow; // 触发时间低4位
unsigned int nOriginalTrigger; // 原生触发号(相机自带的触发号)
unsigned short nIsForceOver; // 是否强制结束0--正常结束 1--强制结束 属于相机内部机制主动传输 上层无法设置生效)
unsigned short nIsMainCam; // 主从标记 1--主相机 0--从相机
int64_t nHostTimeStamp; // 主机生成的时间戳
unsigned int reserved[30]; // 预留
}MV_CODEREADER_TRIGGER_INFO_DATA;
// 触发模式
typedef enum _MV_CODEREADER_TRIGGER_MODE_
{
MV_CODEREADER_TRIGGER_MODE_OFF = 0, // 触发关闭
MV_CODEREADER_TRIGGER_MODE_ON = 1, // 触发打开
}MV_CODEREADER_TRIGGER_MODE;
// 触发源
typedef enum _MV_CODEREADER_TRIGGER_SOURCE_
{
MV_CODEREADER_TRIGGER_SOURCE_LINE0 = 0, // Line0
MV_CODEREADER_TRIGGER_SOURCE_LINE1 = 1, // Line1
MV_CODEREADER_TRIGGER_SOURCE_LINE2 = 2, // Line2
MV_CODEREADER_TRIGGER_SOURCE_LINE3 = 3, // Line3
MV_CODEREADER_TRIGGER_SOURCE_COUNTER0 = 4, // 计数器0触发
MV_CODEREADER_TRIGGER_SOURCE_TCPSERVERSTART = 5, // Tcp服务器触发
MV_CODEREADER_TRIGGER_SOURCE_UDPSTART = 6, // Udp触发
MV_CODEREADER_TRIGGER_SOURCE_SOFTWARE = 7, // 软触发
MV_CODEREADER_TRIGGER_SOURCE_SERIALSTART = 8, // 串口触发
MV_CODEREADER_TRIGGER_SOURCE_SELFTRIGGER = 9, // 自触发
MV_CODEREADER_TRIGGER_SOURCE_MAINSUB = 10, // 主从触发
MV_CODEREADER_TRIGGER_SOURCE_TCPCLIENTSTART = 12, // Tcp客户端触发
}MV_CODEREADER_TRIGGER_SOURCE;
// 条码类型
typedef enum _MV_CODEREADER_CODE_TYPE_
{
MV_CODEREADER_CODE_NONE = 0, // 无可识别条码
// 二维码
MV_CODEREADER_TDCR_DM = 1, // DM码
MV_CODEREADER_TDCR_QR = 2, // QR码
MV_CODEREADER_TDCR_MICROQR = 140, // MicroQR码
// 一维码
MV_CODEREADER_BCR_EAN8 = 8, // EAN8码
MV_CODEREADER_BCR_UPCE = 9, // UPCE码
MV_CODEREADER_BCR_UPCA = 12, // UPCA码
MV_CODEREADER_BCR_EAN13 = 13, // EAN13码
MV_CODEREADER_BCR_ISBN13 = 14, // ISBN13码
MV_CODEREADER_BCR_CODABAR = 20, // 库德巴码
MV_CODEREADER_BCR_ITF25 = 25, // 交叉25码
MV_CODEREADER_BCR_CODE39 = 39, // Code 39
MV_CODEREADER_BCR_CODE93 = 93, // Code 93
MV_CODEREADER_BCR_CODE128 = 128, // Code 128
MV_CODEREADER_TDCR_PDF417 = 131, // PDF417码
MV_CODEREADER_BCR_MATRIX25 = 26, // MATRIX25码
MV_CODEREADER_BCR_MSI = 30, // MSI码
MV_CODEREADER_BCR_CODE11 = 31, // code11
MV_CODEREADER_BCR_INDUSTRIAL25 = 32, // industrial25
MV_CODEREADER_BCR_CHINAPOST = 33, // 中国邮政码
MV_CODEREADER_BCR_ITF14 = 27, // 交叉14码
MV_CODEREADER_BCR_PHARMACODE = 36, // Pharmacode码
MV_CODEREADER_BCR_PHARMACODE2D = 37, // Pharmacode Two Track码
MV_CODEREADER_TDCR_ECC140 = 133, // ECC140码制
MV_CODEREADER_TDCR_AZTEC = 132, // AZTEC码
}MV_CODEREADER_CODE_TYPE;
// 节点访问模式
enum MV_CODEREADER_XML_AccessMode
{
MV_CODEREADER_AM_NI, // 节点未实现
MV_CODEREADER_AM_NA, // 节点不可达
MV_CODEREADER_AM_WO, // 节点只写
MV_CODEREADER_AM_RO, // 节点只读
MV_CODEREADER_AM_RW, // 节点可读可写
MV_CODEREADER_AM_Undefined, // 节点未定义
MV_CODEREADER_AM_CycleDetect, // 节点需周期检测
};
// 每个节点对应的接口类型
enum MV_CODEREADER_XML_InterfaceType
{
MV_CODEREADER_IFT_IValue, // Value类型值
MV_CODEREADER_IFT_IBase, // Base类型值
MV_CODEREADER_IFT_IInteger, // Integer类型值
MV_CODEREADER_IFT_IBoolean, // Boolean类型值
MV_CODEREADER_IFT_ICommand, // Command类型值
MV_CODEREADER_IFT_IFloat, // Float类型值
MV_CODEREADER_IFT_IString, // String类型值
MV_CODEREADER_IFT_IRegister, // Register类型值
MV_CODEREADER_IFT_ICategory, // Category类型值
MV_CODEREADER_IFT_IEnumeration, // Enumeration类型值
MV_CODEREADER_IFT_IEnumEntry, // EnumEntry类型值
MV_CODEREADER_IFT_IPort, // Port类型值
};
// 输出信息类型
enum MvCodeReaderType
{
CodeReader_ResType_NULL = 0, // 没有结果输出
CodeReader_ResType_BCR = 1, // 输出信息为BCR(对应结构体 MV_CODEREADER_RESULT_BCR)
};
/************************************************************************/
/* 升级相关高级参数 */
/************************************************************************/
// 设备运行状态
enum MV_CODEREADER_PROGRAM_STATE
{
MV_CODEREADER_PROGRAM_UNKNOWN, // 未知状态
MV_CODEREADER_PROGRAM_RUNNING, // 设备正在运行
MV_CODEREADER_PROGRAM_STOP // 设备停止运行
};
// 设备当前连接状态
typedef enum _MV_CODEREADER_DEVICE_CONNECT_STATUS_
{
MV_CODEREADER_DEVICE_STATUS_FREE = 1, // 空闲状态
MV_CODEREADER_DEVICE_STATUS_BASE = 2, // 第三方连接状态
}MV_CODEREADER_DEVICE_CONNECT_STATUS;
//明场/暗场矫正模式
typedef enum _MV_CODEREADER_FIELD_CORRECT_MODE_
{
MV_CODEREADER_DARK_FILED_CORRECT = 0, // 暗场校验
MV_CODEREADER_BRIGHT_FILED_CORRECT = 1, // 明场校验
MV_CODEREADER_INVAILED_FILED_CORRECT = 2, // 无效校验
}MV_CODEREADER_FIELD_CORRECT_MODE;
#endif /* _MV_CODEREADER_PARAMS_H_ */

View File

@ -0,0 +1,139 @@
#ifndef _MV_CODEREADER_PIXEL_TYPE_H_
#define _MV_CODEREADER_PIXEL_TYPE_H_
/************************************************************************/
/* GigE Vision (2.0.03) PIXEL FORMATS */
/************************************************************************/
// Indicate if pixel is monochrome or RGB
#define MV_CODEREADER_GVSP_PIX_MONO 0x01000000
#define MV_CODEREADER_GVSP_PIX_RGB 0x02000000 // deprecated in version 1.1
#define MV_CODEREADER_GVSP_PIX_COLOR 0x02000000
#define MV_CODEREADER_GVSP_PIX_CUSTOM 0x80000000
#define MV_CODEREADER_GVSP_PIX_COLOR_MASK 0xFF000000
// Indicate effective number of bits occupied by the pixel (including padding).
// This can be used to compute amount of memory required to store an image.
#define MV_CODEREADER_PIXEL_BIT_COUNT(n) ((n) << 16)
#define MV_CODEREADER_GVSP_PIX_EFFECTIVE_PIXEL_SIZE_MASK 0x00FF0000
#define MV_CODEREADER_GVSP_PIX_EFFECTIVE_PIXEL_SIZE_SHIFT 16
// Pixel ID: lower 16-bit of the pixel formats
#define MV_CODEREADER_GVSP_PIX_ID_MASK 0x0000FFFF
#define MV_CODEREADER_GVSP_PIX_COUNT 0x46 // next Pixel ID available
enum MvCodeReaderGvspPixelType
{
// Undefined pixel type
#ifdef WIN32
PixelType_CodeReader_Gvsp_Undefined = 0xFFFFFFFF,
#else
PixelType_CodeReader_Gvsp_Undefined = -1,
#endif
// Mono buffer format defines
PixelType_CodeReader_Gvsp_Mono1p = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(1) | 0x0037),
PixelType_CodeReader_Gvsp_Mono2p = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(2) | 0x0038),
PixelType_CodeReader_Gvsp_Mono4p = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(4) | 0x0039),
PixelType_CodeReader_Gvsp_Mono8 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(8) | 0x0001),
PixelType_CodeReader_Gvsp_Mono8_Signed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(8) | 0x0002),
PixelType_CodeReader_Gvsp_Mono10 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0003),
PixelType_CodeReader_Gvsp_Mono10_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x0004),
PixelType_CodeReader_Gvsp_Mono12 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0005),
PixelType_CodeReader_Gvsp_Mono12_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x0006),
PixelType_CodeReader_Gvsp_Mono14 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0025),
PixelType_CodeReader_Gvsp_Mono16 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0007),
// Bayer buffer format defines
PixelType_CodeReader_Gvsp_BayerGR8 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(8) | 0x0008),
PixelType_CodeReader_Gvsp_BayerRG8 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(8) | 0x0009),
PixelType_CodeReader_Gvsp_BayerGB8 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(8) | 0x000A),
PixelType_CodeReader_Gvsp_BayerBG8 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(8) | 0x000B),
PixelType_CodeReader_Gvsp_BayerGR10 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x000C),
PixelType_CodeReader_Gvsp_BayerRG10 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x000D),
PixelType_CodeReader_Gvsp_BayerGB10 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x000E),
PixelType_CodeReader_Gvsp_BayerBG10 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x000F),
PixelType_CodeReader_Gvsp_BayerGR12 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0010),
PixelType_CodeReader_Gvsp_BayerRG12 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0011),
PixelType_CodeReader_Gvsp_BayerGB12 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0012),
PixelType_CodeReader_Gvsp_BayerBG12 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0013),
PixelType_CodeReader_Gvsp_BayerGR10_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x0026),
PixelType_CodeReader_Gvsp_BayerRG10_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x0027),
PixelType_CodeReader_Gvsp_BayerGB10_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x0028),
PixelType_CodeReader_Gvsp_BayerBG10_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x0029),
PixelType_CodeReader_Gvsp_BayerGR12_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x002A),
PixelType_CodeReader_Gvsp_BayerRG12_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x002B),
PixelType_CodeReader_Gvsp_BayerGB12_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x002C),
PixelType_CodeReader_Gvsp_BayerBG12_Packed = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x002D),
PixelType_CodeReader_Gvsp_BayerGR16 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x002E),
PixelType_CodeReader_Gvsp_BayerRG16 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x002F),
PixelType_CodeReader_Gvsp_BayerGB16 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0030),
PixelType_CodeReader_Gvsp_BayerBG16 = (MV_CODEREADER_GVSP_PIX_MONO | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0031),
// RGB Packed buffer format defines
PixelType_CodeReader_Gvsp_RGB8_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(24) | 0x0014),
PixelType_CodeReader_Gvsp_BGR8_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(24) | 0x0015),
PixelType_CodeReader_Gvsp_RGBA8_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(32) | 0x0016),
PixelType_CodeReader_Gvsp_BGRA8_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(32) | 0x0017),
PixelType_CodeReader_Gvsp_RGB10_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(48) | 0x0018),
PixelType_CodeReader_Gvsp_BGR10_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(48) | 0x0019),
PixelType_CodeReader_Gvsp_RGB12_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(48) | 0x001A),
PixelType_CodeReader_Gvsp_BGR12_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(48) | 0x001B),
PixelType_CodeReader_Gvsp_RGB16_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(48) | 0x0033),
PixelType_CodeReader_Gvsp_RGB10V1_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(32) | 0x001C),
PixelType_CodeReader_Gvsp_RGB10V2_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(32) | 0x001D),
PixelType_CodeReader_Gvsp_RGB12V1_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(36) | 0X0034),
PixelType_CodeReader_Gvsp_RGB565_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0035),
PixelType_CodeReader_Gvsp_BGR565_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0X0036),
// YUV Packed buffer format defines
PixelType_CodeReader_Gvsp_YUV411_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x001E),
PixelType_CodeReader_Gvsp_YUV422_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x001F),
PixelType_CodeReader_Gvsp_YUV422_YUYV_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0032),
PixelType_CodeReader_Gvsp_YUV444_Packed = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(24) | 0x0020),
PixelType_CodeReader_Gvsp_YCBCR8_CBYCR = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(24) | 0x003A),
PixelType_CodeReader_Gvsp_YCBCR422_8 = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x003B),
PixelType_CodeReader_Gvsp_YCBCR422_8_CBYCRY = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0043),
PixelType_CodeReader_Gvsp_YCBCR411_8_CBYYCRYY = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x003C),
PixelType_CodeReader_Gvsp_YCBCR601_8_CBYCR = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(24) | 0x003D),
PixelType_CodeReader_Gvsp_YCBCR601_422_8 = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x003E),
PixelType_CodeReader_Gvsp_YCBCR601_422_8_CBYCRY = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0044),
PixelType_CodeReader_Gvsp_YCBCR601_411_8_CBYYCRYY = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x003F),
PixelType_CodeReader_Gvsp_YCBCR709_8_CBYCR = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(24) | 0x0040),
PixelType_CodeReader_Gvsp_YCBCR709_422_8 = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0041),
PixelType_CodeReader_Gvsp_YCBCR709_422_8_CBYCRY = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(16) | 0x0045),
PixelType_CodeReader_Gvsp_YCBCR709_411_8_CBYYCRYY = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(12) | 0x0042),
// RGB Planar buffer format defines
PixelType_CodeReader_Gvsp_RGB8_Planar = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(24) | 0x0021),
PixelType_CodeReader_Gvsp_RGB10_Planar = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(48) | 0x0022),
PixelType_CodeReader_Gvsp_RGB12_Planar = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(48) | 0x0023),
PixelType_CodeReader_Gvsp_RGB16_Planar = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(48) | 0x0024),
// 自定义的图片格式
PixelType_CodeReader_Gvsp_Jpeg = (MV_CODEREADER_GVSP_PIX_CUSTOM | MV_CODEREADER_PIXEL_BIT_COUNT(24) | 0x0001),
PixelType_CodeReader_Gvsp_Coord3D_ABC32f = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(96) | 0x00C0),
PixelType_CodeReader_Gvsp_Coord3D_ABC32f_Planar = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(96) | 0x00C1),
PixelType_CodeReader_Gvsp_Coord3D_AC32f = (MV_CODEREADER_GVSP_PIX_COLOR | MV_CODEREADER_PIXEL_BIT_COUNT(40) | 0x00C2),//0x024000C2, /* 3D coordinate A-C 32-bit floating point */
PixelType_CodeReader_Gvsp_COORD3D_DEPTH_PLUS_MASK = (0x82000000 | MV_CODEREADER_PIXEL_BIT_COUNT(28) | 0x0001),//0x82280001
};
//跨平台定义
//Cross Platform Definition
#ifdef WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#endif /* _MV_CODEREADER_PIXEL_TYPE_H_ */

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,594 @@
/*************************************************************************
* GLFW 3.3 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
*************************************************************************/
#ifndef _glfw3_native_h_
#define _glfw3_native_h_
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************
* Doxygen documentation
*************************************************************************/
/*! @file glfw3native.h
* @brief The header of the native access functions.
*
* This is the header file of the native access functions. See @ref native for
* more information.
*/
/*! @defgroup native Native access
* @brief Functions related to accessing native handles.
*
* **By using the native access functions you assert that you know what you're
* doing and how to fix problems caused by using them. If you don't, you
* shouldn't be using them.**
*
* Before the inclusion of @ref glfw3native.h, you may define zero or more
* window system API macro and zero or more context creation API macros.
*
* The chosen backends must match those the library was compiled for. Failure
* to do this will cause a link-time error.
*
* The available window API macros are:
* * `GLFW_EXPOSE_NATIVE_WIN32`
* * `GLFW_EXPOSE_NATIVE_COCOA`
* * `GLFW_EXPOSE_NATIVE_X11`
* * `GLFW_EXPOSE_NATIVE_WAYLAND`
*
* The available context API macros are:
* * `GLFW_EXPOSE_NATIVE_WGL`
* * `GLFW_EXPOSE_NATIVE_NSGL`
* * `GLFW_EXPOSE_NATIVE_GLX`
* * `GLFW_EXPOSE_NATIVE_EGL`
* * `GLFW_EXPOSE_NATIVE_OSMESA`
*
* These macros select which of the native access functions that are declared
* and which platform-specific headers to include. It is then up your (by
* definition platform-specific) code to handle which of these should be
* defined.
*/
/*************************************************************************
* System headers and types
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
// This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
// example to allow applications to correctly declare a GL_KHR_debug callback)
// but windows.h assumes no one will define APIENTRY before it does
#if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#include <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
#include <ApplicationServices/ApplicationServices.h>
typedef void* id;
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/* WGL is declared by windows.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/* NSGL is declared by Cocoa.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
#include <GL/glx.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
#include <EGL/egl.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
#include <GL/osmesa.h>
#endif
/*************************************************************************
* Functions
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
/*! @brief Returns the adapter device name of the specified monitor.
*
* @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
/*! @brief Returns the display device name of the specified monitor.
*
* @return The UTF-8 encoded display device name (for example
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `HWND` of the specified window.
*
* @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/*! @brief Returns the `HGLRC` of the specified window.
*
* @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
*
* @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
/*! @brief Returns the `NSWindow` of the specified window.
*
* @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/*! @brief Returns the `NSOpenGLContext` of the specified window.
*
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_X11)
/*! @brief Returns the `Display` used by GLFW.
*
* @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI Display* glfwGetX11Display(void);
/*! @brief Returns the `RRCrtc` of the specified monitor.
*
* @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
/*! @brief Returns the `RROutput` of the specified monitor.
*
* @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `Window` of the specified window.
*
* @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
/*! @brief Sets the current primary selection to the specified string.
*
* @param[in] string A UTF-8 encoded string.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The specified string is copied before this function
* returns.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref clipboard
* @sa glfwGetX11SelectionString
* @sa glfwSetClipboardString
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI void glfwSetX11SelectionString(const char* string);
/*! @brief Returns the contents of the current primary selection as a string.
*
* If the selection is empty or if its contents cannot be converted, `NULL`
* is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated.
*
* @return The contents of the selection as a UTF-8 encoded string, or `NULL`
* if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref
* glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the
* library is terminated.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref clipboard
* @sa glfwSetX11SelectionString
* @sa glfwGetClipboardString
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetX11SelectionString(void);
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
/*! @brief Returns the `GLXContext` of the specified window.
*
* @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
/*! @brief Returns the `GLXWindow` of the specified window.
*
* @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
/*! @brief Returns the `struct wl_display*` used by GLFW.
*
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
/*! @brief Returns the `struct wl_output*` of the specified monitor.
*
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
/*! @brief Returns the main `struct wl_surface*` of the specified window.
*
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
/*! @brief Returns the `EGLDisplay` used by GLFW.
*
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
/*! @brief Returns the `EGLContext` of the specified window.
*
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
/*! @brief Returns the `EGLSurface` of the specified window.
*
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
/*! @brief Retrieves the color buffer associated with the specified window.
*
* @param[in] window The window whose color buffer to retrieve.
* @param[out] width Where to store the width of the color buffer, or `NULL`.
* @param[out] height Where to store the height of the color buffer, or `NULL`.
* @param[out] format Where to store the OSMesa pixel format of the color
* buffer, or `NULL`.
* @param[out] buffer Where to store the address of the color buffer, or
* `NULL`.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
/*! @brief Retrieves the depth buffer associated with the specified window.
*
* @param[in] window The window whose depth buffer to retrieve.
* @param[out] width Where to store the width of the depth buffer, or `NULL`.
* @param[out] height Where to store the height of the depth buffer, or `NULL`.
* @param[out] bytesPerValue Where to store the number of bytes per depth
* buffer element, or `NULL`.
* @param[out] buffer Where to store the address of the depth buffer, or
* `NULL`.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
/*! @brief Returns the `OSMesaContext` of the specified window.
*
* @return The `OSMesaContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _glfw3_native_h_ */

View File

@ -0,0 +1,311 @@
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2018 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Khronos platform-specific types and definitions.
*
* The master copy of khrplatform.h is maintained in the Khronos EGL
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
* The last semantic modification to khrplatform.h was at commit ID:
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by filing pull requests or issues on
* the EGL Registry repository linked above.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
# define KHRONOS_STATIC 1
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(KHRONOS_STATIC)
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
* header compatible with static linking. */
# define KHRONOS_APICALL
#elif defined(_WIN32)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
/*
* To support platform where unsigned long cannot be used interchangeably with
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
* unsigned long long or similar (this results in different C++ name mangling).
* To avoid changes for existing platforms, we restrict usage of intptr_t to
* platforms where the size of a pointer is larger than the size of long.
*/
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
#define KHRONOS_USE_INTPTR_T
#endif
#endif
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef KHRONOS_USE_INTPTR_T
typedef intptr_t khronos_intptr_t;
typedef uintptr_t khronos_uintptr_t;
#elif defined(_WIN64)
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */

View File

@ -0,0 +1,489 @@
#ifndef _MV3D_RGBD_API_H_
#define _MV3D_RGBD_API_H_
#include "Mv3dRgbdDefine.h"
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************
* @~chinese
* @brief SDK版本号
* @param pstVersion [OUT]
* @return MV3D_RGBD_OK
* @~english
* @brief Get SDK Version
* @param pstVersion [OUT] version info
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetSDKVersion(MV3D_RGBD_VERSION_INFO* pstVersion);
/************************************************************************
* @~chinese
* @brief SDK运行环境初始化
* @return MV3D_RGBD_OK
* @~english
* @brief SDK run environment initialization
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_Initialize();
/************************************************************************
* @~chinese
* @brief SDK运行环境释放
* @return MV3D_RGBD_OK
* @~english
* @brief SDK run environment release
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_Release();
/************************************************************************
* @~chinese
* @brief
* @param nDeviceType [IN] ,Mv3dRgbdDeviceType,(DeviceType_Ethernet | DeviceType_USB | DeviceType_Ethernet_Vir | DeviceType_USB_Vir)
* @param pDeviceNumber [OUT]
* @return MV3D_RGBD_OK
* @~english
* @brief gets the number of devices in the current environment
* @param nDeviceType [IN] device typerefer to Mv3dRgbdDeviceTypeget all(DeviceType_Ethernet | DeviceType_USB | DeviceType_Ethernet_Vir | DeviceType_USB_Vir)
* @param pDeviceNumber [OUT] device number
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetDeviceNumber(uint32_t nDeviceType, uint32_t* pDeviceNumber);
/************************************************************************
* @~chinese
* @brief
* @param nDeviceType [IN] ,Mv3dRgbdDeviceType,(DeviceType_Ethernet | DeviceType_USB | DeviceType_Ethernet_Vir | DeviceType_USB_Vir)
* @param pstDeviceInfos [IN OUT]
* @param nMaxDeviceCount [IN]
* @param pDeviceCount [OUT]
* @return MV3D_RGBD_OK
* @~english
* @brief gets 3D cameras list
* @param nDeviceType [IN] device typerefer to Mv3dRgbdDeviceTypeget all(DeviceType_Ethernet | DeviceType_USB | DeviceType_Ethernet_Vir | DeviceType_USB_Vir)
* @param pstDeviceInfos [IN OUT] devices list
* @param nMaxDeviceCount [IN] max number of device list caches
* @param pDeviceCount [OUT] number of devices in the fill list
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetDeviceList(uint32_t nDeviceType, MV3D_RGBD_DEVICE_INFO* pstDeviceInfos, uint32_t nMaxDeviceCount, uint32_t* pDeviceCount);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN OUT]
* @param pstDeviceInfo [IN]
* @return MV3D_RGBD_OK
* @remark RGB Chunk
* @~english
* @brief open device
* @param handle [IN OUT] camera handle
* @param pstDeviceInfo [IN] enum camera info. the default is null, open first camera
* @return Success, return MV3D_RGBD_OK. Failure, return error code
* @remark Set working mode to depth, image mode to depth, and open RGB Chunk
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_OpenDevice(HANDLE *handle, MV3D_RGBD_DEVICE_INFO* pstDeviceInfo = NULL);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN OUT]
* @param chDeviceName [IN]
* @return MV3D_RGBD_OK
* @remark RGB Chunk
* @~english
* @brief open device by device user defined name
* @param handle [IN OUT] camera handle
* @param chDeviceName [IN] device user defined name
* @return Success, return MV3D_RGBD_OK. Failure, return error code
* @remark Set working mode to depth, image mode to depth, and open RGB Chunk
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_OpenDeviceByName(HANDLE *handle, const char* chDeviceName);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN OUT]
* @param chSerialNumber [IN]
* @return MV3D_RGBD_OK
* @remark RGB Chunk
* @~english
* @brief open device by serial number
* @param handle [IN OUT] camera handle
* @param chSerialNumber [IN] serial number
* @return Success, return MV3D_RGBD_OK. Failure, return error code
* @remark Set working mode to depth, image mode to depth, and open RGB Chunk
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_OpenDeviceBySerialNumber(HANDLE *handle, const char* chSerialNumber);
/************************************************************************
* @~chinese
* @brief IP打开设备,
* @param handle [IN OUT]
* @param chIP [IN] IP地址
* @return MV3D_RGBD_OK
* @remark RGB Chunk
* @~english
* @brief open device by iponly network device is valid
* @param handle [IN OUT] camera handle
* @param chIP [IN] IP
* @return Success, return MV3D_RGBD_OK. Failure, return error code
* @remark Set working mode to depth, image mode to depth, and open RGB Chunk
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_OpenDeviceByIp(HANDLE *handle, const char* chIP);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief close Device
* @param handle [IN] camera handle
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_CloseDevice(HANDLE *handle);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pstDevInfo [IN][OUT]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief get current device information
* @param handle [IN] camera handle
* @param pstDevInfo [IN][OUT] structure pointer of device information
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetDeviceInfo(HANDLE handle, MV3D_RGBD_DEVICE_INFO* pstDevInfo);
/************************************************************************
* @~chinese
* @brief IP,
* @param chSerialNumber [IN]
* @param pstIPConfig [IN] IP配置IPDHCP等
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief ip configurationonly network device is valid
* @param chSerialNumber [IN] serial number
* @param pstIPConfig [IN] IP Config, Static IPDHCP
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_SetIpConfig(const char* chSerialNumber, MV3D_RGBD_IP_CONFIG* pstIPConfig);
/***********************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param cbOutput [IN]
* @param pUser [IN]
* @return MV3D_RGBD_OK
* @remark NULL时,
* @~english
* @brief register image data callback
* @param handle [IN] camera handle
* @param cbOutput [IN] callback function pointer
* @param pUser [IN] user defined variable
* @return Success, return MV3D_RGBD_OK. Failure, return error code
* @remark Cancel callback registration when pUser is NULL
***********************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_RegisterFrameCallBack(HANDLE handle, MV3D_RGBD_FrameDataCallBack cbOutput, void* pUser);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param cbException [IN]
* @param pUser [IN]
* @return
* @~english
* @brief register exception message callBack
* @param handle: [IN] camera handle
* @param cbException [IN] exception message callback function pointer
* @param pUser [IN] user defined variable
* @return Refer to error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_RegisterExceptionCallBack(HANDLE handle, MV3D_RGBD_ExceptionCallBack cbException, void* pUser);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pstStreamCfgList [IN][OUT]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief get stream cfg list before start working
* @param handle [IN] camera handle
* @param pstStreamCfgList [IN][OUT] structure pointer of stream cfg list
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetStreamCfgList(HANDLE handle, MV3D_RGBD_STREAM_CFG_LIST* pstStreamCfgList);
/***********************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief start working
* @param handle [IN] camera handle
* @return Success, return MV3D_RGBD_OK. Failure, return error code
***********************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_Start(HANDLE handle);
/***********************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief stop working
* @param handle [IN] camera handle
* @return Success, return MV3D_RGBD_OK. Failure, return error code
***********************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_Stop(HANDLE handle);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pstFrameData [IN][OUT]
* @param nTimeOut [IN] (ms)
* @return MV3D_RGBD_OK
* @~english
* @brief fetch frame data
* @param handle [IN] camera handle
* @param pstFrameData [IN] data set pointer
* @param nTimeOut [IN] timevalue(ms)
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_FetchFrame(HANDLE handle, MV3D_RGBD_FRAME_DATA* pstFrameData, uint32_t nTimeOut);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @return ,MV3D_RGBD_OK,,
* @remark
* @~english
* @brief execute camera soft trigger
* @param handle [IN] camera handle
* @return Success, return MV3D_RGBD_OK. Failure, return error code
* @remark Set trigger mode to open, trigger source to software, and excute soft trigger
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_SoftTrigger(HANDLE handle);
/************************************************************************
* @~chinese
* @brief Command命令
* @param handle [IN]
* @param strKey [IN]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief execute camera command
* @param handle [IN] camera handle
* @param strKey [IN] key value
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_Execute(HANDLE handle, const char* strKey);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param nCoordinateType [IN] Mv3dRgbdCoordinateType
* @param pstCalibInfo [IN][OUT]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief get camera current calibration info
* @param handle [IN] camera handle
* @param nCoordinateType [IN] coordinate type, refer to Mv3dRgbdCoordinateType
* @param pstCalibInfo [IN][OUT] calibration info
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetCalibInfo(HANDLE handle, uint32_t nCoordinateType, MV3D_RGBD_CALIB_INFO* pstCalibInfo);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pstCameraParam [IN][OUT]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief get camera intrinsic and extrinsic information
* @param handle [IN] camera handle
* @param pstCameraParam [IN][OUT] camera intrinsic and extrinsic Info
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetCameraParam(HANDLE handle, MV3D_RGBD_CAMERA_PARAM* pstCameraParam);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pFilePathName [IN]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief device upgrade
* @param handle [IN] camera handle
* @param pFilePathName [IN] file name
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_LocalUpgrade(HANDLE handle, const char* pFilePathName);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pProcess [OUT]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief get upgrade progress
* @param handle [IN] camera handle
* @param pProcess [OUT] progress receiving address
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetUpgradeProcess(HANDLE handle, uint32_t* pProcess);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param strKey [IN]
* @param pstParam [IN]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief get camera param value
* @param handle [IN] camera handle
* @param strKey [IN] key value
* @param pstParam [IN] structure pointer of camera param
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetParam(HANDLE handle, const char* strKey, MV3D_RGBD_PARAM* pstParam);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param strKey [IN]
* @param pstParam [IN]
* @return ,MV3D_RGBD_OK,,
* @~english
* @brief set camera param value
* @param handle [IN] camera handle
* @param strKey [IN] key value
* @param pstParam [IN] structure pointer of camera param
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_SetParam(HANDLE handle, const char* strKey, MV3D_RGBD_PARAM* pstParam);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pOutFileName [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief export camera param
* @param handle [IN] camera handle
* @param pOutFileName [IN] export file name
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_ExportAllParam(HANDLE handle, const char* pOutFileName);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pInFileName [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief import camera param
* @param handle [IN] camera handle
* @param pInFileName [IN] import file name
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_ImportAllParam(HANDLE handle, const char* pInFileName);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pstFileAccess [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief read the file from the camera
* @param handle [IN] camera handle
* @param pstFileAccess [IN] file access structure
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_FileAccessRead(void* handle, MV3D_RGBD_FILE_ACCESS* pstFileAccess);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pstFileAccess [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief write the file to camera
* @param handle [IN] camera handle
* @param pstFileAccess [IN] file access structure
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_FileAccessWrite(void* handle, MV3D_RGBD_FILE_ACCESS* pstFileAccess);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pstFileAccessProgress [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief get file access progress
* @param handle [IN] camera handle
* @param pstFileAccessProgress [IN] file access progress structure
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_GetFileAccessProgress(void* handle, MV3D_RGBD_FILE_ACCESS_PROGRESS* pstFileAccessProgress);
#ifdef __cplusplus
}
#endif
#endif // _MV3D_RGBD_API_H_

View File

@ -0,0 +1,512 @@
#ifndef _MV3D_RGBD_DEFINE_H_
#define _MV3D_RGBD_DEFINE_H_
#ifndef MV3D_RGBD_API
#if (defined (_WIN32) || defined(WIN64))
#if defined(MV3D_RGBD_EXPORTS)
#define MV3D_RGBD_API __declspec(dllexport)
#else
#define MV3D_RGBD_API __declspec(dllimport)
#endif
#else
#ifndef __stdcall
#define __stdcall
#endif
#ifndef MV3D_RGBD_API
#define MV3D_RGBD_API
#endif
#endif
#endif
/****************************** ch: 摘要 | en: Instructions **********************************************/
/**
* @~chinese
* 6
* 1.
* 2.
* 3.
* 4.
* 5.
* 6.
*
* @~english
* The document mainly consists of six parts:
* 1.Cross Platform Definition
* 2.Status Code
* 3.Macro Definition
* 4.Enumeration
* 5.Data Structure
* 6.Callback Interface Definition
**/
/***************************************** Part1 ch: 跨平台定义 | en: Cross Platform Definition **************************************************/
#ifdef WIN32
typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#define MV3D_RGBD_UNDEFINED 0xFFFFFFFF
#else
#include <stdint.h>
#define MV3D_RGBD_UNDEFINED -1
#endif
/***************************************** Part2 ch: 状态码 | en: Status Code **************************************************/
/// \~chinese
/// \name 正确码定义
/// @{
/// \~english
/// \name Definition of correct code
/// @{
#define MV3D_RGBD_OK 0x00000000 ///< \~chinese 成功,无错误 \~english Successed, no error
/// @}
///
/// \~chinese
/// \name 通用错误码定义:范围0x80060000-0x800600FF
/// @{
/// \~english
/// \name Definition of General Error Code (from 0x80060000 to 0x800600FF)
/// @{
#define MV3D_RGBD_E_HANDLE 0x80060000 ///< \~chinese 错误或无效的句柄 \~english Incorrect or invalid handle
#define MV3D_RGBD_E_SUPPORT 0x80060001 ///< \~chinese 不支持的功能 \~english The function is not supported
#define MV3D_RGBD_E_BUFOVER 0x80060002 ///< \~chinese 缓存已满 \~english The buffer is full
#define MV3D_RGBD_E_CALLORDER 0x80060003 ///< \~chinese 函数调用顺序错误 \~english Incorrect calling sequence
#define MV3D_RGBD_E_PARAMETER 0x80060004 ///< \~chinese 错误的参数 \~english Incorrect parameter
#define MV3D_RGBD_E_RESOURCE 0x80060005 ///< \~chinese 资源申请失败 \~english Resource request failed
#define MV3D_RGBD_E_NODATA 0x80060006 ///< \~chinese 无数据 \~english No data
#define MV3D_RGBD_E_PRECONDITION 0x80060007 ///< \~chinese 前置条件有误,或运行环境已发生变化 \~english Incorrect precondition, or running environment has changed
#define MV3D_RGBD_E_VERSION 0x80060008 ///< \~chinese 版本不匹配 \~english The version mismatched
#define MV3D_RGBD_E_NOENOUGH_BUF 0x80060009 ///< \~chinese 传入的内存空间不足 \~english Insufficient memory
#define MV3D_RGBD_E_ABNORMAL_IMAGE 0x8006000A ///< \~chinese 异常图像,可能是丢包导致图像不完整 \~english Abnormal image. Incomplete image caused by packet loss
#define MV3D_RGBD_E_LOAD_LIBRARY 0x8006000B ///< \~chinese 动态导入DLL失败 \~english Failed to load the dynamic link library dynamically
#define MV3D_RGBD_E_ALGORITHM 0x8006000C ///< \~chinese 算法错误 \~english Algorithm error
#define MV3D_RGBD_E_DEVICE_OFFLINE 0x8006000D ///< \~chinese 设备离线 \~english The device is offline
#define MV3D_RGBD_E_ACCESS_DENIED 0x8006000E ///< \~chinese 设备无访问权限 \~english No device access permission
#define MV3D_RGBD_E_OUTOFRANGE 0x8006000F ///< \~chinese 值超出范围 \~english The value is out of range
#define MV3D_RGBD_E_UPG_FILE_MISMATCH 0x80060010 ///< \~chinese 升级固件不匹配 \~english The upgraded firmware does not match
#define MV3D_RGBD_E_UPG_CONFLICT 0x80060012 ///< \~chinese 升级冲突 \~english The upgraded firmware conflict
#define MV3D_RGBD_E_UPG_INNER_ERR 0x80060013 ///< \~chinese 升级时相机内部出现错误 \~english An error occurred inside the camera during the upgrade
#define MV3D_RGBD_E_INDUSTRY 0x80060020 ///< \~chinese 行业属性不匹配 \~english The industry attributes does not match
#define MV3D_RGBD_E_NETWORK 0x80060021 ///< \~chinese 网络相关错误 \~english Network related error
#define MV3D_RGBD_E_UNKNOW 0x800600FF ///< \~chinese 未知的错误 \~english Unknown error
/// @}
/***************************************** Part3 ch: 常量定义 | en: Macro Definition **************************************************/
///< \~chinese 常量 \~english Constant
#define MV3D_RGBD_MAX_IMAGE_COUNT 10 ///< \~chinese 最大图片个数 \~english The maximum number of images
#define MV3D_RGBD_MAX_STRING_LENGTH 256 ///< \~chinese 最大字符串长度 \~english The maximum length of string
#define MV3D_RGBD_MAX_PATH_LENGTH 256 ///< \~chinese 最大路径长度 \~english The maximum length of path
#define MV3D_RGBD_MAX_ENUM_COUNT 16 ///< \~chinese 最大枚举数量 \~english The maximum number of enumerations
///< \~chinese 像素类型 \~english Pixel Type
#define MV3D_RGBD_PIXEL_MONO 0x01000000 ///< \~chinese Mono像素格式 \~english Mono pixel format
#define MV3D_RGBD_PIXEL_COLOR 0x02000000 ///< \~chinese Color像素格式 \~english Color pixel format
#define MV3D_RGBD_PIXEL_CUSTOM 0x80000000 ///< \~chinese 自定义像素格式 \~english Custom pixel format
#define MV3D_RGBD_PIXEL_BIT_COUNT(n) ((n) << 16) ///< \~chinese 像素格式 \~english Pixel format
///< \~chinese 属性常量定义 \~english Attribute Key Value Definition
#define MV3D_RGBD_INT_WIDTH "Width" ///< \~chinese 图像宽 \~english Image width
#define MV3D_RGBD_INT_HEIGHT "Height" ///< \~chinese 图像高 \~english Image height
#define MV3D_RGBD_ENUM_WORKINGMODE "CameraWorkingMode" ///< \~chinese 工作模式 \~english The camera working mode
#define MV3D_RGBD_ENUM_PIXELFORMAT "PixelFormat" ///< \~chinese 像素格式 \~english Pixel format
#define MV3D_RGBD_ENUM_IMAGEMODE "ImageMode" ///< \~chinese 图像模式 \~english Image mode
#define MV3D_RGBD_FLOAT_GAIN "Gain" ///< \~chinese 增益 \~english Gain
#define MV3D_RGBD_FLOAT_EXPOSURETIME "ExposureTime" ///< \~chinese 曝光时间 \~english Exposure time
#define MV3D_RGBD_FLOAT_FRAMERATE "AcquisitionFrameRate" ///< \~chinese 采集帧率 \~english Acquired frame rate
#define MV3D_RGBD_ENUM_TRIGGERSELECTOR "TriggerSelector" ///< \~chinese 触发选择器 \~english Trigger selector
#define MV3D_RGBD_ENUM_TRIGGERMODE "TriggerMode" ///< \~chinese 触发模式 \~english Trigger mode
#define MV3D_RGBD_ENUM_TRIGGERSOURCE "TriggerSource" ///< \~chinese 触发源 \~english Trigger source
#define MV3D_RGBD_FLOAT_TRIGGERDELAY "TriggerDelay" ///< \~chinese 触发延迟时间 \~english Trigger delay
#define MV3D_RGBD_INT_IMAGEALIGN "ImageAlign" ///< \~chinese 深度图对齐到RGB坐标系默认值1对齐0不对齐重启程序后恢复默认值
///< \~english Whether to align the depth image with RGB image: 1 (align, default value), 0 (not align). The default value will be restored after rebooting
#define MV3D_RGBD_BOOL_LASERENABLE "LaserEnable" ///< \~chinese 投射器使能 \~english Open or close laser control
#define Mv3D_RGBD_FLOAT_BASEDISTANCE "BaseDistance" ///< \~chinese 左右目基线距 \~english Left and right eyes base distance
#define MV3D_RGBD_ENUM_RESOLUTION "BinningSelector" ///< \~chinese 采集分辨率 \~english Acquisition resolution
#define MV3D_RGBD_INT_OUTPUT_RGBD "OutputRgbd" ///< \~chinese RGBD图像输出默认值0不输出1输出重启程序后恢复默认值
///< \~english Whether to output rgbd image: 1 (not output, default value), 0 (output). The default value will be restored after rebooting
#define MV3D_RGBD_INT_DEVICE_TIMEOUT "DeviceTimeout" ///< \~chinese 设备控制超时时间(ms) \~english Timeout period of device control (unit: ms)
#define MV3D_RGBD_INT_IMAGE_NODE_NUM "ImageNodeNum" ///< \~chinese 图像缓存节点个数 \~english The number of image buffer node
#define MV3D_RGBD_FLOAT_Z_UNIT "ZUnit" ///< \~chinese 深度图量纲(mm) \~english The dimension of depth image (unit: mm)
///< \~chinese 设备文件枚举常量定义 \~english File Constant Definition
#define MV3D_RGBD_SENSOR_CALI "RGBDSensorCali" ///< \~chinese 相机传感器标定文件 \~english The calibration file of camera sensor
#define MV3D_RGBD_HANDEYE_CALI "RGBDHandEyeCali" ///< \~chinese 相机手眼标定文件 \~english The camera hand-eye calibration file
///< \~chinese 类型定义 \~english Typedef Documentation
typedef int32_t MV3D_RGBD_STATUS; ///< \~chinese 返回值类型 \~english Return value type
typedef void* HANDLE; ///< \~chinese 句柄类型 \~english Handle type
typedef int32_t BOOL; ///< \~chinese BOOL类型 \~english Boolean type
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
/***************************************** Part4 ch: 枚举 | en: Enumeration **************************************************/
///< \~chinese 设备类型 \~english Device Type
typedef enum Mv3dRgbdDeviceType
{
DeviceType_Ethernet = 1 << 0, ///< \~chinese 网口设备 \~english Network type camera
DeviceType_USB = 1 << 1, ///< \~chinese USB设备 \~english USB type camera
DeviceType_Ethernet_Vir = 1 << 2, ///< \~chinese 虚拟网口设备 \~english Virtual network type camera
DeviceType_USB_Vir = 1 << 3 ///< \~chinese 虚拟USB设备 \~english Virtual USB type camera
} Mv3dRgbdDeviceType;
///< \~chinese ip类型 \~english IP Address Mode
typedef enum Mv3dRgbdIpCfgMode
{
IpCfgMode_Static = 1, ///< \~chinese 静态IP \~english Static IP mode
IpCfgMode_DHCP = 2, ///< \~chinese 自动分配IP(DHCP) \~english Automatically assigned IP address (DHCP)
IpCfgMode_LLA = 4 ///< \~chinese 自动分配IP(LLA) \~english Automatically assigned IP address (LLA)
} Mv3dRgbdIpCfgMode;
///< \~chinese USB协议类型 \~english Supported USB Protocol Type
typedef enum Mv3dRgbdUsbProtocol
{
UsbProtocol_USB2 = 1, ///< \~chinese USB 2.0 \~english USB 2.0
UsbProtocol_USB3 = 2 ///< \~chinese USB 3.0 \~english USB 3.0
} Mv3dRgbdUsbProtocol;
///< \~chinese 图像格式 \~english Image Format
typedef enum Mv3dRgbdImageType
{
ImageType_Undefined = MV3D_RGBD_UNDEFINED, ///< \~chinese 未定义的图像类型 \~english Undefined image type
ImageType_Mono8 = (MV3D_RGBD_PIXEL_MONO | MV3D_RGBD_PIXEL_BIT_COUNT(8) | 0x0001), //0x01080001,(Mono8)
ImageType_Mono16 = (MV3D_RGBD_PIXEL_MONO | MV3D_RGBD_PIXEL_BIT_COUNT(16) | 0x0007), //0x01100007,(Mono16)
ImageType_Depth = (MV3D_RGBD_PIXEL_MONO | MV3D_RGBD_PIXEL_BIT_COUNT(16) | 0x00B8), //0x011000B8,(C16)
ImageType_YUV422 = (MV3D_RGBD_PIXEL_COLOR | MV3D_RGBD_PIXEL_BIT_COUNT(16) | 0x0032), //0x02100032
ImageType_YUV420SP_NV12 = (MV3D_RGBD_PIXEL_COLOR | MV3D_RGBD_PIXEL_BIT_COUNT(12) | 0x8001), //0x020C8001
ImageType_YUV420SP_NV21 = (MV3D_RGBD_PIXEL_COLOR | MV3D_RGBD_PIXEL_BIT_COUNT(12) | 0x8002), //0x020C8002
ImageType_RGB8_Planar = (MV3D_RGBD_PIXEL_COLOR | MV3D_RGBD_PIXEL_BIT_COUNT(24) | 0x0021), //0x02180021
ImageType_PointCloud = (MV3D_RGBD_PIXEL_COLOR | MV3D_RGBD_PIXEL_BIT_COUNT(96) | 0x00C0), //0x026000C0,(ABC32f)
ImageType_Jpeg = (MV3D_RGBD_PIXEL_CUSTOM| MV3D_RGBD_PIXEL_BIT_COUNT(24) | 0x0001), //0x80180001, ///< \~chinese 自定义的图片格式 \~english The custom image format
ImageType_Rgbd = (MV3D_RGBD_PIXEL_CUSTOM| MV3D_RGBD_PIXEL_COLOR| MV3D_RGBD_PIXEL_BIT_COUNT(40) | 0x3007), //0x82283007
} Mv3dRgbdImageType;
///< \~chinese 数据流类型 \~english Data Stream Type
typedef enum Mv3dRgbdStreamType
{
StreamType_Undefined = 0,
StreamType_Depth = 1, ///< \~chinese 深度图数据流 \~english Depth image data stream
StreamType_Color = 2, ///< \~chinese 彩色图数据流 \~english Color image data stream
StreamType_Ir_Left = 3, ///< \~chinese 矫正后的左目图数据流 \~english Corrected left-eye image data stream
StreamType_Ir_Right = 4, ///< \~chinese 矫正后的右目图数据流 \~english Corrected right-eye image data stream
StreamType_Imu = 5, ///< \~chinese IMU数据流 \~english IMU data stream
StreamType_LeftMono = 6, ///< \~chinese 左目泛光图数据流 \~english Illuminated left-eye image data stream
StreamType_Mask = 7, ///< \~chinese 掩膜图数据流 \~english Mask image data stream
StreamType_Mono = 8, ///< \~chinese 未矫正的左右目融合图数据流 \~english Uncorrected left and right eyes fusion image data stream
StreamType_Phase = 9, ///< \~chinese 相位图数据流 \~english Phase image data stream
StreamType_Rgbd = 10 ///< \~chinese RGB-D图数据流 \~english RGB-D image data stream
}Mv3dRgbdStreamType;
///< \~chinese 坐标系类型 \~english Coordinates Type
typedef enum Mv3dRgbdCoordinateType
{
CoordinateType_Undefined = 0, ///< \~chinese 未定义的坐标系 \~english Undefined coordinates
CoordinateType_Depth = 1, ///< \~chinese 深度图坐标系 \~english Depth image coordinates
CoordinateType_RGB = 2 ///< \~chinese RGB图坐标系 \~english RGB image coordinates
} Mv3dRgbdCoordinateType;
///< \~chinese 异常信息 \~english Exception Information
typedef enum Mv3dRgbdDevException
{
DevException_Disconnect = 1 ///< \~chinese 设备断开连接 \~english The device is disconnected
} Mv3dRgbdDevException;
///< \~chinese 参数类型 \~english Parameter Data Type
typedef enum Mv3dRgbdParamType
{
ParamType_Bool = 1, ///< \~chinese Bool类型参数 \~english Boolean
ParamType_Int = 2, ///< \~chinese Int类型参数 \~english Int
ParamType_Float = 3, ///< \~chinese Float类型参数 \~english Float
ParamType_Enum = 4, ///< \~chinese Enum类型参数 \~english Enumeration
ParamType_String = 5 ///< \~chinese String类型参数 \~english String
} Mv3dRgbdParamType;
///< \~chinese 深度图与rgb图存图格式 \~english Format of Saving Depth Images and RGB Images
typedef enum Mv3dRgbdFileType
{
FileType_BMP = 1, ///< \~chinese BMP格式 \~english BMP
FileType_JPG = 2, ///< \~chinese JPG格式 \~english JPG
FileType_TIFF = 3 ///< \~chinese TIFF格式 \~english TIFF
}Mv3dRgbdFileType;
///< \~chinese 点云图存图格式 \~english Formats of Saving Point Cloud Images
typedef enum Mv3dRgbdPointCloudFileType
{
PointCloudFileType_PLY = 1, ///< \~chinese PLY_ASCII格式 \~english PLY(ascii)
PointCloudFileType_CSV = 2, ///< \~chinese CSV格式 \~english CSV
PointCloudFileType_OBJ = 3, ///< \~chinese OBJ格式 \~english OBJ
PointCloudFileType_PLY_Binary = 4 ///< \~chinese PLY_BINARY格式 \~english PLY(binary)
}Mv3dRgbdPointCloudFileType;
/***************************************** Part5 ch: 数据结构体 | en: Data Structure **************************************************/
///< \~chinese 版本信息 \~english SDK Version Information
typedef struct _MV3D_RGBD_VERSION_INFO_
{
uint32_t nMajor; ///< \~chinese 主版本 \~english The main version
uint32_t nMinor; ///< \~chinese 次版本 \~english The minor version
uint32_t nRevision; ///< \~chinese 修正版本 \~english The revision version
} MV3D_RGBD_VERSION_INFO;
///< \~chinese 网口设备信息 \~english Network Type Device Information
typedef struct _MV3D_RGBD_DEVICE_NET_INFO_
{
unsigned char chMacAddress[8]; ///< \~chinese Mac地址 \~english MAC address
Mv3dRgbdIpCfgMode enIPCfgMode; ///< \~chinese 当前IP类型 \~english Current IP type
char chCurrentIp[16]; ///< \~chinese 设备当前IP \~english Devices IP address
char chCurrentSubNetMask[16]; ///< \~chinese 设备当前子网掩码 \~english Devices subnet mask
char chDefultGateWay[16]; ///< \~chinese 设备默认网关 \~english Devices default gateway
char chNetExport[16]; ///< \~chinese 网口IP地址 \~english Network interface IP address
uint8_t nReserved[16]; ///< \~chinese 保留字节 \~english Reserved
} MV3D_RGBD_DEVICE_NET_INFO;
///< \~chinese USB设备信息 \~english USB Type Device Information
typedef struct _MV3D_RGBD_DEVICE_USB_INFO_
{
uint32_t nVendorId; ///< \~chinese 供应商ID号 \~english Manufacturer/vendor ID
uint32_t nProductId; ///< \~chinese 产品ID号 \~english Product ID
Mv3dRgbdUsbProtocol enUsbProtocol; ///< \~chinese 支持的USB协议 \~english Supported USB protocol types
char chDeviceGUID[64]; ///< \~chinese 设备GUID号 \~english Device GUID
uint8_t nReserved[16]; ///< \~chinese 保留字节 \~english Reserved
} MV3D_RGBD_DEVICE_USB_INFO;
///< \~chinese 枚举相关设备信息 \~english Device Information
typedef struct _MV3D_RGBD_DEVICE_INFO_
{
char chManufacturerName[32]; ///< \~chinese 设备厂商 \~english Manufacturer
char chModelName[32]; ///< \~chinese 设备型号 \~english Device model
char chDeviceVersion[32]; ///< \~chinese 设备版本 \~english Device version
char chManufacturerSpecificInfo[44]; ///< \~chinese 设备厂商特殊信息 \~english The specific information about manufacturer
uint32_t nDevTypeInfo; ///< \~chinese 设备类型信息 \~english Device type info
char chSerialNumber[16]; ///< \~chinese 设备序列号 \~english Device serial number
char chUserDefinedName[16]; ///< \~chinese 设备用户自定义名称 \~english User-defined name of device
Mv3dRgbdDeviceType enDeviceType; ///< \~chinese 设备类型网口、USB、虚拟网口设备、虚拟USB设备
///< \~english Device type(network / USB / virtual network / virtual USB)
union
{
MV3D_RGBD_DEVICE_NET_INFO stNetInfo; ///< \~chinese 网口设备特有 \~english Network type device
MV3D_RGBD_DEVICE_USB_INFO stUsbInfo; ///< \~chinese USB设备特有 \~english USB type device information
} SpecialInfo; ///< \~chinese 不同设备特有信息 \~english Particular information of different types devices
} MV3D_RGBD_DEVICE_INFO;
///< \~chinese IP配置 \~english IP Configuration Parameters
typedef struct _MV3D_RGBD_IP_CONFIG_
{
Mv3dRgbdIpCfgMode enIPCfgMode; ///< \~chinese IP配置模式 \~english IP configuration mode
char chDestIp[16]; ///< \~chinese 设置的目标IP,仅静态IP模式下有效 \~english The IP address which is to be attributed to the target device. It is valid in the static IP mode only
char chDestNetMask[16]; ///< \~chinese 设置的目标子网掩码,仅静态IP模式下有效 \~english The subnet mask of target device. It is valid in the static IP mode only
char chDestGateWay[16]; ///< \~chinese 设置的目标网关,仅静态IP模式下有效 \~english The gateway of target device. It is valid in the static IP mode only
uint8_t nReserved[16]; ///< \~chinese 保留字节 \~english Reserved
} MV3D_RGBD_IP_CONFIG;
///< \~chinese 相机图像 \~english Camera Image Parameters
typedef struct _MV3D_RGBD_IMAGE_DATA_
{
Mv3dRgbdImageType enImageType; ///< \~chinese 图像格式 \~english Image format
uint32_t nWidth; ///< \~chinese 图像宽 \~english Image width
uint32_t nHeight; ///< \~chinese 图像高 \~english Image height
uint8_t* pData; ///< \~chinese 相机输出的图像数据 \~english Image data, which is outputted by the camera
uint32_t nDataLen; ///< \~chinese 图像数据长度(字节) \~english Image data length (bytes)
uint32_t nFrameNum; ///< \~chinese 帧号,代表第几帧图像 \~english Frame number, which indicates the frame sequence
int64_t nTimeStamp; ///< \~chinese 设备上报的时间戳 设备上电从0开始规则详见设备手册
///< \~english Timestamp uploaded by the device. It starts from 0 when the device is powered on. Refer to the device user manual for detailed rules
BOOL bIsRectified; ///< \~chinese 是否校正 \~english Correction flag
Mv3dRgbdStreamType enStreamType; ///< \~chinese 流类型,用于区分图像(图像格式相同时) \~english Data stream type, used to distinguish data in the same image format
Mv3dRgbdCoordinateType enCoordinateType; ///< \~chinese 坐标系类型 \~english Coordinates type
uint8_t nReserved[4]; ///< \~chinese 保留字节 \~english Reserved
} MV3D_RGBD_IMAGE_DATA;
///< \~chinese 图像帧数据 \~english Frame Data
typedef struct _MV3D_RGBD_FRAME_DATA_
{
uint32_t nImageCount; ///< \~chinese 图像个数表示stImage数组的有效个数 \~english The number of images. It indicates the number of valid stImage arrays
MV3D_RGBD_IMAGE_DATA stImageData[MV3D_RGBD_MAX_IMAGE_COUNT]; ///< \~chinese 图像数组,每一个代表一种类型的图像 \~english Image array, each one represents one type of images
uint32_t nValidInfo; ///< \~chinese 帧有效信息0帧有效1 << 0丢包1 << 1触发标识符无效
///< \~english Frame valid info: 0 (Frame is valid), 1 << 0 (lost package), 1 << 1 (trigger is not valid)
uint8_t nReserved[12]; ///< \~chinese 保留字节 \~english Reserved
} MV3D_RGBD_FRAME_DATA;
///< \~chinese 固件输出的图像附加信息 \~english Image Additional Information Output by Firmware
typedef struct _MV3D_RGBD_STREAM_CFG_
{
Mv3dRgbdImageType enImageType; ///< \~chinese 图像格式 \~english Image format
uint32_t nWidth; ///< \~chinese 图像宽 \~english Image width
uint32_t nHeight; ///< \~chinese 图像高 \~english Image height
uint8_t nReserved[32]; ///< \~chinese 保留字节 \~english Reserved
}MV3D_RGBD_STREAM_CFG;
///< \~chinese 固件输出的图像帧附加信息 \~english Frame Additional Information Output by Firmware
typedef struct _MV3D_RGBD_STREAM_CFG_LIST_
{
uint32_t nStreamCfgCount; ///< \~chinese 图像信息数量 \~english The number of image information
MV3D_RGBD_STREAM_CFG stStreamCfg[MV3D_RGBD_MAX_IMAGE_COUNT]; ///< \~chinese 图像附加信息 \~english Image additional information
uint8_t nReserved[16]; ///< \~chinese 保留字节 \~english Reserved
}MV3D_RGBD_STREAM_CFG_LIST;
///< \~chinese 相机内参 \~english Camera Internal Parameters
///< | fx| 0| cx|
///< | 0| fy| cy|
///< | 0| 0| 1|
typedef struct _MV3D_RGBD_CAMERA_INTRINSIC_
{
float fData[3*3]; ///< \~chinese 内参参数fx,0,cx,0,fy,cy,0,0,1 \~english Internal parameters: fx,0,cx,0,fy,cy,0,0,1
} MV3D_RGBD_CAMERA_INTRINSIC;
///< \~chinese 相机畸变系数 \~english Camera Distortion Coefficient
typedef struct _MV3D_RGBD_CAMERA_DISTORTION_
{
float fData[12]; ///< \~chinese 畸变系数k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4 \~english Distortion coefficient: k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4
} MV3D_RGBD_CAMERA_DISTORTION;
///< \~chinese 相机的内参,畸变系数,分辨率信息 \~english Structure About Camera Internal Parameters, Distortion Coefficient and Resolution Information
typedef struct _MV3D_RGBD_CALIB_INFO_
{
MV3D_RGBD_CAMERA_INTRINSIC stIntrinsic; ///< \~chinese 相机内参 \~english Camera internal parameters
MV3D_RGBD_CAMERA_DISTORTION stDistortion; ///< \~chinese 畸变系数 \~english Camera distortion coefficient
uint32_t nWidth; ///< \~chinese 图像宽 \~english Image width
uint32_t nHeight; ///< \~chinese 图像高 \~english Image height
uint8_t nReserved[8]; ///< \~chinese 保留字节 \~english Reserved
} MV3D_RGBD_CALIB_INFO;
///< \~chinese 相机深度图转Rgb的外参 \~english Camera Extrinsic Parameters of Depth Image to Rgb Image
///< | r00| r01| r02| t0|
///< | r10| r11| r12| t1|
///< | r20| r21| r22| t2|
///< | 0| 0| 0| 1|
typedef struct _MV3D_RGBD_CAMERA_EXTRINSIC_
{
float fData[4*4]; ///< \~chinese 深度图转Rgb外参参数r00,r01,r02,t0,r10,r11,r12,t1,r20,r21,r22,t2,0,0,0,1
///< \~english Extrinsic parameters of depth image to rgb image: r00,r01,r02,t0,r10,r11,r12,t1,r20,r21,r22,t2,0,0,0,1
}MV3D_RGBD_CAMERA_EXTRINSIC;
///< \~chinese 相机参数信息 \~english Camera Parameters Information
typedef struct _MV3D_RGBD_CAMERA_PARAM_
{
MV3D_RGBD_CALIB_INFO stDepthCalibInfo; ///< \~chinese 深度图内参和畸变矩阵信息 \~english Depth image intrinsic information and distortion coefficient
MV3D_RGBD_CALIB_INFO stRgbCalibInfo; ///< \~chinese rgb内参和畸变矩阵信息 \~english Rgb image intrinsic information and distortion coefficient
MV3D_RGBD_CAMERA_EXTRINSIC stDepth2RgbExtrinsic; ///< \~chinese 相机深度图转RGB的外参 \~english Camera extrinsic parameters of depth image to rgb image
uint8_t nReserved[32]; ///< \~chinese 保留字节 \~english Reserved
}MV3D_RGBD_CAMERA_PARAM;
///< \~chinese Int类型值 \~english Int Type Value
typedef struct _MV3D_RGBD_INTPARAM_
{
int64_t nCurValue; ///< \~chinese 当前值 \~english Current value
int64_t nMax; ///< \~chinese 最大值 \~english The maximum value
int64_t nMin; ///< \~chinese 最小值 \~english The minimum value
int64_t nInc; ///< \~chinese 增量值 \~english The increment value
} MV3D_RGBD_INTPARAM;
///< \~chinese Enum类型值 \~english Enumeration Type Value
typedef struct _MV3D_RGBD_ENUMPARAM_
{
uint32_t nCurValue; ///< \~chinese 当前值 \~english Current value
uint32_t nSupportedNum; ///< \~chinese 有效数据个数 \~english The number of valid data
uint32_t nSupportValue[MV3D_RGBD_MAX_ENUM_COUNT]; ///< \~chinese 支持的枚举类型 \~english The type of supported enumerations
} MV3D_RGBD_ENUMPARAM;
///< \~chinese Float类型值 \~english Float Type Value
typedef struct _MV3D_RGBD_FLOATPARAM_
{
float fCurValue; ///< \~chinese 当前值 \~english Current value
float fMax; ///< \~chinese 最大值 \~english The maximum value
float fMin; ///< \~chinese 最小值 \~english The minimum value
} MV3D_RGBD_FLOATPARAM;
///< \~chinese String类型值 \~english String Type Value
typedef struct _MV3D_RGBD_STRINGPARAM_
{
char chCurValue[MV3D_RGBD_MAX_STRING_LENGTH]; ///< \~chinese 当前值 \~english Current value
uint32_t nMaxLength; ///< \~chinese 属性节点能设置字符的最大长度 \~english The maximum length of string
} MV3D_RGBD_STRINGPARAM;
///< \~chinese 设备参数 \~english Device Parameters
typedef struct _MV3D_RGBD_PARAM_
{
Mv3dRgbdParamType enParamType; ///< \~chinese 设置属性值类型 \~english Parameter data type
union
{
BOOL bBoolParam; ///< \~chinese Bool类型参数 \~english Boolean type parameter
MV3D_RGBD_INTPARAM stIntParam; ///< \~chinese Int类型参数 \~english Int type parameter
MV3D_RGBD_FLOATPARAM stFloatParam; ///< \~chinese Float类型参数 \~english Float type parameter
MV3D_RGBD_ENUMPARAM stEnumParam; ///< \~chinese Enum类型参数 \~english Enum type parameter
MV3D_RGBD_STRINGPARAM stStringParam; ///< \~chinese String类型参数 \~english String type parameter
} ParamInfo;
uint8_t nReserved[16]; ///< \~chinese 保留字节 \~english Reserved
} MV3D_RGBD_PARAM;
///< \~chinese 异常信息 \~english Exception Information
typedef struct _MV3D_RGBD_EXCEPTION_INFO_
{
Mv3dRgbdDevException enExceptionId; ///< \~chinese 异常ID \~english Exception ID
char chExceptionDes[MV3D_RGBD_MAX_STRING_LENGTH]; ///< \~chinese 异常描述 \~english Exception description
uint8_t nReserved[4]; ///< \~chinese 保留字节 \~english Reserved
} MV3D_RGBD_EXCEPTION_INFO;
///< \~chinese 文件存取 \~english File Access
typedef struct _MV3D_RGBD_FILE_ACCESS_
{
const char* pUserFileName; ///< \~chinese 用户文件名 \~english User file name
const char* pDevFileName; ///< \~chinese 设备文件名 \~english Device file name
uint8_t nReserved[32]; ///< \~chinese 保留字节 \~english Reserved
}MV3D_RGBD_FILE_ACCESS;
///< \~chinese 文件存取进度 \~english File Access Progress
typedef struct _MV3D_RGBD_FILE_ACCESS_PROGRESS_
{
int64_t nCompleted; ///< \~chinese 已完成的长度 \~english Completed length
int64_t nTotal; ///< \~chinese 总长度 \~english Total length
uint8_t nReserved[32]; ///< \~chinese 保留字节 \~english Reserved
}MV3D_RGBD_FILE_ACCESS_PROGRESS;
/***************************************** Part6 ch: 回调接口定义 | en: Callback Interface Definition **************************************************/
///< \~chinese 帧数据回调 \~english Frame Data Callback
typedef void(__stdcall* MV3D_RGBD_FrameDataCallBack) (MV3D_RGBD_FRAME_DATA* pstFrameData, void* pUser);
///< \~chinese 异常回调 \~english Exception Callback
typedef void(__stdcall* MV3D_RGBD_ExceptionCallBack) (MV3D_RGBD_EXCEPTION_INFO* pstExceptInfo, void* pUser);
#endif // _MV3D_RGBD_DEFINE_H_

View File

@ -0,0 +1,159 @@
#ifndef _MV3D_RGBD_IMG_PROC_H_
#define _MV3D_RGBD_IMG_PROC_H_
#include "Mv3dRgbdDefine.h"
#ifdef __cplusplus
extern "C" {
#endif
/************************************************************************
* @~chinese
* @brief RGBD相机深度图像转换点云图像
* @param handle [IN]
* @param pstDepthImage [IN]
* @param pstPointCloudImage [OUT]
* @return MV3D_RGBD_OK
* @~english
* @brief depth image convert to pointcloud image
* @param handle [IN] camera handle
* @param pstDepthImage [IN] depth data
* @param pstPointCloudImage [OUT] point cloud data
* @return Success, return MV3D_RGBD_OK. Failure,return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_MapDepthToPointCloud(void* handle, MV3D_RGBD_IMAGE_DATA* pstDepthImage, MV3D_RGBD_IMAGE_DATA* pstPointCloudImage);
/************************************************************************
* @~chinese
* @brief RGBD相机深度图像转换点云图像
* @param pstDepthImage [IN]
* @param pstCalibInfo [IN]
* @param fZunit [IN] (mm)
* @param pstPointCloudImage [OUT]
* @return MV3D_RGBD_OK
* @~english
* @brief depth image convert to pointcloud image without handle
* @param pstDepthImage [IN] depth data
* @param pstCalibInfo [IN] calib info
* @param fZunit [IN] dimension(mm)
* @param pstPointCloudImage [OUT] point cloud data
* @return Success, return MV3D_RGBD_OK. Failure,return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_MapDepthToPointCloudEx(MV3D_RGBD_IMAGE_DATA* pstDepthImage, MV3D_RGBD_CALIB_INFO* pstCalibInfo, float fZunit, MV3D_RGBD_IMAGE_DATA* pstPointCloudImage);
/************************************************************************
* @~chinese
* @brief
* @param pstInImage [IN]
* @param fZunit [IN] (mm)
* @param pstOutImage [OUT]
* @param pstCameraParam [IN][OUT]
* @return MV3D_RGBD_OK
* @~english
* @brief image convert coordinate to rgb coordinate
* @param pstInImage [IN] input image data
* @param fZunit [IN] dimension(mm)
* @param pstOutImage [OUT] output image data
* @param pstCameraParam [IN][OUT] camera param
* @return Success, return MV3D_RGBD_OK. Failure,return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_ImageCoordinateTrans(MV3D_RGBD_IMAGE_DATA* pstInImage, float fZunit, MV3D_RGBD_IMAGE_DATA* pstOutImage, MV3D_RGBD_CAMERA_PARAM* pstCameraParam);
/************************************************************************
* @~chinese
* @brief ,RGB图和原始图存图接口
* :C16
* RGB图格式:RGB8_Planar/YUV422/YUV420SP_NV12/YUV420SP_NV21
* :Mono8(bmp格式)
* @param handle [IN]
* @param pstImage [IN]
* @param enFileType [IN]
* @param chFileName [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief depth and rgb image save image to file
* depth image format: C16
* rgb image format: RGB8_Planar/YUV422/YUV420SP_NV12/YUV420SP_NV21
* mono image format: Mono8(only support bmp file type)
* @param handle [IN] camera handle
* @param pstImage [IN] image data
* @param enFileType [IN] file type
* @param chFileName [IN] file name
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_SaveImage(void* handle, MV3D_RGBD_IMAGE_DATA* pstImage, Mv3dRgbdFileType enFileType, const char* chFileName);
/************************************************************************
* @~chinese
* @brief
* @param handle [IN]
* @param pstImage [IN]
* @param enPointCloudFileType [IN]
* @param chFileName [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief pointcloud image save image to file
* @param handle [IN] camera handle
* @param pstImage [IN] image data
* @param enPointCloudFileType [IN] pointcloud image file type
* @param chFileName [IN] file name
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_SavePointCloudImage(void* handle, MV3D_RGBD_IMAGE_DATA* pstImage, Mv3dRgbdPointCloudFileType enPointCloudFileType, const char* chFileName);
/************************************************************************
* @~chinese
* @brief
* :RGB8_Planar/YUV422/YUV420SP_NV12/YUV420SP_NV21
* :PLY_ASCII
* @param handle [IN]
* @param pstPointCloudImage [IN]
* @param pstTexture [IN]
* @param enPointCloudFileType [IN]
* @param chFileName [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief textured pointcloud image save image to file
* textured image format: RGB8_Planar/YUV422/YUV420SP_NV12/YUV420SP_NV21
* saved pointcloud image format: PLY_ASCII
* @param handle [IN] camera handle
* @param pstPointCloudImage [IN] pointcloude image data
* @param pstTexture [IN] image texture data
* @param enPointCloudFileType [IN] pointcloud image file type
* @param chFileName [IN] file name
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_SaveTexturedPointCloudImage(void* handle, MV3D_RGBD_IMAGE_DATA* pstPointCloudImage, MV3D_RGBD_IMAGE_DATA* pstTexture, Mv3dRgbdPointCloudFileType enPointCloudFileType, const char* chFileName);
/************************************************************************
* @~chinese
* @brief RGB图像接口
* :C16
* RGB图格式:RGB8_Planar/YUV422/YUV420SP_NV12/YUV420SP_NV21
* @param handle [IN]
* @param pstImage [IN]
* @param hWnd [IN]
* @return MV3D_RGBD_OK
* @~english
* @brief display depth and rgb image
* depth image format: C16
* rgb image format: RGB8_Planar/YUV422/YUV420SP_NV12/YUV420SP_NV21
* @param handle [IN] camera handle
* @param pstImage [IN] image data
* @param hWnd [IN] windows handle
* @return Success, return MV3D_RGBD_OK. Failure, return error code
************************************************************************/
MV3D_RGBD_API MV3D_RGBD_STATUS MV3D_RGBD_DisplayImage(void* handle, MV3D_RGBD_IMAGE_DATA* pstImage, void* hWnd);
#ifdef __cplusplus
}
#endif
#endif // _MV3D_RGBD_IMG_PROC_H_

View File

@ -0,0 +1,159 @@
#ifndef SAMPLE_COMMON_RENDERIMAGE_HPP_
#define SAMPLE_COMMON_RENDERIMAGE_HPP_
#include "RenderWindow.hpp"
using namespace RenderImage;
static int CoverYuv422_T_RGB_Pixel(int y, int u, int v)
{
unsigned int pixel32 = 0;
unsigned char *pixel = (unsigned char *)&pixel32;
int r, g, b;
r = y + (1.370705 * (v - 128));
g = y - (0.698001 * (v - 128)) - (0.337633 * (u - 128));
b = y + (1.732446 * (u - 128));
if (r > 255)
{
r = 255;
}
if (g > 255)
{
g = 255;
}
if (b > 255)
{
b = 255;
}
if (r < 0)
{
r = 0;
}
if (g < 0)
{
g = 0;
}
if (b < 0)
{
b = 0;
}
pixel[0] = r;
pixel[1] = g;
pixel[2] = b;
return pixel32;
}
static void YUV422_T_RGB(unsigned int nWidth, unsigned int nHeight,const unsigned char *pYUVSrc, unsigned char *pRGBDst)
{
unsigned int in, out = 0;
unsigned int pixel_16;
unsigned char pixel_24[3];
unsigned int pixel32;
int y0, u, y1, v;
if ((pYUVSrc == NULL) || (pRGBDst == NULL))
{
return;
}
for (in = 0; in < nWidth * nHeight * 2; in += 4)
{
pixel_16 =
pYUVSrc[in + 3] << 24 |
pYUVSrc[in + 2] << 16 |
pYUVSrc[in + 1] << 8 |
pYUVSrc[in + 0];
y0 = (pixel_16 & 0x000000ff);
u = (pixel_16 & 0x0000ff00) >> 8;
y1 = (pixel_16 & 0x00ff0000) >> 16;
v = (pixel_16 & 0xff000000) >> 24;
pixel32 = CoverYuv422_T_RGB_Pixel(y0, u, v);
pixel_24[0] = (pixel32 & 0x000000ff);
pixel_24[1] = (pixel32 & 0x0000ff00) >> 8;
pixel_24[2] = (pixel32 & 0x00ff0000) >> 16;
pRGBDst[out++] = pixel_24[0];
pRGBDst[out++] = pixel_24[1];
pRGBDst[out++] = pixel_24[2];
pixel32 = CoverYuv422_T_RGB_Pixel(y1, u, v);
pixel_24[0] = (pixel32 & 0x000000ff);
pixel_24[1] = (pixel32 & 0x0000ff00) >> 8;
pixel_24[2] = (pixel32 & 0x00ff0000) >> 16;
pRGBDst[out++] = pixel_24[0];
pRGBDst[out++] = pixel_24[1];
pRGBDst[out++] = pixel_24[2];
}
return;
}
static int parseFrame(MV3D_RGBD_FRAME_DATA* pstFrameData, RIFrameInfo* pDepth
, RIFrameInfo* pRgb, RIFrameInfo* pRgbd)
{
for (unsigned int i = 0; i < pstFrameData->nImageCount; i++)
{
//LOGD("parseFrame : framenum (%d) height(%d) width(%d) len (%d)!", pstFrameData->stImageData[i].nFrameNum,
// pstFrameData->stImageData[i].nHeight, pstFrameData->stImageData[i].nWidth, pstFrameData->stImageData[i].nDataLen);
if (ImageType_Depth == pstFrameData->stImageData[i].enImageType)
{
pDepth->enPixelType = RIPixelType_Coord3D_C16;
pDepth->nFrameNum = pstFrameData->stImageData[i].nFrameNum;
pDepth->nHeight = pstFrameData->stImageData[i].nHeight;
pDepth->nWidth = pstFrameData->stImageData[i].nWidth;
pDepth->nFrameLength= pstFrameData->stImageData[i].nDataLen;
pDepth->pData = pstFrameData->stImageData[i].pData;
}
if (ImageType_RGB8_Planar == pstFrameData->stImageData[i].enImageType)
{
pRgb->enPixelType = RIPixelType_RGB8_Planar;
pRgb->nFrameNum = pstFrameData->stImageData[i].nFrameNum;
pRgb->nHeight = pstFrameData->stImageData[i].nHeight;
pRgb->nWidth = pstFrameData->stImageData[i].nWidth;
pRgb->nFrameLength = pstFrameData->stImageData[i].nDataLen;
pRgb->pData = pstFrameData->stImageData[i].pData;
}
if (ImageType_YUV422 == pstFrameData->stImageData[i].enImageType)
{
int nDstImageLen = pstFrameData->stImageData[i].nWidth * pstFrameData->stImageData[i].nHeight * 3;
static unsigned char* pRGBBuffer = NULL;
static unsigned int nImageLen = nDstImageLen;
if (pRGBBuffer == NULL || nImageLen != nDstImageLen)
{
nImageLen = nDstImageLen;
pRGBBuffer = (unsigned char *)malloc(nImageLen * sizeof(unsigned char));
if (pRGBBuffer == NULL)
{
// LOGD("YUV422 buffer malloc fail!");
return -1;
}
memset(pRGBBuffer, 0x00, nImageLen * sizeof(unsigned char));
// LOGD("YUV422 buffer malloc success!");
}
YUV422_T_RGB(pstFrameData->stImageData[i].nWidth, pstFrameData->stImageData[i].nHeight, pstFrameData->stImageData[i].pData, pRGBBuffer);
pRgb->enPixelType = RIPixelType_RGB8_Packed;
pRgb->nFrameNum = pstFrameData->stImageData[i].nFrameNum;
pRgb->nHeight = pstFrameData->stImageData[i].nHeight;
pRgb->nWidth = pstFrameData->stImageData[i].nWidth;
pRgb->nFrameLength = nDstImageLen;
pRgb->pData = pRGBBuffer;
}
if (ImageType_Rgbd == pstFrameData->stImageData[i].enImageType)
{
pRgbd->enPixelType = RIPixelType_RGBD_C16;
pRgbd->nFrameNum = pstFrameData->stImageData[i].nFrameNum;
pRgbd->nHeight = pstFrameData->stImageData[i].nHeight;
pRgbd->nWidth = pstFrameData->stImageData[i].nWidth;
pRgbd->nFrameLength = pstFrameData->stImageData[i].nDataLen;
pRgbd->pData = pstFrameData->stImageData[i].pData;
}
}
return 0;
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

10
3rdparty/json/inc/json.h vendored Normal file
View File

@ -0,0 +1,10 @@
#ifndef JSON_JSON_H_INCLUDED
# define JSON_JSON_H_INCLUDED
# include "json_autolink.h"
# include "json_value.h"
# include "json_reader.h"
# include "json_writer.h"
# include "json_features.h"
#endif // JSON_JSON_H_INCLUDED

19
3rdparty/json/inc/json_autolink.h vendored Normal file
View File

@ -0,0 +1,19 @@
#ifndef JSON_AUTOLINK_H_INCLUDED
# define JSON_AUTOLINK_H_INCLUDED
# include "json_config.h"
# ifdef JSON_IN_CPPTL
# include <cpptl/cpptl_autolink.h>
# endif
# if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && !defined(JSON_IN_CPPTL)
# define CPPTL_AUTOLINK_NAME "json"
# undef CPPTL_AUTOLINK_DLL
# ifdef JSON_DLL
# define CPPTL_AUTOLINK_DLL
# endif
# include "json_autolink.h"
# endif
#endif // JSON_AUTOLINK_H_INCLUDED

125
3rdparty/json/inc/json_batchallocator.h vendored Normal file
View File

@ -0,0 +1,125 @@
#ifndef JSONCPP_BATCHALLOCATOR_H_INCLUDED
# define JSONCPP_BATCHALLOCATOR_H_INCLUDED
# include <stdlib.h>
# include <assert.h>
# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
namespace Json {
/* Fast memory allocator.
*
* This memory allocator allocates memory for a batch of object (specified by
* the page size, the number of object in each page).
*
* It does not allow the destruction of a single object. All the allocated objects
* can be destroyed at once. The memory can be either released or reused for future
* allocation.
*
* The in-place new operator must be used to construct the object using the pointer
* returned by allocate.
*/
template<typename AllocatedType
,const unsigned int objectPerAllocation>
class BatchAllocator
{
public:
typedef AllocatedType Type;
BatchAllocator( unsigned int objectsPerPage = 255 )
: freeHead_( 0 )
, objectsPerPage_( objectsPerPage )
{
// printf( "Size: %d => %s\n", sizeof(AllocatedType), typeid(AllocatedType).name() );
assert( sizeof(AllocatedType) * objectPerAllocation >= sizeof(AllocatedType *) ); // We must be able to store a slist in the object free space.
assert( objectsPerPage >= 16 );
batches_ = allocateBatch( 0 ); // allocated a dummy page
currentBatch_ = batches_;
}
~BatchAllocator()
{
for ( BatchInfo *batch = batches_; batch; )
{
BatchInfo *nextBatch = batch->next_;
free( batch );
batch = nextBatch;
}
}
/// allocate space for an array of objectPerAllocation object.
/// @warning it is the responsability of the caller to call objects constructors.
AllocatedType *allocate()
{
if ( freeHead_ ) // returns node from free list.
{
AllocatedType *object = freeHead_;
freeHead_ = *(AllocatedType **)object;
return object;
}
if ( currentBatch_->used_ == currentBatch_->end_ )
{
currentBatch_ = currentBatch_->next_;
while ( currentBatch_ && currentBatch_->used_ == currentBatch_->end_ )
currentBatch_ = currentBatch_->next_;
if ( !currentBatch_ ) // no free batch found, allocate a new one
{
currentBatch_ = allocateBatch( objectsPerPage_ );
currentBatch_->next_ = batches_; // insert at the head of the list
batches_ = currentBatch_;
}
}
AllocatedType *allocated = currentBatch_->used_;
currentBatch_->used_ += objectPerAllocation;
return allocated;
}
/// Release the object.
/// @warning it is the responsability of the caller to actually destruct the object.
void release( AllocatedType *object )
{
assert( object != 0 );
*(AllocatedType **)object = freeHead_;
freeHead_ = object;
}
private:
struct BatchInfo
{
BatchInfo *next_;
AllocatedType *used_;
AllocatedType *end_;
AllocatedType buffer_[objectPerAllocation];
};
// disabled copy constructor and assignement operator.
BatchAllocator( const BatchAllocator & );
void operator =( const BatchAllocator &);
static BatchInfo *allocateBatch( unsigned int objectsPerPage )
{
const unsigned int mallocSize = sizeof(BatchInfo) - sizeof(AllocatedType)* objectPerAllocation
+ sizeof(AllocatedType) * objectPerAllocation * objectsPerPage;
BatchInfo *batch = static_cast<BatchInfo*>( malloc( mallocSize ) );
batch->next_ = 0;
batch->used_ = batch->buffer_;
batch->end_ = batch->buffer_ + objectsPerPage;
return batch;
}
BatchInfo *batches_;
BatchInfo *currentBatch_;
/// Head of a single linked list within the allocated space of freeed object
AllocatedType *freeHead_;
unsigned int objectsPerPage_;
};
} // namespace Json
# endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION
#endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED

43
3rdparty/json/inc/json_config.h vendored Normal file
View File

@ -0,0 +1,43 @@
#ifndef JSON_CONFIG_H_INCLUDED
# define JSON_CONFIG_H_INCLUDED
/// If defined, indicates that json library is embedded in CppTL library.
//# define JSON_IN_CPPTL 1
/// If defined, indicates that json may leverage CppTL library
//# define JSON_USE_CPPTL 1
/// If defined, indicates that cpptl vector based map should be used instead of std::map
/// as Value container.
//# define JSON_USE_CPPTL_SMALLMAP 1
/// If defined, indicates that Json specific container should be used
/// (hash table & simple deque container with customizable allocator).
/// THIS FEATURE IS STILL EXPERIMENTAL!
//# define JSON_VALUE_USE_INTERNAL_MAP 1
/// Force usage of standard new/malloc based allocator instead of memory pool based allocator.
/// The memory pools allocator used optimization (initializing Value and ValueInternalLink
/// as if it was a POD) that may cause some validation tool to report errors.
/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
/// If defined, indicates that Json use exception to report invalid type manipulation
/// instead of C assert macro.
# define JSON_USE_EXCEPTION 1
# ifdef JSON_IN_CPPTL
# include <cpptl/config.h>
# ifndef JSON_USE_CPPTL
# define JSON_USE_CPPTL 1
# endif
# endif
# ifdef JSON_IN_CPPTL
# define JSON_API CPPTL_API
# elif defined(JSON_DLL_BUILD)
# define JSON_API __declspec(dllexport)
# elif defined(JSON_DLL)
# define JSON_API __declspec(dllimport)
# else
# define JSON_API
# endif
#endif // JSON_CONFIG_H_INCLUDED

42
3rdparty/json/inc/json_features.h vendored Normal file
View File

@ -0,0 +1,42 @@
#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
# define CPPTL_JSON_FEATURES_H_INCLUDED
# include "json_forwards.h"
namespace Json {
/** \brief Configuration passed to reader and writer.
* This configuration object can be used to force the Reader or Writer
* to behave in a standard conforming way.
*/
class JSON_API Features
{
public:
/** \brief A configuration that allows all features and assumes all strings are UTF-8.
* - C & C++ comments are allowed
* - Root object can be any JSON value
* - Assumes Value strings are encoded in UTF-8
*/
static Features all();
/** \brief A configuration that is strictly compatible with the JSON specification.
* - Comments are forbidden.
* - Root object must be either an array or an object value.
* - Assumes Value strings are encoded in UTF-8
*/
static Features strictMode();
/** \brief Initialize the configuration like JsonConfig::allFeatures;
*/
Features();
/// \c true if comments are allowed. Default: \c true.
bool allowComments_;
/// \c true if root must be either an array or an object value. Default: \c false.
bool strictRoot_;
};
} // namespace Json
#endif // CPPTL_JSON_FEATURES_H_INCLUDED

39
3rdparty/json/inc/json_forwards.h vendored Normal file
View File

@ -0,0 +1,39 @@
#ifndef JSON_FORWARDS_H_INCLUDED
# define JSON_FORWARDS_H_INCLUDED
# include "json_config.h"
namespace Json {
// writer.h
class FastWriter;
class StyledWriter;
// reader.h
class Reader;
// features.h
class Features;
// value.h
typedef int Int;
typedef unsigned int UInt;
class StaticString;
class Path;
class PathArgument;
class Value;
class ValueIteratorBase;
class ValueIterator;
class ValueConstIterator;
#ifdef JSON_VALUE_USE_INTERNAL_MAP
class ValueAllocator;
class ValueMapAllocator;
class ValueInternalLink;
class ValueInternalArray;
class ValueInternalMap;
#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
} // namespace Json
#endif // JSON_FORWARDS_H_INCLUDED

448
3rdparty/json/inc/json_internalarray.inl vendored Normal file
View File

@ -0,0 +1,448 @@
// included by json_value.cpp
// everything is within Json namespace
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueInternalArray
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueArrayAllocator::~ValueArrayAllocator()
{
}
// //////////////////////////////////////////////////////////////////
// class DefaultValueArrayAllocator
// //////////////////////////////////////////////////////////////////
#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
class DefaultValueArrayAllocator : public ValueArrayAllocator
{
public: // overridden from ValueArrayAllocator
virtual ~DefaultValueArrayAllocator()
{
}
virtual ValueInternalArray *newArray()
{
return new ValueInternalArray();
}
virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
{
return new ValueInternalArray( other );
}
virtual void destructArray( ValueInternalArray *array )
{
delete array;
}
virtual void reallocateArrayPageIndex( Value **&indexes,
ValueInternalArray::PageIndex &indexCount,
ValueInternalArray::PageIndex minNewIndexCount )
{
ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
if ( minNewIndexCount > newIndexCount )
newIndexCount = minNewIndexCount;
void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
if ( !newIndexes )
throw std::bad_alloc();
indexCount = newIndexCount;
indexes = static_cast<Value **>( newIndexes );
}
virtual void releaseArrayPageIndex( Value **indexes,
ValueInternalArray::PageIndex indexCount )
{
if ( indexes )
free( indexes );
}
virtual Value *allocateArrayPage()
{
return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) );
}
virtual void releaseArrayPage( Value *value )
{
if ( value )
free( value );
}
};
#else // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
/// @todo make this thread-safe (lock when accessign batch allocator)
class DefaultValueArrayAllocator : public ValueArrayAllocator
{
public: // overridden from ValueArrayAllocator
virtual ~DefaultValueArrayAllocator()
{
}
virtual ValueInternalArray *newArray()
{
ValueInternalArray *array = arraysAllocator_.allocate();
new (array) ValueInternalArray(); // placement new
return array;
}
virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
{
ValueInternalArray *array = arraysAllocator_.allocate();
new (array) ValueInternalArray( other ); // placement new
return array;
}
virtual void destructArray( ValueInternalArray *array )
{
if ( array )
{
array->~ValueInternalArray();
arraysAllocator_.release( array );
}
}
virtual void reallocateArrayPageIndex( Value **&indexes,
ValueInternalArray::PageIndex &indexCount,
ValueInternalArray::PageIndex minNewIndexCount )
{
ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
if ( minNewIndexCount > newIndexCount )
newIndexCount = minNewIndexCount;
void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
if ( !newIndexes )
throw std::bad_alloc();
indexCount = newIndexCount;
indexes = static_cast<Value **>( newIndexes );
}
virtual void releaseArrayPageIndex( Value **indexes,
ValueInternalArray::PageIndex indexCount )
{
if ( indexes )
free( indexes );
}
virtual Value *allocateArrayPage()
{
return static_cast<Value *>( pagesAllocator_.allocate() );
}
virtual void releaseArrayPage( Value *value )
{
if ( value )
pagesAllocator_.release( value );
}
private:
BatchAllocator<ValueInternalArray,1> arraysAllocator_;
BatchAllocator<Value,ValueInternalArray::itemsPerPage> pagesAllocator_;
};
#endif // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
static ValueArrayAllocator *&arrayAllocator()
{
static DefaultValueArrayAllocator defaultAllocator;
static ValueArrayAllocator *arrayAllocator = &defaultAllocator;
return arrayAllocator;
}
static struct DummyArrayAllocatorInitializer {
DummyArrayAllocatorInitializer()
{
arrayAllocator(); // ensure arrayAllocator() statics are initialized before main().
}
} dummyArrayAllocatorInitializer;
// //////////////////////////////////////////////////////////////////
// class ValueInternalArray
// //////////////////////////////////////////////////////////////////
bool
ValueInternalArray::equals( const IteratorState &x,
const IteratorState &other )
{
return x.array_ == other.array_
&& x.currentItemIndex_ == other.currentItemIndex_
&& x.currentPageIndex_ == other.currentPageIndex_;
}
void
ValueInternalArray::increment( IteratorState &it )
{
JSON_ASSERT_MESSAGE( it.array_ &&
(it.currentPageIndex_ - it.array_->pages_)*itemsPerPage + it.currentItemIndex_
!= it.array_->size_,
"ValueInternalArray::increment(): moving iterator beyond end" );
++(it.currentItemIndex_);
if ( it.currentItemIndex_ == itemsPerPage )
{
it.currentItemIndex_ = 0;
++(it.currentPageIndex_);
}
}
void
ValueInternalArray::decrement( IteratorState &it )
{
JSON_ASSERT_MESSAGE( it.array_ && it.currentPageIndex_ == it.array_->pages_
&& it.currentItemIndex_ == 0,
"ValueInternalArray::decrement(): moving iterator beyond end" );
if ( it.currentItemIndex_ == 0 )
{
it.currentItemIndex_ = itemsPerPage-1;
--(it.currentPageIndex_);
}
else
{
--(it.currentItemIndex_);
}
}
Value &
ValueInternalArray::unsafeDereference( const IteratorState &it )
{
return (*(it.currentPageIndex_))[it.currentItemIndex_];
}
Value &
ValueInternalArray::dereference( const IteratorState &it )
{
JSON_ASSERT_MESSAGE( it.array_ &&
(it.currentPageIndex_ - it.array_->pages_)*itemsPerPage + it.currentItemIndex_
< it.array_->size_,
"ValueInternalArray::dereference(): dereferencing invalid iterator" );
return unsafeDereference( it );
}
void
ValueInternalArray::makeBeginIterator( IteratorState &it ) const
{
it.array_ = const_cast<ValueInternalArray *>( this );
it.currentItemIndex_ = 0;
it.currentPageIndex_ = pages_;
}
void
ValueInternalArray::makeIterator( IteratorState &it, ArrayIndex index ) const
{
it.array_ = const_cast<ValueInternalArray *>( this );
it.currentItemIndex_ = index % itemsPerPage;
it.currentPageIndex_ = pages_ + index / itemsPerPage;
}
void
ValueInternalArray::makeEndIterator( IteratorState &it ) const
{
makeIterator( it, size_ );
}
ValueInternalArray::ValueInternalArray()
: pages_( 0 )
, size_( 0 )
, pageCount_( 0 )
{
}
ValueInternalArray::ValueInternalArray( const ValueInternalArray &other )
: pages_( 0 )
, pageCount_( 0 )
, size_( other.size_ )
{
PageIndex minNewPages = other.size_ / itemsPerPage;
arrayAllocator()->reallocateArrayPageIndex( pages_, pageCount_, minNewPages );
JSON_ASSERT_MESSAGE( pageCount_ >= minNewPages,
"ValueInternalArray::reserve(): bad reallocation" );
IteratorState itOther;
other.makeBeginIterator( itOther );
Value *value;
for ( ArrayIndex index = 0; index < size_; ++index, increment(itOther) )
{
if ( index % itemsPerPage == 0 )
{
PageIndex pageIndex = index / itemsPerPage;
value = arrayAllocator()->allocateArrayPage();
pages_[pageIndex] = value;
}
new (value) Value( dereference( itOther ) );
}
}
ValueInternalArray &
ValueInternalArray::operator =( const ValueInternalArray &other )
{
ValueInternalArray temp( other );
swap( temp );
return *this;
}
ValueInternalArray::~ValueInternalArray()
{
// destroy all constructed items
IteratorState it;
IteratorState itEnd;
makeBeginIterator( it);
makeEndIterator( itEnd );
for ( ; !equals(it,itEnd); increment(it) )
{
Value *value = &dereference(it);
value->~Value();
}
// release all pages
PageIndex lastPageIndex = size_ / itemsPerPage;
for ( PageIndex pageIndex = 0; pageIndex < lastPageIndex; ++pageIndex )
arrayAllocator()->releaseArrayPage( pages_[pageIndex] );
// release pages index
arrayAllocator()->releaseArrayPageIndex( pages_, pageCount_ );
}
void
ValueInternalArray::swap( ValueInternalArray &other )
{
Value **tempPages = pages_;
pages_ = other.pages_;
other.pages_ = tempPages;
ArrayIndex tempSize = size_;
size_ = other.size_;
other.size_ = tempSize;
PageIndex tempPageCount = pageCount_;
pageCount_ = other.pageCount_;
other.pageCount_ = tempPageCount;
}
void
ValueInternalArray::clear()
{
ValueInternalArray dummy;
swap( dummy );
}
void
ValueInternalArray::resize( ArrayIndex newSize )
{
if ( newSize == 0 )
clear();
else if ( newSize < size_ )
{
IteratorState it;
IteratorState itEnd;
makeIterator( it, newSize );
makeIterator( itEnd, size_ );
for ( ; !equals(it,itEnd); increment(it) )
{
Value *value = &dereference(it);
value->~Value();
}
PageIndex pageIndex = (newSize + itemsPerPage - 1) / itemsPerPage;
PageIndex lastPageIndex = size_ / itemsPerPage;
for ( ; pageIndex < lastPageIndex; ++pageIndex )
arrayAllocator()->releaseArrayPage( pages_[pageIndex] );
size_ = newSize;
}
else if ( newSize > size_ )
resolveReference( newSize );
}
void
ValueInternalArray::makeIndexValid( ArrayIndex index )
{
// Need to enlarge page index ?
if ( index >= pageCount_ * itemsPerPage )
{
PageIndex minNewPages = (index + 1) / itemsPerPage;
arrayAllocator()->reallocateArrayPageIndex( pages_, pageCount_, minNewPages );
JSON_ASSERT_MESSAGE( pageCount_ >= minNewPages, "ValueInternalArray::reserve(): bad reallocation" );
}
// Need to allocate new pages ?
ArrayIndex nextPageIndex =
(size_ % itemsPerPage) != 0 ? size_ - (size_%itemsPerPage) + itemsPerPage
: size_;
if ( nextPageIndex <= index )
{
PageIndex pageIndex = nextPageIndex / itemsPerPage;
PageIndex pageToAllocate = (index - nextPageIndex) / itemsPerPage + 1;
for ( ; pageToAllocate-- > 0; ++pageIndex )
pages_[pageIndex] = arrayAllocator()->allocateArrayPage();
}
// Initialize all new entries
IteratorState it;
IteratorState itEnd;
makeIterator( it, size_ );
size_ = index + 1;
makeIterator( itEnd, size_ );
for ( ; !equals(it,itEnd); increment(it) )
{
Value *value = &dereference(it);
new (value) Value(); // Construct a default value using placement new
}
}
Value &
ValueInternalArray::resolveReference( ArrayIndex index )
{
if ( index >= size_ )
makeIndexValid( index );
return pages_[index/itemsPerPage][index%itemsPerPage];
}
Value *
ValueInternalArray::find( ArrayIndex index ) const
{
if ( index >= size_ )
return 0;
return &(pages_[index/itemsPerPage][index%itemsPerPage]);
}
ValueInternalArray::ArrayIndex
ValueInternalArray::size() const
{
return size_;
}
int
ValueInternalArray::distance( const IteratorState &x, const IteratorState &y )
{
return indexOf(y) - indexOf(x);
}
ValueInternalArray::ArrayIndex
ValueInternalArray::indexOf( const IteratorState &iterator )
{
if ( !iterator.array_ )
return ArrayIndex(-1);
return ArrayIndex(
(iterator.currentPageIndex_ - iterator.array_->pages_) * itemsPerPage
+ iterator.currentItemIndex_ );
}
int
ValueInternalArray::compare( const ValueInternalArray &other ) const
{
int sizeDiff( size_ - other.size_ );
if ( sizeDiff != 0 )
return sizeDiff;
for ( ArrayIndex index =0; index < size_; ++index )
{
int diff = pages_[index/itemsPerPage][index%itemsPerPage].compare(
other.pages_[index/itemsPerPage][index%itemsPerPage] );
if ( diff != 0 )
return diff;
}
return 0;
}

607
3rdparty/json/inc/json_internalmap.inl vendored Normal file
View File

@ -0,0 +1,607 @@
// included by json_value.cpp
// everything is within Json namespace
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueInternalMap
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
/** \internal MUST be safely initialized using memset( this, 0, sizeof(ValueInternalLink) );
* This optimization is used by the fast allocator.
*/
ValueInternalLink::ValueInternalLink()
: previous_( 0 )
, next_( 0 )
{
}
ValueInternalLink::~ValueInternalLink()
{
for ( int index =0; index < itemPerLink; ++index )
{
if ( !items_[index].isItemAvailable() )
{
if ( !items_[index].isMemberNameStatic() )
free( keys_[index] );
}
else
break;
}
}
ValueMapAllocator::~ValueMapAllocator()
{
}
#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
class DefaultValueMapAllocator : public ValueMapAllocator
{
public: // overridden from ValueMapAllocator
virtual ValueInternalMap *newMap()
{
return new ValueInternalMap();
}
virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
{
return new ValueInternalMap( other );
}
virtual void destructMap( ValueInternalMap *map )
{
delete map;
}
virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
{
return new ValueInternalLink[size];
}
virtual void releaseMapBuckets( ValueInternalLink *links )
{
delete [] links;
}
virtual ValueInternalLink *allocateMapLink()
{
return new ValueInternalLink();
}
virtual void releaseMapLink( ValueInternalLink *link )
{
delete link;
}
};
#else
/// @todo make this thread-safe (lock when accessign batch allocator)
class DefaultValueMapAllocator : public ValueMapAllocator
{
public: // overridden from ValueMapAllocator
virtual ValueInternalMap *newMap()
{
ValueInternalMap *map = mapsAllocator_.allocate();
new (map) ValueInternalMap(); // placement new
return map;
}
virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
{
ValueInternalMap *map = mapsAllocator_.allocate();
new (map) ValueInternalMap( other ); // placement new
return map;
}
virtual void destructMap( ValueInternalMap *map )
{
if ( map )
{
map->~ValueInternalMap();
mapsAllocator_.release( map );
}
}
virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
{
return new ValueInternalLink[size];
}
virtual void releaseMapBuckets( ValueInternalLink *links )
{
delete [] links;
}
virtual ValueInternalLink *allocateMapLink()
{
ValueInternalLink *link = linksAllocator_.allocate();
memset( link, 0, sizeof(ValueInternalLink) );
return link;
}
virtual void releaseMapLink( ValueInternalLink *link )
{
link->~ValueInternalLink();
linksAllocator_.release( link );
}
private:
BatchAllocator<ValueInternalMap,1> mapsAllocator_;
BatchAllocator<ValueInternalLink,1> linksAllocator_;
};
#endif
static ValueMapAllocator *&mapAllocator()
{
static DefaultValueMapAllocator defaultAllocator;
static ValueMapAllocator *mapAllocator = &defaultAllocator;
return mapAllocator;
}
static struct DummyMapAllocatorInitializer {
DummyMapAllocatorInitializer()
{
mapAllocator(); // ensure mapAllocator() statics are initialized before main().
}
} dummyMapAllocatorInitializer;
// h(K) = value * K >> w ; with w = 32 & K prime w.r.t. 2^32.
/*
use linked list hash map.
buckets array is a container.
linked list element contains 6 key/values. (memory = (16+4) * 6 + 4 = 124)
value have extra state: valid, available, deleted
*/
ValueInternalMap::ValueInternalMap()
: buckets_( 0 )
, tailLink_( 0 )
, bucketsSize_( 0 )
, itemCount_( 0 )
{
}
ValueInternalMap::ValueInternalMap( const ValueInternalMap &other )
: buckets_( 0 )
, tailLink_( 0 )
, bucketsSize_( 0 )
, itemCount_( 0 )
{
reserve( other.itemCount_ );
IteratorState it;
IteratorState itEnd;
other.makeBeginIterator( it );
other.makeEndIterator( itEnd );
for ( ; !equals(it,itEnd); increment(it) )
{
bool isStatic;
const char *memberName = key( it, isStatic );
const Value &aValue = value( it );
resolveReference(memberName, isStatic) = aValue;
}
}
ValueInternalMap &
ValueInternalMap::operator =( const ValueInternalMap &other )
{
ValueInternalMap dummy( other );
swap( dummy );
return *this;
}
ValueInternalMap::~ValueInternalMap()
{
if ( buckets_ )
{
for ( BucketIndex bucketIndex =0; bucketIndex < bucketsSize_; ++bucketIndex )
{
ValueInternalLink *link = buckets_[bucketIndex].next_;
while ( link )
{
ValueInternalLink *linkToRelease = link;
link = link->next_;
mapAllocator()->releaseMapLink( linkToRelease );
}
}
mapAllocator()->releaseMapBuckets( buckets_ );
}
}
void
ValueInternalMap::swap( ValueInternalMap &other )
{
ValueInternalLink *tempBuckets = buckets_;
buckets_ = other.buckets_;
other.buckets_ = tempBuckets;
ValueInternalLink *tempTailLink = tailLink_;
tailLink_ = other.tailLink_;
other.tailLink_ = tempTailLink;
BucketIndex tempBucketsSize = bucketsSize_;
bucketsSize_ = other.bucketsSize_;
other.bucketsSize_ = tempBucketsSize;
BucketIndex tempItemCount = itemCount_;
itemCount_ = other.itemCount_;
other.itemCount_ = tempItemCount;
}
void
ValueInternalMap::clear()
{
ValueInternalMap dummy;
swap( dummy );
}
ValueInternalMap::BucketIndex
ValueInternalMap::size() const
{
return itemCount_;
}
bool
ValueInternalMap::reserveDelta( BucketIndex growth )
{
return reserve( itemCount_ + growth );
}
bool
ValueInternalMap::reserve( BucketIndex newItemCount )
{
if ( !buckets_ && newItemCount > 0 )
{
buckets_ = mapAllocator()->allocateMapBuckets( 1 );
bucketsSize_ = 1;
tailLink_ = &buckets_[0];
}
// BucketIndex idealBucketCount = (newItemCount + ValueInternalLink::itemPerLink) / ValueInternalLink::itemPerLink;
return true;
}
const Value *
ValueInternalMap::find( const char *key ) const
{
if ( !bucketsSize_ )
return 0;
HashKey hashedKey = hash( key );
BucketIndex bucketIndex = hashedKey % bucketsSize_;
for ( const ValueInternalLink *current = &buckets_[bucketIndex];
current != 0;
current = current->next_ )
{
for ( BucketIndex index=0; index < ValueInternalLink::itemPerLink; ++index )
{
if ( current->items_[index].isItemAvailable() )
return 0;
if ( strcmp( key, current->keys_[index] ) == 0 )
return &current->items_[index];
}
}
return 0;
}
Value *
ValueInternalMap::find( const char *key )
{
const ValueInternalMap *constThis = this;
return const_cast<Value *>( constThis->find( key ) );
}
Value &
ValueInternalMap::resolveReference( const char *key,
bool isStatic )
{
HashKey hashedKey = hash( key );
if ( bucketsSize_ )
{
BucketIndex bucketIndex = hashedKey % bucketsSize_;
ValueInternalLink **previous = 0;
BucketIndex index;
for ( ValueInternalLink *current = &buckets_[bucketIndex];
current != 0;
previous = &current->next_, current = current->next_ )
{
for ( index=0; index < ValueInternalLink::itemPerLink; ++index )
{
if ( current->items_[index].isItemAvailable() )
return setNewItem( key, isStatic, current, index );
if ( strcmp( key, current->keys_[index] ) == 0 )
return current->items_[index];
}
}
}
reserveDelta( 1 );
return unsafeAdd( key, isStatic, hashedKey );
}
void
ValueInternalMap::remove( const char *key )
{
HashKey hashedKey = hash( key );
if ( !bucketsSize_ )
return;
BucketIndex bucketIndex = hashedKey % bucketsSize_;
for ( ValueInternalLink *link = &buckets_[bucketIndex];
link != 0;
link = link->next_ )
{
BucketIndex index;
for ( index =0; index < ValueInternalLink::itemPerLink; ++index )
{
if ( link->items_[index].isItemAvailable() )
return;
if ( strcmp( key, link->keys_[index] ) == 0 )
{
doActualRemove( link, index, bucketIndex );
return;
}
}
}
}
void
ValueInternalMap::doActualRemove( ValueInternalLink *link,
BucketIndex index,
BucketIndex bucketIndex )
{
// find last item of the bucket and swap it with the 'removed' one.
// set removed items flags to 'available'.
// if last page only contains 'available' items, then desallocate it (it's empty)
ValueInternalLink *&lastLink = getLastLinkInBucket( index );
BucketIndex lastItemIndex = 1; // a link can never be empty, so start at 1
for ( ;
lastItemIndex < ValueInternalLink::itemPerLink;
++lastItemIndex ) // may be optimized with dicotomic search
{
if ( lastLink->items_[lastItemIndex].isItemAvailable() )
break;
}
BucketIndex lastUsedIndex = lastItemIndex - 1;
Value *valueToDelete = &link->items_[index];
Value *valueToPreserve = &lastLink->items_[lastUsedIndex];
if ( valueToDelete != valueToPreserve )
valueToDelete->swap( *valueToPreserve );
if ( lastUsedIndex == 0 ) // page is now empty
{ // remove it from bucket linked list and delete it.
ValueInternalLink *linkPreviousToLast = lastLink->previous_;
if ( linkPreviousToLast != 0 ) // can not deleted bucket link.
{
mapAllocator()->releaseMapLink( lastLink );
linkPreviousToLast->next_ = 0;
lastLink = linkPreviousToLast;
}
}
else
{
Value dummy;
valueToPreserve->swap( dummy ); // restore deleted to default Value.
valueToPreserve->setItemUsed( false );
}
--itemCount_;
}
ValueInternalLink *&
ValueInternalMap::getLastLinkInBucket( BucketIndex bucketIndex )
{
if ( bucketIndex == bucketsSize_ - 1 )
return tailLink_;
ValueInternalLink *&previous = buckets_[bucketIndex+1].previous_;
if ( !previous )
previous = &buckets_[bucketIndex];
return previous;
}
Value &
ValueInternalMap::setNewItem( const char *key,
bool isStatic,
ValueInternalLink *link,
BucketIndex index )
{
char *duplicatedKey = valueAllocator()->makeMemberName( key );
++itemCount_;
link->keys_[index] = duplicatedKey;
link->items_[index].setItemUsed();
link->items_[index].setMemberNameIsStatic( isStatic );
return link->items_[index]; // items already default constructed.
}
Value &
ValueInternalMap::unsafeAdd( const char *key,
bool isStatic,
HashKey hashedKey )
{
JSON_ASSERT_MESSAGE( bucketsSize_ > 0, "ValueInternalMap::unsafeAdd(): internal logic error." );
BucketIndex bucketIndex = hashedKey % bucketsSize_;
ValueInternalLink *&previousLink = getLastLinkInBucket( bucketIndex );
ValueInternalLink *link = previousLink;
BucketIndex index;
for ( index =0; index < ValueInternalLink::itemPerLink; ++index )
{
if ( link->items_[index].isItemAvailable() )
break;
}
if ( index == ValueInternalLink::itemPerLink ) // need to add a new page
{
ValueInternalLink *newLink = mapAllocator()->allocateMapLink();
index = 0;
link->next_ = newLink;
previousLink = newLink;
link = newLink;
}
return setNewItem( key, isStatic, link, index );
}
ValueInternalMap::HashKey
ValueInternalMap::hash( const char *key ) const
{
HashKey hash = 0;
while ( *key )
hash += *key++ * 37;
return hash;
}
int
ValueInternalMap::compare( const ValueInternalMap &other ) const
{
int sizeDiff( itemCount_ - other.itemCount_ );
if ( sizeDiff != 0 )
return sizeDiff;
// Strict order guaranty is required. Compare all keys FIRST, then compare values.
IteratorState it;
IteratorState itEnd;
makeBeginIterator( it );
makeEndIterator( itEnd );
for ( ; !equals(it,itEnd); increment(it) )
{
if ( !other.find( key( it ) ) )
return 1;
}
// All keys are equals, let's compare values
makeBeginIterator( it );
for ( ; !equals(it,itEnd); increment(it) )
{
const Value *otherValue = other.find( key( it ) );
int valueDiff = value(it).compare( *otherValue );
if ( valueDiff != 0 )
return valueDiff;
}
return 0;
}
void
ValueInternalMap::makeBeginIterator( IteratorState &it ) const
{
it.map_ = const_cast<ValueInternalMap *>( this );
it.bucketIndex_ = 0;
it.itemIndex_ = 0;
it.link_ = buckets_;
}
void
ValueInternalMap::makeEndIterator( IteratorState &it ) const
{
it.map_ = const_cast<ValueInternalMap *>( this );
it.bucketIndex_ = bucketsSize_;
it.itemIndex_ = 0;
it.link_ = 0;
}
bool
ValueInternalMap::equals( const IteratorState &x, const IteratorState &other )
{
return x.map_ == other.map_
&& x.bucketIndex_ == other.bucketIndex_
&& x.link_ == other.link_
&& x.itemIndex_ == other.itemIndex_;
}
void
ValueInternalMap::incrementBucket( IteratorState &iterator )
{
++iterator.bucketIndex_;
JSON_ASSERT_MESSAGE( iterator.bucketIndex_ <= iterator.map_->bucketsSize_,
"ValueInternalMap::increment(): attempting to iterate beyond end." );
if ( iterator.bucketIndex_ == iterator.map_->bucketsSize_ )
iterator.link_ = 0;
else
iterator.link_ = &(iterator.map_->buckets_[iterator.bucketIndex_]);
iterator.itemIndex_ = 0;
}
void
ValueInternalMap::increment( IteratorState &iterator )
{
JSON_ASSERT_MESSAGE( iterator.map_, "Attempting to iterator using invalid iterator." );
++iterator.itemIndex_;
if ( iterator.itemIndex_ == ValueInternalLink::itemPerLink )
{
JSON_ASSERT_MESSAGE( iterator.link_ != 0,
"ValueInternalMap::increment(): attempting to iterate beyond end." );
iterator.link_ = iterator.link_->next_;
if ( iterator.link_ == 0 )
incrementBucket( iterator );
}
else if ( iterator.link_->items_[iterator.itemIndex_].isItemAvailable() )
{
incrementBucket( iterator );
}
}
void
ValueInternalMap::decrement( IteratorState &iterator )
{
if ( iterator.itemIndex_ == 0 )
{
JSON_ASSERT_MESSAGE( iterator.map_, "Attempting to iterate using invalid iterator." );
if ( iterator.link_ == &iterator.map_->buckets_[iterator.bucketIndex_] )
{
JSON_ASSERT_MESSAGE( iterator.bucketIndex_ > 0, "Attempting to iterate beyond beginning." );
--(iterator.bucketIndex_);
}
iterator.link_ = iterator.link_->previous_;
iterator.itemIndex_ = ValueInternalLink::itemPerLink - 1;
}
}
const char *
ValueInternalMap::key( const IteratorState &iterator )
{
JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." );
return iterator.link_->keys_[iterator.itemIndex_];
}
const char *
ValueInternalMap::key( const IteratorState &iterator, bool &isStatic )
{
JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." );
isStatic = iterator.link_->items_[iterator.itemIndex_].isMemberNameStatic();
return iterator.link_->keys_[iterator.itemIndex_];
}
Value &
ValueInternalMap::value( const IteratorState &iterator )
{
JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." );
return iterator.link_->items_[iterator.itemIndex_];
}
int
ValueInternalMap::distance( const IteratorState &x, const IteratorState &y )
{
int offset = 0;
IteratorState it = x;
while ( !equals( it, y ) )
increment( it );
return offset;
}

196
3rdparty/json/inc/json_reader.h vendored Normal file
View File

@ -0,0 +1,196 @@
#ifndef CPPTL_JSON_READER_H_INCLUDED
# define CPPTL_JSON_READER_H_INCLUDED
# include "json_features.h"
# include "json_value.h"
# include <deque>
# include <stack>
# include <string>
# include <iostream>
namespace Json {
/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a Value.
*
*/
class JSON_API Reader
{
public:
typedef char Char;
typedef const Char *Location;
/** \brief Constructs a Reader allowing all features
* for parsing.
*/
Reader();
/** \brief Constructs a Reader allowing the specified feature set
* for parsing.
*/
Reader( const Features &features );
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
* \param document UTF-8 encoded string containing the document to read.
* \param root [out] Contains the root value of the document if it was
* successfully parsed.
* \param collectComments \c true to collect comment and allow writing them back during
* serialization, \c false to discard comments.
* This parameter is ignored if Features::allowComments_
* is \c false.
* \return \c true if the document was successfully parsed, \c false if an error occurred.
*/
bool parse( const std::string &document,
Value &root,
bool collectComments = true );
/** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
* \param document UTF-8 encoded string containing the document to read.
* \param root [out] Contains the root value of the document if it was
* successfully parsed.
* \param collectComments \c true to collect comment and allow writing them back during
* serialization, \c false to discard comments.
* This parameter is ignored if Features::allowComments_
* is \c false.
* \return \c true if the document was successfully parsed, \c false if an error occurred.
*/
bool parse( const char *beginDoc, const char *endDoc,
Value &root,
bool collectComments = true );
/// \brief Parse from input stream.
/// \see Json::operator>>(std::istream&, Json::Value&).
bool parse( std::istream &is,
Value &root,
bool collectComments = true );
/** \brief Returns a user friendly string that list errors in the parsed document.
* \return Formatted error message with the list of errors with their location in
* the parsed document. An empty string is returned if no error occurred
* during parsing.
*/
std::string getFormatedErrorMessages() const;
private:
enum TokenType
{
tokenEndOfStream = 0,
tokenObjectBegin,
tokenObjectEnd,
tokenArrayBegin,
tokenArrayEnd,
tokenString,
tokenNumber,
tokenTrue,
tokenFalse,
tokenNull,
tokenArraySeparator,
tokenMemberSeparator,
tokenComment,
tokenError
};
class Token
{
public:
TokenType type_;
Location start_;
Location end_;
};
class ErrorInfo
{
public:
Token token_;
std::string message_;
Location extra_;
};
typedef std::deque<ErrorInfo> Errors;
bool expectToken( TokenType type, Token &token, const char *message );
bool readToken( Token &token );
void skipSpaces();
bool match( Location pattern,
int patternLength );
bool readComment();
bool readCStyleComment();
bool readCppStyleComment();
bool readString();
void readNumber();
bool readValue();
bool readObject( Token &token );
bool readArray( Token &token );
bool decodeNumber( Token &token );
bool decodeString( Token &token );
bool decodeString( Token &token, std::string &decoded );
bool decodeDouble( Token &token );
bool decodeUnicodeCodePoint( Token &token,
Location &current,
Location end,
unsigned int &unicode );
bool decodeUnicodeEscapeSequence( Token &token,
Location &current,
Location end,
unsigned int &unicode );
bool addError( const std::string &message,
Token &token,
Location extra = 0 );
bool recoverFromError( TokenType skipUntilToken );
bool addErrorAndRecover( const std::string &message,
Token &token,
TokenType skipUntilToken );
void skipUntilSpace();
Value &currentValue();
Char getNextChar();
void getLocationLineAndColumn( Location location,
int &line,
int &column ) const;
std::string getLocationLineAndColumn( Location location ) const;
void addComment( Location begin,
Location end,
CommentPlacement placement );
void skipCommentTokens( Token &token );
typedef std::stack<Value *> Nodes;
Nodes nodes_;
Errors errors_;
std::string document_;
Location begin_;
Location end_;
Location current_;
Location lastValueEnd_;
Value *lastValue_;
std::string commentsBefore_;
Features features_;
bool collectComments_;
};
/** \brief Read from 'sin' into 'root'.
Always keep comments from the input JSON.
This can be used to read a file into a particular sub-object.
For example:
\code
Json::Value root;
cin >> root["dir"]["file"];
cout << root;
\endcode
Result:
\verbatim
{
"dir": {
"file": {
// The input stream JSON would be nested here.
}
}
}
\endverbatim
\throw std::exception on parse error.
\see Json::operator<<()
*/
std::istream& operator>>( std::istream&, Value& );
} // namespace Json
#endif // CPPTL_JSON_READER_H_INCLUDED

1070
3rdparty/json/inc/json_value.h vendored Normal file

File diff suppressed because it is too large Load Diff

292
3rdparty/json/inc/json_valueiterator.inl vendored Normal file
View File

@ -0,0 +1,292 @@
// included by json_value.cpp
// everything is within Json namespace
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueIteratorBase
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueIteratorBase::ValueIteratorBase()
#ifndef JSON_VALUE_USE_INTERNAL_MAP
: current_()
, isNull_( true )
{
}
#else
: isArray_( true )
, isNull_( true )
{
iterator_.array_ = ValueInternalArray::IteratorState();
}
#endif
#ifndef JSON_VALUE_USE_INTERNAL_MAP
ValueIteratorBase::ValueIteratorBase( const Value::ObjectValues::iterator &current )
: current_( current )
, isNull_( false )
{
}
#else
ValueIteratorBase::ValueIteratorBase( const ValueInternalArray::IteratorState &state )
: isArray_( true )
{
iterator_.array_ = state;
}
ValueIteratorBase::ValueIteratorBase( const ValueInternalMap::IteratorState &state )
: isArray_( false )
{
iterator_.map_ = state;
}
#endif
Value &
ValueIteratorBase::deref() const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
return current_->second;
#else
if ( isArray_ )
return ValueInternalArray::dereference( iterator_.array_ );
return ValueInternalMap::value( iterator_.map_ );
#endif
}
void
ValueIteratorBase::increment()
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
++current_;
#else
if ( isArray_ )
ValueInternalArray::increment( iterator_.array_ );
ValueInternalMap::increment( iterator_.map_ );
#endif
}
void
ValueIteratorBase::decrement()
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
--current_;
#else
if ( isArray_ )
ValueInternalArray::decrement( iterator_.array_ );
ValueInternalMap::decrement( iterator_.map_ );
#endif
}
ValueIteratorBase::difference_type
ValueIteratorBase::computeDistance( const SelfType &other ) const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
# ifdef JSON_USE_CPPTL_SMALLMAP
return current_ - other.current_;
# else
// Iterator for null value are initialized using the default
// constructor, which initialize current_ to the default
// std::map::iterator. As begin() and end() are two instance
// of the default std::map::iterator, they can not be compared.
// To allow this, we handle this comparison specifically.
if ( isNull_ && other.isNull_ )
{
return 0;
}
// Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL,
// which is the one used by default).
// Using a portable hand-made version for non random iterator instead:
// return difference_type( std::distance( current_, other.current_ ) );
difference_type myDistance = 0;
for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it )
{
++myDistance;
}
return myDistance;
# endif
#else
if ( isArray_ )
return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ );
return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ );
#endif
}
bool
ValueIteratorBase::isEqual( const SelfType &other ) const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
if ( isNull_ )
{
return other.isNull_;
}
return current_ == other.current_;
#else
if ( isArray_ )
return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ );
return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ );
#endif
}
void
ValueIteratorBase::copy( const SelfType &other )
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
current_ = other.current_;
#else
if ( isArray_ )
iterator_.array_ = other.iterator_.array_;
iterator_.map_ = other.iterator_.map_;
#endif
}
Value
ValueIteratorBase::key() const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
const Value::CZString czstring = (*current_).first;
if ( czstring.c_str() )
{
if ( czstring.isStaticString() )
return Value( StaticString( czstring.c_str() ) );
return Value( czstring.c_str() );
}
return Value( czstring.index() );
#else
if ( isArray_ )
return Value( ValueInternalArray::indexOf( iterator_.array_ ) );
bool isStatic;
const char *memberName = ValueInternalMap::key( iterator_.map_, isStatic );
if ( isStatic )
return Value( StaticString( memberName ) );
return Value( memberName );
#endif
}
UInt
ValueIteratorBase::index() const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
const Value::CZString czstring = (*current_).first;
if ( !czstring.c_str() )
return czstring.index();
return Value::UInt( -1 );
#else
if ( isArray_ )
return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) );
return Value::UInt( -1 );
#endif
}
const char *
ValueIteratorBase::memberName() const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
const char *name = (*current_).first.c_str();
return name ? name : "";
#else
if ( !isArray_ )
return ValueInternalMap::key( iterator_.map_ );
return "";
#endif
}
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueConstIterator
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueConstIterator::ValueConstIterator()
{
}
#ifndef JSON_VALUE_USE_INTERNAL_MAP
ValueConstIterator::ValueConstIterator( const Value::ObjectValues::iterator &current )
: ValueIteratorBase( current )
{
}
#else
ValueConstIterator::ValueConstIterator( const ValueInternalArray::IteratorState &state )
: ValueIteratorBase( state )
{
}
ValueConstIterator::ValueConstIterator( const ValueInternalMap::IteratorState &state )
: ValueIteratorBase( state )
{
}
#endif
ValueConstIterator &
ValueConstIterator::operator =( const ValueIteratorBase &other )
{
copy( other );
return *this;
}
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueIterator
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueIterator::ValueIterator()
{
}
#ifndef JSON_VALUE_USE_INTERNAL_MAP
ValueIterator::ValueIterator( const Value::ObjectValues::iterator &current )
: ValueIteratorBase( current )
{
}
#else
ValueIterator::ValueIterator( const ValueInternalArray::IteratorState &state )
: ValueIteratorBase( state )
{
}
ValueIterator::ValueIterator( const ValueInternalMap::IteratorState &state )
: ValueIteratorBase( state )
{
}
#endif
ValueIterator::ValueIterator( const ValueConstIterator &other )
: ValueIteratorBase( other )
{
}
ValueIterator::ValueIterator( const ValueIterator &other )
: ValueIteratorBase( other )
{
}
ValueIterator &
ValueIterator::operator =( const SelfType &other )
{
copy( other );
return *this;
}

174
3rdparty/json/inc/json_writer.h vendored Normal file
View File

@ -0,0 +1,174 @@
#ifndef JSON_WRITER_H_INCLUDED
# define JSON_WRITER_H_INCLUDED
# include "json_value.h"
# include <vector>
# include <string>
# include <iostream>
namespace Json {
class Value;
/** \brief Abstract class for writers.
*/
class JSON_API Writer
{
public:
virtual ~Writer();
virtual std::string write( const Value &root ) = 0;
};
/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format without formatting (not human friendly).
*
* The JSON document is written in a single line. It is not intended for 'human' consumption,
* but may be usefull to support feature such as RPC where bandwith is limited.
* \sa Reader, Value
*/
class JSON_API FastWriter : public Writer
{
public:
FastWriter();
virtual ~FastWriter(){}
void enableYAMLCompatibility();
public: // overridden from Writer
virtual std::string write( const Value &root );
private:
void writeValue( const Value &value );
std::string document_;
bool yamlCompatiblityEnabled_;
};
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way.
*
* The rules for line break and indent are as follow:
* - Object value:
* - if empty then print {} without indent and line break
* - if not empty the print '{', line break & indent, print one value per line
* and then unindent and line break and print '}'.
* - Array value:
* - if empty then print [] without indent and line break
* - if the array contains no object value, empty array or some other value types,
* and all the values fit on one lines, then print the array on a single line.
* - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line.
*
* If the Value have comments then they are outputed according to their #CommentPlacement.
*
* \sa Reader, Value, Value::setComment()
*/
class JSON_API StyledWriter: public Writer
{
public:
StyledWriter();
virtual ~StyledWriter(){}
public: // overridden from Writer
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param root Value to serialize.
* \return String containing the JSON document that represents the root value.
*/
virtual std::string write( const Value &root );
private:
void writeValue( const Value &value );
void writeArrayValue( const Value &value );
bool isMultineArray( const Value &value );
void pushValue( const std::string &value );
void writeIndent();
void writeWithIndent( const std::string &value );
void indent();
void unindent();
void writeCommentBeforeValue( const Value &root );
void writeCommentAfterValueOnSameLine( const Value &root );
bool hasCommentForValue( const Value &value );
static std::string normalizeEOL( const std::string &text );
typedef std::vector<std::string> ChildValues;
ChildValues childValues_;
std::string document_;
std::string indentString_;
int rightMargin_;
int indentSize_;
bool addChildValues_;
};
/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way,
to a stream rather than to a string.
*
* The rules for line break and indent are as follow:
* - Object value:
* - if empty then print {} without indent and line break
* - if not empty the print '{', line break & indent, print one value per line
* and then unindent and line break and print '}'.
* - Array value:
* - if empty then print [] without indent and line break
* - if the array contains no object value, empty array or some other value types,
* and all the values fit on one lines, then print the array on a single line.
* - otherwise, it the values do not fit on one line, or the array contains
* object or non empty array, then print one value per line.
*
* If the Value have comments then they are outputed according to their #CommentPlacement.
*
* \param indentation Each level will be indented by this amount extra.
* \sa Reader, Value, Value::setComment()
*/
class JSON_API StyledStreamWriter
{
public:
StyledStreamWriter( std::string indentation="\t" );
~StyledStreamWriter(){}
public:
/** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
* \param out Stream to write to. (Can be ostringstream, e.g.)
* \param root Value to serialize.
* \note There is no point in deriving from Writer, since write() should not return a value.
*/
void write( std::ostream &out, const Value &root );
private:
void writeValue( const Value &value );
void writeArrayValue( const Value &value );
bool isMultineArray( const Value &value );
void pushValue( const std::string &value );
void writeIndent();
void writeWithIndent( const std::string &value );
void indent();
void unindent();
void writeCommentBeforeValue( const Value &root );
void writeCommentAfterValueOnSameLine( const Value &root );
bool hasCommentForValue( const Value &value );
static std::string normalizeEOL( const std::string &text );
typedef std::vector<std::string> ChildValues;
ChildValues childValues_;
std::ostream* document_;
std::string indentString_;
int rightMargin_;
std::string indentation_;
bool addChildValues_;
};
std::string JSON_API valueToString( Int value );
std::string JSON_API valueToString( UInt value );
std::string JSON_API valueToString( double value );
std::string JSON_API valueToString( bool value );
std::string JSON_API valueToQuotedString( const char *value );
/// \brief Output using the StyledStreamWriter.
/// \see Json::operator>>()
std::ostream& operator<<( std::ostream&, const Value &root );
} // namespace Json
#endif // JSON_WRITER_H_INCLUDED

885
3rdparty/json/src/json_reader.cpp vendored Normal file
View File

@ -0,0 +1,885 @@
#include <json_reader.h>
#include <json_value.h>
#include <utility>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <iostream>
#include <stdexcept>
#if _MSC_VER >= 1400 // VC++ 8.0
#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated.
#endif
namespace Json {
// Implementation of class Features
// ////////////////////////////////
Features::Features()
: allowComments_( true )
, strictRoot_( false )
{
}
Features
Features::all()
{
return Features();
}
Features
Features::strictMode()
{
Features features;
features.allowComments_ = false;
features.strictRoot_ = true;
return features;
}
// Implementation of class Reader
// ////////////////////////////////
static inline bool
in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4 )
{
return c == c1 || c == c2 || c == c3 || c == c4;
}
static inline bool
in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4, Reader::Char c5 )
{
return c == c1 || c == c2 || c == c3 || c == c4 || c == c5;
}
static bool
containsNewLine( Reader::Location begin,
Reader::Location end )
{
for ( ;begin < end; ++begin )
if ( *begin == '\n' || *begin == '\r' )
return true;
return false;
}
static std::string codePointToUTF8(unsigned int cp)
{
std::string result;
// based on description from http://en.wikipedia.org/wiki/UTF-8
if (cp <= 0x7f)
{
result.resize(1);
result[0] = static_cast<char>(cp);
}
else if (cp <= 0x7FF)
{
result.resize(2);
result[1] = static_cast<char>(0x80 | (0x3f & cp));
result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
}
else if (cp <= 0xFFFF)
{
result.resize(3);
result[2] = static_cast<char>(0x80 | (0x3f & cp));
result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6)));
result[0] = 0xE0 | static_cast<char>((0xf & (cp >> 12)));
}
else if (cp <= 0x10FFFF)
{
result.resize(4);
result[3] = static_cast<char>(0x80 | (0x3f & cp));
result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12)));
result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
}
return result;
}
// Class Reader
// //////////////////////////////////////////////////////////////////
Reader::Reader()
: features_( Features::all() )
{
}
Reader::Reader( const Features &features )
: features_( features )
{
}
bool
Reader::parse( const std::string &document,
Value &root,
bool collectComments )
{
document_ = document;
const char *begin = document_.c_str();
const char *end = begin + document_.length();
return parse( begin, end, root, collectComments );
}
bool
Reader::parse( std::istream& sin,
Value &root,
bool collectComments )
{
//std::istream_iterator<char> begin(sin);
//std::istream_iterator<char> end;
// Those would allow streamed input from a file, if parse() were a
// template function.
// Since std::string is reference-counted, this at least does not
// create an extra copy.
std::string doc;
std::getline(sin, doc, (char)EOF);
return parse( doc, root, collectComments );
}
bool
Reader::parse( const char *beginDoc, const char *endDoc,
Value &root,
bool collectComments )
{
if ( !features_.allowComments_ )
{
collectComments = false;
}
begin_ = beginDoc;
end_ = endDoc;
collectComments_ = collectComments;
current_ = begin_;
lastValueEnd_ = 0;
lastValue_ = 0;
commentsBefore_ = "";
errors_.clear();
while ( !nodes_.empty() )
nodes_.pop();
nodes_.push( &root );
bool successful = readValue();
Token token;
skipCommentTokens( token );
if ( collectComments_ && !commentsBefore_.empty() )
root.setComment( commentsBefore_, commentAfter );
if ( features_.strictRoot_ )
{
if ( !root.isArray() && !root.isObject() )
{
// Set error location to start of doc, ideally should be first token found in doc
token.type_ = tokenError;
token.start_ = beginDoc;
token.end_ = endDoc;
addError( "A valid JSON document must be either an array or an object value.",
token );
return false;
}
}
return successful;
}
bool
Reader::readValue()
{
Token token;
skipCommentTokens( token );
bool successful = true;
if ( collectComments_ && !commentsBefore_.empty() )
{
currentValue().setComment( commentsBefore_, commentBefore );
commentsBefore_ = "";
}
switch ( token.type_ )
{
case tokenObjectBegin:
successful = readObject( token );
break;
case tokenArrayBegin:
successful = readArray( token );
break;
case tokenNumber:
successful = decodeNumber( token );
break;
case tokenString:
successful = decodeString( token );
break;
case tokenTrue:
currentValue() = true;
break;
case tokenFalse:
currentValue() = false;
break;
case tokenNull:
currentValue() = Value();
break;
default:
return addError( "Syntax error: value, object or array expected.", token );
}
if ( collectComments_ )
{
lastValueEnd_ = current_;
lastValue_ = &currentValue();
}
return successful;
}
void
Reader::skipCommentTokens( Token &token )
{
if ( features_.allowComments_ )
{
do
{
readToken( token );
}
while ( token.type_ == tokenComment );
}
else
{
readToken( token );
}
}
bool
Reader::expectToken( TokenType type, Token &token, const char *message )
{
readToken( token );
if ( token.type_ != type )
return addError( message, token );
return true;
}
bool
Reader::readToken( Token &token )
{
skipSpaces();
token.start_ = current_;
Char c = getNextChar();
bool ok = true;
switch ( c )
{
case '{':
token.type_ = tokenObjectBegin;
break;
case '}':
token.type_ = tokenObjectEnd;
break;
case '[':
token.type_ = tokenArrayBegin;
break;
case ']':
token.type_ = tokenArrayEnd;
break;
case '"':
token.type_ = tokenString;
ok = readString();
break;
case '/':
token.type_ = tokenComment;
ok = readComment();
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '-':
token.type_ = tokenNumber;
readNumber();
break;
case 't':
token.type_ = tokenTrue;
ok = match( "rue", 3 );
break;
case 'f':
token.type_ = tokenFalse;
ok = match( "alse", 4 );
break;
case 'n':
token.type_ = tokenNull;
ok = match( "ull", 3 );
break;
case ',':
token.type_ = tokenArraySeparator;
break;
case ':':
token.type_ = tokenMemberSeparator;
break;
case 0:
token.type_ = tokenEndOfStream;
break;
default:
ok = false;
break;
}
if ( !ok )
token.type_ = tokenError;
token.end_ = current_;
return true;
}
void
Reader::skipSpaces()
{
while ( current_ != end_ )
{
Char c = *current_;
if ( c == ' ' || c == '\t' || c == '\r' || c == '\n' )
++current_;
else
break;
}
}
bool
Reader::match( Location pattern,
int patternLength )
{
if ( end_ - current_ < patternLength )
return false;
int index = patternLength;
while ( index-- )
if ( current_[index] != pattern[index] )
return false;
current_ += patternLength;
return true;
}
bool
Reader::readComment()
{
Location commentBegin = current_ - 1;
Char c = getNextChar();
bool successful = false;
if ( c == '*' )
successful = readCStyleComment();
else if ( c == '/' )
successful = readCppStyleComment();
if ( !successful )
return false;
if ( collectComments_ )
{
CommentPlacement placement = commentBefore;
if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) )
{
if ( c != '*' || !containsNewLine( commentBegin, current_ ) )
placement = commentAfterOnSameLine;
}
addComment( commentBegin, current_, placement );
}
return true;
}
void
Reader::addComment( Location begin,
Location end,
CommentPlacement placement )
{
assert( collectComments_ );
if ( placement == commentAfterOnSameLine )
{
assert( lastValue_ != 0 );
lastValue_->setComment( std::string( begin, end ), placement );
}
else
{
if ( !commentsBefore_.empty() )
commentsBefore_ += "\n";
commentsBefore_ += std::string( begin, end );
}
}
bool
Reader::readCStyleComment()
{
while ( current_ != end_ )
{
Char c = getNextChar();
if ( c == '*' && *current_ == '/' )
break;
}
return getNextChar() == '/';
}
bool
Reader::readCppStyleComment()
{
while ( current_ != end_ )
{
Char c = getNextChar();
if ( c == '\r' || c == '\n' )
break;
}
return true;
}
void
Reader::readNumber()
{
while ( current_ != end_ )
{
if ( !(*current_ >= '0' && *current_ <= '9') &&
!in( *current_, '.', 'e', 'E', '+', '-' ) )
break;
++current_;
}
}
bool
Reader::readString()
{
Char c = 0;
while ( current_ != end_ )
{
c = getNextChar();
if ( c == '\\' )
getNextChar();
else if ( c == '"' )
break;
}
return c == '"';
}
bool
Reader::readObject( Token &tokenStart )
{
Token tokenName;
std::string name;
currentValue() = Value( objectValue );
while ( readToken( tokenName ) )
{
bool initialTokenOk = true;
while ( tokenName.type_ == tokenComment && initialTokenOk )
initialTokenOk = readToken( tokenName );
if ( !initialTokenOk )
break;
if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object
return true;
if ( tokenName.type_ != tokenString )
break;
name = "";
if ( !decodeString( tokenName, name ) )
return recoverFromError( tokenObjectEnd );
Token colon;
if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator )
{
return addErrorAndRecover( "Missing ':' after object member name",
colon,
tokenObjectEnd );
}
Value &value = currentValue()[ name ];
nodes_.push( &value );
bool ok = readValue();
nodes_.pop();
if ( !ok ) // error already set
return recoverFromError( tokenObjectEnd );
Token comma;
if ( !readToken( comma )
|| ( comma.type_ != tokenObjectEnd &&
comma.type_ != tokenArraySeparator &&
comma.type_ != tokenComment ) )
{
return addErrorAndRecover( "Missing ',' or '}' in object declaration",
comma,
tokenObjectEnd );
}
bool finalizeTokenOk = true;
while ( comma.type_ == tokenComment &&
finalizeTokenOk )
finalizeTokenOk = readToken( comma );
if ( comma.type_ == tokenObjectEnd )
return true;
}
return addErrorAndRecover( "Missing '}' or object member name",
tokenName,
tokenObjectEnd );
}
bool
Reader::readArray( Token &tokenStart )
{
currentValue() = Value( arrayValue );
skipSpaces();
if ( *current_ == ']' ) // empty array
{
Token endArray;
readToken( endArray );
return true;
}
int index = 0;
while ( true )
{
Value &value = currentValue()[ index++ ];
nodes_.push( &value );
bool ok = readValue();
nodes_.pop();
if ( !ok ) // error already set
return recoverFromError( tokenArrayEnd );
Token token;
// Accept Comment after last item in the array.
ok = readToken( token );
while ( token.type_ == tokenComment && ok )
{
ok = readToken( token );
}
bool badTokenType = ( token.type_ == tokenArraySeparator &&
token.type_ == tokenArrayEnd );
if ( !ok || badTokenType )
{
return addErrorAndRecover( "Missing ',' or ']' in array declaration",
token,
tokenArrayEnd );
}
if ( token.type_ == tokenArrayEnd )
break;
}
return true;
}
bool
Reader::decodeNumber( Token &token )
{
bool isDouble = false;
for ( Location inspect = token.start_; inspect != token.end_; ++inspect )
{
isDouble = isDouble
|| in( *inspect, '.', 'e', 'E', '+' )
|| ( *inspect == '-' && inspect != token.start_ );
}
if ( isDouble )
return decodeDouble( token );
Location current = token.start_;
bool isNegative = *current == '-';
if ( isNegative )
++current;
Value::UInt threshold = (isNegative ? Value::UInt(-Value::minInt)
: Value::maxUInt) / 10;
Value::UInt value = 0;
while ( current < token.end_ )
{
Char c = *current++;
if ( c < '0' || c > '9' )
return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token );
if ( value >= threshold )
return decodeDouble( token );
value = value * 10 + Value::UInt(c - '0');
}
if ( isNegative )
currentValue() = -Value::Int( value );
else if ( value <= Value::UInt(Value::maxInt) )
currentValue() = Value::Int( value );
else
currentValue() = value;
return true;
}
bool
Reader::decodeDouble( Token &token )
{
double value = 0;
const int bufferSize = 32;
int count;
int length = int(token.end_ - token.start_);
if ( length <= bufferSize )
{
Char buffer[bufferSize];
memcpy( buffer, token.start_, length );
buffer[length] = 0;
count = sscanf( buffer, "%lf", &value );
}
else
{
std::string buffer( token.start_, token.end_ );
count = sscanf( buffer.c_str(), "%lf", &value );
}
if ( count != 1 )
return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token );
currentValue() = value;
return true;
}
bool
Reader::decodeString( Token &token )
{
std::string decoded;
if ( !decodeString( token, decoded ) )
return false;
currentValue() = decoded;
return true;
}
bool
Reader::decodeString( Token &token, std::string &decoded )
{
decoded.reserve( token.end_ - token.start_ - 2 );
Location current = token.start_ + 1; // skip '"'
Location end = token.end_ - 1; // do not include '"'
while ( current != end )
{
Char c = *current++;
if ( c == '"' )
break;
else if ( c == '\\' )
{
if ( current == end )
return addError( "Empty escape sequence in string", token, current );
Char escape = *current++;
switch ( escape )
{
case '"': decoded += '"'; break;
case '/': decoded += '/'; break;
case '\\': decoded += '\\'; break;
case 'b': decoded += '\b'; break;
case 'f': decoded += '\f'; break;
case 'n': decoded += '\n'; break;
case 'r': decoded += '\r'; break;
case 't': decoded += '\t'; break;
case 'u':
{
unsigned int unicode;
if ( !decodeUnicodeCodePoint( token, current, end, unicode ) )
return false;
decoded += codePointToUTF8(unicode);
}
break;
default:
return addError( "Bad escape sequence in string", token, current );
}
}
else
{
decoded += c;
}
}
return true;
}
bool
Reader::decodeUnicodeCodePoint( Token &token,
Location &current,
Location end,
unsigned int &unicode )
{
if ( !decodeUnicodeEscapeSequence( token, current, end, unicode ) )
return false;
if (unicode >= 0xD800 && unicode <= 0xDBFF)
{
// surrogate pairs
if (end - current < 6)
return addError( "additional six characters expected to parse unicode surrogate pair.", token, current );
unsigned int surrogatePair;
if (*(current++) == '\\' && *(current++)== 'u')
{
if (decodeUnicodeEscapeSequence( token, current, end, surrogatePair ))
{
unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
}
else
return false;
}
else
return addError( "expecting another \\u token to begin the second half of a unicode surrogate pair", token, current );
}
return true;
}
bool
Reader::decodeUnicodeEscapeSequence( Token &token,
Location &current,
Location end,
unsigned int &unicode )
{
if ( end - current < 4 )
return addError( "Bad unicode escape sequence in string: four digits expected.", token, current );
unicode = 0;
for ( int index =0; index < 4; ++index )
{
Char c = *current++;
unicode *= 16;
if ( c >= '0' && c <= '9' )
unicode += c - '0';
else if ( c >= 'a' && c <= 'f' )
unicode += c - 'a' + 10;
else if ( c >= 'A' && c <= 'F' )
unicode += c - 'A' + 10;
else
return addError( "Bad unicode escape sequence in string: hexadecimal digit expected.", token, current );
}
return true;
}
bool
Reader::addError( const std::string &message,
Token &token,
Location extra )
{
ErrorInfo info;
info.token_ = token;
info.message_ = message;
info.extra_ = extra;
errors_.push_back( info );
return false;
}
bool
Reader::recoverFromError( TokenType skipUntilToken )
{
int errorCount = int(errors_.size());
Token skip;
while ( true )
{
if ( !readToken(skip) )
errors_.resize( errorCount ); // discard errors caused by recovery
if ( skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream )
break;
}
errors_.resize( errorCount );
return false;
}
bool
Reader::addErrorAndRecover( const std::string &message,
Token &token,
TokenType skipUntilToken )
{
addError( message, token );
return recoverFromError( skipUntilToken );
}
Value &
Reader::currentValue()
{
return *(nodes_.top());
}
Reader::Char
Reader::getNextChar()
{
if ( current_ == end_ )
return 0;
return *current_++;
}
void
Reader::getLocationLineAndColumn( Location location,
int &line,
int &column ) const
{
Location current = begin_;
Location lastLineStart = current;
line = 0;
while ( current < location && current != end_ )
{
Char c = *current++;
if ( c == '\r' )
{
if ( *current == '\n' )
++current;
lastLineStart = current;
++line;
}
else if ( c == '\n' )
{
lastLineStart = current;
++line;
}
}
// column & line start at 1
column = int(location - lastLineStart) + 1;
++line;
}
std::string
Reader::getLocationLineAndColumn( Location location ) const
{
int line, column;
getLocationLineAndColumn( location, line, column );
char buffer[18+16+16+1];
sprintf( buffer, "Line %d, Column %d", line, column );
return buffer;
}
std::string
Reader::getFormatedErrorMessages() const
{
std::string formattedMessage;
for ( Errors::const_iterator itError = errors_.begin();
itError != errors_.end();
++itError )
{
const ErrorInfo &error = *itError;
formattedMessage += "* " + getLocationLineAndColumn( error.token_.start_ ) + "\n";
formattedMessage += " " + error.message_ + "\n";
if ( error.extra_ )
formattedMessage += "See " + getLocationLineAndColumn( error.extra_ ) + " for detail.\n";
}
return formattedMessage;
}
std::istream& operator>>( std::istream &sin, Value &root )
{
Json::Reader reader;
bool ok = reader.parse(sin, root, true);
//JSON_ASSERT( ok );
if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages());
return sin;
}
} // namespace Json

1728
3rdparty/json/src/json_value.cpp vendored Normal file

File diff suppressed because it is too large Load Diff

829
3rdparty/json/src/json_writer.cpp vendored Normal file
View File

@ -0,0 +1,829 @@
#include <json_writer.h>
#include <utility>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <sstream>
#include <iomanip>
#if _MSC_VER >= 1400 // VC++ 8.0
#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated.
#endif
namespace Json {
static bool isControlCharacter(char ch)
{
return ch > 0 && ch <= 0x1F;
}
static bool containsControlCharacter( const char* str )
{
while ( *str )
{
if ( isControlCharacter( *(str++) ) )
return true;
}
return false;
}
static void uintToString( unsigned int value,
char *&current )
{
*--current = 0;
do
{
*--current = (value % 10) + '0';
value /= 10;
}
while ( value != 0 );
}
std::string valueToString( Int value )
{
char buffer[32];
char *current = buffer + sizeof(buffer);
bool isNegative = value < 0;
if ( isNegative )
value = -value;
uintToString( UInt(value), current );
if ( isNegative )
*--current = '-';
assert( current >= buffer );
return current;
}
std::string valueToString( UInt value )
{
char buffer[32];
char *current = buffer + sizeof(buffer);
uintToString( value, current );
assert( current >= buffer );
return current;
}
std::string valueToString( double value )
{
char buffer[32];
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning.
sprintf_s(buffer, sizeof(buffer), "%#.16g", value);
#else
sprintf(buffer, "%#.16g", value);
#endif
char* ch = buffer + strlen(buffer) - 1;
if (*ch != '0') return buffer; // nothing to truncate, so save time
while(ch > buffer && *ch == '0'){
--ch;
}
char* last_nonzero = ch;
while(ch >= buffer){
switch(*ch){
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
--ch;
continue;
case '.':
// Truncate zeroes to save bytes in output, but keep one.
*(last_nonzero+2) = '\0';
return buffer;
default:
return buffer;
}
}
return buffer;
}
std::string valueToString( bool value )
{
return value ? "true" : "false";
}
std::string valueToQuotedString( const char *value )
{
// Not sure how to handle unicode...
if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value ))
return std::string("\"") + value + "\"";
// We have to walk value and escape any special characters.
// Appending to std::string is not efficient, but this should be rare.
// (Note: forward slashes are *not* rare, but I am not escaping them.)
unsigned maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL
std::string result;
result.reserve(maxsize); // to avoid lots of mallocs
result += "\"";
for (const char* c=value; *c != 0; ++c)
{
switch(*c)
{
case '\"':
result += "\\\"";
break;
case '\\':
result += "\\\\";
break;
case '\b':
result += "\\b";
break;
case '\f':
result += "\\f";
break;
case '\n':
result += "\\n";
break;
case '\r':
result += "\\r";
break;
case '\t':
result += "\\t";
break;
//case '/':
// Even though \/ is considered a legal escape in JSON, a bare
// slash is also legal, so I see no reason to escape it.
// (I hope I am not misunderstanding something.
// blep notes: actually escaping \/ may be useful in javascript to avoid </
// sequence.
// Should add a flag to allow this compatibility mode and prevent this
// sequence from occurring.
default:
if ( isControlCharacter( *c ) )
{
std::ostringstream oss;
oss << "\\u" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << static_cast<int>(*c);
result += oss.str();
}
else
{
result += *c;
}
break;
}
}
result += "\"";
return result;
}
// Class Writer
// //////////////////////////////////////////////////////////////////
Writer::~Writer()
{
}
// Class FastWriter
// //////////////////////////////////////////////////////////////////
FastWriter::FastWriter()
: yamlCompatiblityEnabled_( false )
{
}
void
FastWriter::enableYAMLCompatibility()
{
yamlCompatiblityEnabled_ = true;
}
std::string
FastWriter::write( const Value &root )
{
document_ = "";
writeValue( root );
document_ += "\n";
return document_;
}
void
FastWriter::writeValue( const Value &value )
{
switch ( value.type() )
{
case nullValue:
document_ += "null";
break;
case intValue:
document_ += valueToString( value.asInt() );
break;
case uintValue:
document_ += valueToString( value.asUInt() );
break;
case realValue:
document_ += valueToString( value.asDouble() );
break;
case stringValue:
document_ += valueToQuotedString( value.asCString() );
break;
case booleanValue:
document_ += valueToString( value.asBool() );
break;
case arrayValue:
{
document_ += "[";
int size = value.size();
for ( int index =0; index < size; ++index )
{
if ( index > 0 )
document_ += ",";
writeValue( value[index] );
}
document_ += "]";
}
break;
case objectValue:
{
Value::Members members( value.getMemberNames() );
document_ += "{";
for ( Value::Members::iterator it = members.begin();
it != members.end();
++it )
{
const std::string &name = *it;
if ( it != members.begin() )
document_ += ",";
document_ += valueToQuotedString( name.c_str() );
document_ += yamlCompatiblityEnabled_ ? ": "
: ":";
writeValue( value[name] );
}
document_ += "}";
}
break;
}
}
// Class StyledWriter
// //////////////////////////////////////////////////////////////////
StyledWriter::StyledWriter()
: rightMargin_( 74 )
, indentSize_( 3 )
{
}
std::string
StyledWriter::write( const Value &root )
{
document_ = "";
addChildValues_ = false;
indentString_ = "";
writeCommentBeforeValue( root );
writeValue( root );
writeCommentAfterValueOnSameLine( root );
document_ += "\n";
return document_;
}
void
StyledWriter::writeValue( const Value &value )
{
switch ( value.type() )
{
case nullValue:
pushValue( "null" );
break;
case intValue:
pushValue( valueToString( value.asInt() ) );
break;
case uintValue:
pushValue( valueToString( value.asUInt() ) );
break;
case realValue:
pushValue( valueToString( value.asDouble() ) );
break;
case stringValue:
pushValue( valueToQuotedString( value.asCString() ) );
break;
case booleanValue:
pushValue( valueToString( value.asBool() ) );
break;
case arrayValue:
writeArrayValue( value);
break;
case objectValue:
{
Value::Members members( value.getMemberNames() );
if ( members.empty() )
pushValue( "{}" );
else
{
writeWithIndent( "{" );
indent();
Value::Members::iterator it = members.begin();
while ( true )
{
const std::string &name = *it;
const Value &childValue = value[name];
writeCommentBeforeValue( childValue );
writeWithIndent( valueToQuotedString( name.c_str() ) );
document_ += " : ";
writeValue( childValue );
if ( ++it == members.end() )
{
writeCommentAfterValueOnSameLine( childValue );
break;
}
document_ += ",";
writeCommentAfterValueOnSameLine( childValue );
}
unindent();
writeWithIndent( "}" );
}
}
break;
}
}
void
StyledWriter::writeArrayValue( const Value &value )
{
unsigned size = value.size();
if ( size == 0 )
pushValue( "[]" );
else
{
bool isArrayMultiLine = isMultineArray( value );
if ( isArrayMultiLine )
{
writeWithIndent( "[" );
indent();
bool hasChildValue = !childValues_.empty();
unsigned index =0;
while ( true )
{
const Value &childValue = value[index];
writeCommentBeforeValue( childValue );
if ( hasChildValue )
writeWithIndent( childValues_[index] );
else
{
writeIndent();
writeValue( childValue );
}
if ( ++index == size )
{
writeCommentAfterValueOnSameLine( childValue );
break;
}
document_ += ",";
writeCommentAfterValueOnSameLine( childValue );
}
unindent();
writeWithIndent( "]" );
}
else // output on a single line
{
assert( childValues_.size() == size );
document_ += "[ ";
for ( unsigned index =0; index < size; ++index )
{
if ( index > 0 )
document_ += ", ";
document_ += childValues_[index];
}
document_ += " ]";
}
}
}
bool
StyledWriter::isMultineArray( const Value &value )
{
int size = value.size();
bool isMultiLine = size*3 >= rightMargin_ ;
childValues_.clear();
for ( int index =0; index < size && !isMultiLine; ++index )
{
const Value &childValue = value[index];
isMultiLine = isMultiLine ||
( (childValue.isArray() || childValue.isObject()) &&
childValue.size() > 0 );
}
if ( !isMultiLine ) // check if line length > max line length
{
childValues_.reserve( size );
addChildValues_ = true;
int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]'
for ( int index =0; index < size && !isMultiLine; ++index )
{
writeValue( value[index] );
lineLength += int( childValues_[index].length() );
isMultiLine = isMultiLine && hasCommentForValue( value[index] );
}
addChildValues_ = false;
isMultiLine = isMultiLine || lineLength >= rightMargin_;
}
return isMultiLine;
}
void
StyledWriter::pushValue( const std::string &value )
{
if ( addChildValues_ )
childValues_.push_back( value );
else
document_ += value;
}
void
StyledWriter::writeIndent()
{
if ( !document_.empty() )
{
char last = document_[document_.length()-1];
if ( last == ' ' ) // already indented
return;
if ( last != '\n' ) // Comments may add new-line
document_ += '\n';
}
document_ += indentString_;
}
void
StyledWriter::writeWithIndent( const std::string &value )
{
writeIndent();
document_ += value;
}
void
StyledWriter::indent()
{
indentString_ += std::string( indentSize_, ' ' );
}
void
StyledWriter::unindent()
{
assert( int(indentString_.size()) >= indentSize_ );
indentString_.resize( indentString_.size() - indentSize_ );
}
void
StyledWriter::writeCommentBeforeValue( const Value &root )
{
if ( !root.hasComment( commentBefore ) )
return;
document_ += normalizeEOL( root.getComment( commentBefore ) );
document_ += "\n";
}
void
StyledWriter::writeCommentAfterValueOnSameLine( const Value &root )
{
if ( root.hasComment( commentAfterOnSameLine ) )
document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) );
if ( root.hasComment( commentAfter ) )
{
document_ += "\n";
document_ += normalizeEOL( root.getComment( commentAfter ) );
document_ += "\n";
}
}
bool
StyledWriter::hasCommentForValue( const Value &value )
{
return value.hasComment( commentBefore )
|| value.hasComment( commentAfterOnSameLine )
|| value.hasComment( commentAfter );
}
std::string
StyledWriter::normalizeEOL( const std::string &text )
{
std::string normalized;
normalized.reserve( text.length() );
const char *begin = text.c_str();
const char *end = begin + text.length();
const char *current = begin;
while ( current != end )
{
char c = *current++;
if ( c == '\r' ) // mac or dos EOL
{
if ( *current == '\n' ) // convert dos EOL
++current;
normalized += '\n';
}
else // handle unix EOL & other char
normalized += c;
}
return normalized;
}
// Class StyledStreamWriter
// //////////////////////////////////////////////////////////////////
StyledStreamWriter::StyledStreamWriter( std::string indentation )
: document_(NULL)
, rightMargin_( 74 )
, indentation_( indentation )
{
}
void
StyledStreamWriter::write( std::ostream &out, const Value &root )
{
document_ = &out;
addChildValues_ = false;
indentString_ = "";
writeCommentBeforeValue( root );
writeValue( root );
writeCommentAfterValueOnSameLine( root );
*document_ << "\n";
document_ = NULL; // Forget the stream, for safety.
}
void
StyledStreamWriter::writeValue( const Value &value )
{
switch ( value.type() )
{
case nullValue:
pushValue( "null" );
break;
case intValue:
pushValue( valueToString( value.asInt() ) );
break;
case uintValue:
pushValue( valueToString( value.asUInt() ) );
break;
case realValue:
pushValue( valueToString( value.asDouble() ) );
break;
case stringValue:
pushValue( valueToQuotedString( value.asCString() ) );
break;
case booleanValue:
pushValue( valueToString( value.asBool() ) );
break;
case arrayValue:
writeArrayValue( value);
break;
case objectValue:
{
Value::Members members( value.getMemberNames() );
if ( members.empty() )
pushValue( "{}" );
else
{
writeWithIndent( "{" );
indent();
Value::Members::iterator it = members.begin();
while ( true )
{
const std::string &name = *it;
const Value &childValue = value[name];
writeCommentBeforeValue( childValue );
writeWithIndent( valueToQuotedString( name.c_str() ) );
*document_ << " : ";
writeValue( childValue );
if ( ++it == members.end() )
{
writeCommentAfterValueOnSameLine( childValue );
break;
}
*document_ << ",";
writeCommentAfterValueOnSameLine( childValue );
}
unindent();
writeWithIndent( "}" );
}
}
break;
}
}
void
StyledStreamWriter::writeArrayValue( const Value &value )
{
unsigned size = value.size();
if ( size == 0 )
pushValue( "[]" );
else
{
bool isArrayMultiLine = isMultineArray( value );
if ( isArrayMultiLine )
{
writeWithIndent( "[" );
indent();
bool hasChildValue = !childValues_.empty();
unsigned index =0;
while ( true )
{
const Value &childValue = value[index];
writeCommentBeforeValue( childValue );
if ( hasChildValue )
writeWithIndent( childValues_[index] );
else
{
writeIndent();
writeValue( childValue );
}
if ( ++index == size )
{
writeCommentAfterValueOnSameLine( childValue );
break;
}
*document_ << ",";
writeCommentAfterValueOnSameLine( childValue );
}
unindent();
writeWithIndent( "]" );
}
else // output on a single line
{
assert( childValues_.size() == size );
*document_ << "[ ";
for ( unsigned index =0; index < size; ++index )
{
if ( index > 0 )
*document_ << ", ";
*document_ << childValues_[index];
}
*document_ << " ]";
}
}
}
bool
StyledStreamWriter::isMultineArray( const Value &value )
{
int size = value.size();
bool isMultiLine = size*3 >= rightMargin_ ;
childValues_.clear();
for ( int index =0; index < size && !isMultiLine; ++index )
{
const Value &childValue = value[index];
isMultiLine = isMultiLine ||
( (childValue.isArray() || childValue.isObject()) &&
childValue.size() > 0 );
}
if ( !isMultiLine ) // check if line length > max line length
{
childValues_.reserve( size );
addChildValues_ = true;
int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]'
for ( int index =0; index < size && !isMultiLine; ++index )
{
writeValue( value[index] );
lineLength += int( childValues_[index].length() );
isMultiLine = isMultiLine && hasCommentForValue( value[index] );
}
addChildValues_ = false;
isMultiLine = isMultiLine || lineLength >= rightMargin_;
}
return isMultiLine;
}
void
StyledStreamWriter::pushValue( const std::string &value )
{
if ( addChildValues_ )
childValues_.push_back( value );
else
*document_ << value;
}
void
StyledStreamWriter::writeIndent()
{
/*
Some comments in this method would have been nice. ;-)
if ( !document_.empty() )
{
char last = document_[document_.length()-1];
if ( last == ' ' ) // already indented
return;
if ( last != '\n' ) // Comments may add new-line
*document_ << '\n';
}
*/
*document_ << '\n' << indentString_;
}
void
StyledStreamWriter::writeWithIndent( const std::string &value )
{
writeIndent();
*document_ << value;
}
void
StyledStreamWriter::indent()
{
indentString_ += indentation_;
}
void
StyledStreamWriter::unindent()
{
assert( indentString_.size() >= indentation_.size() );
indentString_.resize( indentString_.size() - indentation_.size() );
}
void
StyledStreamWriter::writeCommentBeforeValue( const Value &root )
{
if ( !root.hasComment( commentBefore ) )
return;
*document_ << normalizeEOL( root.getComment( commentBefore ) );
*document_ << "\n";
}
void
StyledStreamWriter::writeCommentAfterValueOnSameLine( const Value &root )
{
if ( root.hasComment( commentAfterOnSameLine ) )
*document_ << " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) );
if ( root.hasComment( commentAfter ) )
{
*document_ << "\n";
*document_ << normalizeEOL( root.getComment( commentAfter ) );
*document_ << "\n";
}
}
bool
StyledStreamWriter::hasCommentForValue( const Value &value )
{
return value.hasComment( commentBefore )
|| value.hasComment( commentAfterOnSameLine )
|| value.hasComment( commentAfter );
}
std::string
StyledStreamWriter::normalizeEOL( const std::string &text )
{
std::string normalized;
normalized.reserve( text.length() );
const char *begin = text.c_str();
const char *end = begin + text.length();
const char *current = begin;
while ( current != end )
{
char c = *current++;
if ( c == '\r' ) // mac or dos EOL
{
if ( *current == '\n' ) // convert dos EOL
++current;
normalized += '\n';
}
else // handle unix EOL & other char
normalized += c;
}
return normalized;
}
std::ostream& operator<<( std::ostream &sout, const Value &root )
{
Json::StyledStreamWriter writer;
writer.write(sout, root);
return sout;
}
} // namespace Json

BIN
3rdparty/opencv/dll/opencv_aruco454.dll vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_bgsegm454.dll vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_ccalib454.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_core454.dll vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_dnn454.dll vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_dpm454.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_face454.dll vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_flann454.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_fuzzy454.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_gapi454.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_hfs454.dll vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_mcc454.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_ml454.dll vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_photo454.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/opencv/dll/opencv_plot454.dll vendored Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More