Skip to content

Commit

Permalink
refactor ffmpeg format check
Browse files Browse the repository at this point in the history
  • Loading branch information
shun-iwasawa committed Mar 1, 2024
1 parent 0234015 commit 88ac582
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 88ac582

Please sign in to comment.