|
Status | run (const Object *obj, const ExportMovieDesc &desc, std::function< void(float, float)> majorProgress, std::function< void(float)> minorProgress, std::function< void(QString)> progressMessage) |
| Begin exporting the movie described by exportDesc.
|
|
QString | error () |
|
void | cancel () |
|
|
static Status | executeFFmpeg (const QString &cmd, const QStringList &args, std::function< bool(int)> progress) |
| Runs the specified command (should be ffmpeg) and allows for progress feedback.
|
|
|
Status | assembleAudio (const Object *obj, QString ffmpegPath, std::function< void(float)> progress) |
| Combines all audio tracks in obj into a single file.
|
|
Status | generateMovie (const Object *obj, QString ffmpegPath, QString strOutputFile, std::function< void(float)> progress) |
| Exports obj to a movie image at strOut using FFmpeg.
|
|
Status | generateGif (const Object *obj, QString ffmpeg, QString strOut, std::function< void(float)> progress) |
| Exports obj to a gif image at strOut using FFmpeg.
|
|
Status | executeFFMpegPipe (const QString &cmd, const QStringList &args, std::function< void(float)> progress, std::function< bool(QProcess &, int)> writeFrame) |
| Runs the specified command (should be ffmpeg), and lets writeFrame pipe data into it 1 frame at a time.
|
|
Status | checkInputParameters (const ExportMovieDesc &) |
|
Definition at line 43 of file movieexporter.h.
◆ MovieExporter()
MovieExporter::MovieExporter |
( |
| ) |
|
◆ ~MovieExporter()
MovieExporter::~MovieExporter |
( |
| ) |
|
◆ assembleAudio()
Status MovieExporter::assembleAudio |
( |
const Object * |
obj, |
|
|
QString |
ffmpegPath, |
|
|
std::function< void(float)> |
progress |
|
) |
| |
|
private |
Combines all audio tracks in obj into a single file.
- Parameters
-
[in] | obj | |
[in] | ffmpegPath | |
[out] | progress | A function that takes one float argument (the percentage of the audio assembly complete) and may display the output to the user in any way it sees fit. |
- Returns
- Returns the final status of the operation. Ok if successful, or safe if there was intentionally no output.
Definition at line 162 of file movieexporter.cpp.
◆ cancel()
void MovieExporter::cancel |
( |
| ) |
|
|
inline |
◆ checkInputParameters()
◆ error()
◆ executeFFmpeg()
Status MovieExporter::executeFFmpeg |
( |
const QString & |
cmd, |
|
|
const QStringList & |
args, |
|
|
std::function< bool(int)> |
progress |
|
) |
| |
|
static |
Runs the specified command (should be ffmpeg) and allows for progress feedback.
- Parameters
-
[in] | cmd | A string containing the command to execute |
[in] | args | A string list containing the arguments to pass to the command |
[out] | progress | A function that takes one float argument (the percentage of the ffmpeg operation complete) and may display the output to the user in any way it sees fit. |
executeFFMpeg does not allow for writing direct input, the only input through the "-i" argument to specify input files on the disk.
- Returns
- Returns Status::OK if everything went well, and Status::FAIL and error is detected (usually a non-zero exit code for ffmpeg).
Definition at line 541 of file movieexporter.cpp.
◆ executeFFMpegPipe()
Status MovieExporter::executeFFMpegPipe |
( |
const QString & |
cmd, |
|
|
const QStringList & |
args, |
|
|
std::function< void(float)> |
progress, |
|
|
std::function< bool(QProcess &, int)> |
writeFrame |
|
) |
| |
|
private |
Runs the specified command (should be ffmpeg), and lets writeFrame pipe data into it 1 frame at a time.
- Parameters
-
[in] | cmd | A string containing the command to execute |
[in] | args | A string list containing the arguments to pass to the command |
[out] | progress | A function that takes one float argument (the percentage of the ffmpeg operation complete) and may display the output to the user in any way it sees fit. |
[in] | writeFrame | A function that takes two arguments, a process (the ffmpeg process) and an integer (frames processed or -1, see full description). This function should write a single frame to the process. The function returns true value if it actually wrote a frame. |
This function operates generally as follows:
- Spawn process with the command from cmd
- Check ffmpeg's output for a progress update.
- Add frames with writeFrame until it returns false.
- Repeat from step 2 until all frames have been written.
The idea is that there are two forms of processing occuring simultaneously, generating frames to send to ffmpeg, and ffmpeg encoding those frames. Whether these this actually occur concurrently or one after another appears to depend on the environment.
The writeFrame function deserves a bit of extra details. It does not only return false when there is an error in generating or writing a frame, it also does it when it wants to "return control" to the rest of the executeFFMpegPipe function for the purposes of reading updates from ffmpeg's output. This should be done every once in a while if possible, but with some formats (specifically gif), all frames must be loaded before any processing can continue, so there is no point returning false for it until all frames have been written. writeFrame is also responsible for closing the writeChannel of the process when it has finished writing all frames. This indicates to executeFFMpegPipe that it no longer needs to call writeFrame.
- Returns
- Returns Status::OK if everything went well, and Status::FAIL and error is detected (usually a non-zero exit code for ffmpeg).
Definition at line 657 of file movieexporter.cpp.
◆ generateGif()
Status MovieExporter::generateGif |
( |
const Object * |
obj, |
|
|
QString |
ffmpegPath, |
|
|
QString |
strOut, |
|
|
std::function< void(float)> |
progress |
|
) |
| |
|
private |
Exports obj to a gif image at strOut using FFmpeg.
- Parameters
-
[in] | obj | An Object containing the animation to export. |
[in] | ffmpegPath | The path to the FFmpeg binary. |
[in] | strOut | The output path. Should end with .gif. |
[out] | progress | A function that takes one float argument (the percentage of the gif generation complete) and may display the output to the user in any way it sees fit. |
- Returns
- Returns the final status of the operation (ok or canceled)
Definition at line 419 of file movieexporter.cpp.
◆ generateMovie()
Status MovieExporter::generateMovie |
( |
const Object * |
obj, |
|
|
QString |
ffmpegPath, |
|
|
QString |
strOutputFile, |
|
|
std::function< void(float)> |
progress |
|
) |
| |
|
private |
Exports obj to a movie image at strOut using FFmpeg.
- Parameters
-
[in] | obj | An Object containing the animation to export. |
[in] | ffmpegPath | The path to the FFmpeg binary. |
[in] | strOutputFile | The output path. Should end with .gif. |
[out] | progress | A function that takes one float argument (the percentage of the gif generation complete) and may display the output to the user in any way it sees fit. |
The movie formats supported by this operation are any file formats that the referenced FFmpeg binary supports and that have the required features (ex. video and audio support)
- Returns
- Returns the final status of the operation (ok or canceled)
Definition at line 270 of file movieexporter.cpp.
◆ run()
Status MovieExporter::run |
( |
const Object * |
obj, |
|
|
const ExportMovieDesc & |
desc, |
|
|
std::function< void(float, float)> |
majorProgress, |
|
|
std::function< void(float)> |
minorProgress, |
|
|
std::function< void(QString)> |
progressMessage |
|
) |
| |
Begin exporting the movie described by exportDesc.
- Parameters
-
[in] | obj | An Object containing the animation to export. |
[in] | desc | A structure containing all the export parameters. See ExportMovieDesc. |
[out] | majorProgress | A function to update the major progress bar. The major progress bar goes from 0-100% only one time, representing the overall progress of the export. The first float parameter is the current progress %, and the second is the desired progress when the next sub-task completes. This should only be called at the beginning of a subtask. |
[out] | minorProgress | A function to update the minor progress bar. The minor progress bar goes from 0-100% for each sub-task of the exporting process. It is up to minor progress to update the major progress bar to reflect the sub-task progress. |
[out] | progressMessage | A function ot update the progres bar message. The messages will describe the current sub-task of the exporting process. |
- Returns
- Returns Status:OK on success, or Status::FAIL on error.
Definition at line 78 of file movieexporter.cpp.
◆ MAX_SOUND_FRAMES
const int MovieExporter::MAX_SOUND_FRAMES = 63 |
|
static |
◆ mCanceled
bool MovieExporter::mCanceled = false |
|
private |
◆ mDesc
◆ mTempDir
◆ mTempWorkDir
QString MovieExporter::mTempWorkDir |
|
private |
The documentation for this class was generated from the following files: