Skip to content

Commit

Permalink
Add getArgsForSourceFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Aug 5, 2024
1 parent f424fda commit 9b6aff6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/shared/WobblyProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4128,8 +4128,15 @@ 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 = "src = c." + source_filter + "(r'" + handleSingleQuotes(input_file) + "'" + getArgsForSourceFilter() +")\n";

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
10 changes: 8 additions & 2 deletions src/wibbly/WibblyJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ 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);
Expand All @@ -246,10 +252,10 @@ void WibblyJob::sourceToScript(std::string &script) const {
" if isinstance(src, vs.VideoOutputTuple):\n"
" src = src[0]\n"
" except KeyError:\n"
" src = c." + source_filter + "(r'" + fixed_input_file + "')\n"
" src = c." + source_filter + "(r'" + fixed_input_file + "'" + getArgsForSourceFilter() + ")\n"
" src.set_output(index=1)\n"
"else:\n"
" src = c." + source_filter + "(r'" + fixed_input_file + "')\n"
" src = c." + source_filter + "(r'" + fixed_input_file + "'" + getArgsForSourceFilter() + ")\n"
" src.set_output(index=1)\n"
" wibbly_last_input_file = r'" + fixed_input_file + "'\n"
"\n";
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
7 changes: 6 additions & 1 deletion 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() {
if (source_filter == "bs.VideoSource")
return ", rff=True";
return "";
}

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

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();

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

0 comments on commit 9b6aff6

Please sign in to comment.