various improvements

This commit is contained in:
itsmattkc
2018-10-05 00:17:09 +10:00
parent ceb744e589
commit 5f16c1c84f
17 changed files with 172 additions and 123 deletions
+6 -13
View File
@@ -36,12 +36,7 @@ void open_clip(Clip* clip, bool multithreaded) {
// maybe keep cacher instance in memory while clip exists for performance?
clip->cacher = new Cacher(clip);
QObject::connect(clip->cacher, SIGNAL(finished()), clip->cacher, SLOT(deleteLater()));
if (clip->track < 0) {
clip->cacher->start(QThread::LowPriority);
} else {
clip->cacher->start(QThread::TimeCriticalPriority);
}
clip->cacher->start((clip->track < 0) ? QThread::LowPriority : QThread::TimeCriticalPriority);
}
} else {
clip->finished_opening = false;
@@ -114,11 +109,6 @@ bool get_clip_frame(Clip* c, long playhead) {
// do we need to update the texture?
MediaStream* ms = static_cast<Media*>(c->media)->get_stream_from_file_index(c->track < 0, c->media_stream);
// backwards compatibilty code
if (c->frame_rate == 0) {
c->frame_rate = ms->video_frame_rate;
}
long sequence_clip_time = playhead - c->timeline_in + c->clip_in;
long clip_time = refactor_frame_number(sequence_clip_time, c->sequence->frame_rate, c->frame_rate);
@@ -286,7 +276,10 @@ void retrieve_next_frame_raw_data(Clip* c, AVFrame* output) {
// output->pts = c->frame->best_effort_timestamp;
} else if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
output->pts = c->frame->pts;
ret = swr_convert_frame(c->swr_ctx, output, c->frame);
ret = swr_convert_frame(c->swr_ctx, output, c->frame);
if (ret < 0) {
qDebug() << "[ERROR] Failed to resample audio." << ret;
}
@@ -303,7 +296,7 @@ bool is_clip_active(Clip* c, long playhead) {
return c->enabled
&& c->timeline_in < playhead + ceil(c->sequence->frame_rate)
&& c->timeline_out > playhead
&& playhead - c->timeline_in + c->clip_in < c->getMediaLength(c->sequence->frame_rate);
&& playhead - c->timeline_in + c->clip_in < c->getMaximumLength();
}
void set_sequence(Sequence* s) {