Video development Technology Video device Enumeration C #

Source: Internet
Author: User

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:

  1. int idevicecount =-1;
  2. Intptr[] Lpdeviceptrs;

  3. Enumerate all of the system's video devices
  4. int ret = Anychatcoresdk.enumvideocapture (null, ref idevicecount);
  5. if (ret! = 0 | | idevicecount = = 0)
  6. Return
  7. Lpdeviceptrs = new Intptr[idevicecount];
  8. ret = Anychatcoresdk.enumvideocapture (lpdeviceptrs, ref idevicecount);

  9. CbxCamera.Items.Clear ();
  10. foreach (IntPtr p in lpdeviceptrs)
  11. {
  12. string device = Marshal.ptrtostringansi (p); If it is a Unicode version, you need to use: Marshal.ptrtostringuni (P);
  13. if (string. IsNullOrEmpty (device) = = False)
  14. {
  15. Cbxcamera.text = device;
  16. CBXCAMERA.ITEMS.ADD (device);
  17. }
  18. }

  19. Get the current video capture device
  20. StringBuilder sb = new StringBuilder (1024);
  21. Anychatcoresdk.getcurvideocapture (SB, sb.) capacity);
  22. if (string. IsNullOrEmpty (sb.) ToString ()) = = False)
  23. Cbxcamera.text = sb. ToString ();
  24. else if (CbxCamera.Items.Count > 0)
  25. Cbxcamera.text = Cbxcamera.items[0]. ToString ();

Video development Technology Video device Enumeration C #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.