Home > chronux > fly_track > videoIO > videoIO_2007a > @videoWriter > close.m

close

PURPOSE ^

VW=CLOSE(VW)

SYNOPSIS ^

function vw = close(vw)

DESCRIPTION ^

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

    % BAD code--typically will leak system resources
    vw = videoWriter(...);
    ...
    clear vw; % leaks resources, probably results in a corrupted file

    % GOOD code
    vw = videoWriter(...);
    ...
    vw = close(vw);
    clear vw; % okay, but not needed

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

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

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