www.pudn.com > VideoMonitor.rar > AV8API.h


/****************************************************************************
*
* ARRAYAPI.h
*
* Main interface
*
***************************************************************************/
/**************************************************************************
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
* PURPOSE.
*
* Copyright (c) 1995 Array Microsystem Inc. All Rights Reserved.
*
**************************************************************************/

#ifndef ARRAYAPI_H
#define ARRAYAPI_H

//
// Array VideoFlow API header file (an OM-1 API like interface)
//

#define VF_MAX_DEVICES 10
#define VF_DISPLAYNAME "Device"
#define VF_ILLEGAL_POS (-32000)

// separate capabilities to be defined
#define VF_CAP_ALL (-1)

//
// API commands
//
#define VF_CMD_OPEN 0x01
#define VF_CMD_CLOSE 0x02
#define VF_CMD_PLAY 0x03
#define VF_CMD_PAUSE 0x04
#define VF_CMD_STOP 0x05
#define VF_CMD_SEEK 0x06
#define VF_CMD_STEP 0x07
#define VF_CMD_SET 0x09
#define VF_CMD_GET 0x0A
#define VF_CMD_TRANSCODE_SET 0x14

#define VF_CMD_RECORD 0xF0
#define VF_CMD_RESUME 0xF1

#define VF_CMD_IS_OVERLAY 0x41
#define VF_CMD_PAINT_OVERLAY 0x42
#define VF_CMD_GET_OVERLAY_CAPS 0x43
#define VF_CMD_USE_OVERLAY_CAPS 0x44
#define VF_CMD_SET_OVERLAY_WND 0x45
#define VF_CMD_SET_OVERLAY_POS 0x46
#define VF_CMD_SET_OVERLAY_DST 0x47
#define VF_CMD_SET_OVERLAY_SRC 0x48
#define VF_CMD_UNLOAD_OVERLAY 0x49

// rke: these are optional commands for multidevice support
#define VF_CMD_ASSIGN 0x51
#define VF_CMD_INFO 0x52
#define VF_CMD_LOCK 0x53
#define VF_CMD_UNLOCK 0x54

#define VF_CMD_REFDATA 0x61
//
// driver errors/status
#define VF_ERR_NOERR 0x0000
#define VF_ERR_INVALID_FLAGS 0x0200 // invalid or incoherent flags
#define VF_ERR_INDEX 0x0700 // get/set index invalid
#define VF_ERR_VALUE 0x1200 // invalid value
#define VF_ERR_DISK_FULL 0xffffffff

//
// callback messages
//
#define VF_MSG_BUF_WRITE 0x03
#define VF_MSG_BUF_CREATE 0x04
#define VF_MSG_BUF_CLOSE 0x05

#define VF_SUBMSG_OUTPUT 0x0002

#define VF_MSGUSER_BUF_WRITE WM_USER + VF_MSG_BUF_WRITE
#define VF_MSGUSER_BUF_CREATE WM_USER + VF_MSG_BUF_CREATE
#define VF_MSGUSER_BUF_CLOSE WM_USER + VF_MSG_BUF_CLOSE

//
// callback structure
//

#pragma pack(4)
typedef struct tagVF_CALLBACK_STRUCT
{
BYTE hStream; // stream handle
WPARAM wSubMsg; // sub message
} VF_CALLBACK_STRUCT, *PVF_CALLBACK_STRUCT, *LPVF_CALLBACK_STRUCT;

#pragma pack(4)
typedef struct tagVF_BUFWRITE_STRUCT
{
VF_CALLBACK_STRUCT vfcallback;
BYTE *lpBuffer; // pointer to the driver buffer
DWORD dwBufferSize; // size of the buffer in bytes
DWORD dwBufferWrite; // encoded data length in bytes
} VF_BUFWRITE_STRUCT, *PVF_BUFWRITE_STRUCT, *LPVF_BUFWRITE_STRUCT;

typedef struct tagVF_TRANSCODE
{
WORD wAlgorithm;
WORD wChannel;
DWORD dwSampleRate;
DWORD dwBitRate;
WORD wMode;
} VF_TRANSCODE;

#pragma pack()

// rke: definition of VF_CALLBACK (prototype for callback functions)
typedef WORD (CALLBACK *VF_CALLBACK)(HANDLE hDriver, UINT msg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);

/*
// C sample callback function
WORD CALLBACK MyCallback(HANDLE hDriver, UINT msg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2)
{
// hDriver unused
// dwUser unused
//
PVF_BUFWRITE_STRUCT pbw = (PVF_BUFWRITE_STRUCT)dwParam1;
PVOID pvRefData = (PVOID)dwParam2;

switch (msg) {
case VF_MSG_BUF_CREATE + WM_USER:
break;
case VF_MSG_BUF_WRITE + WM_USER:
break;
case VF_MSG_BUF_CLOSE + WM_USER:
break;
default:;
}
return 0;
}

// to test type compatibility
VF_CALLBACK pCallback = MyCallback;
*/
//
// flags
//

//
// open flags
//
#define VF_FLAG_UNKNOWN 0x0000
// algorithm
#define VF_FLAG_MPEG 0x0001
#define VF_FLAG_H261 0x0002
#define VF_FLAG_G711 0x0003
// session
#define VF_FLAG_ENCODE 0x0010
#define VF_FLAG_DECODE 0x0020
// source
#define VF_FLAG_FILE 0x0100
#define VF_FLAG_BUFFER 0x0400
// output
#define VF_FLAG_OUTFILE 0x2000
#define VF_FLAG_OUTBUF 0x3000

// stream type
#define VF_FLAG_MPGAUD 0x0001
#define VF_FLAG_MPGVID 0x0002
#define VF_FLAG_MPGSYS 0x0005
#define VF_FLAG_TYPE_H261 0x0007
#define VF_FLAG_TYPE_G711 0x0008

// state
#define VF_FLAG_STOPPED 0x0002
#define VF_FLAG_PLAYING 0x0004

//
// encoding flags
//
// Setup WMPG32 driver mode either VF_DRV_DIRECT or VF_DRV_TRANSCODE
// VF_DRV_DIRECT for Simapp. default mode
// VF_DRV_TRANSCODE for Video for Windows
#define VF_DRV_DIRECT 0x0001
#define VF_DRV_TRANSCODE 0x0002

// transcode set
#define VF_FLAG_TRANSCODE_DRV_MODE 0x0001
#define VF_FLAG_TRANSCODE_AUDIO_ALGORITHM 0x0002
#define VF_FLAG_TRANSCODE_AUDIO_CHANNEL 0x0003
#define VF_FLAG_TRANSCODE_AUDIO_SAMPLERATE 0x0004
#define VF_FLAG_TRANSCODE_AUDIO_BITRATE 0x0005
#define VF_FLAG_TRANSCODE_AUDIO_MODE 0x0006

// system setting
// encode mode
#define VF_FLAG_STM_NORMAL 0x0000
#define VF_FLAG_STM_VCD 0x0001

// video setting
// picture rate
#define VF_FLAG_VID_23967 0x0001
#define VF_FLAG_VID_24 0x0002
#define VF_FLAG_VID_25 0x0003
#define VF_FLAG_VID_2997 0x0004
//#define VF_FLAG_VID_30 0x0005
//#define VF_FLAG_VID_50 0x0006
//#define VF_FLAG_VID_5994 0x0007
//#define VF_FLAG_VID_60 0x0008
//#define VF_FLAG_VID_14985 0x0009
//#define VF_FLAG_VID_999 0x000A
#define VF_FLAG_VID_7498 0x000B
// encode type
//#define VF_FLAG_VID_IPB 0x0000 // mpeg IPB
//#define VF_FLAG_VID_I 0x0001 // mpeg I only
// video input source
#define VF_FLAG_VID_COMPOSITE 0x0000
#define VF_FLAG_VID_SVHS 0x0001
//#define VF_FLAG_VID_EXTRA 0x0002
// mode (input format)
#define VF_FLAG_VID_AUTOFORMAT 0x0000 // used in VOne
#define VF_FLAG_VID_NTSC 0x0001 // used in VOne
#define VF_FLAG_VID_PAL 0x0003 // used in VOne
//#define VF_FLAG_VID_PAL_M 0x0004
//#define VF_FLAG_VID_PAL_N 0x0005
//#define VF_FLAG_VID_SECAM 0x0006

// Video Algorithm
#define VF_FLAG_VID_MPEG 0x0000
#define VF_FLAG_VID_H261 0x0001

// audio setting
// layer
#define VF_FLAG_AUD_LAYER1 0x0001
#define VF_FLAG_AUD_LAYER2 0x0002
#define VF_FLAG_AUD_LAYER3 0x0004
// bitrate
#define VF_FLAG_AUD_32K 0x00000001
#define VF_FLAG_AUD_48K 0x00000002
#define VF_FLAG_AUD_56K 0x00000003
#define VF_FLAG_AUD_64K 0x00000004
#define VF_FLAG_AUD_80K 0x00000005
#define VF_FLAG_AUD_96K 0x00000006
#define VF_FLAG_AUD_112K 0x00000007
#define VF_FLAG_AUD_128K 0x00000008
#define VF_FLAG_AUD_160K 0x00000009
#define VF_FLAG_AUD_192K 0x0000000A
#define VF_FLAG_AUD_224K 0x0000000B
#define VF_FLAG_AUD_256K 0x0000000C
#define VF_FLAG_AUD_320K 0x0000000D
#define VF_FLAG_AUD_384K 0x0000000E
//bitrate -- Video Conferencing application
//#define VF_FLAG_AUD_16K 0x00000100
//#define VF_FLAG_AUD_64000 0x00000101
// sample
#define VF_FLAG_AUD_SMP_44K 0x00000000
#define VF_FLAG_AUD_SMP_48K 0x00000001
#define VF_FLAG_AUD_SMP_32K 0x00000002
// sample -- Video Conferencing application
//#define VF_FLAG_AUD_SMP_22K 0x00000100
//#define VF_FLAG_AUD_SMP_11K 0x00000101
//#define VF_FLAG_AUD_SMP_8000 0x00000102

// mode
#define VF_FLAG_AUD_STEREO 0x0000
#define VF_FLAG_AUD_JOINTSTEREO 0x0001
#define VF_FLAG_AUD_DUALCHANNEL 0x0002
#define VF_FLAG_AUD_SINGLECHANNEL 0x0003
// input
#define VF_FLAG_AUD_LINEIN 0x0000
//#define VF_FLAG_AUD_CD 0x0001
//#define VF_FLAG_AUD_MIC 0x0002
// Audio Algorithm
#define VF_FLAG_AUD_MPEG 0x0000
//#define VF_FLAG_AUD_PCM 0x0001
//#define VF_FLAG_AUD_G711ALAW 0x0002
//#define VF_FLAG_AUD_G711ULAW 0x0003
//#define VF_FLAG_AUD_G722 0x0004
//#define VF_FLAG_AUD_G723 0x0005
//#define VF_FLAG_AUD_G728 0x0006
//#define VF_FLAG_AUD_G729 0x0007
//#define VF_FLAG_AUD_PCMTOMPEG 0x0008
#define VF_FLAG_AUD_NONE 0xFFFF
// Audio Channel
//#define VF_FLAG_AUD_1CHANNEL 0x0000
//#define VF_FLAG_AUD_2CHANNEL 0x0001

//
// Index(set/get)
//
//#define VF_INDEX_DRV_PRODUCT 0x0101
//#define VF_INDEX_DRV_VERSION 0x0102
//#define VF_INDEX_DRV_AUD_SUP 0x0105
//#define VF_INDEX_DRV_HRD_STAT 0x0110
//#define VF_INDEX_DRV_CAPS 0x0111
//#define VF_INDEX_DRV_PARSE_PRIV 0x0112
//#define VF_INDEX_API_VERSION 0x0113
#define VF_INDEX_SYS_WINDOW_HANDLE 0x0114

#define VF_INDEX_STM_TYPE 0x0202
#define VF_INDEX_STM_SOURCE 0x0203
#define VF_INDEX_STM_MODE 0x0204
#define VF_INDEX_STM_TIME_FMT 0x0205
#define VF_INDEX_STM_POSITION 0x0206
#define VF_INDEX_STM_FILESIZE 0x0207
#define VF_INDEX_STM_USER 0x0208
#define VF_INDEX_STM_ENCODEMODE 0x0210
#define VF_INDEX_STM_PKTCTRL 0x0220
#define VF_INDEX_STM_CURRENTPLAYTIME 0x0221
#define VF_INDEX_STM_TOTALPLAYTIME 0x0222
#define VF_INDEX_STM_STATUS 0x0223
#define VF_INDEX_STM_BUFFERLEVEL 0x02F0 // private command


#define VF_INDEX_VID_RATE 0x0402 // frame rate
#define VF_INDEX_VID_SIZE 0x0403 // video size
#define VF_INDEX_VID_POSITION 0x0404 // current video position
#define VF_INDEX_VID_SRC_POS 0x0406 // overlay
#define VF_INDEX_VID_SRC_SIZE 0x0407 // overlay
#define VF_INDEX_VID_DEST_POS 0x0408 // overlay
#define VF_INDEX_VID_DEST_SIZE 0x0409 // overlay
#define VF_INDEX_VID_KEY_MIN 0x040A // overlay
#define VF_INDEX_VID_KEY_MAX 0x040B // overlay
#define VF_INDEX_VID_KEY_MASK 0x040C // overlay
#define VF_INDEX_VID_KEY_COL 0x040D // overlay
#define VF_INDEX_VID_KEY_MODE 0x040E // overlay
#define VF_INDEX_VID_KEY_COLOR_SPACE 0x0410
#define VF_INDEX_VID_CAP_POS 0x0411
#define VF_INDEX_VID_CAP_SIZE 0x0412
#define VF_INDEX_VID_STOP_MODE 0x0413
#define VF_INDEX_VID_BITRATE 0x0414 // video bitrate
#define VF_INDEX_VID_ENCODETYPE 0x0415 // encode type (IPB, I)
#define VF_INDEX_VID_SOURCE 0x0416 // video input
#define VF_INDEX_VID_MODE 0x0417 // video mode (NTSC, PAL)

#define VF_INDEX_VID_INPUTSIZE 0x0420
#define VF_INDEX_VID_INPUTOFFSET 0x0421
#define VF_INDEX_VID_BRIGHTNESS 0x0422
#define VF_INDEX_VID_CONTRAST 0x0423
#define VF_INDEX_VID_HUE 0x0424
#define VF_INDEX_VID_SATURATION 0x0425

#define VF_INDEX_VID_CONSTRAIN 0x0430
#define VF_INDEX_VID_OUTPUTSIZE 0x0431
#define VF_INDEX_VID_OUTPUTOFFSET 0x0432
#define VF_INDEX_VID_VBVSIZE 0x0433
#define VF_INDEX_VID_VBVDELAY 0x0434
#define VF_INDEX_VID_INITIALSMPTE 0x0435
#define VF_INDEX_VID_INITIALDELAY 0x0436
#define VF_INDEX_VID_IINTERVAL 0x0437
#define VF_INDEX_VID_BINTERVAL 0x0438 // how many B frames between I, P frames
#define VF_INDEX_VID_GOPINTERVAL 0x0439
#define VF_INDEX_VID_SEQINTERVAL 0x043A

#define VF_INDEX_VID_QMATRIX 0x0440
#define VF_INDEX_VID_QMATRIXSCALE 0x0441

#define VF_INDEX_VID_IPERCENTBITS 0x0450
#define VF_INDEX_VID_PPERCENTBITS 0x0451
#define VF_INDEX_VID_BPERCENTBITS 0x0452
#define VF_INDEX_VID_LEAKPERCENT 0x0453
#define VF_INDEX_VID_IRATECTRL 0x0454
#define VF_INDEX_VID_PRATECTRL 0x0455
#define VF_INDEX_VID_BRATECTRL 0x0456
#define VF_INDEX_VID_IQGAIN 0x0457
#define VF_INDEX_VID_PQGAIN 0x0458
#define VF_INDEX_VID_BQGAIN 0x0459
#define VF_INDEX_VID_INITIALAVEACT 0x045A
#define VF_INDEX_VID_INITIALAGAIN 0x045B

#define VF_INDEX_VID_THRESHOLDLUMA 0x0460
#define VF_INDEX_VID_THRESHOLDCHROMA 0x0461
#define VF_INDEX_VID_SCENEADAPT 0x0462
#define VF_INDEX_VID_VARIABLEFRAMERATE 0x0463
#define VF_INDEX_VID_VARIABLEBITRATE 0x0464

#define VF_INDEX_VID_NUMBEROFFRAMES 0x0470
#define VF_INDEX_VID_ALGORITHM 0x0480

#define VF_INDEX_VID_LINECROP 0x0481
#define VF_INDEX_VID_YOFFSET 0x0482

#define VF_INDEX_VID_BUFFERLEVEL 0x04F0 // private command

#define VF_INDEX_AUD_POSITION 0x0502
#define VF_INDEX_AUD_VOLUME 0x0503
#define VF_INDEX_AUD_VOLUMEL 0x0504
#define VF_INDEX_AUD_VOLUMER 0x0505
#define VF_INDEX_AUD_GAINL 0x0506
#define VF_INDEX_AUD_GAINR 0x0507
#define VF_INDEX_AUD_LAYER 0x0508
#define VF_INDEX_AUD_BITRATE 0x0509
#define VF_INDEX_AUD_SAMPLE 0x050A
#define VF_INDEX_AUD_MODE 0x050B
#define VF_INDEX_AUD_INPUT 0x050C
#define VF_INDEX_AUD_ALGORITHM 0x050D
#define VF_INDEX_AUD_CHANNEL 0x050E
#define VF_INDEX_AUD_GAIN 0x050F

#define VF_INDEX_AUD_BUFFERLEVEL 0x05F0 // private command

#define VF_INDEX_OUTPUT 0xFFF0
#define VF_INDEX_OUTFILE 0xFFF1
#define VF_INDEX_OUTBUF 0xFFF2
#define VF_INDEX_OUTHARD 0xFFF3
#define VF_INDEX_OUTNULL 0xFFF4

#ifdef _INC_WINDOWS
// some macros for an easier writing of calls to the driver

#define DRV_CMD DRV_USER + 100
//#define DRV_ERR DRV_USER + 101
//#define WM_POSTMESSAGECALLBACK WM_USER+5

#ifdef _DEBUG
// when debugging generate division by zero error if VFCmd is called with hVFDrv == 0
#define VFCmd(hVFDrv, a,b,c,d) (hVFDrv ? SendDriverMessage(hVFDrv, DRV_CMD, MAKELPARAM(MAKEWORD(a,b),c),d) : (1/((long)hVFDrv)))
#else
#define VFCmd(hVFDrv, a,b,c,d) SendDriverMessage(hVFDrv, DRV_CMD, MAKELPARAM(MAKEWORD(a,b),c),d)
#endif

#ifndef MAKEWORD
#define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((( WORD)((BYTE)(high))) << 8)))
#endif

#define MAKEDWORD(a,b) MAKELPARAM(a,b)

#define HVFAssign(hVFDrv,iDeviceIndex) VFCmd(hVFDrv,VF_CMD_ASSIGN,0,0,iDeviceIndex)
#define HVFLock(hVFDrv,dwCapabilities) VFCmd(hVFDrv,VF_CMD_LOCK,0,0,dwCapabilities)
#define HVFUnlock(hVFDrv,dwCapabilities) VFCmd(hVFDrv,VF_CMD_UNLOCK,0,0,dwCapabilities)

#define HVFOpen(hVFDrv,wFlags,pscFileORpCallback) VFCmd(hVFDrv,VF_CMD_OPEN,0,wFlags,pscFileORpCallback)
#define HVFClose(hVFDrv,bStream) VFCmd(hVFDrv,VF_CMD_CLOSE,bStream,0,0)
#define HVFRefData(hVFDrv,bStream,dwRefData) VFCmd(hVFDrv,VF_CMD_REFDATA,bStream,0,(LONG)(dwRefData))
#define HVFRecord(hVFDrv,bStream,wFlags,lPosition) VFCmd(hVFDrv,VF_CMD_RECORD,bStream,wFlags,lPosition)
#define HVFPause(hVFDrv,bStream) VFCmd(hVFDrv,VF_CMD_PAUSE,bStream,0,0)
#define HVFResume(hVFDrv,bStream) VFCmd(hVFDrv,VF_CMD_RESUME,bStream,0,0)
#define HVFStop(hVFDrv,bStream) VFCmd(hVFDrv,VF_CMD_STOP,bStream,0,0)

#define HVFSet(hVFDrv,bStream,wIndex,lValue) VFCmd(hVFDrv,VF_CMD_SET,bStream,wIndex,lValue)
#define HVFGet(hVFDrv,bStream,wIndex) VFCmd(hVFDrv,VF_CMD_GET,bStream,wIndex,0)

#define HVFIsOverlay(hVFDrv) VFCmd(hVFDrv,VF_CMD_IS_OVERLAY,0,0,0)
#define HVFGetOverlayCaps(hVFDrv) VFCmd(hVFDrv,VF_CMD_GET_OVERLAY_CAPS,0,0,0)
#define HVFUseOverlayCaps(hVFDrv, dwOverlayCaps) VFCmd(hVFDrv,VF_CMD_USE_OVERLAY_CAPS,0,0,(LONG)(dwOverlayCaps))
#define HVFPaintOverlay(hVFDrv, pPaintStruct) VFCmd(hVFDrv,VF_CMD_PAINT_OVERLAY,0,0,(LONG)(pPaintStruct))
#define HVFSetOverlayWnd(hVFDrv,hWnd) VFCmd(hVFDrv,VF_CMD_SET_OVERLAY_WND,0,0,(LONG)(hWnd))
#define HVFSetOverlayDst(hVFDrv,wDstWidth,wDstHeight) VFCmd(hVFDrv,VF_CMD_SET_OVERLAY_DST,0,0,MAKELPARAM(wDstWidth,wDstHeight))
#define HVFSetOverlayPos(hVFDrv,iXPos,iYPos) VFCmd(hVFDrv,VF_CMD_SET_OVERLAY_POS,0,0,MAKELPARAM(iXPos,iYPos))
#define HVFSetOverlaySrc(hVFDrv,wSrcWidth,wSrcHeight) VFCmd(hVFDrv,VF_CMD_SET_OVERLAY_SRC,0,0,MAKELPARAM(wSrcWidth,wSrcHeight))
#define HVFUnloadOverlay(hVFDrv) VFCmd(hVFDrv,VF_CMD_UNLOAD_OVERLAY,0,0,0)

#define HVFTranscodeSet(hVFDrv,wIndex,lValue) VFCmd(hVFDrv,VF_CMD_TRANSCODE_SET,0,wIndex,lValue)

// for compatibility
// These macros have the effect that a variable or class member named 'hVFDrv'
// has to be defined in the context where these macros are used
#define VFOpen(wFlags,pscFileORpCallback) VFCmd(hVFDrv,VF_CMD_OPEN,0,wFlags,pscFileORpCallback)
#define VFClose(bStream) VFCmd(hVFDrv,VF_CMD_CLOSE,bStream,0,0)
#define VFRecord(bStream,wFlags,lPosition) VFCmd(hVFDrv,VF_CMD_RECORD,bStream,wFlags,lPosition)
#define VFPause(bStream) VFCmd(hVFDrv,VF_CMD_PAUSE,bStream,0,0)
#define VFResume(bStream) VFCmd(hVFDrv,VF_CMD_RESUME,bStream,0,0)
#define VFStop(bStream) VFCmd(hVFDrv,VF_CMD_STOP,bStream,0,0)
#define VFSet(bStream,wIndex,lValue) VFCmd(hVFDrv,VF_CMD_SET,bStream,wIndex,lValue)
#define VFGet(bStream,wIndex) VFCmd(hVFDrv,VF_CMD_GET,bStream,wIndex,0)
#define VFTranscodeSet(wIndex,lValue) VFCmd(hVFDrv,VF_CMD_TRANSCODE_SET,0,wIndex,lValue)

#endif // _INC_WINDOWS

#endif