HIKVISION DS-4 Series Manual Download Page 34

                                                                   

Technical Manual

 

© 2006-2010 by HIKVISION. All rights reserved. 

 

 

 

 

 

 

 

 

32 

callback function: (*IMAGE_STREAM_CALLBACK) 

(UINT channelNumber, void *context) 

UINT channelNumber 

channel no. 

void *context   

 

the context provided when call the callback function 

Explanation:   

Register  the  user  to  get  the  original  picture  stream  function,  and  user  can  get  the  real-time 

video data on YUV420 format. 

Return value: 

0 - success; -1 - failed;   

Remarks:   

DS-42xxHCI/HFVI Card does not support this function 

 

 

4.2.59.

 

int SetImageStream(int hChannelHandle, int bStart, unsigned int fps,   

unsigned width, unsigned height, unsigned char* imageBuf) 

Parameter:   

   

int    hChannelHandle 

 

 

 

Channel handle 

int  bStart 

 

 

 

 

 

1:boot capture, 0: Stop capture 

 

unsigned int 

 

fps   

 

 

 

frame rate 

      unsigned int     

width 

 

 

 

the width of the picture (should be 1.8,1/4,1/2   

 

 

 

 

 

 

 

 

 

 

original size or twice of the width of CIF) 

 

unsigned int 

 

height 

 

 

 

the height of picture(should be1.8,1/4,1/2   

 

 

 

 

 

 

 

 

 

 

original size or twice of the height of CIF) 

 

unsigned char  *imageBuffer        The address to store data after    capturing the picture 

Explanation:   

User  can  boot  or  stop  getting  original  picture  data  stream  through  this  function,  and  this 

function depends on the host PC processing speed.   

Return value: 

  0—success; -1 – failed;   

Remarks:   

DS-42xxHCI/HFVI Card does not support this function 

 

4.2.60.

 

int GetOriginalImage(int channelHandle, unsigned char *ImageBuf, int *Size); 

Parameter

 :     

    int channelHandle                          channel handle 

    unsigned char*ImageBuf                pointer of original image 

    int  *Size                                          size  of  original  image  (before  calling  it,  it  is  the  size  of 

imagebuf,  but  after  calling  it,  it  is  the  byte 

factually used)     

Explanation:   

            To get the original image.  The original image of DS40xxHCI is the standard 4CIF format 

(including QCIF encoding), the user program can call SaveYUVToBmpFile to create 24 

byte bmp file.   

Return value: 

Summary of Contents for DS-4 Series

Page 1: ...Technical Manual 2006 2010 by HIKVISION All rights reserved 1 DS 4xxx Encoding Decoding Card SDK Documentation Version 5 1 For Linux Hangzhou Hikvision Digital Tech Co Ltd ...

Page 2: ...e used for any other purpose without prior written consent of HIKVISION and then only on the condition that this notice is included in any such reproduction No information as to the contents or subject matter of this documentation or any part thereof or arising directly or indirectly therefrom shall be given orally or in writing or shall be communicated in any manner whatsoever to any third party ...

Page 3: ...0 GetDspDetail 16 4 2 11 GetEncodeChannelCount 16 4 2 12 GetDecodeChannelCount 16 4 2 13 GetDisplayChannelCount 17 4 2 14 GetBoardInfo 17 4 2 15 GetCapability 17 4 2 16 StartVideoPreview 18 4 2 17 StopVideoPreview 18 4 2 18 SetVideoPara 18 4 2 19 GetVideoPara 18 4 2 20 GetSDKVersion 19 4 2 21 SetStreamType 19 4 2 22 GetStreamType 19 4 2 23 SetSubStreamType 19 4 2 24 GetSubStreamType 20 4 2 25 Star...

Page 4: ...tupMotionDetection 29 4 2 52 StartMotionDetection 29 4 2 53 StopMotionDetection 30 4 2 54 MotionAnalyzer 30 4 2 55 SetupMotionDetectionEx 30 4 2 56 SetAudioPreview 31 4 2 57 GetSoundLevel 31 4 2 58 RegisterImageStreamCallback 31 4 2 59 SetImageStream 32 4 2 60 GetOriginalImage 32 4 2 61 SaveYUVToBmpFile 33 4 2 62 GetJpegImage 33 4 2 63 SetupSubChannel 33 4 2 64 GetSubChannelStreamType 34 4 2 65 Ge...

Page 5: ...41 5 1 25 HW_SetJumpInterval 41 5 1 26 HW_Jump 41 5 1 27 HW_GetVersion 41 5 1 28 HW_GetCurrentFrameRate 42 5 1 29 HW_GetCurrentFrameNum 42 5 1 30 HW_GetFileTotalFrames 42 5 1 31 HW_GetFileTime 42 5 1 32 HW_GetCurrentFrameTime 42 5 1 33 HW_GetPlayedFrames 42 5 1 34 HW_SetFileEndMsg 43 5 1 35 HW_SetStreamOpenMode 43 5 1 36 HW_GetStreamOpenMode 43 5 1 37 HW_SetAudioPreview 43 5 1 38 HW_StartDecVgaDis...

Page 6: ...teTime 47 5 1 51 HW_GetCurrentAbsoluteTime 47 5 1 52 HW_LocateByAbsoluteTime 47 5 1 53 HW_LocateByFrameNumber 48 5 1 54 HW_InputDataByFrame int hChannel char pBuf int nSize 48 5 1 55 Avoid the flash of the image while decoding 48 5 1 56 RegisterDecoderVideoCaptureCallback 48 5 1 57 HW_SetDecoderVideoCapture 49 ...

Page 7: ...cation developers in the form of dynamic data base It also has Demo dsdemo and mddemo and corresponding source code which can effectively decrease the period of development applications When using software developer should especially notice that they can modify all the parameters like resolution stream code frame structure except the stream code complex stream video stream Namely it can transform ...

Page 8: ... if main channels are 4CIF non real time recording sub channels are invalid DS 4208HFVI supports 8 channels 4CIF 2CIF CIF QCIF real time encoding and 8 sub channels CIF QCIF encoding DS 4216HFVI supports 16 channels 4CIF 2CIF CIF QCIF real time encoding and 16 sub channels CIF QCIF encoding Note Reboot your computer after the driver installed Demo program included in our SDK must run on XWINDOW ...

Page 9: ...DSP can encode 8 channels CIF QCIF in real time or 2CIF DCIF 4CIF in non real time DS 40xxHSI supports grabbing YUV image JPEG image raw stream and matrix output but it doesn t support sub stream 6 Support encodingAudio stream only 7 Improve the sense of video signal detection 8 Support processing the color crosstalk on HCI HCI card 9 Improve the performance of encoding and decoding Bug fixed 1 Fi...

Page 10: ...ectly Then the application could carry out the preview by it by the SDL or other more efficient ways Please refer to the demo dsdemo It is use SDL to realize the preview Please note in demo the parameter of SDL_VIDEO_YUV_HWACCEL was set as 1 it could cause low cpu load and more wonderful picture But it is restricted by the system In some system as some video card there will case the image flash Th...

Page 11: ... is on process the performance will be improved in the afterward versions Video Matrix 1 Video input the real time video captured by HCI board the video after decode of MDI board local files or real time stream transfer from the network 2 Video output output channel of MDI channel Video output support screen partition each video output can be divided into max 16 windows and picture switch of the v...

Page 12: ... in double encoding BBP frame in subchannel PktSubSysHeader when in double encoding system header in subchannel 3 2 Definition for video standard StandardNone No video signal StandardNTSC NTSC format StandardPAL PAL format 3 3 Definition for extraordinary ability typedef struct tagChannelCapability UCHAR bAudioPreview Audio preview UCHAR bAlarmIO Alarming signal UCHAR bWatchDog Watch dog CHANNEL_C...

Page 13: ...h motion detection When setting the motion detection areas use 32x32 as one unit resolution using 4CIF 704x5760 there re 22 units in one row 704 32 There are 18 lines 576 32 when in PAL format 15 lines 480 32 in NTSC format no matter what kind of encoding format Through the test using this way the sensibility and the reliability have been developed compared with the H serial board and simplify the...

Page 14: ...VFromBmpFile Set logo display mode SetLogoDisplayMode Set the logo for data and location SetLogo Set the mask Enable the mask SetupMask E Set the encode format for master channel SetEncoderPictureFormat Set the stream type for master channel SetStreamType Set the image quality SetDefaultQuant Set the structon for encode and frame rate SetIBPMode Set the max bit rate SetupBitrateControl Set the mod...

Page 15: ...mage data SetImageStream M Set the encode type for the sub channel SetSubStreamType Set the picture format for the sub channel SetSubEncoderPictureFormat Switch between the sub channel and the master SetupSubChannel The sub channel could have diffident frame rate and encode coefficient Start video encode from the sub channel StartSubVideoCapture N Exit Stop getting raw stream data SetImageStream S...

Page 16: ... DeInitDSPs is the correspondingAPI 4 2 3 int DeInitDSPs Explanation To close the functions in every board and must be called before exiting application Return value 0 success 1 failed 4 2 4 int ChannelOpen int ChannelNum STREAM_READ_CALLBACK streamReadCallback Parameter int ChannelNum channel No 0 n STREAM_READ_CALLBACK StreamReadCallBack Data callback function void StreamReadCallBack int Channel...

Page 17: ... is means those some initializations of DSP are failed 4 2 8 int GetBoardCount Explanation Get the number of card in system Return value The number of the cards 4 2 9 int GetBoardDetail UINT boardNum DS_BOARD_DETAIL pBoardDetail Parameter UINT boardNum the index of the board DS_BOARD_DETAIL pBoardDetail the info of the board typedef struct BOARD_TYPE_DS type the type of the board BYTE sn 16 the se...

Page 18: ...ChannelIndex the index of the first encoding channel UINT decodeChannelCount the decode channel count in the dsp UINT firstDecodeChannelIndex the index of the first decoding channel UINT displayChannelCount the display channel count in the dsp UINT firstDisplayChannelIndex the index of the first display channel UINT reserved1 UINT reserved2 UINT reserved3 UINT reserved4 DSP_DETAIL Explanation Get ...

Page 19: ...II number of SN SerialNo 0 corresponding to the highest SerialNo 11 corresponding to the lowest E g 400001002345 corresponding to array 4 0 0 0 1 0 0 2 3 4 5 Return value 0 success 1 fail Note Board as follow DS400XM 0 DS400XH 1 DS4004HC 2 DS4008HC 3 DS4016HC 4 DS4001HF 5 DS4004HF 6 DS4002MD 7 DS4004MD 8 DS4016HCS 9 DS4002HT 10 DS4004HT 11 4 2 15 int GetCapability int hChannelHandle CHANNEL_CAPABI...

Page 20: ...copy video data from pPreviewConf dataAddr Return value 0 success 1 failed 4 2 17 int StopVideoPreview int channelHandle Parameter int channelInfo channel handle Explanation Stop video preview Return value 0 success 1 failed 4 2 18 int SetVideoPara int channelHandle int Brightness int Contrast int Saturation int Hue Parameter int channelHandle channel handle int Brightness value of brightness 0 25...

Page 21: ...is modified latest 4 2 21 int SetStreamType int channelHandle int type Parameter int channelHandle channel handle int type stream type see the macro definition as follows Macro definition define STREAM_TYPE_VIDEO 1 video stream define STREAM_TYPE_AUDIO 2 audio stream define STREAM_TYPE_AVSYNC 3 video audio synchronous stream Explanation DS 42xx card do not support STREAM_TYPE_AUDIO mode Set stream...

Page 22: ... program can process the data stream directly by using callback parameter of StreamDirect ReadCallback Or you ca do it just like H serial boards that is user s program to read the data stream using ReadStreamData after knowing the registered message sending to the user s program RegisterMeddageNotifyHandle by SDK Return value 0 success 1 failed 4 2 26 int StopVideoCapture int channelHandle Paramet...

Page 23: ...g big data capacity and usually used as the original reference of frames interval encoding Key frame interval is the numbers of the frames between the continuous frames encoding Return value 0 success 1 failed 4 2 30 int SetDefaultQuant int channelHandle int IQuantVal int PQuantVal int BQuantVal Parameter int channelHandle channel handle int IquantVal I frame quantization parameters int PquantVal ...

Page 24: ...ation Set the encoding format of the sub channel Return value 0 success 1 failed Remarks DS 42xx Card doesn t support DCIF resolution 4 2 33 int SetupBitrateControl int channelHandle int MaxBps Parameter int channelHandle channel handle int MaxBps the most baud rate more than 100000 Explanation It can be used to set the maximum baud rate If the parameter of MaxBps is set to 0 then bit rate control...

Page 25: ...tandard_t videoStandard Parameter int channelHandle channel handle VideoStandard_t videoStandard video standard Explanation To set current video standard to the specified type it s is unnecessary to call the function if we boot the system under the condition that the video camera is connected But it is necessary to call this function if we boot the system without connecting the cameras or we chang...

Page 26: ...ck line in the left x y is original picture coordinate of top left camera input in system processing pictures X must be multiple of 2 The parameter range of x y axis have relationship with the mode of the cameras If the appointed value is not matching with the camera input it may cause the stillness of the picture or roll in horizontal or vertical direction Please be careful to call this function ...

Page 27: ... in Chinese GB code for example 星期二 _OSD_HOUR24 show 24 hours clock for example 18 _OSD_HOUR12 show 12 hours clock for example AM09 or PM09 _OSD_MINUTE show minute time by length of 2 _OSD_SECOND show second time by length of 2 Note that we must set NULL in the end of format strings otherwise there will show some error contents The display of string and time can be set in FORMAT1 or FORMAT2 and th...

Page 28: ...of OSD will be lower automatically darker OSD will be brighter and the twinkle function is closed unsigned short Forma1 Format2 strings overlay to describe the position and sequence of character the description about them as follows int param Bit 0 color auto change as the background Bit 16 23 the multiple of vertical zoom Bit 24 31 the multiple of horizontal zoom In OSD the origial size of the AS...

Page 29: ...ess 1 failed 4 2 45 int SetLogoDisplayMode int channelHandle unsigned short ColorKeyR unsigned short ColorKeyG unsigned short ColorKeyB unsigned short bTranslucent int TwinkleInterval Parameter int channelHandle channel handle unsigned short ColorKeyR ColorKeyG ColorKeyB color of LOGO image will be completely translucent during display unsigned short bTranslucent whether do it translucently proces...

Page 30: ...hannelHandle hannel handle RECT rectList the array of the rect int iAreas the count of the rect Explanation Set the video mask There have up to 32 rect mask The range of the rect is 0 0 703 575 the width of the rect must align with 16 and the high must align with 8 Return value 0 success 1 failed 4 2 49 int StopMask int channelHandle Parameter int channelHandle channel handle Explanation Stop the ...

Page 31: ...e RECT rectList rectangle array int iAreas number of rectangle The Max value is 100 Explanation Set motion detection areas When receive the data frame of marcblock s movement information PktMotion Detection call function MotionAnalyzer which can analyze every needed detection areas that is set by SetupMotionDetection If the threshold of some areas iThreshold in MotionAnalyzer function is reached t...

Page 32: ... areas is performed by Host computer and the data source is given by frame of PktMotionData and the result is filled in parameter of iResult The application can analyze it by itself through the information of motion intensity provided by code stream or the bound analyze calling this function The data structure of motion intensity is explained in 2 25 Return value 0 success 1 failed 4 2 55 int Setu...

Page 33: ...the OR operator iGrade 0x80000000 then the new algorithm will be adopted With the new algorithm the precision of motion detection is greatly improved 4 2 56 int SetAudioPreview int channelHandle int bEnable Parameter int channelHandle channel handle int bEnable enable Explanation To set audio preview There is only 1 channel of all the audio inputs to the cards selected outputting to sound board Re...

Page 34: ...al size or twice of the width of CIF unsigned int height the height of picture should be1 8 1 4 1 2 original size or twice of the height of CIF unsigned char imageBuffer The address to store data after capturing the picture Explanation User can boot or stop getting original picture data stream through this function and this function depends on the host PC processing speed Return value 0 success 1 ...

Page 35: ...SC It can be judged according to the size of the buffer Return value 0 success 1 failed 4 2 62 int GetJpegImage int hChannelHandle unsigned char ImageBuf unsigned long Size unsigned int nQuality Parameter int channelHandle channel handle unsigned char ImageBuf the pointer of image buffer unsigned long Size the pointer of the size IN the buffer size OUT the size of the image unsigned int nQuality t...

Page 36: ... type Explanation It is just compatible older version Now the Frame type is provide directly Return value 0 other data 1 File header of master data stream 2 File header of sub data stream 3 Video Frame type of master data stream 4 VideoFrame type of sub data stream 5 Audio Frame 4 2 65 int GetFramesStatistics int channelHandle PFRAMES_STATISTICS framesStatistics Parameter int channelHandle channel...

Page 37: ...ble Parameter int boardNumber the index for the board Explanation Set the watchdog There have 4 pin in the DS4016HCS It must connect the reset in PC with it then link to the motherboard Return value 0 success 1 failed V4 2 New add 4 2 70 int StartVideoPreviewEx int hChannelHandle PREVIEWCONFIG pPreviewConf UINT useSyncSem UINT mode Parameter int channelHandle channel handle PREVIEWCONFIG pPreviewC...

Page 38: ...changed Note that the number of the D1 sized images in memory should be less than 4 To avoid the PCI bus over pressed SDK will decrease the quality of image to reduce the transfer data V5 1 SDK New add 4 2 71 int __stdcall SetEncoderAudioOutput UINT nEncodeChannel int bEnable UINT nOutputChannel Parameters UINT nEncodeChannel Encoding channel index int bEnable Enable or not UINT nOutputChannel Out...

Page 39: ...1 2 int HW_ReleaseDecDevice Explanation close the system should be called before exit 5 1 3 int HW_ChannelOpen long nChannelNum int phChannel Explanation Open the decode channel and get the channel handler Parameter nChannelNum channel number begin from 0 phChannel channel handler 5 1 4 int HW_ChannelClose int hChannel Explanation Close the decode channel Parameter hChannel channel handler 5 1 5 i...

Page 40: ...the size for the data buffer Return nSize if call success else 1 5 1 8 int HW_OpenFile int hChannel char sFileName Explanation Open the file that want to be decoded Parameter hChannel channel handler sFileName the file name 5 1 9 int HW_CloseFile int hChannel Explanation Close the decoding file Parameter hChannel channel handler 5 1 10 int HW_Play int hChannel Explanation Start decoding Parameter ...

Page 41: ...r 5 1 15 int HW_SetVolume int hChannel ULONG nVlome Explanation Adjust the volume for the audio Parameter hChannel channel handler nVlome 0 0xffff 5 1 16 int HW_StartCapFile int hChannel char sFileName Explanation Capture the decoding data and save as Parameter hChannel channel handler sFileName file name 5 1 17 int HW_StopCapFile int hChannel Explanation Stop capturing Parameter hChannel channel ...

Page 42: ...ileName ULONG nReserved Explanation covert the YV12 image to the BMP file Parameter pBuf the buffer for the image nSize the size of the buffer nWidth the width of the image nHeight the height of the image sFileName the file name of the BMP nReserved reserved 5 1 21 int HW_GetSpeed int hChannel long pSpeed Explanation Get the speed for decodeing Parameter hChannel channel handler pSpeed speed 4 4 5...

Page 43: ...t of the file 0 100 5 1 25 int HW_SetJumpInterval int hChannel ULONG nSecond Explanation Set the interval to jump Parameter hChannel channel handler nSecond the interval as second 5 1 26 int HW_Jump int hChannel ULONG nDirection Explanation Set the direction for jumping Parameter hChannel channel handler nDirection JUMP_FORWARD forward JUMP_BACKWARD back 5 1 27 int HW_GetVersion PHW_VERSION pVersi...

Page 44: ...s int hChannel ULONG pTotalFrames Explanation Get the total frame number of the file Parameter hChannel channel handler pTotalFrames total frame number 5 1 31 int HW_GetFileTime int hChannel ULONG pFileTime Explanation Get the total time of the file Parameter hChannel channel handler pFileTime total time ms 5 1 32 int HW_GetCurrentFrameTime int hChannel ULONG pFrameTime Explanation Get the current...

Page 45: ... pMode Explanation Get the current change mode Parameter hChannel channel handler pMode 0 5 5 1 37 int HW_SetAudioPreview int hChannel UINT bEnable Explanation Set audio preview The Link just as the HCI There will be only one channel could be open in the time The Sdk will close other channels Call after HW_ChannelOpen and HW_PlaySound Parameter bEnable 1 open 0 close 5 1 38 int HW_StartDecVgaDispl...

Page 46: ... of the area align with 8 UINT width the width of the area align with 16 UINT height the height of the area align with 8 UINT r the red weight of the background UINT g the green weight of the background UINT b the blue weight of the background UINT param expand parameter REGION_PARAM define MAX_DISPLAY_REGION 16 The max count of the area that could display Explanation There could partition the dis...

Page 47: ...char pImage the point that YUV420 image Explanation Fill the area by YUV420 image The size of the Image must equal to the area Note If the current area is just displaying this api is invalid 5 1 45 int SetDecoderAudioOutput UINT nDecodeChannel UINT bOpen UINT nOutputChannel Parameter UINT nDecodeChannel the index for the decode channel UINT bOpen 1 open 0 close UINT nOutputChannel the index for th...

Page 48: ...l UINT nDisplayRegion the area that want to dispaly UINT nFrameRate Frame rate of video output Explanation This is the expand for the SetDecoderVideoOutput It is Matrix output It could put the decodingdata to the other boards The index for the nDisplayChannel is index from the whole MDI board 5 1 48 int SetEncoderVideoExtOutput UINT nEncodeChannel UINT nPort int bOpen UINT nDisplayChannel UINT nDi...

Page 49: ...YSTEMTIME pEndTime end time for the recoding Explanation Get the absolute time for the recoding file Note The millisecond in the struct SYSTEMTIME is invalid now and always is 0 5 1 51 int HW_GetCurrentAbsoluteTime int hChannel SYSTEMTIME pTime Parameter int hChannel channel handler SYSTEMTIEM pTime the current absolute time of the recording Explanation Get the current absolute time of the recordi...

Page 50: ...if call success else 1 5 1 55 HW_SetDecoderPostProcess int hChannel UINT param Explanation Avoid the flash of the image while decoding Parameter int hChannel channel handler UINT param 0 end the process 1 start the process New API in v4 3 SDK 5 1 56 int RegisterDecoderVideoCaptureCallback DECODER_VIDEO_CAPTURE_CALLBACK DecoderVideoCaptureCallback void context Explanation Invoke this API to registe...

Page 51: ... grabbed void context Context when invoke callback function Return value Return 0 if successful return error code if failed 5 1 57 int HW_SetDecoderVideoCapture HANDLE hChannel BOOL bStart UINT param Explanation Start or stop grabbing decoded data in yuv420 format Parameters HANDLE hChannel Channel handle BOOL bStart Start or Stop grabbing UINT param Reserved value is 0 Return Value Return 0 if su...

Reviews: