ffmpegframepool: implemented functional frame pool

Includes splitting off core functionality to a base MemoryPool class that can
be re-used later if necessary.
This commit is contained in:
itsmattkc
2020-04-14 02:43:12 +10:00
parent 2eb03bf386
commit 7bfdf8af7c
10 changed files with 396 additions and 260 deletions
+8 -11
View File
@@ -35,8 +35,8 @@ extern "C" {
#include "audio/sampleformat.h"
#include "avframeptr.h"
#include "codec/decoder.h"
#include "codec/framepool.h"
#include "codec/waveoutput.h"
#include "ffmpegframepool.h"
#include "project/item/footage/videostream.h"
OLIVE_NAMESPACE_ENTER
@@ -56,7 +56,7 @@ public:
bool CacheWillContainTime(const int64_t& t) const;
bool CacheCouldContainTime(const int64_t& t) const;
bool CacheIsEmpty() const;
FramePool::ElementPtr GetFrameFromCache(const int64_t& t) const;
FFmpegFramePool::ElementPtr GetFrameFromCache(const int64_t& t) const;
void RemoveFramesBefore(const qint64& t);
@@ -65,7 +65,7 @@ public:
void ClearFrameCache();
FramePool::ElementPtr RetrieveFrame(const int64_t &target_ts, bool cache_is_locked);
FFmpegFramePool::ElementPtr RetrieveFrame(const int64_t &target_ts, bool cache_is_locked);
/**
* @brief Uses the FFmpeg API to retrieve a packet (stored in pkt_) and decode it (stored in frame_)
@@ -96,8 +96,8 @@ private:
QWaitCondition cache_wait_cond_;
QMutex cache_lock_;
QList<FramePool::ElementPtr> cached_frames_;
FramePool frame_pool_;
QList<FFmpegFramePool::ElementPtr> cached_frames_;
FFmpegFramePool frame_pool_;
int64_t cache_target_time_;
@@ -160,13 +160,13 @@ private:
void UnconditionalAudioIndex(const QAtomicInt* cancelled);
void CacheFrameToDisk(AVFrame* f);
void ClearResources();
void SetupScaler(const int& divider);
void InitScaler(int divider);
void FreeScaler();
SwsContext* scale_ctx_;
int scale_divider_;
AVPixelFormat src_pix_fmt_;
AVPixelFormat ideal_pix_fmt_;
PixelFormat::Format native_pix_fmt_;
@@ -175,9 +175,6 @@ private:
rational aspect_ratio_;
int64_t start_time_;
SwsContext* scale_ctx_;
int scale_divider_;
QTimer clear_timer_;
FFmpegDecoderInstance* our_instance_;