#ifndef _VIDEO_OUT_HH_ #define _VIDEO_OUT_HH_ /*--------------------* *-- System Headers --* *--------------------*/ #include #include /*-------------------* *-- Local Headers --* *-------------------*/ #include "definitions.hh" #include "ErrorCodes.hh" #include "Image.hh" /*-------------------------------* *-- VideoOut Class Definition --* *-------------------------------*/ /** \class VideoOut * \brief VideoOut is a base class for any type of video output that will be * used with the XVision system. * * VideoOut provides an API that is similar to Unix device-independent I/O. * It allows the user to easily gain access to an Image and then display it * in any number of formats (including SDL live display and ImageSequenceOut). */ class VideoOut { public: /*-----------------* *-- Constructor --* *-----------------*/ /** \fn VideoOut::VideoOut (char* videoName) * \brief Constructs a VideoOut device with bookkeeping name videoName. * \param videoName The bookkeeping name of the VideoOut device. * \returns nothing */ VideoOut (char* videoName); /*----------------* *-- Destructor --* *----------------*/ /** \fn VideoOut::~VideoOut (void) * \brief Cleans up after a VideoOut device. * \param none * \returns nothing */ virtual ~VideoOut(); /*--------------------------------* *-- VideoOut Interface Methods --* *--------------------------------*/ /*----------------------------------------------------------------------* * The following are methods that do not have to be implemented for a * VideoOut derived class. They are merely provided in the event that * they may someday be useful. *-----------------------------------------------------------------------*/ /** \fn virtual ErrType VideoOut::read (Image* image) * \brief Reads a frame into image from the VideoOut device. This method * is here for API consistency and is not currently used. * \param image The Image* to read the frame into * \returns NOT_IMPLEMENTED: always returns this unless overridden to do * something else */ virtual ErrType read (Image* image); /** \fn virtual ErrType VideoOut::readDirect (Image* image) * \brief Reads a frame into image from the VideoOut device (see * VideoIn::readDirect). This method is here for API consistency and is * not currently used. * \param image The Image* to read the frame into * \returns NOT_IMPLEMENTED: always returns this unless overridden to do * something else */ virtual ErrType readDirect (Image* image); /** \fn virtual ErrType readAhead (void) * \brief I have no idea what this method might do. Only provided for API * consistency. * \param none * \returns NOT_IMPLEMENTED: always returns this unless overridden to do * something else */ virtual ErrType readAhead (void); /** \fn virtual ErrType seek (void) * \brief This method will skip around in a VideoOut stream, essentially * allowing random access to the VideoOut stream. However, this method * is not currently implemented and is only provided for API consistency. * \param none * \returns NOT_IMPLEMENTED: always returns this unless overridden to do * something else */ virtual ErrType seek (void); /*------------------------------------------------------------------------* * The following methods must be implemented in a VideoOut derived class. *------------------------------------------------------------------------*/ /** \fn virtual ErrType write (void) * \brief Writes out the currently held Image to whatever appropriate * device (depends on the derived implementation). * \param none * \returns SUCCESS: the write was successful
* ERROR: there was an error writing the frame */ virtual ErrType write (void); /*----------------------* *-- ACCESSOR METHODS --* *----------------------*/ /*----------------------------------------------------------------------* * Most of the get methods below do not need to be implemented in a * derived class since the default method provided in VideoOut will * suffice. However, they can be overridden to provide better control * of who is allowed access to the data members, etc. * ---------------------------------------------------------------------*/ /** \fn virtual ErrType name (char* newName) * \brief Sets the VideoOut device's bookkeeping name to newName. * \param newName The name to set the bookkeeping to * \returns SUCCESS: The bookkeeping name was successfully updated
* ERROR: There was an error updating the bookkeeping name */ virtual ErrType name (char* newName); /** \fn virtual char* name (void) * \brief Returns the VideoOut device's bookkeeping name. * \param none * \returns The VideoOut device's bookkeeping name */ virtual char* name (void); /** \fn virtual ErrType width (int newWidth) * \brief Sets the width of the current frame and all future frames to * newWidth. * \param newWidth The width to set the VideoOut device to * \returns SUCCESS: The width was successfully set to newWidth
* ERROR: There was an error setting the width to newWidth */ virtual ErrType width (int newWidth); /** \fn virtual ErrType width (void) * \brief Returns the current frame's width. * \param none * \returns The current frame's width */ virtual int width (void); /** \fn virtual ErrType height (int newHeight) * \brief Sets the height of the current frame and all future frames to * newHeight. * \param newHeight The height to set the VideoOut device to * \returns SUCCESS: The height was successfully set to newHeight
* ERROR: There was an error setting the height to newHeight */ virtual ErrType height (int newHeight); /** \fn virtual int height (void) * \brief Returns the current frame's height * \param none * \returns The current frame's height */ virtual int height (void); /** \fn virtual ErrType bitDepth (int newBitDepth) * \brief Sets the bits/pixel of the current frame and all future frames * to newBitDepth. * \param newBitDepth The bit depth to set the VideoOut device to * \returns SUCCESS: The bit depth was successfully set to newBitDepth
* ERROR: There was an error setting the bit depth to newBitDepth */ virtual ErrType bitDepth (int newBitDepth); /** \fn virtual int bitDepth (void) * \brief Returns the current frame's bit depth * \param none * \returns The current frame's bit depth */ virtual int bitDepth (void); /** \fn virtual ErrType byteDepth (int newByteDepth) * \brief Sets the bytes/pixel of the current frame and all future frames * to newByteDepth. * \param newByteDepth The bit depth to set the VideoOut device to * \returns SUCCESS: The byte depth was successfully set to newByteDepth
* ERROR: There was an error setting the byte depth to newByteDepth */ virtual ErrType byteDepth (int newByteDepth); /** \fn virtual int byteDepth (void) * \brief Returns the current frame's byte depth * \param none * \returns The current frame's byte depth */ virtual int byteDepth (void); /** \fn virtual ErrType image (Image* newImage) * \brief Sets image_ to newImage. * \param newImage The Image* to set image_ to * \returns SUCCESS: image_ was successfully set to newImage
* ERROR: There was an error setting image_ to newImage */ virtual ErrType image (Image* newImage); /** \fn virtual Image* image (void) * \brief Returns image_. * \params none * \returns image_ */ virtual Image* image (void); protected: /** This VideoOut device's bookkeeping name */ char* name_; /** The current frame */ Image* image_; /** The size of the frame in bytes (width_*height_*bytesPerPixel_) */ long size_; /** The width of the frame */ int width_; /** The height of the frame */ int height_; /** The number of bits/pixel in the frame */ int bitsPerPixel_; /** bitsPerPixel_/8 */ int bytesPerPixel_; /** The current frame number */ int frame_; }; #endif /* _VIDEO_OUT_HH_ */