As a result of the small series of audio and video solutions used in br_chat for video conferencing system development, so here also with the environment and processing mechanism to do a simple introduction.
1, br_ chat-enumeration of local video capture devices-method Overview:
dword brac_enumvideocapture (tchar** Lpdevicename, Dword&
dwdevicenum);
functions: Enumerate local video capture devices
return value: 0 for success, otherwise error code
parameter:
lpdevicename
Video device name, Can be empty, which means only the number of devices;
Dwdevicenum
Number of video devices;
Note:
This method will allocate buffers internally, after the external use is completed, it is necessary to manually release these buffers, otherwise it will cause memory leaks, because the internal use of "GlobalAlloc" to allocate high-end memory, so the external need to call " GlobalFree "to release, not a delete or free method, please refer to br_ Chat SDK in the source code of the Demo program, SDK/SRC directory.
2. Call the implementation code:
- int idevicecount =-1;
- Intptr[] Lpdeviceptrs;
- Enumerate all of the system's video devices
- int ret = Anychatcoresdk.enumvideocapture (null, ref idevicecount);
- if (ret! = 0 | | idevicecount = = 0)
- Return
- Lpdeviceptrs = new Intptr[idevicecount];
- ret = Anychatcoresdk.enumvideocapture (lpdeviceptrs, ref idevicecount);
- CbxCamera.Items.Clear ();
- foreach (IntPtr p in lpdeviceptrs)
- {
- string device = Marshal.ptrtostringansi (p); If it is a Unicode version, you need to use: Marshal.ptrtostringuni (P);
- if (string. IsNullOrEmpty (device) = = False)
- {
- Cbxcamera.text = device;
- CBXCAMERA.ITEMS.ADD (device);
- }
- }
- Get the current video capture device
- StringBuilder sb = new StringBuilder (1024);
- Anychatcoresdk.getcurvideocapture (SB, sb.) capacity);
- if (string. IsNullOrEmpty (sb.) ToString ()) = = False)
- Cbxcamera.text = sb. ToString ();
- else if (CbxCamera.Items.Count > 0)
- Cbxcamera.text = Cbxcamera.items[0]. ToString ();
Video development Technology Video device Enumeration C #