FrameCaptureContextFactory.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. namespace NRKernal.Record
  10. {
  11. using System.Collections.Generic;
  12. /// <summary> A frame capture context factory. </summary>
  13. public class FrameCaptureContextFactory
  14. {
  15. /// <summary> List of contexts. </summary>
  16. private static List<FrameCaptureContext> m_ContextList = new List<FrameCaptureContext>();
  17. /// <summary> Creates a new FrameCaptureContext. </summary>
  18. /// <returns> A FrameCaptureContext. </returns>
  19. public static FrameCaptureContext Create()
  20. {
  21. FrameCaptureContext context = new FrameCaptureContext();
  22. m_ContextList.Add(context);
  23. return context;
  24. }
  25. /// <summary> Dispose all context. </summary>
  26. public static void DisposeAllContext()
  27. {
  28. foreach (var item in m_ContextList)
  29. {
  30. if (item != null)
  31. {
  32. item.StopCapture();
  33. item.Release();
  34. }
  35. }
  36. }
  37. }
  38. }