VideoHandle.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using bbiwarg.InputProviders;
  7. namespace bbiwarg
  8. {
  9. class VideoHandle
  10. {
  11. private IInputProvider inputProvider;
  12. private InputFrame inputFrame;
  13. private DepthImage depthImage;
  14. public VideoHandle(IInputProvider inputProvider) {
  15. this.inputProvider = inputProvider;
  16. inputProvider.init();
  17. inputProvider.start();
  18. inputProvider.updateFrame();
  19. inputFrame = inputProvider.getInputFrame();
  20. depthImage = inputFrame.getDepthImage();
  21. }
  22. public void nextFrame()
  23. {
  24. if (inputProvider.isActive())
  25. {
  26. inputProvider.releaseFrame();
  27. inputProvider.updateFrame();
  28. inputFrame = inputProvider.getInputFrame();
  29. depthImage = inputFrame.getDepthImage();
  30. }
  31. else
  32. {
  33. inputProvider.stop();
  34. }
  35. }
  36. public int getWidth()
  37. {
  38. return inputFrame.getWidth();
  39. }
  40. public int getHeight()
  41. {
  42. return inputFrame.getHeight();
  43. }
  44. public DepthImage getDepthImage() {
  45. return depthImage;
  46. }
  47. }
  48. }