Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

vetCodec_MPEG Class Reference

Inheritance diagram for vetCodec_MPEG:

vetCodec vetInput vetOutput vetObject

Public Member Functions

 vetCodec_MPEG (vetCodec_MPEGParameters *initParams=NULL)
 Default constructor, initialize parameters and superclasses.
 vetCodec_MPEG (char *filename, int stream=0)
 Initialize parameters and load given quicktime movie.
 ~vetCodec_MPEG ()
 Default destructor, close file and free buffer.
VETRESULT save ()
 MPEG encoding is not implemented in libmpeg3.
VETRESULT save (char *filename, int stream=0)
 Save current movie to file.
VETRESULT load ()
 Load movie from current filename, use SetFileName() or load(char*, int).
VETRESULT load (char *filename, int stream=0)
 Load a BMP format image into current buffer (vetFrameRGB).
VETRESULT setParameters (vetCodec_MPEGParameters *initParams)
 Set parameters for (de)coding.
vetCodec_MPEGParametersgetParameters ()
 Get parameters for (de)coding.
VETRESULT setFilterParameters (vetFilterParameters *initParams)
vetFilterParametersgetFilterParameters ()
VETRESULT reset ()
 Reset filename and movie related settings.
bool EoF ()
 Get the state of current data source.
bool eof (int stream=-1) const
 Test for end of file.
VETRESULT setFrameIndex (long index, int stream=-1)
 Seek to point in stream (position in the video timeline).
VETRESULT goToPreviousFrame (int stream=-1)
 Move frame index to previous frame.
VETRESULT goToVideoEnd (int stream=-1)
 Move video frame index to end (last frame).
VETRESULT goToAudioEnd (int stream=-1)
 Move audio sample index to end (last frame).
double getLastPacketTime ()
unsigned int getWidth () const
 Read current frame index (position in the video timeline).Read current sample index (position in the audio timeline).read current image's width.
unsigned int getHeight () const
 read current image's height.
int getColorModel (int stream=-1)
 read color model for selected stream.
bool hasVideo ()
 check if loaded movie has a video stream.
int getVideoStreamCount ()
 get movie's video streams count.
float getVideoFrameRate (int stream=-1)
 get movie's video frame rate.
long getVideoStreamLength (int stream=-1)
 get movie's video frame count.
bool hasAudio ()
 get movie's audio streams count.
int getAudioStreamCount ()
 get movie's audio streams count.
int getAudioChannels (int stream=-1)
 get movie's audio channel count for selected stream.
float getAudioSampleRate (int stream=-1)
 get movie's audio sample rate for selected stream.
long getAudioStreamLength (int stream=-1)
 get movie's audio sample count for selected stream.
VETRESULT setHeight (unsigned int value)
 Set current canvas' height.
VETRESULT setWidth (unsigned int value)
 Set current canvas' width.
VETRESULT extractTo (vetFrameYUV420 &img)
 Load current frame data into image (parameter), increments frame index.
VETRESULT extractTo (vetFrameRGB24 &img)
 Load current frame data into image (parameter), increments frame index.
VETRESULT extractTo (vetFrameT< unsigned char > &img)
 Load current frame data into image (parameter), increments frame index.
VETRESULT importFrom (vetFrameYUV420 &img)
 Load movie from current filename, use SetFileName() or load(char*, int).
VETRESULT importFrom (vetFrameRGB24 &img)
 Load movie from current filename, use SetFileName() or load(char*, int).
VETRESULT importFrom (vetFrameT< unsigned char > &img)
 Load movie from current filename, use SetFileName() or load(char*, int).
bool isEncodingAvailable ()
 Input operator, import standard VETLib frame formats, current implementation calls directly importFrom() method.Ouput operator, export to standard VETLib frame formats, current implementation calls directly extractTo() method and if framerate isn't zero waits untill clock is syncronized, if elaboration time is greater than sleeptime, no delay is applied.
bool isDecodingAvailable ()
 Check ability to decode data.

Static Public Member Functions

static int getMPEG3_Version_major ()
static int getMPEG3_Version_minor ()
static int getMPEG3_Version_release ()

Protected Attributes

vetCodec_MPEGParametersmyParams
 Current parameters.
mpeg3_t * file
 MPEG file handle.
unsigned char ** buff
 decoded data buffer. Buffer for decoded data
char * Y
 decoded YUV Y data buffer.
char * U
 decoded YUV U data buffer.
char * V
 decoded YUV V data buffer.
unsigned int width
 movie's width.
unsigned int height
 movie's height.

Detailed Description

Definition at line 158 of file vetCodec_MPEG.h.


Constructor & Destructor Documentation

vetCodec_MPEG::vetCodec_MPEG vetCodec_MPEGParameters initParams = NULL  ) 
 

Default constructor, initialize parameters and superclasses.

Parameters:
[in] initParams parameters for this module or NULL for defaults.

Definition at line 48 of file vetCodec_MPEG.cpp.

References buff, DEBUGMSG, file, reset(), and setParameters().

vetCodec_MPEG::vetCodec_MPEG char *  filename,
int  stream = 0
 

Initialize parameters and load given quicktime movie.

Parameters:
[in] filename a valid MOV movie filename
[in] stream video stream to load (default is first: 0)

Definition at line 28 of file vetCodec_MPEG.cpp.

References buff, DEBUGMSG, file, load(), reset(), and setParameters().


Member Function Documentation

bool vetCodec_MPEG::eof int  stream = -1  )  const
 

Test for end of file.

Returns:
true if frame index is last frame, false else.

Definition at line 665 of file vetCodec_MPEG.cpp.

References file, myParams, and vetCodec_MPEGParameters::stream.

bool vetCodec_MPEG::EoF  )  [virtual]
 

Get the state of current data source.

Returns:
true is there are no more frames to load, false else.

Implements vetCodec.

Definition at line 137 of file vetCodec_MPEG.cpp.

References file.

VETRESULT vetCodec_MPEG::extractTo vetFrameT< unsigned char > &  img  )  [virtual]
 

Load current frame data into image (parameter), increments frame index.

Parameters:
[out] img Greyscale VETLib Frame to store data.
Returns:
VETRET_OK if everything is fine, VETRET_PARAM_ERR if frame is not valid, VETRET_INTERNAL_ERR or VETRET_ILLEGAL_USE else.
Note:
Ouput operator (>>) call directly this function.
See also:
operator >> (vetFrameT&)

Implements vetCodec.

Definition at line 235 of file vetCodec_MPEG.cpp.

References DEBUGMSG, and VETRET_NOT_IMPLEMENTED.

VETRESULT vetCodec_MPEG::extractTo vetFrameRGB24 img  )  [virtual]
 

Load current frame data into image (parameter), increments frame index.

Parameters:
[out] img VETLib Cache24 Frame to store data.
Returns:
VETRET_OK if everything is fine, VETRET_PARAM_ERR if frame is not valid, VETRET_INTERNAL_ERR or VETRET_ILLEGAL_USE else.
Note:
Ouput operator (>>) call directly this function.
See also:
operator >> (vetFrameRGB24&)

Implements vetCodec.

Definition at line 197 of file vetCodec_MPEG.cpp.

References buff, vetUtility::conv_rgb24_rgb96(), vetFrameRGB24::data, DEBUGMSG, file, vetFrame::height, height, vetFrameRGB24::reAllocCanvas(), VETRET_ILLEGAL_USE, VETRET_OK, vetFrame::width, and width.

VETRESULT vetCodec_MPEG::extractTo vetFrameYUV420 img  )  [virtual]
 

Load current frame data into image (parameter), increments frame index.

Parameters:
[out] img VETLib Cache Frame to store data.
Returns:
VETRET_OK if everything is fine, VETRET_PARAM_ERR if frame is not valid, VETRET_INTERNAL_ERR or VETRET_ILLEGAL_USE else.
Note:
Ouput operator (>>) call directly this function.
See also:
operator >> (vetFrameYUV420&)

Implements vetCodec.

Definition at line 158 of file vetCodec_MPEG.cpp.

References DEBUGMSG, file, vetFrame::height, height, vetFrameYUV420::reAllocCanvas(), vetFrameYUV420::U, vetFrameYUV420::V, VETRET_ILLEGAL_USE, VETRET_NOT_IMPLEMENTED, vetFrame::width, width, and vetFrameYUV420::Y.

int vetCodec_MPEG::getAudioChannels int  stream = -1  ) 
 

get movie's audio channel count for selected stream.

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
number of audio channels.

Definition at line 583 of file vetCodec_MPEG.cpp.

References file, getAudioStreamCount(), hasAudio(), myParams, and vetCodec_MPEGParameters::stream.

float vetCodec_MPEG::getAudioSampleRate int  stream = -1  ) 
 

get movie's audio sample rate for selected stream.

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
number of sample per second.

Definition at line 564 of file vetCodec_MPEG.cpp.

References file, getAudioStreamCount(), hasAudio(), myParams, and vetCodec_MPEGParameters::stream.

int vetCodec_MPEG::getAudioStreamCount  ) 
 

get movie's audio streams count.

Returns:
number of audio streams.

Definition at line 510 of file vetCodec_MPEG.cpp.

References file.

Referenced by getAudioChannels(), getAudioSampleRate(), getAudioStreamLength(), and goToAudioEnd().

long vetCodec_MPEG::getAudioStreamLength int  stream = -1  )  [virtual]
 

get movie's audio sample count for selected stream.

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
number of sample.

Implements vetCodec.

Definition at line 526 of file vetCodec_MPEG.cpp.

References file, getAudioStreamCount(), hasAudio(), myParams, and vetCodec_MPEGParameters::stream.

int vetCodec_MPEG::getColorModel int  stream = -1  ) 
 

read color model for selected stream.

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
Color Model.

Definition at line 621 of file vetCodec_MPEG.cpp.

References file, getVideoStreamCount(), and hasVideo().

unsigned int vetCodec_MPEG::getHeight  )  const [inline, virtual]
 

read current image's height.

Returns:
Height in pixel.

Implements vetInput.

Definition at line 390 of file vetCodec_MPEG.h.

References height.

vetCodec_MPEGParameters& vetCodec_MPEG::getParameters  )  [inline]
 

Get parameters for (de)coding.

Returns:
pointer to vetCodec_MPEGParameters instance.

Definition at line 273 of file vetCodec_MPEG.h.

References myParams.

float vetCodec_MPEG::getVideoFrameRate int  stream = -1  ) 
 

get movie's video frame rate.

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
number of frame per second.

Definition at line 602 of file vetCodec_MPEG.cpp.

References file, getVideoStreamCount(), hasVideo(), myParams, and vetCodec_MPEGParameters::stream.

int vetCodec_MPEG::getVideoStreamCount  ) 
 

get movie's video streams count.

Returns:
number of video streams.

Definition at line 481 of file vetCodec_MPEG.cpp.

References file.

Referenced by getColorModel(), getVideoFrameRate(), getVideoStreamLength(), goToPreviousFrame(), goToVideoEnd(), and setFrameIndex().

long vetCodec_MPEG::getVideoStreamLength int  stream = -1  )  [virtual]
 

get movie's video frame count.

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
number of frames in the stream.

Implements vetCodec.

Definition at line 545 of file vetCodec_MPEG.cpp.

References file, getVideoStreamCount(), hasVideo(), myParams, and vetCodec_MPEGParameters::stream.

unsigned int vetCodec_MPEG::getWidth  )  const [inline, virtual]
 

Read current frame index (position in the video timeline).Read current sample index (position in the audio timeline).read current image's width.

Returns:
Width in pixel.

Implements vetInput.

Definition at line 383 of file vetCodec_MPEG.h.

References width.

VETRESULT vetCodec_MPEG::goToAudioEnd int  stream = -1  ) 
 

Move audio sample index to end (last frame).

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
VETRET_OK if everything is fine, VETRET_ILLEGAL_USE is stream hasn't been loaded.

Definition at line 435 of file vetCodec_MPEG.cpp.

References file, getAudioStreamCount(), myParams, vetCodec_MPEGParameters::stream, VETRET_ILLEGAL_USE, and VETRET_PARAM_ERR.

VETRESULT vetCodec_MPEG::goToPreviousFrame int  stream = -1  ) 
 

Move frame index to previous frame.

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
VETRET_OK if everything is fine, VETRET_ILLEGAL_USE is stream hasn't been loaded.

Definition at line 389 of file vetCodec_MPEG.cpp.

References file, getVideoStreamCount(), myParams, vetCodec_MPEGParameters::stream, VETRET_ILLEGAL_USE, and VETRET_PARAM_ERR.

VETRESULT vetCodec_MPEG::goToVideoEnd int  stream = -1  ) 
 

Move video frame index to end (last frame).

Parameters:
[in] stream select stream index. default is -1: current active stream.
Returns:
VETRET_OK if everything is fine, VETRET_ILLEGAL_USE is stream hasn't been loaded.

Definition at line 412 of file vetCodec_MPEG.cpp.

References file, getVideoStreamCount(), myParams, vetCodec_MPEGParameters::stream, VETRET_ILLEGAL_USE, and VETRET_PARAM_ERR.

bool vetCodec_MPEG::hasAudio  ) 
 

get movie's audio streams count.

Returns:
number of audio streams.

Definition at line 494 of file vetCodec_MPEG.cpp.

References file.

Referenced by getAudioChannels(), getAudioSampleRate(), and getAudioStreamLength().

bool vetCodec_MPEG::hasVideo  ) 
 

check if loaded movie has a video stream.

Returns:
true if there is at least one video stream, false else.

Definition at line 465 of file vetCodec_MPEG.cpp.

References file.

Referenced by getColorModel(), getVideoFrameRate(), getVideoStreamLength(), and setFrameIndex().

VETRESULT vetCodec_MPEG::importFrom vetFrameT< unsigned char > &  img  )  [virtual]
 

Load movie from current filename, use SetFileName() or load(char*, int).

Returns:
VETRET_ILLEGAL_USE if file is not correctly loaded, VETRET_OK else.

Implements vetCodec.

Definition at line 304 of file vetCodec_MPEG.cpp.

References DEBUGMSG, and VETRET_NOT_IMPLEMENTED.

VETRESULT vetCodec_MPEG::importFrom vetFrameRGB24 img  )  [virtual]
 

Load movie from current filename, use SetFileName() or load(char*, int).

Returns:
VETRET_ILLEGAL_USE if file is not correctly loaded, VETRET_OK else.

Implements vetCodec.

Definition at line 284 of file vetCodec_MPEG.cpp.

References DEBUGMSG, and VETRET_NOT_IMPLEMENTED.

VETRESULT vetCodec_MPEG::importFrom vetFrameYUV420 img  )  [virtual]
 

Load movie from current filename, use SetFileName() or load(char*, int).

Returns:
VETRET_ILLEGAL_USE if file is not correctly loaded, VETRET_OK else.

Implements vetCodec.

Definition at line 264 of file vetCodec_MPEG.cpp.

References DEBUGMSG, and VETRET_NOT_IMPLEMENTED.

bool vetCodec_MPEG::isDecodingAvailable  )  [inline, virtual]
 

Check ability to decode data.

Returns:
true is class is able to decode video data, flase else.

Implements vetCodec.

Definition at line 626 of file vetCodec_MPEG.h.

bool vetCodec_MPEG::isEncodingAvailable  )  [inline, virtual]
 

Input operator, import standard VETLib frame formats, current implementation calls directly importFrom() method.Ouput operator, export to standard VETLib frame formats, current implementation calls directly extractTo() method and if framerate isn't zero waits untill clock is syncronized, if elaboration time is greater than sleeptime, no delay is applied.

Parameters:
[out] img VETLib Cache Frame to store data.
Returns:
Address of current instance.
See also:
importFrom(vetFrameYUV420&)

vetsleep()

setElaborationStart()

getElaborationTime()

Implements vetCodec.

Definition at line 625 of file vetCodec_MPEG.h.

VETRESULT vetCodec_MPEG::load char *  filename,
int  stream = 0
[virtual]
 

Load a BMP format image into current buffer (vetFrameRGB).

Parameters:
[in] filename a valid MPEG1-2 movie filename
[in] stream video stream to load (default is first: 0)
Returns:
VETRET_ILLEGAL_USE if file is not correctly loaded, VETRET_OK else.

Implements vetCodec.

Definition at line 368 of file vetCodec_MPEG.cpp.

References DEBUGMSG, load(), myParams, vetCodec_MPEGParameters::setFileName(), and vetCodec_MPEGParameters::setStream().

VETRESULT vetCodec_MPEG::load  ) 
 

Load movie from current filename, use SetFileName() or load(char*, int).

Returns:
VETRET_ILLEGAL_USE if file is not correctly loaded, VETRET_OK else.

Definition at line 321 of file vetCodec_MPEG.cpp.

References buff, file, vetCodec_MPEGParameters::fileName, height, INFO, myParams, vetCodec_MPEGParameters::stream, U, V, VETRET_ILLEGAL_USE, VETRET_OK, width, and Y.

Referenced by load(), and vetCodec_MPEG().

VETRESULT vetCodec_MPEG::reset  )  [virtual]
 

Reset filename and movie related settings.

Returns:
VETRET_OK

Implements vetCodec.

Definition at line 64 of file vetCodec_MPEG.cpp.

References buff, file, height, INFO, myParams, vetCodec_MPEGParameters::reset(), vetObject::setDescription(), vetObject::setName(), vetObject::setVersion(), VETRET_OK, and width.

Referenced by vetCodec_MPEG().

VETRESULT vetCodec_MPEG::save char *  filename,
int  stream = 0
[inline, virtual]
 

Save current movie to file.

Parameters:
[in] filenameoutput movie filename
[in] stream video stream to load (default is first: 0)
Returns:
VETRET_ILLEGAL_USE if file is not correctly loaded, VETRET_OK else.

Implements vetCodec.

Definition at line 234 of file vetCodec_MPEG.h.

References VETRET_NOT_IMPLEMENTED.

VETRESULT vetCodec_MPEG::save  )  [inline]
 

MPEG encoding is not implemented in libmpeg3.

Returns:
VETRET_NOT_IMPLEMENTED.

Definition at line 233 of file vetCodec_MPEG.h.

References VETRET_NOT_IMPLEMENTED.

VETRESULT vetCodec_MPEG::setFrameIndex long  index,
int  stream = -1
 

Seek to point in stream (position in the video timeline).

Parameters:
[in] index position to set, number of frame offset [0, framesCount[
[in] stream select stream index. default is -1: current active stream.
Returns:
VETRET_OK if everything is fine, VETRET_PARAM_ERR if index or stream are not valid, VETRET_ILLEGAL_USE if stream hasn't been loaded.

Definition at line 644 of file vetCodec_MPEG.cpp.

References file, getVideoStreamCount(), hasVideo(), myParams, vetCodec_MPEGParameters::setFrameIndex(), vetCodec_MPEGParameters::stream, and VETRET_ILLEGAL_USE.

VETRESULT vetCodec_MPEG::setHeight unsigned int  value  )  [inline, virtual]
 

Set current canvas' height.

Returns:
height in pixel.

Implements vetOutput.

Definition at line 492 of file vetCodec_MPEG.h.

References height, and VETRET_OK.

VETRESULT vetCodec_MPEG::setParameters vetCodec_MPEGParameters initParams  ) 
 

Set parameters for (de)coding.

Parameters:
[in] initParams Instance of vetCodec_MPEGParameters or NULL, NULL argument make function to create a new instance with default parameters.
Returns:
VETRET_OK

Definition at line 107 of file vetCodec_MPEG.cpp.

References myParams, and VETRET_OK.

Referenced by setFilterParameters(), and vetCodec_MPEG().

VETRESULT vetCodec_MPEG::setWidth unsigned int  value  )  [inline, virtual]
 

Set current canvas' width.

Returns:
width in pixel.

Implements vetOutput.

Definition at line 503 of file vetCodec_MPEG.h.

References VETRET_OK, and width.


The documentation for this class was generated from the following files:
Generated on Tue Jan 24 11:59:26 2006 for VETLib by  doxygen 1.4.4