25 #ifndef __VIDEOSOURCE_FFMPEG_HH__
26 #define __VIDEOSOURCE_FFMPEG_HH__
28 #include <VideoSource/VideoSource_Base.hh>
29 #include <Image/Camera.hh>
32 #ifndef BIAS_HAVE_FFMPEG
33 #error BIAS was build without FFmpeg, please enable USE_FFMPEG and recompile BIAS.
38 #define INT64_C(c) (c ## LL)
39 #define UINT64_C(c) (c ## ULL)
45 #include <libavcodec/avcodec.h>
46 #include <libavformat/avformat.h>
47 #include <libswscale/swscale.h>
77 virtual int OpenDevice(
const char *filename);
83 virtual int CloseDevice();
97 int SeekFrame(int64_t frame);
114 inline float GetFPS() {
return FramesPerSecond_; }
171 char * ExtractDateString_(std::string str);
178 enum PixelFormat outputPixFmt_;
192 #endif // __VIDEOSOURCE_FFMPEG_HH__
int64_t duration_
Stream duration in milliseconds, 0 if unknown.
EColorModel
These are the most often used color models.
int64_t pts_
Presentation timestamp of last decoded frame in microseconds.
Defines a common interface to different devices.
Simple video decoding of video files using FFmpeg library.
int streamIndex_
Index of the video stream.
std::string errMsg_
The last error message.
int64_t GetNumberOfFrames() const
Get the number of frames in the video stream.
int GetTimeBaseDen()
Get the timebase denumerator of the video stream.
int GetTimeBaseNum()
Get the timebase numerator of the video stream.
AVFrame * pFrame_
Video stream frame.
int64_t numFrames_
Number of frames of the stream, 0 if unknown.
std::string GetError()
Get the last error message.
int64_t GetPTS()
Get the presentation timestamp of the last decoded frame in microseconds.
int timeBaseNum_
Stream timebase numerator.
AVFormatContext * pFormatCtx_
Format context for video decoder.
SwsContext * pSwsCtx_
Color conversion context.
int64_t GetDuration()
Get the duration of the video stream in microseconds.
char * GetDateString()
Get a string representation of the timestamp of the video stream.
int64_t frameNumber_
Number of decoded frames.
int timeBaseDen_
Stream timebase denumerator.
int64_t GetCurrentFrameNumber() const
Get the number of frames decoded so far.
char * dateStr_
String representation of timestamp_.
int64_t timestamp_
Stream timestamp.
float GetFPS()
Get the framerate of the video stream.
uint8_t * pBuffer_
Ouput frame buffer.
int64_t GetTimestamp()
Get the timestamp of the video stream in microseconds in Unix time.
AVFrame * pOutputFrame_
Output frame.