Skip to content

Commit

Permalink
Merge pull request #5317 from shun-iwasawa/p/refactor_ffmpeg_format_c…
Browse files Browse the repository at this point in the history
…heck

Refactor FFmpeg format check on launch
  • Loading branch information
RodneyBaker authored Mar 3, 2024
2 parents 9acc058 + 88ac582 commit 6d016bd
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ Ffmpeg::Ffmpeg() {
Ffmpeg::~Ffmpeg() {}

bool Ffmpeg::checkFormat(std::string format) {
QStringList args;
args << "-formats";
QProcess ffmpeg;
ThirdParty::runFFmpeg(ffmpeg, args);
ffmpeg.waitForFinished();
QString results = ffmpeg.readAllStandardError();
results += ffmpeg.readAllStandardOutput();
ffmpeg.close();
std::string strResults = results.toStdString();
static std::string strResults = "";
if (strResults.empty()) {
QStringList args;
args << "-formats";
QProcess ffmpeg;
ThirdParty::runFFmpeg(ffmpeg, args);
ffmpeg.waitForFinished();
QString results = ffmpeg.readAllStandardError();
results += ffmpeg.readAllStandardOutput();
ffmpeg.close();
strResults = results.toStdString();
}
std::string::size_type n;
n = strResults.find(format);
if (n != std::string::npos)
Expand Down

0 comments on commit 6d016bd

Please sign in to comment.