bic boi video caching rewrite

This commit is contained in:
itsmattkc
2018-10-14 00:19:50 +11:00
parent 2be02c29a8
commit 94efe97929
8 changed files with 243 additions and 189 deletions
+10 -11
View File
@@ -36,7 +36,8 @@ Clip::Clip(Sequence* s) :
fbo(NULL),
autoscale(config.autoscale_by_default),
maintain_audio_pitch(false),
reverse(false)
reverse(false),
use_existing_frame(false)
{
reset();
}
@@ -75,17 +76,10 @@ Clip* Clip::copy(Sequence* s) {
}
void Clip::reset() {
cache_size = false;
audio_just_reset = false;
cache_A.offset = false;
cache_B.offset = false;
open = false;
finished_opening = false;
pkt_written = false;
cache_A.written = false;
cache_B.written = false;
cache_A.unread = false;
cache_B.unread = false;
pkt_written = false;
reached_end = false;
audio_reset = false;
frame_sample_index = -1;
@@ -96,8 +90,6 @@ void Clip::reset() {
codec = NULL;
codecCtx = NULL;
texture = NULL;
cache_A.frames = NULL;
cache_B.frames = NULL;
}
void Clip::reset_audio() {
@@ -137,6 +129,13 @@ void Clip::refresh() {
recalculateMaxLength();
}
void Clip::clear_queue() {
while (queue.size() > 0) {
av_frame_free(&queue.first());
queue.removeFirst();
}
}
Clip::~Clip() {
if (open) {
close_clip(this);
+11 -11
View File
@@ -50,6 +50,7 @@ struct Clip
void reset_audio();
void reset();
void refresh();
void clear_queue();
// timeline variables
Sequence* sequence;
@@ -95,21 +96,24 @@ struct Clip
AVPacket* pkt;
AVFrame* frame;
bool pkt_written;
bool reached_end;
bool reached_end; // deprecated
bool pkt_written;
bool open;
bool finished_opening;
bool replaced;
int64_t rev_target;
// caching functions
// caching functions
bool use_existing_frame;
bool multithreaded;
Cacher* cacher;
int cache_size; // deprecated
QWaitCondition can_cache;
int cache_size;
ClipCache cache_A;
ClipCache cache_B;
int max_queue_size;
QVector<AVFrame*> queue;
ClipCache cache_A; // deprecated
QMutex queue_lock;
QMutex lock;
QMutex open_lock;
@@ -130,11 +134,7 @@ struct Clip
int audio_buffer_write;
bool audio_reset;
bool audio_just_reset;
long audio_target_frame;
// statistics
int stat_seek_time;
int stat_read_time;
long audio_target_frame;
};
#endif // CLIP_H