/*
 * class VideoWriter
 *
 * $Date$
 * $Revision$
 *
 */

#ifndef VIDEO_WRITER_HH__
#define VIDEO_WRITER_HH__

#include "WImage/VideoFile.hh"

/** 
 * @addtogroup WImage 
 * @{ */

/**
 * An abstract video writer. The video is being written putting its content
 * from an array of greyscale video objects into the file. 
 */
/*abstract*/
class 
VideoWriter: public VideoFile
{
public:
  
  /** Constructor. Only calls the mother class' constructor to initialize
   * the {\em ImageArray} reference. 
   * @param name
   * the file name
   * @param arrays
   * the array of video arrays for the values 
   * @param colors
   * the number of colors */
  VideoWriter (char const *name, VideoArray < coeff > *arrays[], int colors)
    : VideoFile (name, arrays, colors, arrays[0]->frames ()) {}

  /** Destructor - does nothing. */
  virtual ~VideoWriter (void) {}

  /** Write the video . All steps independent of the file format will be 
   * performed, like testing for file writeability etc. 
   * @exception ios_base::failure
   * a read error has occured [not supported by all libraries, so eventually 
   * {\em invalid_argument} instead] */
  void write (void);

protected: 
  /** Write different file formats (abstract). This is the method to be 
   * implemented for every video file format. It will be called by the
   * {\em write ()} method. 
   * @return 
   * 0 if successful, -1 on write error. */
  virtual int writefmt (void) = 0;
  
}; /* class VideoWriter */

/** @} */

#endif /* VIDEO_WRITER_HH__ */
