function varargout = mplay(varargin)
%MPLAY View video from files, the MATLAB workspace, or Simulink signals.
%   MPLAY starts a GUI to view video and sequences of images.  You can use
%   multiple players to view multiple videos simultaneously.
%
%   MPLAY provides capabilities to view video coming from
%      - variables or expressions from the MATLAB workspace
%      - multimedia files available on the file system
%      - Simulink signals representing video data
%
%   Command line syntax
%   MPLAY starts a new instance of the MPlay GUI.
%
%   MPLAY('filename') connects MPlay directly to an AVI file.  The file is
%   read in one frame at a time, which conserves memory during playback.
%   Audio tracks are not supported.
%
%   MPLAY(A) imports the movie variable, A, into the MPlay GUI from the
%   MATLAB workspace.
%
%   Movie, A, may be one of the following formats.
%       - MATLAB movie structure
%       - Intensity movie array (M-by-N-by-T or M-by-N-by-1-by-T array,
%         where each image is M-by-N and there are T image frames)
%       - RGB movie array (M-by-N-by-3-by-T array, where each RGB image 
%         is M-by-N-by-3 and there are T image frames)
%
%   MPLAY(..., FPS) specifies the default frame rate, FPS, for the
%   video.  If omitted, FPS is set to 20 for variables or uses the frame
%   rate specified in the file.
%
%   MPLAY({line_handles}) specifies one or more Simulink signals to display.
%   line_handles can be obtained by calling "gsl", e.g.,
%   MPLAY({gsl}). Alternatively, MPLAY({'block',PORT}) will view the signal
%   output from 'block' on output port index PORT, e.g., MPLAY({gcb,1}). All
%   ports on the specified block are selected if PORT is omitted.
%
%   The MPlay GUI supports only real-valued, full arrays.  To improve
%   run-time performance, the GUI converts the input data to the uint8 data
%   type before displaying the values. However, this conversion does not
%   occur if you specified the data range using the Color Map dialog box.
%
%   Examples:
%   %--------
%   % #1 Play a video from a file
%   mplay('barcodes.avi');
%
%   % #2 Play a video created in MATLAB workspace
%   fig=figure;  % create a video
%   set(gca,'xlim',[-80 80],'ylim',[-80 80],...
%       'NextPlot','replace','Visible','off')
%   x = -pi:.1:pi;
%   radius = 0:length(x);
%   video = []; % initialize video variable
%   for i=length(x):-1:1
%     patch(sin(x)*radius(i),cos(x)*radius(i),[abs(cos(x(i))) 0 0]);
%     F = getframe(gca);
%     video = cat(4,video,F.cdata); % video is MxNx3xT
%   end
%   close(fig);
%   mplay(video); % display a video
%
%   % #3 Play a video from a Simulink signal
%   mplay({'vipmplaytut/Rotate'});
%
%   See also MOVIE, IMTOOL, MMREADER.

% Copyright 2004-2009 The MathWorks, Inc.
% $Revision: 1.1.6.1 $ $Date: 2010/08/30 02:55:08 $

mplaylinit;

hScopeCfg = scopeextensions.MPlayScopeCfg(varargin, uiservices.cacheFcnArgNames);
hMPlay = uiscopes.new(hScopeCfg);
if nargout > 0
    varargout = {hMPlay};
end

% [EOF]
