|
代码如上,枚举本地设备没有问题,能取到视频设备名称,取当前视频设备时,返回的名称为空。使用的开发工具为Delphi Xe2
- procedure TForm1.Button1Click(Sender: TObject);
- var
- DeviceName:Array[0..10] of PAnsiChar;
- DeviceNumongWord;
- i:Integer;
- szVideoDeviceName:Array[0..1023] of AnsiChar;
- n:Integer;
- dwLenWORD;
- begin
- ZeroMemory(@DeviceName,sizeof(DeviceName));
- DeviceNum:=10;
- if BRAC_EnumVideoCapture(@DeviceName,DeviceNum)=GV_ERR_SUCCESS then
- begin
- Self.ComboBox1.Items.Clear;
- for i := 0 to DeviceNum-1 do
- begin
- if Assigned(DeviceName) then
- begin
- Self.ComboBox1.Items.Add(StrPas(DeviceName));
- GlobalFree(HGLOBAL(DeviceName));
- DeviceName := nil;
- end;
- end;
- dwLen:=Sizeof(szVideoDeviceName);
- ZeroMemory(@szVideoDeviceName,dwLen);
- if BRAC_GetCurVideoCapture(szVideoDeviceName,dwLen)=GV_ERR_SUCCESS then
- begin
- n:=Self.ComboBox1.Items.IndexOf(StrPas(szVideoDeviceName));
- end;
- end;
- end;
附日志内容如下:
附日志内容
[2014-10-22 21:19:57(873)] ---------------------------AnyChat Platform Core SDK Client Log---------------------------
[2014-10-22 21:19:57(877)] Load BRAnyChatCore.dll success!(V5.1 Build Time:Sep 14 2014 19:25:01)
[2014-10-22 21:19:57(893)] Load BRMiscUtil.dll success!(V5.1 Build Time:Sep 14 2014 19:23:17)
[2014-10-22 21:19:58(233)] Load BRMediaUtil.dll success!(V5.1 Build Time:Sep 14 2014 19:23:24)
[2014-10-22 21:19:58(241)] Load BRMediaShow.dll success!(V5.1 Build Time:Sep 14 2014 19:23:22)
[2014-10-22 21:19:58(300)] Load BRMediaCore.dll success!(V5.1 Build Time:Sep 14 2014 19:23:40)
[2014-10-22 21:19:58(483)] Invoke BRAC_Connect(video2.913399.com,14001)=0
[2014-10-22 21:19:58(500)] Invoke LoginServer(username=10000)
[2014-10-22 21:19:58(505)] Invoke EnterRoom(roomid=1)
[2014-10-22 21:19:58(571)] CheckClientSocketLink Connect(ip=121.199.43.135,port=14001)
[2014-10-22 21:19:58(806)] Server version: V4.8(Build Time:2013-12-02 20:18:03, Server OS:Windows)
[2014-10-22 21:19:58(813)] Message OnConnect(bSuccess:1, errorcode=0)
[2014-10-22 21:19:59(101)] Message OnLoginSystem(userid=10000,errorcode=0,username=10000), msg deliver worked(1)
[2014-10-22 21:19:59(167)] Connection to streaming media server successfully!(udp delay:31ms)
[2014-10-22 21:19:59(190)] Message OnEnterRoom(roomid=1,errorcode=0,siteindex=0)
[2014-10-22 21:19:59(194)] Message OnReceiveOnlineUser(count=1,roomid=1)
[2014-10-22 21:19:59(593)] WaveIn Audio Capture Driver(麦克风 (Realtek High Definition)
[2014-10-22 21:19:59(600)] Audio Init, error:0, device:0, 1, 16000, 16, capmode:0
[2014-10-22 21:19:59(608)] Audio codec init, handle:1, 11, 1, 16000, 16, 15850
[2014-10-22 21:19:59(659)] Audio Playback Device Init(0, 1, 16000, 16), WaveOut Playback Driver
[2014-10-22 21:20:02(132)] Invoke BRAC_SetVideoPos(dwUserId:-1, hWnd:0x1d14b6, l:0, t:0, r:240, b:180)
[2014-10-22 21:20:02(139)] Invoke UserCameraControl(userid=-1,bOpen=-1)
[2014-10-22 21:20:03(383)] MinCroppingSize(640, 480) MaxCroppingSize(640, 480) Format(YUY2, 0x32595559)
[2014-10-22 21:20:03(390)] MinCroppingSize(640, 480) MaxCroppingSize(640, 480) Format(YUY2, 0x8d2681)
[2014-10-22 21:20:03(398)] MinCroppingSize(320, 240) MaxCroppingSize(320, 240) Format(YUY2, 0x32595559)
[2014-10-22 21:20:03(404)] MinCroppingSize(320, 240) MaxCroppingSize(320, 240) Format(YUY2, 0x8d2681)
[2014-10-22 21:20:03(410)] MinCroppingSize(176, 144) MaxCroppingSize(176, 144) Format(YUY2, 0x32595559)
[2014-10-22 21:20:03(419)] MinCroppingSize(176, 144) MaxCroppingSize(176, 144) Format(YUY2, 0x8d2681)
[2014-10-22 21:20:03(424)] MinCroppingSize(160, 120) MaxCroppingSize(160, 120) Format(YUY2, 0x32595559)
[2014-10-22 21:20:03(432)] MinCroppingSize(160, 120) MaxCroppingSize(160, 120) Format(YUY2, 0x8d2681)
[2014-10-22 21:20:03(437)] MinCroppingSize(640, 480) MaxCroppingSize(640, 480) Format(YUY2, 0x32595559)
[2014-10-22 21:20:03(444)] MinCroppingSize(640, 480) MaxCroppingSize(640, 480) Format(YUY2, 0x8d2681)
[2014-10-22 21:20:03(451)] Video Config Size(320, 240) Format(YUY2, 25fps)
[2014-10-22 21:20:03(552)] video init finish:320x240, YUY2, fps:25
[2014-10-22 21:20:05(425)] video codec init:codec:1, 15fps, 320x240, bitrate:60000, quality:3, preset:3, gop:60, handle:2 |
|
|