close.m 976 B

123456789101112131415161718192021222324252627282930313233
  1. function vr = close(vr)
  2. %VR=CLOSE(VR)
  3. % Closes video VR and releases any system resources necessary to access it
  4. % (e.g. threads, file handles, etc.). Do NOT just clear a videoReader
  5. % object without first closing its handle:
  6. %
  7. % % BAD code--typically will leak system resources
  8. % vr = videoReader(...);
  9. % ...
  10. % clear vr; % leaks resources
  11. %
  12. % % GOOD code
  13. % vr = videoReader(...);
  14. % vr = close(vr);
  15. % clear vr; % okay, but not needed
  16. %
  17. % After calling CLOSE, VR should not be used any more.
  18. % vr = videoReader(...);
  19. % vr = close(vr);
  20. % next(vr); % BAD
  21. % vr = videoReader(...);
  22. % close(vr); % BAD: should reassign result to vr to be safe
  23. % next(vr); % BAD
  24. %
  25. %SEE ALSO
  26. % videoReader
  27. %
  28. %Copyright (c) 2006 Gerald Dalley
  29. %See "MIT.txt" in the installation directory for licensing details (especially
  30. %when using this library on GNU/Linux).
  31. feval(vr.plugin, 'close', vr.handle);
  32. vr.handle = nan;