proxy: improved UI on proxy menu
This commit is contained in:
@@ -760,6 +760,12 @@ bool FFmpegDecoder::ProxyVideo(const QAtomicInt *cancelled, int divider)
|
||||
futures.append(future);
|
||||
}
|
||||
|
||||
// Wait for all conversions to finish
|
||||
for (int i=0;i<futures.size();i++) {
|
||||
futures[i].waitForFinished();
|
||||
}
|
||||
|
||||
// If succeeded, update the video stream's proxy state
|
||||
if (succeeded) {
|
||||
QFile index_output(proxy_filename);
|
||||
|
||||
@@ -773,11 +779,6 @@ bool FFmpegDecoder::ProxyVideo(const QAtomicInt *cancelled, int divider)
|
||||
video_stream->set_proxy(divider, frame_index);
|
||||
}
|
||||
|
||||
// Wait for all conversions to finish
|
||||
for (int i=0;i<futures.size();i++) {
|
||||
futures[i].waitForFinished();
|
||||
}
|
||||
|
||||
sws_freeContext(scaler);
|
||||
|
||||
av_packet_free(&pkt);
|
||||
|
||||
@@ -148,8 +148,14 @@ const QMap<rational, QByteArray> &VideoRenderFrameCache::time_hash_map() const
|
||||
QString VideoRenderFrameCache::GetFormatExtension(const PixelFormat::Format &f)
|
||||
{
|
||||
if (PixelFormat::FormatIsFloat(f)) {
|
||||
// EXR is only fast with float buffers so we only use it for those
|
||||
return QStringLiteral(".exr");
|
||||
} else {
|
||||
// FIXME: Will probably need different codec here. JPEG is the fastest and smallest by far (much
|
||||
// more so than TIFF or PNG) and we don't mind lossy for the offline cache, but JPEG
|
||||
// doesn't support >8-bit or alpha channels. JPEG2000 does, but my OIIO wasn't compiled
|
||||
// with it and I imagine it's not common in general. Still, this works well for now as a
|
||||
// prototype.
|
||||
return QStringLiteral(".jpg");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,6 +310,14 @@ void ProjectExplorer::ShowContextMenu()
|
||||
proxy_menu->addAction(tr("1/4"))->setData(4);
|
||||
proxy_menu->addAction(tr("1/8"))->setData(8);
|
||||
|
||||
foreach (QAction* a, proxy_menu->actions()) {
|
||||
a->setCheckable(true);
|
||||
|
||||
if (a->data() == video_stream->using_proxy()) {
|
||||
a->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
connect(proxy_menu, &Menu::triggered, this, &ProjectExplorer::ContextMenuStartProxy);
|
||||
|
||||
}
|
||||
@@ -395,9 +403,21 @@ void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
||||
return;
|
||||
}
|
||||
|
||||
if (video_stream->try_start_proxy()) {
|
||||
ProxyTask* proxy_task = new ProxyTask(video_stream, a->data().toInt());
|
||||
TaskManager::instance()->AddTask(proxy_task);
|
||||
int chosen_proxy_setting = a->data().toInt();
|
||||
|
||||
if (chosen_proxy_setting != video_stream->using_proxy()) {
|
||||
if (!a->data().toInt()) {
|
||||
|
||||
// 0 means disable the proxy
|
||||
video_stream->set_proxy(0, QVector<int64_t>());
|
||||
|
||||
} else if (video_stream->try_start_proxy()) {
|
||||
|
||||
// Start a background task for proxying
|
||||
ProxyTask* proxy_task = new ProxyTask(video_stream, a->data().toInt());
|
||||
TaskManager::instance()->AddTask(proxy_task);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user