#ifndef FRAMEREADER_HPP #define FRAMEREADER_HPP #include #include #include #include #include #include #include #include "channel.hpp" // independent of QT, needs ffmpeg extern "C" { #include #include #include } class FrameReader { public: FrameReader(const char *fn); uint8_t *get(int idx); AVFrame *toRGB(AVFrame *); void waitForReady() { while (!joined) usleep(10*1000); } int getRGBSize() { return width*height*3; } void loaderThread(); void cacherThread(); private: AVFormatContext *pFormatCtx = NULL; AVCodecContext *pCodecCtx = NULL; struct SwsContext *sws_ctx = NULL; int width = 1164; int height = 874; std::vector pkts; std::thread *t; bool joined = false; std::map cache; std::mutex mcache; void GOPCache(int idx); channel to_cache; bool valid = true; char url[0x400]; }; #endif