8#include <opencv2/imgcodecs.hpp>
9#include <opencv2/imgproc.hpp>
10#include <opencv2/videoio.hpp>
12#include "algorithmmanager.h"
14#include "readerfactory.h"
15#include "readerparams.h"
16#include "sequentialreaderimpl.h"
19#include <libavcodec/avcodec.h>
20#include <libavformat/avformat.h>
21#include <libavutil/rational.h>
22#include <libswscale/swscale.h>
25#define NOT_IMPLEMENTED assert(false && "Not implemtented yet.")
53 std::shared_ptr<ReaderParams> readerParams);
65 cv::Mat
getPic(
unsigned int index,
66 PictureProcessingFlags flags = APPLY_ALL)
override;
96 bool isDir()
override;
119 std::vector<uint> indices,
120 PictureProcessingFlags flags = APPLY_ALL)
override;
140 int m_currentIndex = -1;
141 std::string m_path =
"";
142 size_t m_frameCount = -1;
143 bool m_isValid =
false;
144 AVRational m_avgVideoFPS;
149 std::shared_ptr<ReaderParams> m_readerParams;
150 int64_t m_startTimestamp = AV_NOPTS_VALUE;
151 std::map<uint, AVFrame*> m_buffer;
152 AVRational m_streamTimeBase = AV_TIME_BASE_Q;
154 int m_lastFrameIdx = -1;
156 AVFormatContext* m_formatContext =
nullptr;
157 AVCodecContext* m_codecContext =
nullptr;
158 const AVCodec* m_codec =
nullptr;
159 struct SwsContext* m_swsContext =
nullptr;
162 cv::Mat avFrame2CvMat(
const AVFrame* av_f);
163 void openFormatContext();
164 void selectVideoStream();
The Reader interface defines functions which are used for reading and parsing the import.
Definition reader.h:23
Definition sequentialreader.h:10
The VideoReader class is used to import video files and implement the Reader interface....
Definition videoreader.h:43
MetaData * getMetaData() override
getMetaData Returns the currently saved MetaData
Definition videoreader.cpp:97
void addMetaData(MetaData *md) override
addMetaData Used to add MetaData to the reader
Definition videoreader.cpp:95
double getVideoDuration() override
Returns the video duration.
Definition videoreader.cpp:208
std::vector< std::string > getFileVector() override
Returns a empty vector.
Definition videoreader.cpp:230
SequentialReader * createSequentialReader(std::vector< uint > indices, PictureProcessingFlags flags=APPLY_ALL) override
createSequentialReader Creates a SequentialReader object for the given indices. This can be used to a...
Definition videoreader.cpp:234
QString getInputPath() override
Returns the input path.
Definition videoreader.cpp:201
bool isDir() override
Returns wether the input is a direcory or not.
Definition videoreader.cpp:216
VideoReader * copy(std::shared_ptr< ReaderParams > params) override
Creates this reader again and returns it.
Definition videoreader.cpp:218
cv::Mat getPic(unsigned int index, PictureProcessingFlags flags=APPLY_ALL) override
Returns the frame to a given index.
Definition videoreader.cpp:101
unsigned int getPicCount() override
Returns the number of frame.
Definition videoreader.cpp:199
bool isValid() override
isValid Retruns wether the reader is valid or not
Definition videoreader.cpp:99
~VideoReader()
VideoReader destructor.
Definition videoreader.cpp:39
double getFPS() override
Returns the video FPS.
Definition videoreader.cpp:203