GCGlib  0.04.228
GCG Graphics Engine
gcgVIDEOFILE Class Reference

Class for decode frames from a video file. More...

#include <gcg.h>

Inheritance diagram for gcgVIDEOFILE:
gcgVIDEO gcgCLASS

Public Member Functions

 gcgVIDEOFILE ()
 Constructs a valid video file reader. The decodification actually starts with a call to openVideoFile(). More...
 
virtual ~gcgVIDEOFILE ()
 Releases all video file resources by calling destroyVideo(). More...
 
virtual bool destroyVideo ()
 Releases all resources of this video file object. More...
 
virtual bool openVideoFile (const char *filename)
 Opens the video file and makes it ready to be decoded. Initially points to the first frame in the video. More...
 
virtual long getFrameCount ()
 Returns the total number of frames in the video file. More...
 
virtual long getCurrentPosition ()
 Gets the current video position, i.e., the current frame number that can be read by a call to copyFrame(). If the last frame was read by a previous call to copyFrame(), it reports a warning (0x1E06A) and returns a negative value. Use setCurrentPosition() to get a valid position. More...
 
virtual bool setCurrentPosition (long newposition)
 Sets the current video position, i.e., points to the indicated frame number. More...
 
virtual bool copyFrame (gcgIMAGE *dstimg)
 Copies the current frame to a gcgIMAGE object. If successful, it automatically points to the next frame. If the last frame was already read, it reports a warning (0x1E06A) and returns false. Use setCurrentPosition() to read a valid frame. More...
 
- Public Member Functions inherited from gcgVIDEO
 gcgVIDEO ()
 Constructs a valid but empty image. The image can be used as destiny image in any gcgIMAGE method or GCGlib function. More...
 
virtual ~gcgVIDEO ()
 Releases all video resources by deleting the video handler. More...
 
- Public Member Functions inherited from gcgCLASS
void * operator new (size_t size)
 Defines a new operator to be used by instatiations of GCGlib classes instead the global one. More...
 
void * operator new (size_t size, const std::nothrow_t &) throw ()
 Defines a new operator to be used by instantiations of GCGlib classes instead the global one. Returns a NULL pointer instead of throwing an exception if an error occurs. More...
 
void * operator new[] (size_t size)
 Defines a new operator to be used by GCGlib array allocations instead the global one. More...
 
void * operator new[] (size_t size, const std::nothrow_t &) throw ()
 Defines a new operator to be used by vector allocations instead the global one. More...
 
void operator delete (void *p)
 Defines a delete operator to free instances of GCGlib classes instead the global one. It is designed to match the new operator. More...
 
void operator delete (void *p, const std::nothrow_t &) throw ()
 Defines a delete operator to free instances of GCGlib classes instead the global one. It is designed to match the new operator. More...
 
void operator delete[] (void *p)
 Defines a delete operator to free instances of arrays for GCGlib classes instead the global one. It is designed to match the new[] operator. More...
 
void operator delete[] (void *p, const std::nothrow_t &) throw ()
 Defines a delete operator to free instances of arrays for GCGlib classes instead the global one. It is designed to match the new[] operator. More...
 

Detailed Description

Class for decode frames from a video file.

The gcgVIDEOFILE class is the main interface of GCGlib with video files. It uses platform specific objects and APIs. The frame decoding is assynchronous using frame indices. The video frames are provided by gcgIMAGE objects. Do not change any attributes unless you are absolutely sure about you are doing.

Since
0.01.6

Constructor & Destructor Documentation

◆ gcgVIDEOFILE()

gcgVIDEOFILE::gcgVIDEOFILE ( )

Constructs a valid video file reader. The decodification actually starts with a call to openVideoFile().

See also
openVideoFile()
~gcgVIDEOFILE()

◆ ~gcgVIDEOFILE()

virtual gcgVIDEOFILE::~gcgVIDEOFILE ( )
virtual

Releases all video file resources by calling destroyVideo().

See also
destroyVideo()
gcgVIDEOFILE()

Member Function Documentation

◆ copyFrame()

virtual bool gcgVIDEOFILE::copyFrame ( gcgIMAGE dstimg)
virtual

Copies the current frame to a gcgIMAGE object. If successful, it automatically points to the next frame. If the last frame was already read, it reports a warning (0x1E06A) and returns false. Use setCurrentPosition() to read a valid frame.

Parameters
dstimgA pointer to the gcgIMAGE object to which the current frame is to be copied. If NULL, an error is reported.
Returns
true if the frame was copied. If it returns false, it reached the end of video, reporting a warning (0x1E06A), or an error occurred. Check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
getFrameCount();
getCurrentPosition()
setCurrentPosition()

◆ destroyVideo()

virtual bool gcgVIDEOFILE::destroyVideo ( )
virtual

Releases all resources of this video file object.

Returns
true if the resources were released. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
gcgVIDEOFILE()
~gcgVIDEOFILE()

◆ getCurrentPosition()

virtual long gcgVIDEOFILE::getCurrentPosition ( )
virtual

Gets the current video position, i.e., the current frame number that can be read by a call to copyFrame(). If the last frame was read by a previous call to copyFrame(), it reports a warning (0x1E06A) and returns a negative value. Use setCurrentPosition() to get a valid position.

Returns
The current frame number. If an error occurred or the end of video was reached by a call to copyFrame(), reporting a warning (0x1E06A), it returns a negative value. Check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
getFrameCount();
setCurrentPosition()
copyFrame()

◆ getFrameCount()

virtual long gcgVIDEOFILE::getFrameCount ( )
virtual

Returns the total number of frames in the video file.

Returns
The number of frames in the video file or zero/negative value if an error occurred. In case of failure, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
openVideoFile();
copyFrame()
setCurrentPosition()
getCurrentPosition()

◆ openVideoFile()

virtual bool gcgVIDEOFILE::openVideoFile ( const char *  filename)
virtual

Opens the video file and makes it ready to be decoded. Initially points to the first frame in the video.

Parameters
filenameVideo file name.
Returns
true if the video file was successfully opened. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
getFrameCount();
copyFrame()
setCurrentPosition()
getCurrentPosition()

◆ setCurrentPosition()

virtual bool gcgVIDEOFILE::setCurrentPosition ( long  newposition)
virtual

Sets the current video position, i.e., points to the indicated frame number.

Parameters
newpositionFrame number to be positioned to. It must be in the interval [0, getFrameCount() - 1] otherwise an error is reported.
Returns
true if it was correctly positioned in the frame. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
getFrameCount();
getCurrentPosition()
copyFrame()

The documentation for this class was generated from the following file: