Raytrix Light Field SDK  4.0
Logo
Public Member Functions | Protected Member Functions | List of all members
Rx::FileIO::CFFmpegDec_Impl Class Reference

Detailed Description

Video Decode Codec.

Inherits Rx::FileIO::IVideoDecode, and Rx::FileIO::IParameterVideoDecode.

Public Member Functions

 CFFmpegDec_Impl ()
 Default constructor. More...
 
 ~CFFmpegDec_Impl ()
 Destructor. More...
 
virtual void Close ()
 Frees all memory allocated by Open() and finalizes the FFMpeg libraries. More...
 
virtual void Destroy ()
 Destroys this object. More...
 
virtual bool GetNextImage (Interop::Runtime28::IImage *pTrgImg)
 Get the next frame from the video stream as IImage. More...
 
virtual void Open (const CRxString &sxInputVideoPath)
 Opens the video file and initialize/load the FFMpeg libraries. Registers all needed formats and setups the video decoder. More...
 

Protected Member Functions

void ConvertToRxImageFormat (CRxImageFormat &xImageFormat, const AVCodecContext *pxAVCodecContext)
 Converts a AVPixelFormat to a raytrix pixel format and stores it with its related data type inside a ImageFormat. More...
 
int Decode (AVCodecContext *xAVCodecContext, AVFrame *xAVOrgFrame, AVPacket *xAVPkt, Interop::Runtime28::IImage *pTrgImg, int &iGotFrame)
 Tries to decode a frame from the video stream. iGotFrame indicates if a frame was decoded (1 = frame decoded, 0 = no frame found/decoded). More...
 
int OpenCodecContext (int &iStreamIndex, AVFormatContext *pxAVFormatContext)
 Finds the best video stream in the video file and opens the codec used for the decoding. More...
 

Constructor & Destructor Documentation

Rx::FileIO::CFFmpegDec_Impl::CFFmpegDec_Impl ( )

Default constructor.

Rx::FileIO::CFFmpegDec_Impl::~CFFmpegDec_Impl ( )

Destructor.

Member Function Documentation

virtual void Rx::FileIO::CFFmpegDec_Impl::Close ( )
virtual

Frees all memory allocated by Open() and finalizes the FFMpeg libraries.

Implements Rx::FileIO::IVideoDecode.

void Rx::FileIO::CFFmpegDec_Impl::ConvertToRxImageFormat ( CRxImageFormat xImageFormat,
const AVCodecContext *  pxAVCodecContext 
)
protected

Converts a AVPixelFormat to a raytrix pixel format and stores it with its related data type inside a ImageFormat.

Parameters
xImageFormat[out] The image format describing the format of the output images.
pxAVCodecContext[in] The AVCodecContext containing the pixel format.
int Rx::FileIO::CFFmpegDec_Impl::Decode ( AVCodecContext *  xAVCodecContext,
AVFrame *  xAVOrgFrame,
AVPacket *  xAVPkt,
Interop::Runtime28::IImage pTrgImg,
int &  iGotFrame 
)
protected

Tries to decode a frame from the video stream. iGotFrame indicates if a frame was decoded (1 = frame decoded, 0 = no frame found/decoded).

Parameters
xAVCodecContext[in] The AVCodecContext.
xAVOrgFrame[in] AVFrame for the orginal non scaled data.
xAVPkt[in] AVPacket containg the frame data.
pTrgImg[out] Target memory.
iGotFrame[out] Identifier if a frame was decoded.
Returns
The length of the decoded frame on success or -1 when the frame was not part of the video stream.
virtual void Rx::FileIO::CFFmpegDec_Impl::Destroy ( )
virtual

Destroys this object.

Implements Rx::FileIO::IVideoDecode.

virtual bool Rx::FileIO::CFFmpegDec_Impl::GetNextImage ( Interop::Runtime28::IImage pTrgImg)
virtual

Get the next frame from the video stream as IImage.

Parameters
pTrgImg[out] The target memory.
Returns
True if the next frame was found and decoded, false otherwise.

Implements Rx::FileIO::IVideoDecode.

virtual void Rx::FileIO::CFFmpegDec_Impl::Open ( const CRxString sxInputVideoPath)
virtual

Opens the video file and initialize/load the FFMpeg libraries. Registers all needed formats and setups the video decoder.

Parameters
sxInputVideoPath[in] The path to the input video file.

Implements Rx::FileIO::IVideoDecode.

int Rx::FileIO::CFFmpegDec_Impl::OpenCodecContext ( int &  iStreamIndex,
AVFormatContext *  pxAVFormatContext 
)
protected

Finds the best video stream in the video file and opens the codec used for the decoding.

Parameters
iStreamIndex[out] The index of the best video stream, if found.
pxAVFormatContext[in] The AVFormatContext.
Returns
0 on success, -1 if no stream was found.