这是C程序:
**************************
int CEEoServerDlg::Init()
{
int
nRet = 0;
DWORD
i;
//
USHORT osdFormat1[] = {0,0, OSD_Year4, '-', OSD_Month2, '-', OSD_Day, ' ',
//OSD_Hour12, ':', OSD_Minute, ':', OSD_Second, ' ', 0};
//
USHORT osdFormat1[] = {0,0, 0, 0, 0, 0,0, 0,
//
0, 0, 0, 0,0, 0, 0};
USHORT osdFormat1[] = {0,0, 0};
USHORT osdFormat2[] = {0, 0, '0','0', '0', 0, '0', '0',0};
char
szChannel[20];
GetWindowRect(&m_rcParent);
if(!MTALoadLibrary(5000, WORK_AS_SERVER))
{
AfxMessageBox("To initialize net work sdk failed!");
}
else
{
if(!MTARegNotifier(&NetNotifierProc))
AfxMessageBox("To register net work notifier callback function failed!");
}
nRet = EEoInit();
if(nRet >= 0)
{
m_dwVideos = EEoGetTotalChannels();
if(m_dwVideos > 0)
{
DWORD
k = m_dwVideos;
int
nWidth, nHeight;
CRect rcClient;
EEoEnableOverlay(FALSE);
CreateButtons();
EEoSetVideoStandard(VS_PAL_BDGHI);//VS_NTSC
//
for(i=0; i<m_dwVideos; i++)
/*
EEoSetCaptureSize(0, 352, 288);
// EEoSetCaptureSize(352, 288);
EEoSetCaptureSize(1, 704, 576);
EEoSetCaptureSize(2, 704, 576);
EEoSetCaptureSize(3, 704, 576);*/
//
EEoSetCaptureSize(704, 576);
EEoSetVideoFormat(VF_YUY2);
m_VideoWnds = new CVideoWnd[m_dwVideos];
GetClientRect(&rcClient);
if(k>3)
k= (DWORD) sqrt((float)m_dwVideos);
if(k*k<m_dwVideos)
k= k+1;
nWidth = (rcClient.Width() - 200) / k;
nHeight= (rcClient.Height()- 50)
/ k;
EEoSetCaptureSize(/*704, 576*/352, 288);
for(i=0; i<m_dwVideos; i++)
{
rcClient.left
= 1 + nWidth*(i%k);
rcClient.top
= 1 + nHeight*(i/k);
rcClient.right = rcClient.left + nWidth - 1;
rcClient.bottom= rcClient.top + nHeight - 1;
m_VideoWnds[i].SetVideoIndex(i);
m_VideoWnds[i].Create(rcClient, this);
m_VideoWnds[i].GetClientRect(&rcClient);
//
EEoSetCaptureSize(i, 704, 576);
//
if(i % 4 == 1)
//
{
//
EEoSetCaptureSize(i, 640, 480);
//
osdFormat2[0] = 640 - 85;
//
osdFormat2[1] = 480 - 34;
//
}
//
else
{
osdFormat2[0] = 352 - 55;
osdFormat2[1] = 240 - 10;
}
wsprintf(szChannel, "%02d", i+1);
//osdFormat2[4] = szChannel[0];
//osdFormat2[5] = szChannel[1];
DWORD ki= EEoGetVideoSignal(i);
{
EEoSetFrameRate(i, 25);
EEoOpenChannel(i);
//
EEoAssignFrameRate();
EEoSetEncoderParam(i, 1024000, 25);
EEoStartVideoPreview(i, m_VideoWnds[i].GetSafeHwnd(),&rcClient);
}
//
else
{
//
EEoCloseChannel(i);
}
EEoSetupMotionDetection(i, 5, MotionAnalyzerProc, this);
//EEoSetOsdDisplayMode(i, RGB(255,255,255), /*(i%4 == 1) ? 32:*/50, osdFormat1, osdFormat2);
EEoSetOsdDisplayMode(i, 255, /*(i%4 == 1) ? 32:*/50, osdFormat1, osdFormat2);
EEoSetOsd(i, 1);
EEoRegisterVideoStreamCallback(i, VideoStreamProc);
EEoRegisterVideoRawDataCallback(i, VideoRawStreamProc);
//
EEoRegisterAudioStreamCallback(i, AudioStreamProc);
//
EEoStopVideoPreview(i);
((CButton*)GetDlgItem(IDC_CHK_PREVIEW+i))->SetCheck(TRUE);
}
m_VideoWnds[0].GetWindowRect(&m_rcLarge);
m_rcLarge.right = m_rcLarge.left + nWidth*k - 11;
m_rcLarge.bottom= m_rcLarge.top + nHeight*k - 11;
ScreenToClient(&m_rcLarge);
m_dwAudio= EEoGetAudioDevNum();
for(i= 0; i<m_dwAudio; i++)
{
EEoRegisterAudioStreamCallback(i, AudioStreamProc);
}
}
/*else
{
GetDlgItem(IDC_BTN_START_RECORD_ALL)->EnableWindow(FALSE);
GetDlgItem(IDC_BTN_STOP_RECORD_ALL)->EnableWindow(FALSE);
}*/
}
else
{
GetDlgItem(IDC_BTN_START_RECORD_ALL)->EnableWindow(FALSE);
GetDlgItem(IDC_BTN_STOP_RECORD_ALL)->EnableWindow(FALSE);
GetDlgItem(IDC_BTN_DEFAULT)->EnableWindow(FALSE);
m_sldBright.EnableWindow(FALSE);
m_sldContrast.EnableWindow(FALSE);
m_sldHue.EnableWindow(FALSE);
m_sldSaturation.EnableWindow(FALSE);
GetDlgItem(IDC_BTN_SNAP)->EnableWindow(FALSE);
GetDlgItem(IDC_CHK_MOTION_DETECT)->EnableWindow(FALSE);
GetDlgItem(IDC_CHK_OSD)->EnableWindow(FALSE);
}
//
EEoStartCaptureFile(0, "c:\\Videos\\0Video.avi");
//
CFCreate();
return nRet;
}
int
WINAPI EEoSetOsdDisplayMode(DWORD dwChannel, DWORD color, DWORD font_size, USHORT* Line1, USHORT* Line2);
*********************************
下面的是Delphi的函数定义:
TEEoSetOsdDisplayMode
= Function(dwChannel,color,font_size : longint; Line1 ,Line2 : PInteger) : integer;stdcall;
下面是Delphi源程序:
var
iRet,rTV1,rTV2,iCount,oCount : integer;
sSQL : string ;
fData1 : PWORD ;
fData2 : PWORD ;
begin
PSdk4000Func := GetProcAddress(FSdk4000Func,'EEoSetOsdDisplayMode') ;
if PSdk4000Func <> nil then begin
FunEEoSetOsdDisplayMode := TEEoSetOsdDisplayMode(PSdk4000Func);
GetMem(fData1,SizeOf(PWORD)*10) ;
fData1^ := 0 ;
INC(fData1,2)
;
fData1^ := 0 ;
INC(fData1,2) ;
fData1^ := 0 ;
//FreeMem(fData1) ;
//GetMem(fData2,SizeOf(WORD)*100) ;
GetMemory(SizeOf(fData2)*100);
fData2^ :=
0 ;
INC(fData2) ;
fData2^ := 0 ;
INC(fData2) ;
fData2^ := $BDF8 ;
INC(fData2) ;
fData2^ := $BDF8 ;
INC(fData2) ;
fData2^ := $BDF8 ;
INC(fData2) ;
fData2^ := $BDF8 ;
INC(fData2) ;
fData2^ := 0 ;
iRet := FunEEoSetOsdDisplayMode(iTV1,10,80,@fData1,@fData1) ;
FreeMem(fData1,SizeOf(WORD)*100) ;
FreeMem(fData2,SizeOf(WORD)*100) ;
end;
end;
*********************************************************
这个函数USHORT*在Delphi中如何对应?
帮忙看下我上面的定义错在哪里?
编译可以通过,运行出虚拟地址错误。