QtlMovie 1.12 (A specialized FFmpeg front-end)
QtlMovieJob Class Reference

A complete transcoding job. More...

Inheritance diagram for QtlMovieJob:
QtlMovieAction QtlLogger

Public Member Functions

 QtlMovieJob (QtlMovieTask *task, const QtlMovieSettings *settings, QtlLogger *log, QObject *parent=0)
 Constructor. More...
 
virtual void abort () Q_DECL_OVERRIDE
 Abort the transcoding job. More...
 
int currentActionCount () const
 Get the index of currently executing action. More...
 
int currentProgress (int currentActionProgress, int currentActionMaximum=100, int jobMaximum=100) const
 Get an indication of the total progress within the job. More...
 
QStringList getVariable (const QString &name) const
 Get the value of a variable in the job. More...
 
void setVariable (const QString &name, const QStringList &value)
 Store a variable in the job. More...
 
virtual bool start () Q_DECL_OVERRIDE
 Start the transcoding job. More...
 
QtlMovieTasktask () const
 Get the task to process. More...
 
int totalActionCount () const
 Get the total number of actions in this job. More...
 
- Public Member Functions inherited from QtlMovieAction
 QtlMovieAction (const QtlMovieSettings *settings, QtlLogger *log, QObject *parent=0)
 Constructor. More...
 
virtual ~QtlMovieAction ()
 Virtual destructor. More...
 
virtual void debug (const QString &line, const QColor &color=QColor()) Q_DECL_OVERRIDE
 Log a line of debug text. More...
 
QString description () const
 Get the description of the action. More...
 
int elapsedSeconds () const
 Get the number of seconds since the action started. More...
 
bool isCompleted () const
 Check if the action is completed. More...
 
bool isSilent () const
 Check if unimportant messages are skipped. More...
 
bool isStarted () const
 Check if the action was started (and possibly completed in the meantime). More...
 
virtual void line (const QString &line, const QColor &color=QColor()) Q_DECL_OVERRIDE
 Log a line of text. More...
 
void setDescription (const QString &description)
 Set the description of the action. More...
 
void setSilent (bool silent)
 Set if unimportant messages are skipped. More...
 
const QtlMovieSettingssettings () const
 Get the application settings. More...
 
virtual void text (const QString &text) Q_DECL_OVERRIDE
 Log text. More...
 

Static Public Member Functions

static bool canInsertSubtitles (const QString &subtitleFileName)
 Check if it is possible to insert subtitles from the specified file. More...
 
static bool canTranscode (const QtlMovieInputFile *inputFile, QtlMovieOutputFile::OutputType outputType)
 Check if it is possible to transcode an input file (with its streams selections) to an output type. More...
 

Protected Member Functions

virtual void emitCompleted (bool success, const QString &message=QString()) Q_DECL_OVERRIDE
 Emit the completed() signal. More...
 
- Protected Member Functions inherited from QtlMovieAction
virtual void emitProgress (int current, int maximum, int remainingSeconds=-1)
 Emit the progress() signal. More...
 

Private Slots

void actionCompleted (bool success)
 Invoked each time an action completes. More...
 

Private Member Functions

 QtlMovieJob () Q_DECL_EQ_DELETE
 
bool abortStart (const QString &message, bool result=false)
 Report an error during start() and abort the job. More...
 
bool addBurnDvd (const QString &isoFile, const QString &dvdBurner)
 Add the process for burning a DVD ISO image. More...
 
bool addExtractSubtitle (const QtlMovieInputFile *inputFile, QString &outputFileName, bool &internallyCreated, bool convertSsaToSrt, bool srtMandatory)
 Add a process for extracting subtitles into a file. More...
 
bool addFFmpeg (const QString &description, const QStringList ffmpegArguments, bool originalInput)
 Add an FFmpeg process in the process list. More...
 
bool addSubtitleFileVideoFilter (QString &videoFilters, int widthIn, int heightIn, const QString &subtitleFileName)
 Compute an FFmpeg video filter for burning subtitles from an external file into video. More...
 
bool addSubtitleStreamVideoFilter (QString &videoFilters, const QtlMovieInputFile *inputFile, int widthOut, int heightOut)
 Compute an FFmpeg video filter for burning subtitles from a stream of the input file into video. More...
 
bool addTextSubtitleFileVideoFilter (QString &videoFilters, const QString &filterName, int widthIn, int heightIn, const QString &subtitleFileName)
 Compute an FFmpeg video filter for burning text subtitles from an external file into video. More...
 
bool addTranscodeAudioVideoToDvd (const QtlMovieInputFile *inputFile, const QString &outputFileName)
 Add the processes for simple audio/video transcoding to DVD. More...
 
bool addTranscodeToAvi (const QtlMovieInputFile *inputFile, const QString &outputFileName)
 Add a process for transcoding to AVI. More...
 
bool addTranscodeToDvdFile (const QtlMovieInputFile *inputFile, const QString &outputFileName)
 Add the processes for transcoding to a final DVD media file. More...
 
bool addTranscodeToDvdIsoImage (const QtlMovieInputFile *inputFile, const QString &outputFileName)
 Add the processes for transcoding to a DVD ISO image. More...
 
bool addTranscodeToMp4 (const QtlMovieInputFile *inputFile, const QString &outputFileName, const QtlMovieDeviceProfile &profile, int videoQuality)
 Add a process for transcoding to MP4 (iPad, iPhone). More...
 
bool buildScenario ()
 Build the list of actions to execute to perform the job. More...
 
QStringList chapterOptions (int totalSeconds, int chapterSeconds)
 Build a DVD Author option list to create chapters. More...
 
void cleanup ()
 Cleanup the job environment. More...
 
void setExternalSubtitleFileName (QtlMovieInputFile *&inputFile, const QString &subtitleFile)
 Change the name of the external subtitle file. More...
 
bool startNextAction ()
 Start the next action in the list. More...
 

Private Attributes

int _actionCount
 Number of actions to execute on start. More...
 
QList< QtlMovieAction * > _actionList
 List of actions to execute. More...
 
int _outSeconds
 Output file duration in seconds. More...
 
QtlMovieTask_task
 Task to process. More...
 
QString _tempDir
 Directory of temporary files, to delete after completion. More...
 
QMap< QString, QStringList > _variables
 Set of job variables. More...
 

Additional Inherited Members

- Signals inherited from QtlMovieAction
void completed (bool success)
 Emitted when the action completes. More...
 
void progress (const QString &description, int current, int maximum, int elapsedSeconds, int remainingSeconds)
 Emitted when some progress in the reporting is available. More...
 
void started ()
 Emitted when the action starts. More...
 

Detailed Description

A complete transcoding job.

Involves one or more QtlMovieAction.

Constructor & Destructor Documentation

◆ QtlMovieJob() [1/2]

QtlMovieJob::QtlMovieJob ( QtlMovieTask task,
const QtlMovieSettings settings,
QtlLogger log,
QObject *  parent = 0 
)

Constructor.

Parameters
[in]taskThe task to process.
[in]settingsApplication settings.
[in]logMessage logger.
[in]parentOptional parent object.

◆ QtlMovieJob() [2/2]

QtlMovieJob::QtlMovieJob ( )
private

Member Function Documentation

◆ start()

bool QtlMovieJob::start ( )
virtual

Start the transcoding job.

Returns
False if already started. True otherwise.

Reimplemented from QtlMovieAction.

◆ abort()

void QtlMovieJob::abort ( )
virtual

Abort the transcoding job.

If the job was started, the signal completed() will be emitted when all actions actually terminate.

Reimplemented from QtlMovieAction.

◆ task()

QtlMovieTask* QtlMovieJob::task ( ) const
inline

Get the task to process.

Returns
The task to process.

◆ totalActionCount()

int QtlMovieJob::totalActionCount ( ) const
inline

Get the total number of actions in this job.

Available after start.

Returns
The total number of actions in this job.

◆ currentActionCount()

int QtlMovieJob::currentActionCount ( ) const
inline

Get the index of currently executing action.

Available after start.

Returns
The index of currently executing action.

◆ currentProgress()

int QtlMovieJob::currentProgress ( int  currentActionProgress,
int  currentActionMaximum = 100,
int  jobMaximum = 100 
) const

Get an indication of the total progress within the job.

Given an estimation of the progress within the current action, we return an estimation of the progress in the entire job. We assume that all actions have the same duration, which is of course wrong.

Parameters
[in]currentActionProgressCurrent progress in the current action. Shall be in the range 0 to currentActionMaximum.
[in]currentActionMaximumValue for completion of the current action.
[in]jobMaximumValue for completion of the entire job.
Returns
A value between 0 and jobMaximum indicating the progression in the entire job.

◆ setVariable()

void QtlMovieJob::setVariable ( const QString &  name,
const QStringList &  value 
)

Store a variable in the job.

Parameters
[in]nameVariable name.
[in]valueVariable value as a list of strings.

◆ getVariable()

QStringList QtlMovieJob::getVariable ( const QString &  name) const

Get the value of a variable in the job.

Parameters
[in]nameVariable name.
Returns
Variable value as a list of strings.

◆ canTranscode()

bool QtlMovieJob::canTranscode ( const QtlMovieInputFile inputFile,
QtlMovieOutputFile::OutputType  outputType 
)
static

Check if it is possible to transcode an input file (with its streams selections) to an output type.

Parameters
[in]inputFileThe input file.
[in]outputTypeThe target output type.
Returns
True if transcoding is allowed, false otherwise.

◆ canInsertSubtitles()

bool QtlMovieJob::canInsertSubtitles ( const QString &  subtitleFileName)
static

Check if it is possible to insert subtitles from the specified file.

Parameters
[in]subtitleFileNameThe subtitle file.
Returns
True if subtitle insertion is possible, false otherwise.

◆ emitCompleted()

void QtlMovieJob::emitCompleted ( bool  success,
const QString &  message = QString() 
)
protectedvirtual

Emit the completed() signal.

Parameters
[in]successTrue when the action completed successfully, false otherwise.
[in]messageOptional error message to log.

Reimplemented from QtlMovieAction.

◆ actionCompleted

void QtlMovieJob::actionCompleted ( bool  success)
privateslot

Invoked each time an action completes.

Parameters
[in]successIndicates whether the action succeeded or failed.

◆ cleanup()

void QtlMovieJob::cleanup ( )
private

Cleanup the job environment.

◆ buildScenario()

bool QtlMovieJob::buildScenario ( )
private

Build the list of actions to execute to perform the job.

Returns
True on success, false on error (job aborted).

◆ abortStart()

bool QtlMovieJob::abortStart ( const QString &  message,
bool  result = false 
)
private

Report an error during start() and abort the job.

The error message is reported both in a message box and in the log.

Parameters
[in]messageMessage to display.
[in]resultThe value to return, false by default.
Returns
The specified result, false by default.

◆ startNextAction()

bool QtlMovieJob::startNextAction ( )
private

Start the next action in the list.

Returns
True on success, false on error (not started).

◆ addFFmpeg()

bool QtlMovieJob::addFFmpeg ( const QString &  description,
const QStringList  ffmpegArguments,
bool  originalInput 
)
private

Add an FFmpeg process in the process list.

Parameters
[in]descriptionDescription of this process.
[in]ffmpegArgumentsFFmpeg arguments, empty meaning error.
[in]originalInputIf true, the input is the original input file, otherwise it is some intermediate file.
Returns
True on success, false on error.

◆ addSubtitleFileVideoFilter()

bool QtlMovieJob::addSubtitleFileVideoFilter ( QString &  videoFilters,
int  widthIn,
int  heightIn,
const QString &  subtitleFileName 
)
private

Compute an FFmpeg video filter for burning subtitles from an external file into video.

Parameters
[in,out]videoFiltersA video filter string which is updated.
[in]widthInInput video width in pixels.
[in]heightInInput video height in pixels.
[in]subtitleFileNameName of the subtitle file.
Returns
True is success, false on error (message already reported).

◆ addTextSubtitleFileVideoFilter()

bool QtlMovieJob::addTextSubtitleFileVideoFilter ( QString &  videoFilters,
const QString &  filterName,
int  widthIn,
int  heightIn,
const QString &  subtitleFileName 
)
private

Compute an FFmpeg video filter for burning text subtitles from an external file into video.

Parameters
[in,out]videoFiltersA video filter string which is updated.
[in]filterNameFilter name, usually "subtitles" or "ass".
[in]widthInInput video width in pixels.
[in]heightInInput video height in pixels.
[in]subtitleFileNameName of the subtitle file.
Returns
True is success, false on error (message already reported).

◆ addSubtitleStreamVideoFilter()

bool QtlMovieJob::addSubtitleStreamVideoFilter ( QString &  videoFilters,
const QtlMovieInputFile inputFile,
int  widthOut,
int  heightOut 
)
private

Compute an FFmpeg video filter for burning subtitles from a stream of the input file into video.

Parameters
[in,out]videoFiltersA video filter string which is updated.
[in]inputFileInput file with one selected subtitle stream.
[in]widthOutOutput video width in pixels.
[in]heightOutOutput video height in pixels.
Returns
True is success, false on error (message already reported).

◆ chapterOptions()

QStringList QtlMovieJob::chapterOptions ( int  totalSeconds,
int  chapterSeconds 
)
private

Build a DVD Author option list to create chapters.

Parameters
[in]totalSecondsTotal duration of the movie in seconds or zero if unknown.
[in]chapterSecondsDuration of a chapter in seconds or zero if none.
Returns
DVD Author option list. Empty if either movie or chapter duration is unknown.

◆ addTranscodeAudioVideoToDvd()

bool QtlMovieJob::addTranscodeAudioVideoToDvd ( const QtlMovieInputFile inputFile,
const QString &  outputFileName 
)
private

Add the processes for simple audio/video transcoding to DVD.

Parameters
[in]inputFileThe input file.
[in]outputFileNameThe output file name.
Returns
True on success, false on error.

◆ addTranscodeToDvdFile()

bool QtlMovieJob::addTranscodeToDvdFile ( const QtlMovieInputFile inputFile,
const QString &  outputFileName 
)
private

Add the processes for transcoding to a final DVD media file.

Parameters
[in]inputFileThe input file.
[in]outputFileNameThe output file name.
Returns
True on success, false on error.

◆ addTranscodeToDvdIsoImage()

bool QtlMovieJob::addTranscodeToDvdIsoImage ( const QtlMovieInputFile inputFile,
const QString &  outputFileName 
)
private

Add the processes for transcoding to a DVD ISO image.

Parameters
[in]inputFileThe input file.
[in]outputFileNameThe output file name.
Returns
True on success, false on error.

◆ addBurnDvd()

bool QtlMovieJob::addBurnDvd ( const QString &  isoFile,
const QString &  dvdBurner 
)
private

Add the process for burning a DVD ISO image.

Parameters
[in]isoFileThe input ISO image.
[in]dvdBurnerThe DVD burner drive name (see QtlOpticalDrive::name()).
Returns
True on success, false on error.

◆ addTranscodeToMp4()

bool QtlMovieJob::addTranscodeToMp4 ( const QtlMovieInputFile inputFile,
const QString &  outputFileName,
const QtlMovieDeviceProfile profile,
int  videoQuality 
)
private

Add a process for transcoding to MP4 (iPad, iPhone).

Parameters
[in]inputFileThe input file.
[in]outputFileNameThe output file name.
[in]profileDescription of output device.
[in]videoQualityVideo quality indicator in bits / frame / 100 pixels.
Returns
True on success, false on error.

◆ addTranscodeToAvi()

bool QtlMovieJob::addTranscodeToAvi ( const QtlMovieInputFile inputFile,
const QString &  outputFileName 
)
private

Add a process for transcoding to AVI.

Parameters
[in]inputFileThe input file.
[in]outputFileNameThe output file name.
Returns
True on success, false on error.

◆ addExtractSubtitle()

bool QtlMovieJob::addExtractSubtitle ( const QtlMovieInputFile inputFile,
QString &  outputFileName,
bool &  internallyCreated,
bool  convertSsaToSrt,
bool  srtMandatory 
)
private

Add a process for extracting subtitles into a file.

The supported input subtitle types are SRT, SSA, ASS and Teletext (MPEG-TS input file only).

Parameters
[in]inputFileThe input file.
[in,out]outputFileNameThe output subtitle file name. Its suffix, when present, is used to determine the output subtitle format. Without suffix, the appropriate type is automatically selected and the file name is updated.
[out]internallyCreatedReturned as true if the subtitles file is internally created, using code from this application. Returned as false when the subtitles files is created by some external tool such as ffmpeg or ccextractor.
[in]convertSsaToSrtIf true, the SSA/ASS subtitles are converted to SRT.
[in]srtMandatoryIf true, the output format must be SRT, otherwise fails.
Returns
True on success, false on error (unsupported subtitle type for instance).

◆ setExternalSubtitleFileName()

void QtlMovieJob::setExternalSubtitleFileName ( QtlMovieInputFile *&  inputFile,
const QString &  subtitleFile 
)
private

Change the name of the external subtitle file.

Parameters
[in,out]inputFileA pointer to the input file. The pointer value is updated it previously contains a pointer to the original input file. In that case, a new input file object is created. It will be deleted with this job instance.
[in]subtitleFileThe new subtitle file name. Ignored if empty.

Member Data Documentation

◆ _task

QtlMovieTask* QtlMovieJob::_task
private

Task to process.

◆ _outSeconds

int QtlMovieJob::_outSeconds
private

Output file duration in seconds.

◆ _actionCount

int QtlMovieJob::_actionCount
private

Number of actions to execute on start.

◆ _tempDir

QString QtlMovieJob::_tempDir
private

Directory of temporary files, to delete after completion.

◆ _actionList

QList<QtlMovieAction*> QtlMovieJob::_actionList
private

List of actions to execute.

◆ _variables

QMap<QString,QStringList> QtlMovieJob::_variables
private

Set of job variables.


The documentation for this class was generated from the following files: