memorymanager: rewrote entire memory management system

This commit is contained in:
itsmattkc
2020-02-23 20:29:51 +11:00
parent 3a90e76fec
commit 48cdb3a6dd
10 changed files with 143 additions and 147 deletions
+43
View File
@@ -0,0 +1,43 @@
#ifndef FFMPEGFRAMECACHE_H
#define FFMPEGFRAMECACHE_H
extern "C" {
#include <libavformat/avformat.h>
}
#include <QList>
#include <QTimer>
class FFmpegFrameCache
{
public:
FFmpegFrameCache();
void append(AVFrame* f);
void clear();
bool isEmpty() const;
AVFrame* first() const;
AVFrame* at(int i) const;
AVFrame* last() const;
int size() const;
void accessedFirst();
void accessedLast();
void accessed(int i);
void remove_old_frames(qint64 older_than);
private:
struct CachedFrame {
AVFrame* frame;
qint64 accessed;
};
QList<CachedFrame> frames_;
static int global_frame_count_;
};
#endif // FFMPEGFRAMECACHE_H