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

An execution of a media tool process. More...

Inheritance diagram for QtlMovieProcess:
QtlMovieAction QtlLogger QtlMovieCcExtractorProcess QtlMovieClosedCaptionsSearch QtlMovieDvdAuthorProcess QtlMovieFFmpegProcess QtlMovieGrowisofsProcess QtlMovieMkisofsProcess QtlMovieFFmpegVolumeDetect

Signals

void readyReadOutputData ()
 Emitted when some binary data are available from standard output. More...
 
- 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...
 

Public Member Functions

 QtlMovieProcess (const QtlMovieExecFile *execFile, const QStringList &arguments, bool hasBinaryOutput, const QtlMovieSettings *settings, QtlLogger *log, QObject *parent=0, QtlDataPull *dataPull=0)
 Constructor. More...
 
virtual void abort () Q_DECL_OVERRIDE
 Abort process execution. More...
 
QStringList arguments () const
 Get the command line arguments. More...
 
const QtlMovieExecFileexecFile () const
 Get the command executable file. More...
 
QIODevice * outputDevice () const
 Return the device from which standard output can be read. More...
 
void setArguments (const QStringList &arguments)
 Set the command line arguments. More...
 
void setPriority (Qtl::ProcessPriority priority)
 Set the process priority. More...
 
virtual bool start () Q_DECL_OVERRIDE
 Start the process. More...
 
bool useDataPullProgressReport (bool on)
 Use the progress report from the QtlDataPull when possible. More...
 
bool useDataPullProgressReport () const
 Check if progress report from the QtlDataPull is active. 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...
 

Protected Member Functions

QStringList getJobVariable (const QString &name) const
 Get the value of a variable in the job. More...
 
virtual void processOutputLine (QProcess::ProcessChannel channel, const QString &textLine)
 Process one text line from standard error or standard output. More...
 
void setJobVariable (const QString &name, const QStringList &value)
 Store a variable in the parent job. More...
 
virtual void updateEnvironment (QProcessEnvironment &env)
 Update the QProcessEnvironment for the target process before it starts. More...
 
- Protected Member Functions inherited from QtlMovieAction
virtual void emitCompleted (bool success, const QString &message=QString())
 Emit the completed() signal. More...
 
virtual void emitProgress (int current, int maximum, int remainingSeconds=-1)
 Emit the progress() signal. More...
 

Private Slots

void dataPullProgressed (qint64 current, qint64 maximum)
 Invoked when some progress in the QtlDataPull is available. More...
 
void processError (QProcess::ProcessError error)
 Invoked when an error occurs on the process. More...
 
void processFinished (int exitCode, QProcess::ExitStatus exitStatus)
 Invoked when the process is finished. More...
 
void readData ()
 Read as much data as possible from the process standard error (and standard output if hasBinaryOutput is false). More...
 

Private Member Functions

 QtlMovieProcess () Q_DECL_EQ_DELETE
 
void processCompleted (bool success, const QString &message=QString())
 Process the termination of the process. More...
 
void processOutputBuffer (QProcess::ProcessChannel channel, QString &buffer)
 Process a standard error or standard output buffer. More...
 

Private Attributes

QStringList _arguments
 Command line arguments. More...
 
QtlDataPull_dataPull
 Process input. More...
 
bool _dpProgress
 True if dataPullProgressed() was successfully set. More...
 
const QtlMovieExecFile_execFile
 Process executable file. More...
 
bool _gotError
 The process reported an error. More...
 
bool _hasBinaryOutput
 Treat standard output as binary data. More...
 
QtlProcess_process
 Process instance. More...
 
QProcess::ProcessError _processError
 Last reported error. More...
 
QString _stdError
 Standard error buffer. More...
 
QString _stdOutput
 Standard error buffer. More...
 

Detailed Description

An execution of a media tool process.

Text lines from standard error are logged but can be intercepted by subclasses overwriting processOutputLine().

The standard output can be either text (in which case it is processed in the same way as standard error) or binary data. In the later case, availability of standard output data is signaled by readyReadOutputData(). Standard output data can be read from outputDevice().

The progress report can be signaled by progress(). Emitting this signal is entirely up to the subclass.

Constructor & Destructor Documentation

◆ QtlMovieProcess() [1/2]

QtlMovieProcess::QtlMovieProcess ( const QtlMovieExecFile execFile,
const QStringList &  arguments,
bool  hasBinaryOutput,
const QtlMovieSettings settings,
QtlLogger log,
QObject *  parent = 0,
QtlDataPull dataPull = 0 
)

Constructor.

Parameters
[in]execFileProcess executable file.
[in]argumentsCommand line arguments.
[in]hasBinaryOutputWhen true, the standard output must be read from another object. Availability of data is signaled by readyReadOutputData(). When false, the standard output is logged, just like the standard error.
[in]settingsApplication settings.
[in]logMessage logger.
[in]parentOptional parent object.
[in]dataPullIf non zero, used to feed the standard input of the process.

◆ QtlMovieProcess() [2/2]

QtlMovieProcess::QtlMovieProcess ( )
private

Member Function Documentation

◆ start()

bool QtlMovieProcess::start ( )
virtual

Start the process.

Returns
False if already started. True otherwise.

Reimplemented from QtlMovieAction.

Reimplemented in QtlMovieFFmpegProcess, and QtlMovieDvdAuthorProcess.

◆ abort()

void QtlMovieProcess::abort ( )
virtual

Abort process execution.

If the process was started, the signal completed() will be emitted when the process actually terminates.

Reimplemented from QtlMovieAction.

◆ execFile()

const QtlMovieExecFile* QtlMovieProcess::execFile ( ) const
inline

Get the command executable file.

Returns
The command executable file.

◆ arguments()

QStringList QtlMovieProcess::arguments ( ) const
inline

Get the command line arguments.

Returns
The command line arguments.

◆ setArguments()

void QtlMovieProcess::setArguments ( const QStringList &  arguments)

Set the command line arguments.

The process must not be already started.

Returns
The command line arguments.

◆ setPriority()

void QtlMovieProcess::setPriority ( Qtl::ProcessPriority  priority)
inline

Set the process priority.

The process must not be already started. Special privileges may be required to set Qtl::HighPriority and Qtl::VeryHighPriority.

Parameters
[in]priorityRequested priority.

◆ outputDevice()

QIODevice* QtlMovieProcess::outputDevice ( ) const
inline

Return the device from which standard output can be read.

Returns
A device from which to read or zero if hasBinaryOutput is false.

◆ useDataPullProgressReport() [1/2]

bool QtlMovieProcess::useDataPullProgressReport ( bool  on)

Use the progress report from the QtlDataPull when possible.

This is possible only when the QtlDataPull is non zero and its reporting is available.

Parameters
[in]onTrue to use the progress report from the QtlDataPull.
Returns
The new state.

◆ useDataPullProgressReport() [2/2]

bool QtlMovieProcess::useDataPullProgressReport ( ) const
inline

Check if progress report from the QtlDataPull is active.

Returns
True when progress report from the QtlDataPull is active.

◆ readyReadOutputData

void QtlMovieProcess::readyReadOutputData ( )
signal

Emitted when some binary data are available from standard output.

◆ processOutputLine()

void QtlMovieProcess::processOutputLine ( QProcess::ProcessChannel  channel,
const QString &  textLine 
)
protectedvirtual

Process one text line from standard error or standard output.

Simply log the line. Subclasses may overwrite it.

Parameters
[in]channelOrigin of the line (QProcess::StandardOutput or QProcess::StandardError).
[in]textLineText line.

Reimplemented in QtlMovieFFmpegProcess, QtlMovieFFmpegVolumeDetect, QtlMovieClosedCaptionsSearch, QtlMovieCcExtractorProcess, QtlMovieDvdAuthorProcess, QtlMovieGrowisofsProcess, and QtlMovieMkisofsProcess.

◆ updateEnvironment()

void QtlMovieProcess::updateEnvironment ( QProcessEnvironment &  env)
protectedvirtual

Update the QProcessEnvironment for the target process before it starts.

Does nothing by default. Subclasses may overwrite it.

Parameters
[in]envA set of environment variables to update.

Reimplemented in QtlMovieFFmpegProcess, QtlMovieDvdAuthorProcess, and QtlMovieGrowisofsProcess.

◆ setJobVariable()

void QtlMovieProcess::setJobVariable ( const QString &  name,
const QStringList &  value 
)
protected

Store a variable in the parent job.

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

◆ getJobVariable()

QStringList QtlMovieProcess::getJobVariable ( const QString &  name) const
protected

Get the value of a variable in the job.

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

◆ readData

void QtlMovieProcess::readData ( )
privateslot

Read as much data as possible from the process standard error (and standard output if hasBinaryOutput is false).

◆ processFinished

void QtlMovieProcess::processFinished ( int  exitCode,
QProcess::ExitStatus  exitStatus 
)
privateslot

Invoked when the process is finished.

Parameters
[in]exitCodeProcess exit code.
[in]exitStatusQProcess exit status.

◆ processError

void QtlMovieProcess::processError ( QProcess::ProcessError  error)
privateslot

Invoked when an error occurs on the process.

Parameters
[in]errorQProcess error code.

◆ dataPullProgressed

void QtlMovieProcess::dataPullProgressed ( qint64  current,
qint64  maximum 
)
privateslot

Invoked when some progress in the QtlDataPull is available.

Parameters
[in]currentCurrent number of input bytes.
[in]maximumTotal size of the data transfer.

◆ processCompleted()

void QtlMovieProcess::processCompleted ( bool  success,
const QString &  message = QString() 
)
private

Process the termination of the process.

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

◆ processOutputBuffer()

void QtlMovieProcess::processOutputBuffer ( QProcess::ProcessChannel  channel,
QString &  buffer 
)
private

Process a standard error or standard output buffer.

Parameters
[in]channelOrigin of the line (QProcess::StandardOutput or QProcess::StandardError).
[in,out]bufferThe buffer to process. Complete lines are removed from the buffer.

Member Data Documentation

◆ _process

QtlProcess* QtlMovieProcess::_process
private

Process instance.

◆ _execFile

const QtlMovieExecFile* QtlMovieProcess::_execFile
private

Process executable file.

◆ _arguments

QStringList QtlMovieProcess::_arguments
private

Command line arguments.

◆ _hasBinaryOutput

bool QtlMovieProcess::_hasBinaryOutput
private

Treat standard output as binary data.

◆ _dataPull

QtlDataPull* QtlMovieProcess::_dataPull
private

Process input.

◆ _stdOutput

QString QtlMovieProcess::_stdOutput
private

Standard error buffer.

◆ _stdError

QString QtlMovieProcess::_stdError
private

Standard error buffer.

◆ _dpProgress

bool QtlMovieProcess::_dpProgress
private

True if dataPullProgressed() was successfully set.

◆ _gotError

bool QtlMovieProcess::_gotError
private

The process reported an error.

◆ _processError

QProcess::ProcessError QtlMovieProcess::_processError
private

Last reported error.


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