Fixed gif import (#924)

* fixed gif import
This commit is contained in:
Jeremy Bullock 2016-11-23 19:11:57 -07:00 committed by shun-iwasawa
parent 6e785fd361
commit 686e82ae08
2 changed files with 19 additions and 24 deletions

View file

@ -221,10 +221,8 @@ void Ffmpeg::saveSoundTrack(TSoundTrack *st) {
bool Ffmpeg::checkFilesExist() {
QString ffmpegCachePath = getFfmpegCache().getQString();
QString tempPath = ffmpegCachePath + "//" +
m_path.getQString().remove(QRegExp(QString::fromUtf8(
"[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]"))) +
"In0001." + m_intermediateFormat;
QString tempPath = ffmpegCachePath + "//" + cleanPathSymbols() + "In0001." +
m_intermediateFormat;
if (TSystem::doesExistFileOrLevel(TFilePath(tempPath))) {
return true;
} else
@ -233,10 +231,7 @@ bool Ffmpeg::checkFilesExist() {
ffmpegFileInfo Ffmpeg::getInfo() {
QString ffmpegCachePath = getFfmpegCache().getQString();
QString tempPath = ffmpegCachePath + "//" +
m_path.getQString().remove(QRegExp(QString::fromUtf8(
"[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]"))) +
".txt";
QString tempPath = ffmpegCachePath + "//" + cleanPathSymbols() + ".txt";
if (QFile::exists(tempPath)) {
QFile infoText(tempPath);
infoText.open(QIODevice::ReadOnly);
@ -269,10 +264,8 @@ ffmpegFileInfo Ffmpeg::getInfo() {
}
TRasterImageP Ffmpeg::getImage(int frameIndex) {
QString ffmpegCachePath = getFfmpegCache().getQString();
QString tempPath = ffmpegCachePath + "//" +
m_path.getQString().remove(QRegExp(QString::fromUtf8(
"[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]")));
std::string tmpPath = tempPath.toStdString();
QString tempPath = ffmpegCachePath + "//" + cleanPathSymbols();
std::string tmpPath = tempPath.toStdString();
// QString tempPath= m_path.getQString();
QString number = QString("%1").arg(frameIndex, 4, 10, QChar('0'));
QString tempName = "In" + number + ".png";
@ -361,12 +354,10 @@ int Ffmpeg::getFrameCount() {
void Ffmpeg::getFramesFromMovie(int frame) {
QString ffmpegCachePath = getFfmpegCache().getQString();
QString tempPath = ffmpegCachePath + "//" +
m_path.getQString().remove(QRegExp(QString::fromUtf8(
"[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]")));
std::string tmpPath = tempPath.toStdString();
QString tempName = "In%04d." + m_intermediateFormat;
tempName = tempPath + tempName;
QString tempPath = ffmpegCachePath + "//" + cleanPathSymbols();
std::string tmpPath = tempPath.toStdString();
QString tempName = "In%04d." + m_intermediateFormat;
tempName = tempPath + tempName;
QString tempStart;
if (frame == -1) {
tempStart = "In0001." + m_intermediateFormat;
@ -405,15 +396,18 @@ void Ffmpeg::getFramesFromMovie(int frame) {
}
}
QString Ffmpeg::cleanPathSymbols() {
return m_path.getQString().remove(QRegExp(
QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\[\\]\\\\]")));
}
int Ffmpeg::getGifFrameCount() {
int frame = 1;
QString ffmpegCachePath = getFfmpegCache().getQString();
QString tempPath = ffmpegCachePath + "//" +
QString::fromStdString(m_path.getName()) +
QString::fromStdString(m_path.getType());
std::string tmpPath = tempPath.toStdString();
QString tempName = "In%04d." + m_intermediateFormat;
tempName = tempPath + tempName;
QString tempPath = ffmpegCachePath + "//" + cleanPathSymbols();
std::string tmpPath = tempPath.toStdString();
QString tempName = "In%04d." + m_intermediateFormat;
tempName = tempPath + tempName;
QString tempStart;
tempStart = "In0001." + m_intermediateFormat;
tempStart = tempPath + tempStart;

View file

@ -53,6 +53,7 @@ private:
QVector<QString> m_cleanUpList;
QStringList m_audioArgs;
TUINT32 m_sampleRate;
QString cleanPathSymbols();
};
#endif