Merge pull request #615 from manongjohn/update_external_app_handling
Update external app handling
This commit is contained in:
commit
63874b4309
24 changed files with 318 additions and 237 deletions
4
.github/workflows/linux_build.yml
vendored
4
.github/workflows/linux_build.yml
vendored
|
@ -27,7 +27,6 @@ jobs:
|
|||
/home/runner/.ccache
|
||||
/home/runner/work/tahoma2d/taoma2d/thirdparty/openh264
|
||||
/home/runner/work/tahoma2d/taoma2d/thirdparty/ffmpeg
|
||||
/home/runner/work/tahoma2d/taoma2d/thirdparty/ffmpeg_shared
|
||||
/home/runner/work/tahoma2d/taoma2d/thirdparty/opencv
|
||||
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
|
@ -48,6 +47,9 @@ jobs:
|
|||
export CC="ccache ${{ matrix.cc }}"
|
||||
export CXX="ccache ${{ matrix.cxx }}"
|
||||
ci-scripts/linux/tahoma-build.sh
|
||||
- name: Get 3rd Party Apps
|
||||
run: |
|
||||
ci-scripts/linux/tahoma-get3rdpartyapps.sh
|
||||
- name: Create Package
|
||||
run: |
|
||||
ci-scripts/linux/tahoma-buildpkg.sh
|
||||
|
|
4
.github/workflows/macOS_build.yml
vendored
4
.github/workflows/macOS_build.yml
vendored
|
@ -18,7 +18,6 @@ jobs:
|
|||
/Users/runner/.ccache
|
||||
/Users/runner/work/tahoma2d/taoma2d/thirdparty/aom
|
||||
/Users/runner/work/tahoma2d/taoma2d/thirdparty/ffmpeg
|
||||
/Users/runner/work/tahoma2d/taoma2d/thirdparty/ffmpeg_shared
|
||||
/Users/runner/work/tahoma2d/taoma2d/thirdparty/opencv
|
||||
key: ${{ runner.os }}-${{ github.sha }}
|
||||
restore-keys: ${{ runner.os }}-
|
||||
|
@ -34,6 +33,9 @@ jobs:
|
|||
run: |
|
||||
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||
ci-scripts/osx/tahoma-build.sh
|
||||
- name: Get 3rd Party Apps
|
||||
run: |
|
||||
ci-scripts/osx/tahoma-get3rdpartyapps.sh
|
||||
- name: Create Package
|
||||
run: bash ./ci-scripts/osx/tahoma-buildpkg.sh
|
||||
- uses: actions/upload-artifact@v1
|
||||
|
|
22
appveyor.yml
22
appveyor.yml
|
@ -60,6 +60,28 @@ after_build:
|
|||
|
||||
xcopy /Y /E ..\..\stuff "%CONFIGURATION%\Tahoma2D\tahomastuff"
|
||||
|
||||
curl -fsSL -o ffmpeg-4.3.1-win64-static-lgpl.zip https://github.com/tahoma2d/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-win64-static-lgpl.zip
|
||||
|
||||
7z x ffmpeg-4.3.1-win64-static-lgpl.zip
|
||||
|
||||
mkdir %CONFIGURATION%\Tahoma2D\ffmpeg
|
||||
|
||||
copy /Y ffmpeg-4.3.1-win64-static-lgpl\bin\ffmpeg.exe %CONFIGURATION%\Tahoma2D\ffmpeg
|
||||
|
||||
copy /Y ffmpeg-4.3.1-win64-static-lgpl\bin\ffprobe.exe %CONFIGURATION%\Tahoma2D\ffmpeg
|
||||
|
||||
curl -fsSL -o rhubarb-lip-sync-tahoma2d-win.zip https://github.com/tahoma2d/rhubarb-lip-sync/releases/download/v1.10.2/rhubarb-lip-sync-tahoma2d-win.zip
|
||||
|
||||
7z x rhubarb-lip-sync-tahoma2d-win.zip
|
||||
|
||||
mkdir %CONFIGURATION%\Tahoma2D\rhubarb
|
||||
|
||||
copy /Y rhubarb-lip-sync-tahoma2d-win\rhubarb.exe %CONFIGURATION%\Tahoma2D\rhubarb
|
||||
|
||||
mkdir %CONFIGURATION%\Tahoma2D\rhubarb\res
|
||||
|
||||
xcopy /Y /E rhubarb-lip-sync-tahoma2d-win\res "%CONFIGURATION%\Tahoma2D\rhubarb\res"
|
||||
|
||||
artifacts:
|
||||
- path: toonz\$(PLATFORM)\$(CONFIGURATION)
|
||||
name: Tahoma2D
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/bash
|
||||
cd thirdparty
|
||||
|
||||
echo ">>> Cloning openH264"
|
||||
|
@ -15,10 +16,9 @@ sudo make install
|
|||
cd ..
|
||||
|
||||
echo ">>> Cloning ffmpeg"
|
||||
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
|
||||
cp -R ffmpeg ffmpeg_shared
|
||||
git clone https://github.com/tahoma2d/ffmpeg ffmpeg
|
||||
|
||||
cd ffmpeg_shared
|
||||
cd ffmpeg
|
||||
echo "*" >| .gitignore
|
||||
|
||||
echo ">>> Configuring to build ffmpeg (shared)"
|
||||
|
@ -65,56 +65,3 @@ echo ">>> Installing ffmpeg (shared)"
|
|||
sudo make install
|
||||
|
||||
sudo ldconfig
|
||||
|
||||
echo ">>> Configuring to build ffmpeg (static)"
|
||||
cd ../ffmpeg
|
||||
echo "*" >| .gitignore
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
||||
|
||||
./configure --prefix=/usr/local \
|
||||
--cc="$CC" \
|
||||
--cxx="$CXX" \
|
||||
--pkg-config-flags="--static" \
|
||||
--extra-cflags="-I/usr/local/include -static" \
|
||||
--extra-ldflags="-L/usr/local/lib -static" \
|
||||
--extra-ldexeflags="-static" \
|
||||
--enable-static \
|
||||
--enable-cross-compile \
|
||||
--enable-pic \
|
||||
--disable-shared \
|
||||
--enable-libopenh264 \
|
||||
--enable-pthreads \
|
||||
--enable-version3 \
|
||||
--enable-avresample \
|
||||
--enable-libmp3lame \
|
||||
--enable-libopus \
|
||||
--enable-libsnappy \
|
||||
--enable-libtheora \
|
||||
--enable-libvorbis \
|
||||
--enable-libvpx \
|
||||
--enable-libwebp \
|
||||
--enable-lzma \
|
||||
--enable-libfreetype \
|
||||
--enable-libopencore-amrnb \
|
||||
--enable-libopencore-amrwb \
|
||||
--enable-libspeex \
|
||||
--disable-ffplay \
|
||||
--disable-htmlpages \
|
||||
--disable-manpages \
|
||||
--disable-podpages \
|
||||
--disable-txtpages \
|
||||
--disable-libjack \
|
||||
--disable-indev=jack
|
||||
|
||||
echo ">>> Building ffmpeg (static)"
|
||||
make
|
||||
|
||||
echo ">>> Installing to tahoma2d/thirdparty/ffmpeg/bin"
|
||||
if [ ! -d bin ]
|
||||
then
|
||||
mkdir bin
|
||||
fi
|
||||
|
||||
cp ffmpeg ffprobe bin/
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#!/bin/bash
|
||||
cd thirdparty
|
||||
|
||||
echo ">>> Cloning opencv"
|
||||
git clone https://github.com/opencv/opencv.git
|
||||
git clone https://github.com/tahoma2d/opencv
|
||||
|
||||
cd opencv
|
||||
echo "*" >| .gitignore
|
||||
|
|
|
@ -35,14 +35,26 @@ mv appdir/usr/share/tahoma2d/stuff Tahoma2D/tahomastuff
|
|||
chmod -R 777 Tahoma2D/tahomastuff
|
||||
rmdir appdir/usr/share/tahoma2d
|
||||
|
||||
if [ -d ../../thirdparty/ffmpeg/bin ]
|
||||
if [ -d ../../thirdparty/apps/ffmpeg/bin ]
|
||||
then
|
||||
echo ">>> Copying FFmpeg to Tahoma2D/ffmpeg"
|
||||
if [ -d Tahoma2D/ffmpeg ]
|
||||
then
|
||||
rm -rf Tahoma2D/ffmpeg
|
||||
fi
|
||||
cp -R ../../thirdparty/ffmpeg/bin Tahoma2D/ffmpeg
|
||||
mkdir -p Tahoma2D/ffmpeg
|
||||
cp -R ../../thirdparty/apps/ffmpeg/bin/ffmpeg ../../thirdparty/apps/ffmpeg/bin/ffprobe Tahoma2D/ffmpeg
|
||||
fi
|
||||
|
||||
if [ -d ../../thirdparty/apps/rhubarb ]
|
||||
then
|
||||
echo ">>> Copying Rhubarb Lip Sync to Tahoma2D/rhubarb"
|
||||
if [ -d Tahoma2D/rhubarb ]
|
||||
then
|
||||
rm -rf Tahoma2D/rhubarb
|
||||
fi
|
||||
mkdir -p Tahoma2D/rhubarb
|
||||
cp -R ../../thirdparty/apps/rhubarb/rhubarb ../../thirdparty/apps/rhubarb/res Tahoma2D/rhubarb
|
||||
fi
|
||||
|
||||
echo ">>> Creating Tahoma2D/Tahoma2D.AppImage"
|
||||
|
|
28
ci-scripts/linux/tahoma-get3rdpartyapps.sh
Executable file
28
ci-scripts/linux/tahoma-get3rdpartyapps.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
cd thirdparty
|
||||
|
||||
if [ ! -d apps ]
|
||||
then
|
||||
mkdir apps
|
||||
fi
|
||||
cd apps
|
||||
echo "*" >| .gitignore
|
||||
|
||||
echo ">>> Getting FFmpeg"
|
||||
if [ -d ffmpeg ]
|
||||
then
|
||||
rm -rf ffmpeg
|
||||
fi
|
||||
wget https://github.com/tahoma2d/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-linux-static-lgpl.zip
|
||||
unzip ffmpeg-4.3.1-linux-static-lgpl.zip
|
||||
mv ffmpeg-4.3.1-linux-static-lgpl ffmpeg
|
||||
|
||||
|
||||
echo ">>> Getting Rhubarb Lip Sync"
|
||||
if [ -d rhubarb ]
|
||||
then
|
||||
rm -rf rhubarb ]
|
||||
fi
|
||||
wget https://github.com/tahoma2d/rhubarb-lip-sync/releases/download/v1.10.2/rhubarb-lip-sync-tahoma2d-linux.zip
|
||||
unzip rhubarb-lip-sync-tahoma2d-linux.zip -d rhubarb
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/bash
|
||||
sudo add-apt-repository --yes ppa:beineri/opt-qt597-xenial
|
||||
sudo add-apt-repository --yes ppa:achadwick/mypaint-testing
|
||||
sudo apt-get update
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/bash
|
||||
cd thirdparty
|
||||
|
||||
echo ">>> Cloning aom"
|
||||
|
@ -25,10 +26,9 @@ sudo make install
|
|||
cd ../..
|
||||
|
||||
echo ">>> Cloning ffmpeg"
|
||||
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
|
||||
cp -R ffmpeg ffmpeg_shared
|
||||
git clone https://github.com/tahoma2d/ffmpeg
|
||||
|
||||
cd ffmpeg_shared
|
||||
cd ffmpeg
|
||||
echo "*" >| .gitignore
|
||||
|
||||
echo ">>> Configuring to build ffmpeg (shared)"
|
||||
|
@ -73,37 +73,3 @@ make -j7 # runs 7 jobs in parallel
|
|||
echo ">>> Installing ffmpeg (shared)"
|
||||
sudo make install
|
||||
|
||||
echo ">>> Configuring to build ffmpeg (static)"
|
||||
cd ../ffmpeg
|
||||
echo "*" >| .gitignore
|
||||
|
||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
||||
export SDKROOT=`xcrun --show-sdk-path`
|
||||
./configure --prefix=/usr/local \
|
||||
--pkg-config-flags="--static" \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--enable-pic \
|
||||
--enable-pthreads \
|
||||
--enable-version3 \
|
||||
--enable-videotoolbox \
|
||||
--enable-avresample \
|
||||
--enable-libaom \
|
||||
--enable-libxml2 \
|
||||
--enable-libvpx \
|
||||
--disable-ffplay \
|
||||
--disable-sdl2 \
|
||||
--disable-libjack \
|
||||
--disable-libxcb \
|
||||
--disable-indev=jack
|
||||
|
||||
echo ">>> Building ffmpeg (static)"
|
||||
make -j7 # runs 7 jobs in parallel
|
||||
|
||||
echo ">>> Installing to tahoma2d/thirdparty/ffmpeg/bin"
|
||||
if [ ! -d bin ]
|
||||
then
|
||||
mkdir bin
|
||||
fi
|
||||
|
||||
cp ffmpeg ffprobe bin/
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#!/bin/bash
|
||||
cd thirdparty
|
||||
|
||||
echo ">>> Cloning opencv"
|
||||
git clone https://github.com/opencv/opencv.git
|
||||
git clone https://github.com/tahoma2d/opencv
|
||||
|
||||
cd opencv
|
||||
echo "*" >| .gitignore
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
cp -R stuff $TOONZDIR/Tahoma2D.app/tahomastuff
|
||||
chmod -R 777 $TOONZDIR/Tahoma2D.app/tahomastuff
|
||||
|
||||
if [ -d thirdparty/ffmpeg/bin ]
|
||||
if [ -d thirdparty/apps/ffmpeg/bin ]
|
||||
then
|
||||
echo ">>> Copying FFmpeg to $TOONZDIR/Tahoma2D.app/ffmpeg"
|
||||
if [ -d $TOONZDIR/Tahoma2D.app/ffmpeg ]
|
||||
|
@ -30,7 +30,20 @@ then
|
|||
# In case of prior builds, replace ffmpeg folder
|
||||
rm -rf $TOONZDIR/Tahoma2D.app/ffmpeg
|
||||
fi
|
||||
cp -R thirdparty/ffmpeg/bin $TOONZDIR/Tahoma2D.app/ffmpeg
|
||||
mkdir $TOONZDIR/Tahoma2D.app/ffmpeg
|
||||
cp -R thirdparty/apps/ffmpeg/bin/ffmpeg thirdparty/apps/ffmpeg/bin/ffprobe $TOONZDIR/Tahoma2D.app/ffmpeg
|
||||
fi
|
||||
|
||||
if [ -d thirdparty/apps/rhubarb ]
|
||||
then
|
||||
echo ">>> Copying Rhubarb Lip Sync to $TOONZDIR/Tahoma2D.app/rhubarb"
|
||||
if [ -d $TOONZDIR/Tahoma2D.app/rhubarb ]
|
||||
then
|
||||
# In case of prior builds, replace rhubarb folder
|
||||
rm -rf $TOONZDIR/Tahoma2D.app/rhubarb
|
||||
fi
|
||||
mkdir $TOONZDIR/Tahoma2D.app/rhubarb
|
||||
cp -R thirdparty/apps/rhubarb/rhubarb thirdparty/apps/rhubarb/res $TOONZDIR/Tahoma2D.app/rhubarb
|
||||
fi
|
||||
|
||||
if [ -d thirdparty/canon/Framework ]
|
||||
|
@ -77,3 +90,4 @@ echo ">>> Creating Tahoma2D-osx.dmg"
|
|||
$QTDIR/bin/macdeployqt $TOONZDIR/Tahoma2D.app -dmg -verbose=0
|
||||
|
||||
mv $TOONZDIR/Tahoma2D.dmg $TOONZDIR/../Tahoma2D-osx.dmg
|
||||
|
||||
|
|
28
ci-scripts/osx/tahoma-get3rdpartyapps.sh
Executable file
28
ci-scripts/osx/tahoma-get3rdpartyapps.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
cd thirdparty
|
||||
|
||||
if [ ! -d apps ]
|
||||
then
|
||||
mkdir apps
|
||||
fi
|
||||
cd apps
|
||||
echo "*" >| .gitignore
|
||||
|
||||
echo ">>> Getting FFmpeg"
|
||||
if [ -d ffmpeg ]
|
||||
then
|
||||
rm -rf ffmpeg
|
||||
fi
|
||||
wget https://github.com/tahoma2d/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-macos64-static-lgpl.zip
|
||||
unzip ffmpeg-4.3.1-macos64-static-lgpl.zip
|
||||
mv ffmpeg-4.3.1-macos64-static-lgpl ffmpeg
|
||||
|
||||
|
||||
echo ">>> Getting Rhubarb Lip Sync"
|
||||
if [ -d rhubarb ]
|
||||
then
|
||||
rm -rf rhubarb
|
||||
fi
|
||||
wget https://github.com/tahoma2d/rhubarb-lip-sync/releases/download/v1.10.2/rhubarb-lip-sync-tahoma2d-osx.zip
|
||||
unzip rhubarb-lip-sync-tahoma2d-osx.zip -d rhubarb
|
||||
|
9
stuff/doc/LICENSE/LICENSE_rhubarb.txt
Normal file
9
stuff/doc/LICENSE/LICENSE_rhubarb.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
Rhubarb Lip Sync is released under the MIT License (MIT).
|
||||
|
||||
Copyright (c) 2015-2016 Daniel Wolf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
7
stuff/doc/LICENSE/LICENSE_rhubarb_info.txt
Normal file
7
stuff/doc/LICENSE/LICENSE_rhubarb_info.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
Tahoma2D ships with Rhubarb Lip Sync, and uses Rhubarb Lip Sync through command line commands.
|
||||
Tahoma2D does not directly use Rhubarb Lip Sync libraries or code.
|
||||
|
||||
Rhubarb Lip Sync source code can be found at:
|
||||
https://github.com/tahoma2d/rhubarb-lip-sync
|
||||
or
|
||||
https://github.com/DanielSWolf/rhubarb-lip-sync
|
|
@ -1044,6 +1044,20 @@ bool TSystem::showDocument(const TFilePath &path) {
|
|||
#endif
|
||||
}
|
||||
|
||||
QString TSystem::findFileLocation(QStringList folderList, QString fileName) {
|
||||
if (folderList.isEmpty()) return "";
|
||||
|
||||
QStringList::iterator it;
|
||||
for (it = folderList.begin(); it != folderList.end(); it++) {
|
||||
QString path = *it + "/" + fileName;
|
||||
TFilePath fp(path);
|
||||
if (TSystem::doesExistFileOrLevel(fp) && !TFileStatus(fp).isDirectory())
|
||||
return *it;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <windows.h>
|
||||
|
|
|
@ -13,95 +13,88 @@
|
|||
#include "tmsgcore.h"
|
||||
|
||||
Ffmpeg::Ffmpeg() {
|
||||
m_ffmpegPath = Preferences::instance()->getFfmpegPath();
|
||||
m_ffmpegTimeout = Preferences::instance()->getFfmpegTimeout() * 1000;
|
||||
m_ffmpegPath = Preferences::instance()->getFfmpegPath();
|
||||
m_ffmpegTimeout = Preferences::instance()->getFfmpegTimeout();
|
||||
if (m_ffmpegTimeout > 0)
|
||||
m_ffmpegTimeout * 1000;
|
||||
else
|
||||
m_ffmpegTimeout = -1;
|
||||
std::string strPath = m_ffmpegPath.toStdString();
|
||||
m_intermediateFormat = "png";
|
||||
}
|
||||
Ffmpeg::~Ffmpeg() {}
|
||||
|
||||
bool Ffmpeg::checkFfmpeg() {
|
||||
// check the user defined path in preferences first
|
||||
QString path = Preferences::instance()->getFfmpegPath() + "/ffmpeg";
|
||||
QString exe = "ffmpeg";
|
||||
#if defined(_WIN32)
|
||||
path = path + ".exe";
|
||||
exe = exe + ".exe";
|
||||
#endif
|
||||
|
||||
// check the user defined path in preferences first
|
||||
QString path = Preferences::instance()->getFfmpegPath() + "/" + exe;
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true;
|
||||
|
||||
// check the Tahoma root directory next
|
||||
path = QDir::currentPath() + "/ffmpeg";
|
||||
#if defined(_WIN32)
|
||||
path = path + ".exe";
|
||||
#endif
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
|
||||
Preferences::instance()->setValue(ffmpegPath, QDir::currentPath());
|
||||
return true;
|
||||
}
|
||||
// Let's try and autodetect the exe included with release
|
||||
QStringList folderList;
|
||||
|
||||
folderList.append(".");
|
||||
folderList.append("./ffmpeg"); // ffmpeg folder
|
||||
|
||||
#ifdef MACOSX
|
||||
path = QDir::currentPath() + "/" +
|
||||
QString::fromStdString(TEnv::getApplicationFileName()) +
|
||||
".app/ffmpeg/ffmpeg";
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
|
||||
Preferences::instance()->setValue(
|
||||
ffmpegPath, QDir::currentPath() + "/" +
|
||||
QString::fromStdString(TEnv::getApplicationFileName()) +
|
||||
".app/ffmpeg/");
|
||||
return true;
|
||||
}
|
||||
// Look inside app
|
||||
folderList.append("./" +
|
||||
QString::fromStdString(TEnv::getApplicationFileName()) +
|
||||
".app/ffmpeg"); // ffmpeg folder
|
||||
#elif defined LINUX
|
||||
// Need to account for symbolic links
|
||||
folderList.append(TEnv::getWorkingDirectory().getQString() +
|
||||
"/ffmpeg"); // ffmpeg folder
|
||||
#endif
|
||||
|
||||
#ifdef LINUX
|
||||
QString currentPath = TEnv::getWorkingDirectory().getQString();
|
||||
path = currentPath + "/ffmpeg/ffmpeg";
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
|
||||
Preferences::instance()->setValue(ffmpegPath, currentPath + "/ffmpeg/");
|
||||
QString exePath = TSystem::findFileLocation(folderList, exe);
|
||||
|
||||
if (!exePath.isEmpty()) {
|
||||
Preferences::instance()->setValue(ffmpegPath, exePath);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// give up
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Ffmpeg::checkFfprobe() {
|
||||
// check the user defined path in preferences first
|
||||
QString path = Preferences::instance()->getFfmpegPath() + "/ffprobe";
|
||||
QString exe = "ffprobe";
|
||||
#if defined(_WIN32)
|
||||
path = path + ".exe";
|
||||
exe = exe + ".exe";
|
||||
#endif
|
||||
|
||||
// check the user defined path in preferences first
|
||||
QString path = Preferences::instance()->getFfmpegPath() + "/" + exe;
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true;
|
||||
|
||||
// check the Tahoma root directory next
|
||||
path = QDir::currentPath() + "/ffprobe";
|
||||
#if defined(_WIN32)
|
||||
path = path + ".exe";
|
||||
#endif
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
|
||||
Preferences::instance()->setValue(ffmpegPath, QDir::currentPath());
|
||||
return true;
|
||||
}
|
||||
// Let's try and autodetect the exe included with release
|
||||
QStringList folderList;
|
||||
|
||||
folderList.append(".");
|
||||
folderList.append("./ffmpeg"); // ffmpeg folder
|
||||
|
||||
#ifdef MACOSX
|
||||
path = QDir::currentPath() + "/" +
|
||||
QString::fromStdString(TEnv::getApplicationFileName()) +
|
||||
".app/ffmpeg/ffprobe";
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
|
||||
Preferences::instance()->setValue(
|
||||
ffmpegPath, QDir::currentPath() + "/" +
|
||||
QString::fromStdString(TEnv::getApplicationFileName()) +
|
||||
".app/ffmpeg/");
|
||||
return true;
|
||||
}
|
||||
// Look inside app
|
||||
folderList.append("./" +
|
||||
QString::fromStdString(TEnv::getApplicationFileName()) +
|
||||
".app/ffmpeg"); // ffmpeg folder
|
||||
#elif defined LINUX
|
||||
// Need to account for symbolic links
|
||||
folderList.append(TEnv::getWorkingDirectory().getQString() +
|
||||
"/ffmpeg"); // ffmpeg folder
|
||||
#endif
|
||||
|
||||
#ifdef LINUX
|
||||
QString currentPath = TEnv::getWorkingDirectory().getQString();
|
||||
path = currentPath + "/ffmpeg/ffprobe";
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
|
||||
Preferences::instance()->setValue(ffmpegPath, currentPath + "/ffmpeg/");
|
||||
QString exePath = TSystem::findFileLocation(folderList, exe);
|
||||
|
||||
if (!exePath.isEmpty()) {
|
||||
Preferences::instance()->setValue(ffmpegPath, exePath);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// give up
|
||||
return false;
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
private:
|
||||
QString m_intermediateFormat, m_ffmpegPath, m_audioPath, m_audioFormat;
|
||||
int m_frameCount = 0, m_lx, m_ly, m_bpp, m_bitsPerSample, m_channelCount,
|
||||
m_ffmpegTimeout = 30000, m_frameNumberOffset = -1;
|
||||
m_ffmpegTimeout = -1, m_frameNumberOffset = -1;
|
||||
double m_frameRate = 24.0;
|
||||
bool m_ffmpegExists = false, m_ffprobeExists = false, m_hasSoundTrack = false;
|
||||
TFilePath m_path;
|
||||
|
|
|
@ -282,6 +282,8 @@ public:
|
|||
QString getFfmpegPath() const { return getStringValue(ffmpegPath); }
|
||||
int getFfmpegTimeout() { return getIntValue(ffmpegTimeout); }
|
||||
QString getFastRenderPath() const { return getStringValue(fastRenderPath); }
|
||||
QString getRhubarbPath() const { return getStringValue(rhubarbPath); }
|
||||
int getRhubarbTimeout() { return getIntValue(rhubarbTimeout); }
|
||||
|
||||
// Drawing tab
|
||||
QString getScanLevelType() const { return getStringValue(scanLevelType); }
|
||||
|
|
|
@ -74,6 +74,8 @@ enum PreferencesItemId {
|
|||
ffmpegPath,
|
||||
ffmpegTimeout,
|
||||
fastRenderPath,
|
||||
rhubarbPath,
|
||||
rhubarbTimeout,
|
||||
|
||||
//----------
|
||||
// Drawing
|
||||
|
|
|
@ -263,6 +263,8 @@ DVAPI TFilePath toLocalPath(const TFilePath &fp);
|
|||
|
||||
DVAPI bool showDocument(const TFilePath &fp);
|
||||
|
||||
DVAPI QString findFileLocation(QStringList folderList, QString fileName);
|
||||
|
||||
#ifndef TNZCORE_LIGHT
|
||||
DVAPI QDateTime getFileTime(const TFilePath &path);
|
||||
DVAPI QString getHostName();
|
||||
|
|
|
@ -433,7 +433,7 @@ LipSyncPopup::LipSyncPopup()
|
|||
QHBoxLayout *optionsLay = new QHBoxLayout(this);
|
||||
optionsLay->setMargin(10);
|
||||
optionsLay->setSpacing(15);
|
||||
QHBoxLayout* insertAtLay = new QHBoxLayout(this);
|
||||
QHBoxLayout *insertAtLay = new QHBoxLayout(this);
|
||||
insertAtLay->setMargin(0);
|
||||
insertAtLay->setSpacing(4);
|
||||
m_insertAtLabel = new QLabel(tr("Insert at Frame: "));
|
||||
|
@ -477,6 +477,8 @@ LipSyncPopup::LipSyncPopup()
|
|||
SLOT(setPage(int)));
|
||||
|
||||
assert(ret);
|
||||
|
||||
m_rhubarbPath = "";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -515,6 +517,9 @@ void LipSyncPopup::showEvent(QShowEvent *) {
|
|||
m_isEditingLevel = app->getCurrentFrame()->isEditingLevel();
|
||||
m_startAt->setValue(row + 1);
|
||||
m_startAt->clearFocus();
|
||||
|
||||
if (checkRhubarb()) m_rhubarbPath = Preferences::instance()->getRhubarbPath();
|
||||
|
||||
TXshLevelHandle *level = app->getCurrentLevel();
|
||||
m_sl = level->getSimpleLevel();
|
||||
if (!m_sl) {
|
||||
|
@ -548,7 +553,6 @@ void LipSyncPopup::showEvent(QShowEvent *) {
|
|||
}
|
||||
refreshSoundLevels();
|
||||
onLevelChanged(-1);
|
||||
findRhubarb();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -686,53 +690,47 @@ void LipSyncPopup::saveAudio() {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
QString LipSyncPopup::findRhubarb() {
|
||||
QString path = QDir::currentPath() + "/rhubarb/rhubarb";
|
||||
bool found = false;
|
||||
bool LipSyncPopup::checkRhubarb() {
|
||||
QString exe = "rhubarb";
|
||||
#if defined(_WIN32)
|
||||
path = path + ".exe";
|
||||
exe = exe + ".exe";
|
||||
#endif
|
||||
|
||||
// check the user defined path in preferences first
|
||||
QString path = Preferences::instance()->getRhubarbPath() + "/" + exe;
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true;
|
||||
|
||||
// Let's try and autodetect the exe included with release
|
||||
QStringList folderList;
|
||||
|
||||
folderList.append(".");
|
||||
folderList.append("./rhubarb"); // rhubarb folder
|
||||
|
||||
#ifdef MACOSX
|
||||
path = QDir::currentPath() + "/" +
|
||||
QString::fromStdString(TEnv::getApplicationFileName()) +
|
||||
".app/rhubarb/rhubarb";
|
||||
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
|
||||
found = true;
|
||||
}
|
||||
|
||||
// Look inside app
|
||||
folderList.append("./" +
|
||||
QString::fromStdString(TEnv::getApplicationFileName()) +
|
||||
".app/rhubarb"); // rhubarb folder
|
||||
#elif defined LINUX
|
||||
// Need to account for symbolic links
|
||||
folderList.append(TEnv::getWorkingDirectory().getQString() +
|
||||
"/rhubarb"); // rhubarb folder
|
||||
#endif
|
||||
|
||||
std::string sPath = path.toStdString();
|
||||
if (!found && TSystem::doesExistFileOrLevel(TFilePath(path))) {
|
||||
found = true;
|
||||
QString exePath = TSystem::findFileLocation(folderList, exe);
|
||||
|
||||
if (!exePath.isEmpty()) {
|
||||
Preferences::instance()->setValue(rhubarbPath, exePath);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
m_tabBarContainer->show();
|
||||
if (m_tabBar->currentIndex() != m_stackedChooser->currentIndex())
|
||||
m_tabBar->setCurrentIndex(m_stackedChooser->currentIndex());
|
||||
int index = m_soundLevels->currentIndex();
|
||||
int count = m_soundLevels->count();
|
||||
if (index == count - 1) {
|
||||
m_audioFile->show();
|
||||
} else {
|
||||
m_audioFile->hide();
|
||||
}
|
||||
setPage(m_stackedChooser->currentIndex());
|
||||
return path;
|
||||
} else {
|
||||
m_tabBarContainer->hide();
|
||||
setPage(1);
|
||||
return QString("");
|
||||
}
|
||||
// give up
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void LipSyncPopup::runRhubarb() {
|
||||
QString path = findRhubarb();
|
||||
|
||||
QString cacheRoot = ToonzFolder::getCacheRootFolder().getQString();
|
||||
if (!TSystem::doesExistFileOrLevel(TFilePath(cacheRoot + "/rhubarb"))) {
|
||||
TSystem::mkDir(TFilePath(cacheRoot + "/rhubarb"));
|
||||
|
@ -772,17 +770,35 @@ void LipSyncPopup::runRhubarb() {
|
|||
m_progressDialog->show();
|
||||
connect(m_rhubarb, &QProcess::readyReadStandardError, this,
|
||||
&LipSyncPopup::onOutputReady);
|
||||
m_rhubarb->start(path, args);
|
||||
|
||||
QString rhubarbExe = m_rhubarbPath + "/rhubarb";
|
||||
#ifdef _WIN32
|
||||
rhubarbExe = rhubarbExe + ".exe";
|
||||
#endif
|
||||
m_rhubarb->start(rhubarbExe, args);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void LipSyncPopup::onOutputReady() {
|
||||
QString output = m_rhubarb->readAllStandardError().simplified();
|
||||
int index = output.lastIndexOf("%");
|
||||
QString newString = output.mid(index - 2, 2);
|
||||
m_progressDialog->setValue(newString.toInt());
|
||||
qDebug() << "output: " << output;
|
||||
QString output = m_rhubarb->readAllStandardError().simplified();
|
||||
output = output.replace("\\n", "\n")
|
||||
.replace("\\\\", "\\")
|
||||
.replace("\\\"", "")
|
||||
.replace("\"", "");
|
||||
QStringList outputList =
|
||||
output.mid(2, (output.size() - 4)).split(", ", QString::SkipEmptyParts);
|
||||
if (outputList.size()) {
|
||||
QStringList outputType = outputList.at(0).split(": ");
|
||||
if (outputType.at(1) == "progress") {
|
||||
QStringList outputValue = outputList.at(1).split(": ");
|
||||
double progress = outputValue.at(1).toDouble() * 100.0;
|
||||
m_progressDialog->setValue(progress);
|
||||
} else if (outputType.at(1) == "failure") {
|
||||
QStringList outputReason = outputList.at(1).split(": ");
|
||||
DVGui::warning(tr("Rhubarb Processing Error:\n\n") + outputReason.at(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -811,8 +827,19 @@ void LipSyncPopup::onApplyButton() {
|
|||
if (m_stackedChooser->currentIndex() == 0) {
|
||||
bool hasAudio = setAudioFile();
|
||||
if (!hasAudio) return;
|
||||
if (m_rhubarbPath.isEmpty() || m_rhubarbPath.isNull()) {
|
||||
DVGui::warning(
|
||||
tr("Rhubarb not found, please set the location in Preferences and "
|
||||
"restart."));
|
||||
return;
|
||||
}
|
||||
runRhubarb();
|
||||
m_rhubarb->waitForFinished();
|
||||
int rhubarbTimeout = Preferences::instance()->getRhubarbTimeout();
|
||||
if (rhubarbTimeout > 0)
|
||||
rhubarbTimeout * 1000;
|
||||
else
|
||||
rhubarbTimeout = -1;
|
||||
m_rhubarb->waitForFinished(rhubarbTimeout);
|
||||
m_progressDialog->hide();
|
||||
QString results = m_rhubarb->readAllStandardError();
|
||||
results += m_rhubarb->readAllStandardOutput();
|
||||
|
@ -820,12 +847,8 @@ void LipSyncPopup::onApplyButton() {
|
|||
int exitCode = -1;
|
||||
if (m_rhubarb->exitStatus() == QProcess::NormalExit) {
|
||||
exitCode = m_rhubarb->exitCode();
|
||||
if (exitCode != 0) {
|
||||
DVGui::warning(
|
||||
tr("An error occurred processing the audio. Please check the audio "
|
||||
"and try again."));
|
||||
return;
|
||||
}
|
||||
// onOuputReady will handle displaying any error messages from rhubarb
|
||||
if (exitCode != 0) return;
|
||||
}
|
||||
std::string strResults = results.toStdString();
|
||||
m_startAt->setValue(std::max(1, m_startFrame));
|
||||
|
|
|
@ -78,6 +78,7 @@ class LipSyncPopup final : public DVGui::Dialog {
|
|||
bool m_deleteFile = false;
|
||||
DVGui::ProgressDialog *m_progressDialog;
|
||||
QProcess *m_rhubarb;
|
||||
QString m_rhubarbPath;
|
||||
QFrame *m_audioFrame;
|
||||
QFrame *m_dataFrame;
|
||||
QStackedWidget *m_stackedChooser;
|
||||
|
@ -93,7 +94,7 @@ protected:
|
|||
void refreshSoundLevels();
|
||||
void saveAudio();
|
||||
void runRhubarb();
|
||||
QString findRhubarb();
|
||||
bool checkRhubarb();
|
||||
|
||||
public slots:
|
||||
void onApplyButton();
|
||||
|
|
|
@ -1042,9 +1042,11 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {
|
|||
{defaultProjectPath, tr("Default Project Path:")},
|
||||
|
||||
// Import / Export
|
||||
{ffmpegPath, tr("FFmpeg Path:")},
|
||||
{ffmpegTimeout, tr("FFmpeg Timeout:")},
|
||||
{fastRenderPath, tr("Fast Render Path:")},
|
||||
{ffmpegPath, tr("Executable Directory:")},
|
||||
{ffmpegTimeout, tr("Import/Export Timeout (seconds):")},
|
||||
{fastRenderPath, tr("Fast Render Output Directory:")},
|
||||
{rhubarbPath, tr("Executable Directory:")},
|
||||
{rhubarbTimeout, tr("Analyze Audio Timeout (seconds):")},
|
||||
|
||||
// Drawing
|
||||
{scanLevelType, tr("Scan File Format:")},
|
||||
|
@ -1269,9 +1271,9 @@ PreferencesPopup::PreferencesPopup()
|
|||
m_categoryList = new QListWidget(this);
|
||||
QStringList categories;
|
||||
categories << tr("General") << tr("Interface") << tr("Visualization")
|
||||
<< tr("Loading") << tr("Saving") << tr("Import/Export")
|
||||
<< tr("Drawing") << tr("Tools") << tr("Scene") << tr("Animation")
|
||||
<< tr("Preview") << tr("Onion Skin") << tr("Colors")
|
||||
<< tr("Loading") << tr("Saving") << tr("Drawing") << tr("Tools")
|
||||
<< tr("Scene") << tr("Animation") << tr("Preview")
|
||||
<< tr("Onion Skin") << tr("Colors") << tr("3rd Party Apps")
|
||||
<< tr("Version Control") << tr("Touch/Tablet Settings");
|
||||
m_categoryList->addItems(categories);
|
||||
m_categoryList->setFixedWidth(160);
|
||||
|
@ -1284,7 +1286,6 @@ PreferencesPopup::PreferencesPopup()
|
|||
m_stackedWidget->addWidget(createVisualizationPage());
|
||||
m_stackedWidget->addWidget(createLoadingPage());
|
||||
m_stackedWidget->addWidget(createSavingPage());
|
||||
m_stackedWidget->addWidget(createImportExportPage());
|
||||
m_stackedWidget->addWidget(createDrawingPage());
|
||||
m_stackedWidget->addWidget(createToolsPage());
|
||||
m_stackedWidget->addWidget(createXsheetPage());
|
||||
|
@ -1292,6 +1293,7 @@ PreferencesPopup::PreferencesPopup()
|
|||
m_stackedWidget->addWidget(createPreviewPage());
|
||||
m_stackedWidget->addWidget(createOnionSkinPage());
|
||||
m_stackedWidget->addWidget(createColorsPage());
|
||||
m_stackedWidget->addWidget(createImportExportPage());
|
||||
m_stackedWidget->addWidget(createVersionControlPage());
|
||||
m_stackedWidget->addWidget(createTouchTabletPage());
|
||||
// createImportPrefsPage() must always be last
|
||||
|
@ -1603,6 +1605,8 @@ QWidget* PreferencesPopup::createSavingPage() {
|
|||
insertUI(resetUndoOnSavingLevel, lay);
|
||||
insertUI(doNotShowPopupSaveScene, lay);
|
||||
|
||||
insertUI(fastRenderPath, lay);
|
||||
|
||||
lay->setRowStretch(lay->rowCount(), 1);
|
||||
widget->setLayout(lay);
|
||||
return widget;
|
||||
|
@ -1619,26 +1623,21 @@ QWidget* PreferencesPopup::createImportExportPage() {
|
|||
QWidget* widget = new QWidget(this);
|
||||
QGridLayout* lay = new QGridLayout();
|
||||
setupLayout(lay);
|
||||
|
||||
putLabel(
|
||||
tr("Tahoma2D can use FFmpeg for additional file formats.\n") +
|
||||
tr("FFmpeg is bundled with Tahoma2D,\n") +
|
||||
tr("but you can provide the path to a different ffmpeg location."),
|
||||
lay);
|
||||
insertUI(ffmpegPath, lay);
|
||||
|
||||
putLabel(tr("Number of seconds to wait for FFmpeg to complete processing the "
|
||||
"output:"),
|
||||
putLabel(tr("External applications used by Tahoma2D.\nThese come bundled "
|
||||
"with Tahoma2D, but you can set path to a different version."),
|
||||
lay);
|
||||
putLabel(
|
||||
tr("Note: FFmpeg begins working once all images have been processed."),
|
||||
lay);
|
||||
insertUI(ffmpegTimeout, lay);
|
||||
|
||||
putLabel(tr("Please indicate where you would like exports from Fast "
|
||||
"Render (MP4) to go."),
|
||||
lay);
|
||||
insertUI(fastRenderPath, lay);
|
||||
QGridLayout* ffmpegOptionsLay = insertGroupBox(tr("FFmpeg"), lay);
|
||||
{
|
||||
insertUI(ffmpegPath, ffmpegOptionsLay);
|
||||
insertUI(ffmpegTimeout, ffmpegOptionsLay);
|
||||
}
|
||||
|
||||
QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb Lip Sync"), lay);
|
||||
{
|
||||
insertUI(rhubarbPath, rhubarbOptionsLay);
|
||||
insertUI(rhubarbTimeout, rhubarbOptionsLay);
|
||||
}
|
||||
|
||||
lay->setRowStretch(lay->rowCount(), 1);
|
||||
insertFootNote(lay);
|
||||
|
@ -2134,7 +2133,8 @@ void PreferencesPopup::onImport() {
|
|||
DVGui::warning("Failed to process Settings.\nCould not find " +
|
||||
srcDir.getQString());
|
||||
else {
|
||||
QString origFfmpegPath = Preferences::instance()->getFfmpegPath();
|
||||
QString origFfmpegPath = Preferences::instance()->getFfmpegPath();
|
||||
QString origRhubarbPath = Preferences::instance()->getRhubarbPath();
|
||||
|
||||
QFileInfoList fil = QDir(toQString(srcDir)).entryInfoList();
|
||||
int i;
|
||||
|
@ -2155,6 +2155,7 @@ void PreferencesPopup::onImport() {
|
|||
// it to find it again otherwise it will point to old location
|
||||
Preferences::instance()->load();
|
||||
Preferences::instance()->setValue(ffmpegPath, origFfmpegPath);
|
||||
Preferences::instance()->setValue(rhubarbPath, origRhubarbPath);
|
||||
}
|
||||
|
||||
if (useLegacy) {
|
||||
|
|
|
@ -446,9 +446,12 @@ void Preferences::definePreferenceItems() {
|
|||
|
||||
// Import / Export
|
||||
define(ffmpegPath, "ffmpegPath", QMetaType::QString, "");
|
||||
define(ffmpegTimeout, "ffmpegTimeout", QMetaType::Int, 600, 1,
|
||||
define(ffmpegTimeout, "ffmpegTimeout", QMetaType::Int, 0, 0,
|
||||
std::numeric_limits<int>::max());
|
||||
define(fastRenderPath, "fastRenderPath", QMetaType::QString, "desktop");
|
||||
define(rhubarbPath, "rhubarbPath", QMetaType::QString, "");
|
||||
define(rhubarbTimeout, "rhubarbTimeout", QMetaType::Int, 0, 0,
|
||||
std::numeric_limits<int>::max());
|
||||
|
||||
// Drawing
|
||||
define(scanLevelType, "scanLevelType", QMetaType::QString, "tif");
|
||||
|
|
Loading…
Reference in a new issue