API, Activex reference guide

Revision: 1.2
Date: 2007-December-26


TABLE OF CONTENTS

 


 

DOCUMENT HISTORY

Version

Date

Comment

1.1

2007-Sep-20

Initial version

1.2

2007-Dec-26

Add interface

 

1 OVERVIEW

This document specifies the Activex-based application programming interface of the camera and video servers with AxVideoView version 1,2,4,39 and above.

The Activex-based video interface provides the functionality for video/audio streams play and record, PTZ control, Privacy Mask, and Motion Detection setting with the camera and video servers.

 

2 CONTROL PROPERTY

2.1 Media Property

Name

Descruption

BufferEn

Sets/Gets frame buffer enable or not

CompressType

Sets/Gets the Video compress type, such as mpeg4, mjpeg

HostIP

Sets/Gets the host IP address

HttpPort

Sets/Gets the special Http port

MjpegName

Set/Gets the MJPEG streaming file name

Mpeg4Name

Set/Gets the MPEG4 streaming file name

MulticastName

Set/Gets the Multicast streaming file name

Password

Set/Gets the password to access the media stream

Port

Sets/Gets the streaming port

Protocol

Set/Gets the Rtsp streaming protocol as ‘TCP’, ‘UDP’, ‘HTTP’, or ‘Multicast’

RtspEn

Gets current protocol is RTSP or not

UserName

Sets/Gets the user name of the media stream

 

2.1.1 BufferEn

Description:

Sets/Gets frame buffer enable or not. Enable frame buffering make for smooth playing on video stream.

Syntax:

BufferEn= Input_Value
Return_Value = BufferEn 

Parameters:

Name

Type

Description

Input_Value

short

Set frame buffer enable or not.

0:disable, 1:enable

 

Returns:

Name

Type

Description

Return_Value

short

Get the flag of frame buffer enable or not.

0:Disable, 1:Enable

 

Remarks:

Default is Disable(0).

Examples:

short CAxViewer::GetBuffEn() {
short result;
GetProperty(19, VT_I2, (void*)&result);
return result;
}
void CAxViewer::SetBuffEn(short propVal) {
SetProperty(19, VT_I2, propVal);
}
 

 

 

2.1.2 CompressType

Description:

Sets/Gets the Video compress type, such as mpeg4, mjpeg

Syntax:

CompressType= Input_Value
Return_Value = CompressType 

Parameters:

Name

Type

Description

Input_Value

short

Set the video compress type.

0:MJPEG, 1:MPEG4, 255:UNKOWN

 

Returns:

Name

Type

Description

Return_Value

short

Get the video compress type.

0:MJPEG, 1:MPEG4, 255:UNKOWN

 

Remarks:

Default is UNKOWN (255). Meaning that when reconnect the streaming the initial compress type is unknown.

Examples:

short CAxViewer::GetVideoCompressType() {
short result;
GetProperty(3, VT_I2, (void*)&result);
return result;
}
void CAxViewer::SetVideoCompressType(short propVal) {
SetProperty(3, VT_I2, propVal);
}
void CTESTDlg::testChangeVideoCompressType() {
    short propVal = m_Viewer1->GetVideoCompressType();
    propVal++;
    m_Viewer1->SetVideoCompressType(Mpeg4mjpeg%2);
}

 

2.1.3 HostIP

Description:

Sets/Gets the host IP address

Syntax:

HostIP = Input_Value
Return_Value = HostIP

Parameters:

Name

Type

Description

Input_Value           

BSTR

Sets the IP address of the host

 

Returns:

Name

Type

Description

Return_Value

BSTR

Gets the IP address of the host

 

Remarks:

Default is empty string.

Examples:

CString CAxViewer::GetHostIP(){
CString result;
GetProperty(4, VT_BSTR, (void*)&result);
return result;
}
void CAxViewer::SetHostIP(LPCTSTR propVal){
SetProperty(4, VT_BSTR, propVal);
}
void CTESTDlg::testChangeHostIP(CString       ipaddress) {
    CString curIP = m_Viewer1->GetHostIP();
    If(curIP != ipaddress)
        m_Viewer1->SetHostIP(ipaddress);
}

 

2.1.4 HttpPort

Description:

Sets/Gets the special Http port

Syntax:

HttpPort = Input_Value
Return_Value = HttpPort

Parameters:

Name

Type

Description

Input_Value

short

Sets the http port number of the host

 

Returns:

Name

Type

Description

Return_Value

short

Gets the http port number of the host

 

Remarks:

Default is 80 for general propos.

Examples:

short CAxViewer::GetHttpPort() {
    short result;
    GetProperty(2, VT_I2, (void*)&result);
    return result;
}
void CAxViewer::SetHttpPort(short propVal) {
    SetProperty(2, VT_I2, propVal);
}
void CTESTDlg::testChangeHostPort(short port) {
    short curPort = m_Viewer1->GetHttpPort();
    If(curPort != port)
        m_Viewer1->SetHttpPort(port);
}

 

2.1.5 MjpegName

Description:

Set/Gets the MJPEG streaming file name

Syntax:

MjpegName = Input_Value
Return_Value = MjpegName

Parameters:

Name

Type

Description

Input_Value

BSTR

Sets the mjpeg stream file name

 

Returns:

Name

Type

Description

Return_Value

BSTR

Gets the mjpeg stream file name

 

Remarks:

Default is "video.mjpg".

Examples:

CString CAxViewer::GetMjpegName() {
    CString result;
    GetProperty(17, VT_BSTR, (void*)&result);
    return result;
}
void CAxViewer::SetMjpegName(LPCTSTR propVal) {
    SetProperty(17, VT_BSTR, propVal);
}

 

2.1.6 Mpeg4Name

Description:

Set/Gets the MPEG4 streaming file name

Syntax:

Mpeg4Name = Input_Value
Return_Value = Mpeg4Name

Parameters:

Name

Type

Description

Input_Value

BSTR

Sets the mpeg4 stream file name

 

Returns:

Name

Type

Description

Return_Value

BSTR

Gets the mpeg4 stream file name

 

Remarks:

Default is "video.mp4" .

Examples:

CString CAxViewer::GetMpeg4Name() {
    CString result;
    GetProperty(16, VT_BSTR, (void*)&result);
    return result;
}
void CAxViewer::SetMpeg4Name(LPCTSTR propVal) {
    SetProperty(16, VT_BSTR, propVal);
}

 

2.1.7 MulticastName

Description:

Set/Gets the Multicast streaming file name

Syntax:

MulticastName = Input_Value
Return_Value = MulticastName

Parameters:

Name

Type

Description

Input_Value

BSTR

Sets the Multicast stream file name

 

Returns:

Name

Type

Description

Return_Value

BSTR

Gets the Multicast stream file name

 

Remarks:

Default is”multicast.mp4”.

Examples:

CString CAxViewer::GetMulticastName() {
    CString result;
    GetProperty(18, VT_BSTR, (void*)&result);
    return result;
}
void CAxViewer::SetMulticastName(LPCTSTR propVal) {
    SetProperty(18, VT_BSTR, propVal);
}

 

2.1.8 Password

Description:

Set/Gets the password to access the media stream

Syntax:

MulticastName = Input_Value
Return_Value = MulticastName

Parameters:

Name

Type

Description

Input_Value

BSTR

Sets the password to access the media stream

 

Returns:

Name

Type

Description

Return_Value

BSTR

Gets the password to access the media stream

 

Remarks:

 

Examples:

CString CAxViewer::GetPassword() {
    CString result;
    GetProperty(7, VT_BSTR, (void*)&result);
    return result;
}
void CAxViewer::SetPassword(LPCTSTR propVal) {
    SetProperty(7, VT_BSTR, propVal);
}
void CTESTDlg::testChangePassword(CString password) {
    CString curPW = m_Viewer1->GetPassword ();
    If(curPW!= password)
        m_Viewer1->SetPassword(password);
}

 

2.1.9 Port

Description:

Sets/Gets the streaming port

Syntax:

Port = Input_Value
Return_Value = Port

Parameters:

Name

Type

Description

Input_Value

short

Sets the streaming port

 

Returns:

Name

Type

Description

Return_Value

short

Gets the streaming port

 

Remarks:

Default is 8090.

Examples:

short CAxViewer::GetVideoPort(){
    short result;
    GetProperty(1, VT_I2, (void*)&result);
    return result;
}
void CAxViewer::SetVideoPort(short propVal) {
    SetProperty(1, VT_I2, propVal);
}
void CTESTDlg::testChangeVideoPort (short port) {
    short curPort = m_Viewer1->GetVideoPort();
    If(curPort != port)
        m_Viewer1->SetVideoPort(port);
}

 

2.1.10 Protocol

Description:

Set/Gets the Rtsp streaming protocol as ‘TCP’, ‘UDP’, ‘HTTP’, or ‘Multicast’

Syntax:

Protocol = Input_Value
Return_Value = Protocol

Parameters:

Name

Type

Description

Input_Value

short

Set the Rtsp streaming protocol as

1 : ‘TCP’,

2 : ‘UDP’,

3 : ‘HTTP’,

4 : ‘Multicast’

 

Returns:

Name

Type

Description

Return_Value

short

Get the Rtsp streaming protocol as

1 : ‘TCP’,

2 : ‘UDP’,

3 : ‘HTTP’,

4 : ‘Multicast’

 

Remarks:

Default is Multicast(4).

Examples:

short CAxViewer::GetRTSPProtocol(){
    short result;
    GetProperty(15, VT_I2, (void*)&result);
    return result;
}
void CAxViewer::SetRTSPProtocol(short propVal) {
    SetProperty(15, VT_I2, propVal);
}

 

2.1.11 RtspEn

Description:

Gets current protocol is RTSP or not

Syntax:

Return_Value = RtspEn

Parameters:

 

Returns:

Name

Type

Description

Return_Value

short

Gets current protocol is RTSP or not

1: Enable

0: Disable

 

Remarks:

Default is Disable (0).

Examples:

short CAxViewer::GetRtspEn(){
    short result;
    GetProperty(14, VT_I2, (void*)&result);
    return result;
}

 

2.1.12 UserName

Description:

Sets/Gets the user name of the media stream

Syntax:

UserName = Input_Value
Return_Value = UserName

Parameters:

Name

Type

Description

Input_Value

BSTR

Set the user name of the media stream

 

Returns:

Name

Type

Description

Return_Value

BSTR

Get the user name of the media stream

 

Remarks:

Examples:

CString CAxViewer::GetUserName() {
    CString result;
    GetProperty(6, VT_BSTR, (void*)&result);
    return result;
}
void CAxViewer::SetUserName(LPCTSTR propVal) {
    SetProperty(6, VT_BSTR, propVal);
}
void CTESTDlg::testChangeUserName(CString userName) {
    CString curName = m_Viewer1->GetUserName();
    If(curName != userName)
        m_Viewer1->SetUserName(userName);
}

 

2.2 UI Property

Name

Descruption

InitMode

Sets/Gets the Initial Mode for ‘Normal’, ‘Player’, ‘MotionDetect’, or ‘PrivateMask

Language

Sets/Gets the displayed language, such as “da-DK”, “de-DE”, ”el-GR”, “en-US”, “es-ES”, “ja-JP”, “ko-KR”, “zh-CN”, or “zh-TW”

RotateEn

Sets/Gets the image rotatable or not

Rotate

Set/Gets the image rotate type for ‘no_rotate’, ‘Flip’, or ‘Mirror’

ViewSize

Set/Gets the image displayed view size as ‘Medium’ or ‘Large’

 

2.2.1 InitMode

Description:

Sets/Gets the Initial Mode for ‘Normal’, ‘Player’, ‘MotionDetect’, or ‘PrivateMask

Syntax:

InitMode = Input_Value
Return_Value = InitMode

Parameters:

Name

Type

Description

Input_Value

BSTR

Set the Initial Mode for ‘Normal’, ‘Player’, ‘MotionDetect’, or ‘PrivateMask

 

Returns:

Name

Type

Description

Return_Value

BSTR

Get the Initial Mode for ‘Normal’, ‘Player’, ‘MotionDetect’, or ‘PrivateMask’’

 

Remarks:

Default is "Normal".

Examples:

CString CAxViewer::GetInitMode() {
    CString result;
    GetProperty(5, VT_BSTR, (void*)&result);
    return result;
}
void CAxViewer::SetInitMode(LPCTSTR propVal) {
    SetProperty(5, VT_BSTR, propVal);
}
void CTESTDlg:: SetMyInitMode(CString initMode) {
    m_Viewer1-> SetInitMode(initMode);
}

 

2.2.2 Language

Description:

Sets/Gets the displayed language, such as “da-DK”, “de-DE”, ”el-GR”, “en-US”, “es-ES”, “ja-JP”, “ko-KR”, “zh-CN”, or “zh-TW”

Syntax:

Language = Input_Value
Return_Value = Language

Parameters:

Name

Type

Description

Input_Value

BSTR

Set the displayed language, such as “da-DK”, “de-DE”, ”el-GR”, “en-US”, “es-ES”, “ja-JP”, “ko-KR”, “zh-CN”, or “zh-TW”

 

Returns:

Name

Type

Description

Return_Value

BSTR

Get the displayed language, such as “da-DK”, “de-DE”, ”el-GR”, “en-US”, “es-ES”, “ja-JP”, “ko-KR”, “zh-CN”, or “zh-TW”

 

Remarks:

Default is “en-US”.

Examples:

CString CAxViewer::GetLanguage() {
    CString result;
    GetProperty(8, VT_BSTR, (void*)&result);
    return result;
}
void CAxViewer::SetLanguage(LPCTSTR propVal) {
    SetProperty(8, VT_BSTR, propVal);
}
CString CTESTDlg:: GetCurrentLanguage() {
    CString curLanguage;
    curLanguage = m_Viewer1->GetLanguage();
    return curLanguage;
}

 

2.2.3 RotateEn

Description:

Sets/Gets the image rotatable or not.

Syntax:

RotateEn = Input_Value
Return_Value = RotateEn

Parameters:

Name

Type

Description

Input_Value

short

Sets the image rotatable or not

1: Enable

0: Disable

 

Returns:

Name

Type

Description

Return_Value

short

Gets the image rotatable or not

1: Enable

0: Disable

 

Remarks:

Default is Disable (0).

Examples:

short CAxViewer::GetRotateEn() {
    short result;
    GetProperty(12, VT_I2, (void*)&result);
    return result;
}
void CAxViewer::SetRotateEn(short propVal) {
    SetProperty(12, VT_I2, propVal);
}

 

2.2.4 Rotate

Description:

Set/Gets the image rotate type for ‘no_rotate’, ‘Flip’, or ‘Mirror’.

Syntax:

Rotate = Input_Value
Return_Value = Rotate

Parameters:

Name

Type

Description

Input_Value

short

Set the image rotate type

0 : no_rotate,

1 : Flip,

2 : Mirror.

 

Returns:

Name

Type

Description

Return_Value

short

Get the image rotate type

0 : no_rotate,

1 : Flip,

2 : Mirror.

 

Remarks:

Default is no_rotate (0).

Examples:

short CAxViewer::GetRotate() {
    short result;
    GetProperty(9, VT_I2, (void*)&result);
    return result;
}
void CAxViewer::SetRotate(short propVal) {
    SetProperty(9, VT_I2, propVal);
}

 

2.2.5 ViewSize

Description:

Set/Gets the image displayed view size as ‘Medium’ or ‘Large’.

Syntax:

ViewSize = Input_Value
Return_Value = ViewSize

Parameters:

Name

Type

Description

Input_Value

BSTR

Set the image displayed view size as ‘Medium’ or ‘Large’

 

Returns:

Name

Type

Description

Return_Value

BSTR

Get the image displayed view size as ‘Medium’ or ‘Large’

 

Remarks:

Default is ‘Medium’.

Examples:

CString CAxViewer::GetViewSize() {
    CString result;
    GetProperty(10, VT_BSTR, (void*)&result);
    return result;
}
void CAxViewer::SetViewSize(LPCTSTR propVal) {
    SetProperty(10, VT_BSTR, propVal);
}

 

2.3 PTZ Property

Name

Descruption

DZoomEn

Enable digital zoom or not

 

2.3.1 DZoomEn

Description:

Enable digital zoom or not

Syntax:

DZoomEn = Input_Value
Return_Value = DZoomEn

Parameters:

Name

Type

Description

Input_Value

short

Enable digital zoom or not

1: Enable

0: Disable

 

Returns:

Name

Type

Description

Return_Value

short

check the digital zoom support or not

1: Enable

0: Disable

 

Remarks:

Default is Enable(1).

Examples:

short CAxViewer::GetDZoomEn() {
    short result;
    GetProperty(13, VT_I2, (void*)&result);
    return result;
}
void CAxViewer::SetDZoomEn(short propVal) {
    SetProperty(13, VT_I2, propVal);
}

 

2.4 RECORD PROPERTY

Name

Descruption

RecorderEn

Sets/Gets the streaming recordable or not

 

2.4.1 RecorderEn

Description:

Sets/Gets the streaming recordable or not.

Syntax:

RecorderEn = Input_Value
Return_Value = RecorderEn

Parameters:

Name

Type

Description

Input_Value

short

Sets the streaming recordable or not

1: Enable

0: Disable

 

Returns:

Name

Type

Description

Return_Value

short

Gets the streaming recordable or not

1: Enable

0: Disable

 

Remarks:

Default is Disable (0).

Examples:

short CAxViewer::GetRecorderEn() {
    short result;
    GetProperty(11, VT_I2, (void*)&result);
    return result;
}
void CAxViewer::SetRecorderEn(short propVal) {
    SetProperty(11, VT_I2, propVal);
}

 

2.5 MOTION DETECTION PROPERTY

Name

Descruption

 

 

 

2.6 DIO PROPERTY

Name

Descruption

 

 

 

2.7 OSD PROPERTY

Name

Descruption

 

 

 

3 CONTROL METHODS

3.1 Media Methods

Name

Descruption

AudioStart()

Starts or stop play input audio stream

AVConnect()

Connects or disconnects to the media source

ChangeVideoMode()

Switching the video mode between mpeg4 and mjpeg

GetProtocol()

Get current connected RTSP protocol

GetVideoMode()

Get current video mode

IsAudioStart()

Check audio play state

IsTalkEnable()

Check audio output state

IsVideoStart()

Check video play state

RegisterVideoFrameCallBackProc()

Assign a call back function to get the video frame

SetBuffering()

Set frame buffering enable or not

TalkEnable()

Starts or stop audio output stream

VideoStart()

Starts or stop play video stream

AudioStart()

Starts or stop play input audio stream

 

3.1.1 AudioStart()

Description:

Starts or stop play input audio stream

Syntax:

AudioStart(bAudioStart);

Parameters:

Name

Type

Description

bAudioStart

short

Activate or de-activate to play current audio stream

1: Activate

0: de-activate

 

Returns:

Void

Remarks:

Only supported in MPEG4 compress type, if device support.

Examples:

void CAxViewer::AudioStart(short bAudioStart) {
    static BYTE parms[] = VTS_I2; // #define VTS_I2 "\x02"
    InvokeHelper(41, DISPATCH_METHOD, VT_EMPTY, NULL, parms, AudioStart);
}

 

3.1.2 AVConnect()

Description:

Connects or disconnects to the media source

Syntax:

AVConnect(bConnect);

Parameters:

Name

Type

Description

bConnect

short

Connect or disconnect to the media source

1: connect

0: disconnect

 

Returns:

Void

Remarks:

None.

Examples:

void CAxViewer::AVConnect(short bConnect) {
    static BYTE parms[] = VTS_I2; // #define VTS_I2 "\x02"
    InvokeHelper(50, DISPATCH_METHOD, VT_EMPTY, NULL, parms, bConnect);
}
void CTESTDlg::startViewer(CAxViewer **m_Viewer) {
    if(*m_Viewer == NULL){
        *m_Viewer = new CAxViewer;                           
        (*m_Viewer)->Create(NULL,WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | 
        WS_CLIPCHILDREN,CRect(CH1_X1,CH1_Y1,CH1_X2,CH1_Y2),this,100);
        (*m_Viewer)->SetHttpPort(m_ConnectInfo.m_http_port);
        (*m_Viewer)->SetHostIP(m_ConnectInfo.m_ipaddress);
        (*m_Viewer)->SetUserName(m_ConnectInfo.m_user);
        (*m_Viewer)->SetPassword(m_ConnectInfo.m_passwd);
        (*m_Viewer)->AVConnect(1);  //video connect
        (*m_Viewer)->VideoStart(1); //video play
              Sleep(1000); //sleep 1 sec.
    }else{
              (*m_Viewer)->AVConnect(0);  //video disconnect
        (*m_Viewer)->VideoStart(0); //video stop
        delete *m_Viewer;
              *m_Viewer = NULL;
    }
}

 

3.1.3 ChangeVideoMode()

Description:

Switching the video mode between mpeg4 and mjpeg

Syntax:

ChangeVideoMode(nMode);

Parameters:

Name

Type

Description

nMode

short

Specifies the flag of compression type

0:  COMPRESS_MJPEG

1:  COMPRESS_MPEG4

 

Returns:

Void

Remarks:

Compress type “COMPRESS_UNKOWN” is not allowed.

Examples:

void CAxViewer::ChangeVideoMode(short nMode) {
    static BYTE parms[] = VTS_I2;
    InvokeHelper(44, DISPATCH_METHOD, VT_EMPTY, NULL, parms, nMode);
}
void CTESTDlg::OnVideo1Mpeg4mjpeg() {
    static int Mpeg4mjpeg=1;
    if(m_Viewer1)
    {
        Mpeg4mjpeg++;
        m_Viewer1->ChangeVideoMode(Mpeg4mjpeg%2);
    }
}

 

3.1.4 GetProtocol()

Description:

Get current connected RTSP protocol

Syntax:

Return_Value = GetProtocol();

Parameters:

None.

Returns:

Name

Type

Description

Return_Value

short

Return the connected RTSP Protocol

1:  TCP

2:  UDP

3:  HTTP

4:  Multicast

 

Remarks:

None.

Examples:

void CAxViewer::GetProtocol() {
    short result;
    InvokeHelper(62, DISPATCH_METHOD, VT_I2, (void*)&result, NULL, NULL);
    return result;
}

 

3.1.5 GetVideoMode()

Description:

Get current video compress type

Syntax:

Return_Value = GetVideoMode();

Parameters:

None.

Returns:

Name

Type

Description

Return_Value

short

Return current video compress type

0:  MJPEG

1:  MPEG4

255:UNKOWN

 

Remarks:

None.

Examples:

void CAxViewer::GetVideoMode() {
    short result;
    InvokeHelper(48, DISPATCH_METHOD, VT_I2, (void*)&result, NULL, NULL);
    return result;
}

 

3.1.6 IsAudioStart()

Description:

Check audio play state

Syntax:

Return_Value = IsAudioStart();

Parameters:

None.

Returns:

Name

Type

Description

Return_Value

short

Return the flag of audio is playing or not

1:  playing

0:  not playing

 

Remarks:

None.

Examples:

short CAxViewer::IsAudioStart() {
    short result;
    InvokeHelper(46, DISPATCH_METHOD, VT_I2, (void*)&result, NULL, NULL);
    return result;
}

 

3.1.7 IsTalkEnable()

Description:

Check audio output state

Syntax:

Return_Value = IsTalkEnable();

Parameters:

None.

Returns:

Name

Type

Description

Return_Value

short

Return the state of audio output

1:  audio output

0:  no audio output

 

Remarks:

None.

Examples:

short CAxViewer::IsTalkEnable() {
    short result;
    InvokeHelper(45, DISPATCH_METHOD, VT_I2, (void*)&result, NULL, NULL);
    return result;
}

 

3.1.8 IsVideoStart()

Description:

Check video output state

Syntax:

Return_Value = IsVideoStat();

Parameters:

None.

Returns:

Name

Type

Description

Return_Value

short

Return the state of video playing

1:  playing

0:  not playing

 

Remarks:

None.

Examples:

short CAxViewer::IsVideoStart() {
    short result;
    InvokeHelper(47, DISPATCH_METHOD, VT_I2, (void*)&result, NULL, NULL);
    return result;
}

 

 

3.1.9 RegisterVideoFrameCallBackProc()

Description:

Assign a call back function to get the video frame.

Syntax:

RegisterVideoFrameCallBackProc(MyFrameCallBack, ColorSpace, context);

Parameters:

Name

Type

Description

MyFrameCallBack

Static function

This is a function pointer defined by:

typedef void (*fnVideoFrameCallBackProc)

(int channel,

BYTE *pBuffer,

int widht,

int height,

BOOL bSwapUV,

LPVOID lpParam);

 

fnVideoFrameCallBackProc: call back function pointer

channel: video channel in AxVideoView, the value is 0

pBuffer: the video frame byte array

width: width of video frame

height: height of video frame

bSwapUV: specify the U V is swaped or not.

lpParam: object pointer

ColorSpace

Short

Set the color space we want:

0x00: COLORSPACE_DEFAULT

0x01: COLORSPACE_YV12

0x02: COLORSPACE_BGR

0x03: COLORSPACE_RGB

Default color space is YV12

context

DWORD

object pointer

 

Returns:

Void

Remarks:

None.

Examples:

void CAxViewer::RegisterVideoFrameCallBackProc(void *fn, short colorspace, DWORD ctx) {
static BYTE parms[] = VTS_PI4 VTS_I2 VTS_I4;
  InvokeHelper(67, DISPATCH_METHOD, VT_EMPTY, NULL, parms, fn, colorspace, ctx);
}
//Call back function
void CDlgPreview::MyFrameCallBack(int channel, BYTE *pBuffer, int width, int height, BOOL bSwapUV, LPVOID lpParam) {
  BYTE* pImage = new BYTE[width * height * 4];
  strcpy((char*)pImage,(char*)pBuffer);
}
//register the call back function into AxVideoView
void CTESTDlg::startViewer(CAxViewer **m_Viewer) {
    if(*m_Viewer == NULL){
        *m_Viewer = new CAxViewer;                           
        (*m_Viewer)->Create(NULL,WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | 
        WS_CLIPCHILDREN,CRect(CH1_X1,CH1_Y1,CH1_X2,CH1_Y2),this,100);
        (*m_Viewer)->SetHttpPort(m_ConnectInfo.m_http_port);
        (*m_Viewer)->SetHostIP(m_ConnectInfo.m_ipaddress);
        (*m_Viewer)->SetUserName(m_ConnectInfo.m_user);
        (*m_Viewer)->SetPassword(m_ConnectInfo.m_passwd);
        (*m_Viewer)->RegisterVideoFrameCallBackProc(MyFrameCallBack, COLORSPACE_BGR, (DWORD)this);
        (*m_Viewer)->AVConnect(1);  //video connect
        (*m_Viewer)->VideoStart(1); //video play
              Sleep(1000); //sleep 1 sec.
    }else{
              (*m_Viewer)->AVConnect(0);  //video disconnect
        (*m_Viewer)->VideoStart(0); //video stop
        delete *m_Viewer;
              *m_Viewer = NULL;
    }
}

 

3.1.10 SetBuffering()

Description:

Set frame buffering enable or not. Enable frame buffering make for smooth playing on video stream.

Syntax:

SetBuffering(bEnable);

Parameters:

Name

Type

Description

bEnable

boolean

Specifies the  frame buffering enable or not:

1:TRUE

0:FALSE

 

Returns:

Void

Remarks:

Only supported in MPEG4 compress type.

Examples:

void CAxViewer::SetBuffering(short bEnable) {
    static BYTE parms[] = VTS_I2;
    InvokeHelper(66, DISPATCH_METHOD, VT_EMPTY, NULL, parms, bTalkEn);
}

 

3.1.11 TalkEnable()

Description:

Start or stop audio output stream

Syntax:

TalkEnable(bTalkEnable);

Parameters:

Name

Type

Description

bTalkEnable

short

Activate or de-activate audio output stream

1:  Activate audio output stream

0:  De-activate audio output stream

 

Returns:

Void

Remarks:

Enable audio output stream, if device supported and compress type is MPEG4.

Examples:

void CAxViewer::TalkEnable(short bTalkEn) {
    static BYTE parms[] = VTS_I2;
    InvokeHelper(43, DISPATCH_METHOD, VT_EMPTY, NULL, parms, bTalkEn);
}

 

3.1.12 VideoStart()

Description:

Starts or stop play video stream

Syntax:

VideoStart(bVideoStart);

Parameters:

Name

Type

Description

bVideoStart

short

Activate or de-activate video playing

1:  Activate video playing

0:  De-activate video playing

 

Returns:

Void

Remarks:

None.

Examples:

void CAxViewer::VideoStart(short bVideoStart) {
    static BYTE parms[] = VTS_I2;
    InvokeHelper(42,DISPATCH_METHOD, VT_EMPTY, NULL, parms, bVideoStart);
}

 

3.2 UI Methods

Name

Descruption

SetFullScreen()

Set display screen to full screen

SetVideoEffectMode()

Rotate image

 

3.2.1 SetFullScreen()

Description:

Set view size to full screen

Syntax:

SetFullScreen(bFullScreen);

Parameters:

Name

Type

Description

bFullScreen

short

Set the view size to full screen or not

1:  set to full screen

0:  set to original view size

 

Returns:

Void

Remarks:

None.

Examples:

void CAxViewer::SetFullScreen(short bFullScreen) {
    static BYTE parms[] = VTS_I2;
    InvokeHelper(49,DISPATCH_METHOD, VT_EMPTY, NULL, parms, bFullScreen);
}

 

3.2.2 SetVideoEffectMode()

Description:

Rotate image

Syntax:

SetVideoEffectMode(bVideoEffectMode);

Parameters:

Name

Type

Description

bVideoEffectMode

short

Rotate the image or not

1:  rotate the image

0:  not rotate

 

Returns:

Void

Remarks:

None.

Examples:

void CAxViewer::SetVideoEffect(short bVideoEffectMode) {
    static BYTE parms[] = VTS_I2;
    InvokeHelper(56,DISPATCH_METHOD, VT_EMPTY, NULL, parms, bVideoEffectMode);
}

 

3.3 PTZ Methods

Name

Descruption

PTZCommand()

Camera PTZ controlled with parameters

VideoDZoom ()

Set the zoom size with parameter in digital zoom mode

VideoDZoomIn ()

Zoom in the video view in digital zoom mode

VideoDZoomMove()

Move video view with the direction in digital zoom mode

VideoDZoomOffset()

Move video view with the horizontal or vertical offset in digital zoom mode

VideoDZoomOut ()

Zoom out the video view in digital zoom mode

 

3.3.1 PTZCommand()

Description:

Camera PTZ controlled with parameters

Syntax:

bReturn_Flag =  PTZCommand(iComId, sParam1, iParam2, iParam3);

Parameters:

Name

Type

Description

iComId

short

PTZ command id:

1: ptz move upleft

2: ptz move upleft

3: ptz move upleft

4: ptz move left

5: ptz move home

6: ptz move right

7: ptz move downleft

8: ptz move down

9: ptz move downright

10: ptz zoom in

11: ptz zoom out

12: ptz focus far

13: ptz focus near

14: ptz preset go by name

15: ptz preset go by id

16: ptz preset set by name

17: ptz preset set by id

18: ptz preset remove by name

19: ptz preset remove by id

20: ptz patrol start

21: ptz patrol stop

sParam1

BSTR

In command 14, 16 and 18, the command need preset position name as parameter.

iParam2

short

In command 15, 17 and 19, the command need preset position id as parameter.

iParam3

short

In command 16 and 17, the ptz preset set command can set the position as home position indicated by iParam3:

1: true

0: false

 

Returns:

Name

Type

Description

bReturn_Flag

boolean

Return the PTZ execute result is success or not.

 

Remarks:

PTZCommand() is enabled if the device support PTZ.

Examples:

BOOL CAxViewer::PTZCommand(short iComId, LPCTSTR sParam1, short iParam2, short iParam3) {
    BOOL result;
    static BYTE parms[] = VTS_I2 VTS_BSTR VTS_I2 VTS_I2;
    InvokeHelper(65, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms, iComId, sParam1, iParam2, iParam3);
    return result;
}
void CDlgPreview::OnBtnPtzLup() {
    m_ViewerPreview->PTZCommand(1, _T(""), 0, 0);
}

 

3.3.2 VideoDZoom()

Description:

Set the zoom size with parameter in digital zoom mode

Syntax:

VideoDZoom(nStep, dx, dy);

Parameters:

Name

Type

Description

nStep

short

The nStep range from 100 to 1000, means the digital zoom scale from 100% to 1000%.

dx

short

Specify the video horizontal offset

dy

short

Specify the video vertical offset

 

Returns:

Void

Remarks:

Digital zoom is enabled if the device does not support PTZ.

Examples:

void CAxViewer::VideoDZoom(short nStep, short dx, short dy) {
    static BYTE parms[] = VTS_I2 VTS_I2 VTS_I2;
    InvokeHelper(51, DISPATCH_METHOD, VT_EMPTY, NULL, parms, nStep, dx, dy);
}

 

3.3.3 VideoDZoomIn()

Description:

Zoom in the video view in digital zoom mode

Syntax:

VideoZoomIn();

Parameters:

None

Returns:

Void

Remarks:

Digital zoom is enabled if the device does not support PTZ.

Examples:

void CAxViewer::VideoDZoomIn(){
InvokeHelper(54, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
void CDlgPreview::OnBtnTele() {
    m_ViewerPreview->VideoDZoomIn();
}

 

3.3.4 VideoDZoomMove()

Description:

Move video view with the direction in digital zoom mode

Syntax:

VideoDZoomMove(direction);

Parameters:

Name

Type

Description

direction

short

Digital zoom move direction:

0x01: up left

0x02: up

0x03: up right

0x04: left

0x05: center

0x06: right

0x07: down left

0x08: down

0x09: down right

 

Returns:

Void

Remarks:

Digital zoom is enabled if the device does not support PTZ.

Examples:

void CAxViewer::VideoDZoomMove(short direction) {
    static BYTE parms[] = VTS_I2;
    InvokeHelper(52, DISPATCH_METHOD, VT_EMPTY, NULL, parms, direction);
}
void CDlgPreview::OnBtnLup() {
    m_ViewerPreview->VideoDZoomMove(1);
}

 

3.3.5 VideoDZoomOffset()

Description:

Move video view with the horizontal or vertical offset in digital zoom mode

Syntax:

VideoDZoomOffset(dx, dy);

Parameters:

Name

Type

Description

dx

short

Specify the video horizontal offset

dy

short

Specify the video vertical offset

 

Returns:

Void

Remarks:

Digital zoom is enabled if the device does not support PTZ.

Examples:

void CAxViewer::VideoDZoomOffset(short dx, short dy) {
    static BYTE parms[] = VTS_I2 VTS_I2;
    InvokeHelper(53, DISPATCH_METHOD, VT_EMPTY, NULL, parms, dx, dy);
}
 

 

3.3.6 VideoDZoomOut()

Description:

Zoom out the video view in digital zoom mode

Syntax:

VideoZoomOut();

Parameters:

None

Returns:

Void

Remarks:

Digital zoom is enabled if the device does not support PTZ.

Examples:

void CAxViewer::VideoDZoomOut(){
InvokeHelper(55, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
void CDlgPreview::OnBtnWide() {
    m_ViewerPreview->VideoDZoomOut();
}

 

3.4 Record Methods

Name

Descruption

ChooseStorageLocation()

Popup a dialog to choose where to save the recode files

IsRecordStart()

Check record state

RecordStart()

Starts record input stream

SetRecordPath()

Assign the path to save the recorded files

SetSnapshotPathName()

Assign the path and file name to save the snapshot image file

Snapshot()

Take a snapshot and save to previous assigned path name.

 

3.4.1 ChooseStorageLocation()

Description:

Popup a dialog to choose where to save the recode files

Syntax:

Return_Value = ChooseStorageLocation();

Parameters:

None

Returns:

Name

Type

Description

Return_Value

short

Return 1 (TRUE) if the select path is accessible

Return 0 (FALSE) if the select path is inaccessible

 

Remarks:

If no need to popup a dialog, you can use “SetRecordPath()” to assign the record path.

Examples:

short CAxViewer::ChooseStorageLocation() {
    short result;
    InvokeHelper(61, DISPATCH_METHOD, VT_I2, (void*)&result, NULL, NULL);
    return result;
}

 

3.4.2 IsRecordStart()

Description:

Check record state

Syntax:

Return_Value = IsRecordStart();

Parameters:

None

Returns:

Name

Type

Description

Return_Value

short

Return the flag of video stream recording or not

1:  recording

0:  not recording

 

Remarks:

None.

Examples:

short CAxViewer::IsRecordStart() {
    short result;
    InvokeHelper(59, DISPATCH_METHOD, VT_I2, (void*)&result, NULL, NULL);
    return result;
}

 

3.4.3 RecordStart()

Description:

Starts or stop record input stream

Syntax:

RecordStart(bRecord);

Parameters:

Name

Type

Description

bRecord

short

Activate or de-activate recording

1:  Activate recording

0:  De-activate recording

 

Returns:

Void

Remarks:

Only can recording the video compressed by MPEG4.

Examples:

void CAxViewer::RecordStart(short bRecord) {
    static BYTE parms[] = VTS_I2;
    InvokeHelper(58, DISPATCH_METHOD, VT_EMPTY, NULL, parms, bRecord);
}
void CDlgPreview::OnRecord1Startstop() {
    static int Record1Startstop=0;
    CTESTDlg* pwndParent = (CTESTDlg*) (GetParent()->GetParent());
    pwndParent->UpdateData();
    if(pwndParent->m_strSavePath != _T(""))
    {
            if(m_ViewerPreview)
        {
            Record1Startstop++;
            m_ViewerPreview->SetRecordPath(pwndParent->m_strSavePath);
                m_ViewerPreview->RecordStart(Record1Startstop%2);
            if(Record1Startstop%2)
                m_record_startstop.SetWindowText("Stop");
            else
                m_record_startstop.SetWindowText("Start");
        }
    }
}

 

3.4.4 SetRecordPath()

Description:

Assign the path to save the recorded files

Syntax:

bReturn_Flag = SetRecordPath(sPath);

Parameters:

Name

Type

Description

sPath

BSTR

Specifies the path where to save the record file.

 

Returns:

Name

Type

Description

bReturn_Flag

boolean

If sPath is empty then return FALSE else return TRUE

 

Remarks:

The “RecordStart()” function will create a folder named with date in the specified path and save the recorded file named with date and time, such as “<sPath> \20071114\ 20071114192547.avi”.

Examples:

BOOL CAxViewer::SetRecordPath(LPCTSTR sPath) {
    BOOL result;
    static BYTE parms[] = VTS_BSTR;
    InvokeHelper(57, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms, sPath);
    return result;
}
Refer to section 5.4.3

 

3.4.5 SetSnapshotPathName()

Description:

Assign the path and file name to save the snapshot image file

Syntax:

bReturn_Flag = SetSnapshotPathName(sFileName);

Parameters:

Name

Type

Description

sFileName

BSTR

Specifies the path and file name to save the snapshot image file.

 

Returns:

Name

Type

Description

bReturn_Flag

boolean

If sFileName is empty then return FALSE else return TRUE

 

Remarks:

 

Examples:

BOOL CAxViewer::SetSnapshotPathName(LPCTSTR sFileName) {
    BOOL result;
    static BYTE parms[] =      VTS_BSTR;
    InvokeHelper(63, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms, sFileName);
    return result;
}
void CDlgPreview::OnBtnSnapshot() {
    CTESTDlg* pwndParent = (CTESTDlg*) (GetParent()->GetParent());
    pwndParent->UpdateData();
    if(pwndParent->m_strSavePath != _T("")) {
        SYSTEMTIME pTime;
              char picPath[256];
              char picPathName[256];
        GetSystemTime(&pTime);
        _tcscpy(picPath, pwndParent->m_strSavePath);
        sprintf(picPathName, "%s%04d%02d%02d%02d%02d%02d.jpg", picPath, pTime.wYear, pTime.wMonth, pTime.wDay,                                                               pTime.wHour, pTime.wMinute, pTime.wSecond);
              if(m_ViewerPreview) {
            m_ViewerPreview->SetSnapshotPathName(picPathName);
            m_ViewerPreview->Snapshot();
        }
    }
}

 

3.4.6 Snapshot()

Description:

Take a snapshot and save to previous assigned path name.

Syntax:

bReturn_Flag = Snapshot();

Parameters:

None

Returns:

Name

Type

Description

bReturn_Flag

boolean

Return TRUE if snapshot success else return FALSE

 

Remarks:

 

Examples:

BOOL CAxViewer::Snapshot() {
    BOOL result;
    InvokeHelper(64, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL, NULL);
    return result;
}
Refer to section 5.4.5

 

3.5 Motion Detection Methods

Name

Descruption

 

 

 

3.6 DIO Methods

Name

Descruption

 

 

 

3.7 OSD Methods

Name

Descruption

getMaskParam()

Get the parameters of Privacy Mask.

 

3.7.1 getMaskParam()

Description:

Get the parameters of Privacy Mask.

Syntax:

Return_value = getMaskParam(szParamType);

Parameters:

Name

Type

Description

szParamType

BSTR

Specifies which parameter to get, include:

“Height”, “Width”, ”XPos”, “YPos

 

Returns:

Name

Type

Description

Return_value

short

Return the value

 

Remarks:

 

Examples:

short CAxViewer::getMaskParam(BSTR szParamType) {
    short result;
    static BYTE parms[] = VTS_BSTR;
    InvokeHelper(60, DISPATCH_METHOD, VT_I2, (void*)&result, parms, szParamType);
    return result;
}
void CDlgPreview::getMaskParams() {
   short height, width, xpos, ypos;
height = m_ViewerPreview-> getMaskParam(“Hign”);
width = m_ViewerPreview-> getMaskParam(“Width”);
xpos = m_ViewerPreview-> getMaskParam(“XPos”);
ypos = m_ViewerPreview-> getMaskParam(“YPos”);
}