Commit b1dfac79 authored by Matěj Laitl's avatar Matěj Laitl
Browse files

TranscodingJob: don't pass -n to ffmpeg, check file existence manually

BUGFIXES:
 * Transcoding: fix compatibility with libav's ffmpeg

BUG: 300551
FIXED-IN: 2.6
DIGEST: Bugfix
parent 5bf3f7be
......@@ -94,6 +94,7 @@ VERSION 2.6-Beta 1
"1.2 GB free" is shown instead of "85% used"; thicker capacity bar.
BUGFIXES:
* Transcoding: fix compatibility with libav's ffmpeg. (BR 300551)
* Saved lyrics are preserved when the track is moved. (BR 242350)
* Lyrics, labels and album actions are correctly displayed for tracks
from main and saved playlists on Amarok startup. (BR 299150)
......
......@@ -21,6 +21,9 @@
#include <KProcess>
#include <QFile>
#include <QTimer>
namespace Transcoding
{
......@@ -66,8 +69,11 @@ Job::init()
//First the executable...
m_transcoder->setProgram( "ffmpeg" );
//... no not overwrite output files but exit if file exists, otherwise ffmpeg is interactive and hangs
*m_transcoder << QString( "-n" );
//... prevent ffmpeg from being interactive when destination file already exists. We
// would use -n to exit immediatelly, but libav's ffmpeg doesn't support it, so we
// check for destination file existence manually and pass -y (overwrite) to avoid
// race condition
*m_transcoder << QString( "-y" );
//... then we'd have the infile configuration followed by "-i" and the infile path...
*m_transcoder << QString( "-i" )
<< m_src.path();
......@@ -86,9 +92,17 @@ void
Job::start()
{
DEBUG_BLOCK
QString commandline = QString( "'" ) + m_transcoder->program().join("' '") + QString( "'" );
debug()<< "Calling" << commandline.toLocal8Bit().constData();
m_transcoder->start();
if( QFile::exists( m_dest.path() ) )
{
debug() << "Not starting ffmpeg encoder, file already exists:" << m_dest.path();
QTimer::singleShot( 0, this, SLOT(transcoderDone()) );
}
else
{
QString commandline = QString( "'" ) + m_transcoder->program().join("' '") + QString( "'" );
debug()<< "Calling" << commandline.toLocal8Bit().constData();
m_transcoder->start();
}
}
void
......
......@@ -88,7 +88,11 @@ public:
private slots:
void processOutput();
void transcoderDone( int exitCode, QProcess::ExitStatus exitStatus );
/**
* Default arguments are for convenience (read: lazyness) so that this can be
* connected to QTimer::singleShot()
*/
void transcoderDone( int exitCode = -1, QProcess::ExitStatus exitStatus = QProcess::CrashExit );
void init();
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment