Home > chronux > fly_track > videoIO > videoIO_2006b > @videoReader > close.m

close

PURPOSE ^

VR=CLOSE(VR)

SYNOPSIS ^

function vr = close(vr)

DESCRIPTION ^

VR=CLOSE(VR)
  Closes video VR and releases any system resources necessary to access it
  (e.g. threads, file handles, etc.).  Do NOT just clear a videoReader
  object without first closing its handle:

    % BAD code--typically will leak system resources
    vr = videoReader(...);
    ...
    clear vr; % leaks resources

    % GOOD code
    vr = videoReader(...);
    vr = close(vr);
    clear vr; % okay, but not needed

  After calling CLOSE, VR should not be used any more.
    vr = videoReader(...);
    vr = close(vr);
    next(vr); % BAD
    vr = videoReader(...);
    close(vr); % BAD: should reassign result to vr to be safe
    next(vr); % BAD
  
SEE ALSO
  videoReader

Copyright (c) 2006 Gerald Dalley
See "MIT.txt" in the installation directory for licensing details (especially
when using this library on GNU/Linux).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vr = close(vr)
0002 %VR=CLOSE(VR)
0003 %  Closes video VR and releases any system resources necessary to access it
0004 %  (e.g. threads, file handles, etc.).  Do NOT just clear a videoReader
0005 %  object without first closing its handle:
0006 %
0007 %    % BAD code--typically will leak system resources
0008 %    vr = videoReader(...);
0009 %    ...
0010 %    clear vr; % leaks resources
0011 %
0012 %    % GOOD code
0013 %    vr = videoReader(...);
0014 %    vr = close(vr);
0015 %    clear vr; % okay, but not needed
0016 %
0017 %  After calling CLOSE, VR should not be used any more.
0018 %    vr = videoReader(...);
0019 %    vr = close(vr);
0020 %    next(vr); % BAD
0021 %    vr = videoReader(...);
0022 %    close(vr); % BAD: should reassign result to vr to be safe
0023 %    next(vr); % BAD
0024 %
0025 %SEE ALSO
0026 %  videoReader
0027 %
0028 %Copyright (c) 2006 Gerald Dalley
0029 %See "MIT.txt" in the installation directory for licensing details (especially
0030 %when using this library on GNU/Linux).
0031 
0032 feval(vr.plugin, 'close', vr.handle);
0033 vr.handle = nan;

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005