Skip to content

Commit

Permalink
Set rff=True when using BestSource (#33)
Browse files Browse the repository at this point in the history
* Set `rff=True` when using BestSource

Co-authored-by: sgt0 <[email protected]>

* Run build on PRs

---------

Co-authored-by: Setsugennoao <[email protected]>
  • Loading branch information
sgt0 and Setsugennoao authored Sep 18, 2024
1 parent f424fda commit a9272a2
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 12 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ on:
- 'Makefile.am'
- 'qt.conf'
- '.github/workflows/windows.yml'
pull_request:
workflow_dispatch:


jobs:
build-windows:
Expand All @@ -23,7 +24,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand Down Expand Up @@ -57,7 +58,7 @@ jobs:
cp -r $MSYSTEM_PREFIX/share/qt5/plugins/{platforms,styles} deploy
- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Wobbly-win64
path: deploy
14 changes: 13 additions & 1 deletion src/shared/WobblyProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4128,8 +4128,20 @@ void WobblyProject::presetsToScript(std::string &script) const {
}


const char *WobblyProject::getArgsForSourceFilter() const {
if (source_filter == "bs.VideoSource")
return ", rff=True";
return "";
}


void WobblyProject::sourceToScript(std::string &script, bool save_node) const {
std::string src = "src = c." + source_filter + "(r'" + handleSingleQuotes(input_file) + "')\n";
std::string src = std::format(
"src = c.{}(r'{}'{})\n",
source_filter,
handleSingleQuotes(input_file),
getArgsForSourceFilter()
);

if (save_node) {
script +=
Expand Down
1 change: 1 addition & 0 deletions src/shared/WobblyProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ class WobblyProject : public QObject {
void customListsToScript(std::string &script, PositionInFilterChain position) const;
void headerToScript(std::string &script) const;
void presetsToScript(std::string &script) const;
const char *getArgsForSourceFilter() const;
void sourceToScript(std::string &script, bool save_node) const;
void trimToScript(std::string &script) const;
void fieldHintToScript(std::string &script) const;
Expand Down
22 changes: 16 additions & 6 deletions src/wibbly/WibblyJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,24 +235,34 @@ void WibblyJob::headerToScript(std::string &script) const {
"\n";
}

const char *WibblyJob::getArgsForSourceFilter() const {
if (source_filter == "bs.VideoSource")
return ", rff=True";
return "";
}


void WibblyJob::sourceToScript(std::string &script) const {
std::string fixed_input_file = handleSingleQuotes(input_file);

script +=
"if wibbly_last_input_file == r'" + fixed_input_file + "':\n"
script += std::format(
"if wibbly_last_input_file == r'{0}':\n"
" try:\n"
" src = vs.get_output(index=1)\n"
" if isinstance(src, vs.VideoOutputTuple):\n"
" src = src[0]\n"
" except KeyError:\n"
" src = c." + source_filter + "(r'" + fixed_input_file + "')\n"
" src = c.{1}(r'{0}'{2})\n"
" src.set_output(index=1)\n"
"else:\n"
" src = c." + source_filter + "(r'" + fixed_input_file + "')\n"
" src = c.{1}(r'{0}'{2})\n"
" src.set_output(index=1)\n"
" wibbly_last_input_file = r'" + fixed_input_file + "'\n"
"\n";
" wibbly_last_input_file = r'{0}'\n"
"\n",
fixed_input_file,
source_filter,
getArgsForSourceFilter()
);
}


Expand Down
1 change: 1 addition & 0 deletions src/wibbly/WibblyJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class WibblyJob {

double fades_threshold;

const char *getArgsForSourceFilter() const;

void headerToScript(std::string &script) const;
void sourceToScript(std::string &script) const;
Expand Down
12 changes: 10 additions & 2 deletions src/wobbly/WobblyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3878,6 +3878,11 @@ void WobblyWindow::openProject() {
}
}

const char *WobblyWindow::getArgsForSourceFilter(const QString &source_filter) {
if (source_filter == "bs.VideoSource")
return ", rff=True";
return "";
}

void WobblyWindow::realOpenVideo(const QString &path) {
try {
Expand All @@ -3897,8 +3902,11 @@ void WobblyWindow::realOpenVideo(const QString &path) {
"\n"
"c = vs.core\n"
"\n"
"c.%1(r'%2').set_output()\n");
script = script.arg(source_filter).arg(QString::fromStdString(handleSingleQuotes(path.toStdString())));
"c.%1(r'%2'%3).set_output()\n");
script = script
.arg(source_filter)
.arg(QString::fromStdString(handleSingleQuotes(path.toStdString())))
.arg(getArgsForSourceFilter(source_filter));

QApplication::setOverrideCursor(Qt::WaitCursor);

Expand Down
2 changes: 2 additions & 0 deletions src/wobbly/WobblyWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ class WobblyWindow : public QMainWindow {
void keyPressEvent(QKeyEvent *event);
void wheelEvent(QWheelEvent *event);

const char *getArgsForSourceFilter(const QString &source_filter);

void realOpenProject(const QString &path);
void realOpenVideo(const QString &path);
void realSaveProject(const QString &path);
Expand Down

0 comments on commit a9272a2

Please sign in to comment.