Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
BIAS::VideoSource_FFMPEGVideo Class Reference

Class for extracting frames from video files using FFMpeg, analog to class DShowVideo. More...

#include <VideoSource/VideoSource_FFMPEGVideo.hh>

+ Collaboration diagram for BIAS::VideoSource_FFMPEGVideo:

Public Member Functions

void Close ()
 Close file and free buffers. More...
 
unsigned int CountVideoStreams ()
 Return number of video streams. More...
 
std::string ErrMsg ()
 Returns last error message. More...
 
unsigned int GetCurrentDTS () const
 Returns the current decoding timestamp. More...
 
bool GetFrame (BIAS::ImageBase &img)
 Retreive the next frame from the video. More...
 
unsigned int GetLength () const
 Returns the length of the video in TimeBase units. More...
 
int Height ()
 Return height of selected video stream. More...
 
bool Init (int width=0, int height=0, PixelFormat pixFmt=PIX_FMT_RGB24, unsigned int streamIndex=0)
 Select video stream, initialize stuff and set destination size and pixel format. More...
 
bool Open (const char *file)
 Open file and retreive info. More...
 
void Seek (int64_t time)
 Seeks to time which is given in TimeBase units. More...
 
AVRational TimeBase ()
 Returns the TimeBase of the video stream. More...
 
 VideoSource_FFMPEGVideo ()
 
int Width ()
 Return width of selected video stream. More...
 
 ~VideoSource_FFMPEGVideo ()
 

Static Public Member Functions

static PixelFormat Colormodel2PixFmt (ImageBase::EColorModel cm)
 Maps BIAS colormodels to ffmpeg pixelformats. More...
 

Protected Attributes

uint8_t * _buffer
 
AVCodec * _codec
 
AVCodecContext * _codecCtx
 
std::string _errMsg
 
AVFormatContext * _fmtCtx
 
AVFrame * _frame
 
AVFrame * _frameRGB
 
unsigned int _streamIndex
 
SwsContext * _swsCtx
 
int _vidStr
 
std::vector< int > _vidStreams
 

Detailed Description

Class for extracting frames from video files using FFMpeg, analog to class DShowVideo.

Test:
tested with TestVideoSource_FFMPEGVideo.cpp
Author
Max hollmann
Deprecated:
replaced by VideoSource_FFmpeg, to be removed (ischiller)

Definition at line 48 of file VideoSource_FFMPEGVideo.hh.

Constructor & Destructor Documentation

BIAS::VideoSource_FFMPEGVideo::VideoSource_FFMPEGVideo ( )

Definition at line 30 of file VideoSource_FFMPEGVideo.cpp.

BIAS::VideoSource_FFMPEGVideo::~VideoSource_FFMPEGVideo ( )

Definition at line 48 of file VideoSource_FFMPEGVideo.cpp.

Member Function Documentation

void BIAS::VideoSource_FFMPEGVideo::Close ( )

Close file and free buffers.

Definition at line 142 of file VideoSource_FFMPEGVideo.cpp.

PixelFormat BIAS::VideoSource_FFMPEGVideo::Colormodel2PixFmt ( ImageBase::EColorModel  cm)
static

Maps BIAS colormodels to ffmpeg pixelformats.

Supported so far:

  • CM_RGB
  • CM_BGR
  • CM_GRAY

Definition at line 239 of file VideoSource_FFMPEGVideo.cpp.

References BIAS::ImageBase::CM_BGR, BIAS::ImageBase::CM_Grey, and BIAS::ImageBase::CM_RGB.

unsigned int BIAS::VideoSource_FFMPEGVideo::CountVideoStreams ( )

Return number of video streams.

Definition at line 163 of file VideoSource_FFMPEGVideo.cpp.

string BIAS::VideoSource_FFMPEGVideo::ErrMsg ( )

Returns last error message.

Definition at line 233 of file VideoSource_FFMPEGVideo.cpp.

unsigned int BIAS::VideoSource_FFMPEGVideo::GetCurrentDTS ( ) const

Returns the current decoding timestamp.

Definition at line 221 of file VideoSource_FFMPEGVideo.cpp.

bool BIAS::VideoSource_FFMPEGVideo::GetFrame ( BIAS::ImageBase img)

Retreive the next frame from the video.

Definition at line 186 of file VideoSource_FFMPEGVideo.cpp.

References BIAS::ImageBase::GetImageData().

unsigned int BIAS::VideoSource_FFMPEGVideo::GetLength ( ) const

Returns the length of the video in TimeBase units.

Definition at line 226 of file VideoSource_FFMPEGVideo.cpp.

int BIAS::VideoSource_FFMPEGVideo::Height ( )

Return height of selected video stream.

Definition at line 177 of file VideoSource_FFMPEGVideo.cpp.

bool BIAS::VideoSource_FFMPEGVideo::Init ( int  width = 0,
int  height = 0,
PixelFormat  pixFmt = PIX_FMT_RGB24,
unsigned int  streamIndex = 0 
)

Select video stream, initialize stuff and set destination size and pixel format.

Only call after successfully calling Open(). If width and height both are zero, the video is not resized. If either is zero, the other is calculated to maintain the aspect ratio.

Definition at line 83 of file VideoSource_FFMPEGVideo.cpp.

bool BIAS::VideoSource_FFMPEGVideo::Open ( const char *  file)

Open file and retreive info.

Definition at line 52 of file VideoSource_FFMPEGVideo.cpp.

void BIAS::VideoSource_FFMPEGVideo::Seek ( int64_t  time)

Seeks to time which is given in TimeBase units.

Definition at line 211 of file VideoSource_FFMPEGVideo.cpp.

AVRational BIAS::VideoSource_FFMPEGVideo::TimeBase ( )

Returns the TimeBase of the video stream.

Definition at line 216 of file VideoSource_FFMPEGVideo.cpp.

int BIAS::VideoSource_FFMPEGVideo::Width ( )

Return width of selected video stream.

Definition at line 169 of file VideoSource_FFMPEGVideo.cpp.

Member Data Documentation

uint8_t* BIAS::VideoSource_FFMPEGVideo::_buffer
protected

Definition at line 119 of file VideoSource_FFMPEGVideo.hh.

AVCodec* BIAS::VideoSource_FFMPEGVideo::_codec
protected

Definition at line 115 of file VideoSource_FFMPEGVideo.hh.

AVCodecContext* BIAS::VideoSource_FFMPEGVideo::_codecCtx
protected

Definition at line 113 of file VideoSource_FFMPEGVideo.hh.

std::string BIAS::VideoSource_FFMPEGVideo::_errMsg
protected

Definition at line 108 of file VideoSource_FFMPEGVideo.hh.

AVFormatContext* BIAS::VideoSource_FFMPEGVideo::_fmtCtx
protected

Definition at line 112 of file VideoSource_FFMPEGVideo.hh.

AVFrame* BIAS::VideoSource_FFMPEGVideo::_frame
protected

Definition at line 117 of file VideoSource_FFMPEGVideo.hh.

AVFrame* BIAS::VideoSource_FFMPEGVideo::_frameRGB
protected

Definition at line 118 of file VideoSource_FFMPEGVideo.hh.

unsigned int BIAS::VideoSource_FFMPEGVideo::_streamIndex
protected

Definition at line 111 of file VideoSource_FFMPEGVideo.hh.

SwsContext* BIAS::VideoSource_FFMPEGVideo::_swsCtx
protected

Definition at line 114 of file VideoSource_FFMPEGVideo.hh.

int BIAS::VideoSource_FFMPEGVideo::_vidStr
protected

Definition at line 116 of file VideoSource_FFMPEGVideo.hh.

std::vector<int> BIAS::VideoSource_FFMPEGVideo::_vidStreams
protected

Definition at line 110 of file VideoSource_FFMPEGVideo.hh.


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