Describes an input video file. More...
Signals | |
void | mediaInfoChanged () |
Emitted when the media info have changed. More... | |
![]() | |
void | fileNameChanged (const QString &fileName) |
Emitted when the file name has changed. More... | |
Public Member Functions | |
QtlMovieInputFile (const QString &fileName, const QtlMovieSettings *settings, QtlLogger *log, QObject *parent=0) | |
Constructor. More... | |
QtlMovieInputFile (const QtlMovieInputFile &other, QObject *parent=0) | |
Copy constructor. More... | |
QtlDataPull * | dataPull (QObject *parent=0) const |
Get an instance of QtlDataPull to transfer the content of the input file. More... | |
float | durationInSeconds () const |
Try to evaluate the duration of the media file in seconds. More... | |
QString | externalSubtitleFileName () const |
Get the external subtitle file name. More... | |
QString | ffmpegInputFileFormat () const |
Get the name to specify as input file format to ffmpeg when this object is used as input to ffmpeg. More... | |
QString | ffmpegInputFileSpecification () const |
Get the name to specify as input to ffmpeg when this object is used as input to ffmpeg. More... | |
QtlMovieFFprobeTags | ffProbeInfo () const |
Get the list of tags from FFprobe output. More... | |
QtlMediaStreamInfoPtr | firstStream (QtlMediaStreamInfo::StreamType streamType) const |
Get the information about the first stream in the file matching a given type. More... | |
bool | isDvdCompliant () const |
Check if the file seems to be DVD-compliant. More... | |
bool | isIsoImage () const |
Check if the file seems to be a DVD ISO image. More... | |
bool | isM2tsFile () const |
Check if the input file has M2TS format. More... | |
bool | isSubtitleFile () const |
Check if the input file is a pure subtitle file. More... | |
bool | isTsFile () const |
Check if the input file is an MPEG transport stream. More... | |
QtlLogger * | log () const |
Get the associated error logger. More... | |
QtlByteBlock | palette () const |
Get the DVD palette in RGB format. More... | |
bool | pipeInput () const |
Check if the input file content must be piped from QtlMovie. More... | |
void | selectDefaultStreams (const QStringList &audienceLanguages=QStringList()) |
Select the default video, audio and subtitle streams. More... | |
int | selectedAudioStreamIndex () const |
Get the index of audio stream to transcode. More... | |
QtlMediaStreamInfoPtr | selectedAudioStreamInfo () const |
Get the information about the selected audio stream. More... | |
int | selectedSubtitleStreamIndex () const |
Get the index of subtitle stream to transcode. More... | |
QtlMediaStreamInfoPtr | selectedSubtitleStreamInfo () const |
Get the information about the selected subtitle stream. More... | |
int | selectedVideoStreamIndex () const |
Get the index of video stream to transcode. More... | |
QtlMediaStreamInfoPtr | selectedVideoStreamInfo () const |
Get the information about the selected video stream. More... | |
bool | selectedVideoStreamIsDvdCompliant () const |
Check if the selected video stream is DVD-compliant. More... | |
void | setExternalSubtitleFileName (const QString &subtitleFileName) |
Set an external subtitle file name. More... | |
void | setSelectedAudioStreamIndex (int index) |
Set the index of audio stream to transcode. More... | |
void | setSelectedSubtitleStreamIndex (int index) |
Set the index of subtitle stream to transcode. More... | |
void | setSelectedVideoStreamIndex (int index) |
Set the index of video stream to transcode. More... | |
int | streamCount () const |
Get the number of streams in the file. More... | |
int | streamCount (QtlMediaStreamInfo::StreamType streamType) const |
Get the number of streams in the file matching a given type. More... | |
QtlMediaStreamInfoPtr | streamInfo (int streamIndex) const |
Get the information about a stream in input file. More... | |
![]() | |
QtlFile (const QString &fileName, QObject *parent=0) | |
Constructor. More... | |
QtlFile (const QtlFile &other, QObject *parent=0) | |
Copy constructor. More... | |
QString | directoryName () const |
Get the directory name of the file. More... | |
QString | fileName () const |
Get the file name. More... | |
bool | isSet () const |
Check if the file name is set. More... | |
QtlByteBlock | readBinary (int maxSize=-1) const |
Read the binary content of the file. More... | |
QString | readText () const |
Read the text content of the file. More... | |
QStringList | readTextLines (int maxSize=-1) const |
Read the text content of the file. More... | |
virtual bool | setFileName (const QString &fileName) |
Set the file name. More... | |
QString | shortPath (bool keepOnError) const |
Get the "short path name" of the file. More... | |
bool | writeBinary (const QtlByteBlock &content) |
Write the binary content of the file. More... | |
bool | writeText (const QString &text) |
Write the text content of the file. More... | |
bool | writeTextLines (const QStringList &lines) |
Write the text content of the file. More... | |
Private Slots | |
void | closedCaptionsSearchTerminated (bool success) |
Invoked when a search for Closed Captions completes. More... | |
void | ffprobeTerminated (const QtlBoundProcessResult &result) |
Invoked when the ffprobe process completes. More... | |
void | foundClosedCaptions (QtlMediaStreamInfoPtr stream) |
Invoked when a Closed Captions stream is found. More... | |
void | foundTeletextSubtitles (QtlMediaStreamInfoPtr stream) |
Invoked when a Teletext subtitle stream is found. More... | |
void | teletextSearchTerminated (bool success) |
Invoked when the search for Teletext subtitles completes. More... | |
void | updateMediaInfo (const QString &fileName) |
Invoked when the file name has changed, update file info. More... | |
Private Member Functions | |
QtlMovieInputFile () Q_DECL_EQ_DELETE | |
QtlBoundProcess * | ffprobeProcess (int probeTimeDivisor, int ffprobeTimeout) |
Create and start a ffprobe process. More... | |
void | newMediaInfo () |
Report that new media info has been found. More... | |
Private Attributes | |
int | _ccSearchCount |
Number of Closed Captions research in progress. More... | |
int | _dvdAngle |
Angle number when demuxing DVD content. More... | |
QtsDvdProgramChainPtr | _dvdPgc |
Smart pointer to PGC inside the DVD VTS. More... | |
int | _dvdProgramChain |
PGC number when demuxing DVD content. More... | |
QtsDvdTitleSet | _dvdTitleSet |
DVD title set access (when the input file comes from a DVD). More... | |
bool | _dvdTranscodeRawVob |
On DVD, transcode raw VOB files, don't demux. More... | |
QString | _externalSubtitleFileName |
Subtitle file name, can be empty. More... | |
QtlMovieFFprobeTags | _ffInfo |
Media info in ffprobe flat format. More... | |
QString | _ffmpegFormat |
Name to specify as input file format to ffmpeg. More... | |
QString | _ffmpegInput |
Name to specify as input to ffmpeg. More... | |
int | _ffprobeCount |
Number of ffprobe in progress. More... | |
bool | _isM2ts |
File has M2TS format. More... | |
bool | _isSubtitle |
File is a pure subtitle file, no container format. More... | |
bool | _isTs |
File is a transport stream (TS or M2TS format). More... | |
QtlLogger * | _log |
Where to log errors. More... | |
bool | _pipeInput |
Input file content shall be piped from QtlMovie. More... | |
bool | _selectedAudioExplicit |
Audio stream explicitly selected (vs. default choice). More... | |
int | _selectedAudioStreamIndex |
Index of audio stream to transcode. More... | |
bool | _selectedSubtitleExplicit |
Subtitle stream explicitly selected (vs. default choice). More... | |
int | _selectedSubtitleStreamIndex |
Index of subtitle stream to transcode. More... | |
bool | _selectedVideoExplicit |
Video stream explicitly selected (vs. default choice). More... | |
int | _selectedVideoStreamIndex |
Index of video stream to transcode. More... | |
const QtlMovieSettings * | _settings |
Application settings. More... | |
QtlMediaStreamInfoList | _streams |
Stream information. More... | |
QtlMovieTeletextSearch * | _teletextSearch |
Search for Teletext subtitles in MPEG-TS files. More... | |
Additional Inherited Members | |
![]() | |
static QString | absoluteNativeFilePath (const QString &path, bool removeSymLinks=false) |
Build an absolute file path with native directory separators. More... | |
static QStringList | commandSearchPath () |
Return the list of directories in the system search path. More... | |
static bool | createDirectory (const QString &path, bool createOnly=false) |
Create a directory and all parent directories if necessary. More... | |
static QString | enforceSuffix (const QString &path, const QString &suffix, Qt::CaseSensitivity cs=Qt::CaseInsensitive) |
Enforce a suffix in a file name. More... | |
static QStringList | expandFilePath (const QString &path, QtlFilePathFilterInterface *filter=0) |
Expand a file path containing wildcards to all existing files matching the specification. More... | |
static QString | parentPath (const QString &path, int upLevels=1) |
Get the absolute file path of the parent directory of a file. More... | |
template<typename T > | |
static bool | readBigEndianAt (QIODevice &device, qint64 position, T &data) |
Read a big endian integer in a binary file at a given position. More... | |
static bool | readBinary (QIODevice &device, QtlByteBlock &data, int maxSize=-1) |
Read a portion of a binary file at the current position. More... | |
static bool | readBinaryAt (QIODevice &device, qint64 position, QtlByteBlock &data, int maxSize=-1) |
Read a portion of a binary file at a given position. More... | |
static QtlByteBlock | readBinaryFile (const QString &fileName, int maxSize=-1) |
Read the content of a binary file. More... | |
static QString | readTextFile (const QString &fileName) |
Read the content of a text file. More... | |
static QStringList | readTextLinesFile (const QString &fileName, int maxSize=-1) |
Read the content of a text file. More... | |
static QString | search (const QString &baseName, const QStringList &searchPath, const QString &extension=QString(), QFile::Permissions permissions=QFile::Permissions()) |
Search a file in a list of directories. More... | |
static QString | searchExecutable (const QString &baseName, const QStringList &searchPath) |
Search an executable file in a list of directories. More... | |
static QString | searchParentSubdirectory (const QString &dir, const QString &subdir, int maxLevels=128) |
Search a subdirectory in the parent path. More... | |
static QString | shortPath (const QString &path, bool keepOnError) |
Get the "short path name" of a file path. More... | |
static QString | toFileName (const QUrl &url) |
Format the content of an URL into a file path if the URL scheme is file: More... | |
static bool | writeBinary (QIODevice &file, const QtlByteBlock &data) |
Write binary data into an open file. More... | |
static bool | writeBinary (QIODevice &file, const void *data, int size, bool processEvents=false) |
Write binary data into an open file. More... | |
static bool | writeBinaryFile (const QString &fileName, const QtlByteBlock &content) |
Write the content of a binary file. More... | |
static bool | writeTextFile (const QString &fileName, const QString &text) |
Write the content of a text file. More... | |
static bool | writeTextLinesFile (const QString &fileName, const QStringList &lines) |
Write the content of a text file. More... | |
Describes an input video file.
QtlMovieInputFile::QtlMovieInputFile | ( | const QString & | fileName, |
const QtlMovieSettings * | settings, | ||
QtlLogger * | log, | ||
QObject * | parent = 0 |
||
) |
Constructor.
[in] | fileName | Input file name. |
[in] | settings | Application settings. |
[in] | log | Where to log errors. |
[in] | parent | Optional parent widget. |
|
explicit |
Copy constructor.
[in] | other | Other instance to copy (except parent). |
[in] | parent | Optional parent widget. |
|
private |
|
inline |
Get the associated error logger.
|
inline |
Get the name to specify as input to ffmpeg when this object is used as input to ffmpeg.
This may differ from the file name when the input file is a DVD IFO or VOB.
|
inline |
Get the name to specify as input file format to ffmpeg when this object is used as input to ffmpeg.
|
inline |
Get the number of streams in the file.
int QtlMovieInputFile::streamCount | ( | QtlMediaStreamInfo::StreamType | streamType | ) | const |
Get the number of streams in the file matching a given type.
[in] | streamType | Stream type to look for. |
QtlMediaStreamInfoPtr QtlMovieInputFile::firstStream | ( | QtlMediaStreamInfo::StreamType | streamType | ) | const |
Get the information about the first stream in the file matching a given type.
[in] | streamType | Stream type to look for. |
QtlMediaStreamInfoPtr QtlMovieInputFile::streamInfo | ( | int | streamIndex | ) | const |
Get the information about a stream in input file.
[in] | streamIndex | Index of the stream to query, from 0 to streamCount()-1. |
float QtlMovieInputFile::durationInSeconds | ( | ) | const |
Try to evaluate the duration of the media file in seconds.
bool QtlMovieInputFile::isDvdCompliant | ( | ) | const |
Check if the file seems to be DVD-compliant.
More precisely, check if the file looks like one of our DVD-compliant MPEG files, one of those we generate for output type QtlMovieOutputFile::DvdFile. Note that other MPEG files may also be DVD-compliant but it is difficult to check. We simply want to filter a simple use case: We first transcoded to a DVD MPEG file to see the result and we later want to create the ISO image without retranscoding.
bool QtlMovieInputFile::selectedVideoStreamIsDvdCompliant | ( | ) | const |
Check if the selected video stream is DVD-compliant.
To generate a DVD from this kind of file, we can simply copy the audio stream without re-encoding. This saves much time.
bool QtlMovieInputFile::isIsoImage | ( | ) | const |
Check if the file seems to be a DVD ISO image.
In fact, check that the file name ends in ".iso".
|
inline |
Check if the input file is an MPEG transport stream.
This include TS and M2TS files.
|
inline |
Check if the input file has M2TS format.
|
inline |
Check if the input file is a pure subtitle file.
This means that the file is for instance a .srt or .ass file, not included into some container file format.
|
inline |
Check if the input file content must be piped from QtlMovie.
Some input files cannot be read directly from the file system. This is the case for encrypted DVD's: you can browse files, you can read metadata files (.IFO) but you cannot read the content of video files (.VOB). For that kind of files, ffmpeg or ffprobe cannot directly read the file. They must read the content from their standard input and QtlMovie will pipe the extracted file content into it.
QtlDataPull * QtlMovieInputFile::dataPull | ( | QObject * | parent = 0 | ) | const |
Get an instance of QtlDataPull to transfer the content of the input file.
parent | Optional parent object of the QtlDataPull instance. |
QtlByteBlock QtlMovieInputFile::palette | ( | ) | const |
Get the DVD palette in RGB format.
int QtlMovieInputFile::selectedVideoStreamIndex | ( | ) | const |
Get the index of video stream to transcode.
|
inline |
Get the information about the selected video stream.
void QtlMovieInputFile::setSelectedVideoStreamIndex | ( | int | index | ) |
Set the index of video stream to transcode.
[in] | index | Index of video stream to transcode or -1 if none. |
int QtlMovieInputFile::selectedAudioStreamIndex | ( | ) | const |
Get the index of audio stream to transcode.
|
inline |
Get the information about the selected audio stream.
void QtlMovieInputFile::setSelectedAudioStreamIndex | ( | int | index | ) |
Set the index of audio stream to transcode.
[in] | index | Index of audio stream to transcode or -1 if none. |
int QtlMovieInputFile::selectedSubtitleStreamIndex | ( | ) | const |
Get the index of subtitle stream to transcode.
|
inline |
Get the information about the selected subtitle stream.
void QtlMovieInputFile::setSelectedSubtitleStreamIndex | ( | int | index | ) |
Set the index of subtitle stream to transcode.
[in] | index | Index of subtitle stream to transcode or -1 if none. |
QString QtlMovieInputFile::externalSubtitleFileName | ( | ) | const |
Get the external subtitle file name.
void QtlMovieInputFile::setExternalSubtitleFileName | ( | const QString & | subtitleFileName | ) |
Set an external subtitle file name.
If not empty, clear the selected stream index.
[in] | subtitleFileName | The subtitle file name. Can be empty. |
void QtlMovieInputFile::selectDefaultStreams | ( | const QStringList & | audienceLanguages = QStringList() | ) |
Select the default video, audio and subtitle streams.
Default video stream selection: We try to determine the one with "best quality". In theory, this should be some evaluation of the combination of size, bitrate, encoding options. Currently, we just keep the video stream with the largest frame size. If we cannot compute the frame sizes, keep the first video stream.
Default audio stream selection: Try to determine "original version". If not possible, keep first audio track not matching any language in audienceLanguages (supposed to be the original audio, considering any language in audienceLanguages as dubbing). Otherwise, keep first audio without visual/hearing impaired.
Default subtitle stream selection: In all cases, consider only subtitle in audienceLanguages. If this list is empty, there will be no default subtitle. Within the subtitle in audienceLanguages, the following criteria apply.
[in] | audienceLanguages | List of languages of the intended audience. |
|
inline |
Get the list of tags from FFprobe output.
Low-level method, dependent on ffprobe output.
|
signal |
Emitted when the media info have changed.
|
privateslot |
Invoked when the file name has changed, update file info.
[in] | fileName | Absolute file path. |
|
privateslot |
Invoked when the ffprobe process completes.
[in] | result | Process execution results. |
|
privateslot |
Invoked when a Teletext subtitle stream is found.
[in] | stream | A smart pointer to the stream info data. |
|
privateslot |
Invoked when a Closed Captions stream is found.
[in] | stream | A smart pointer to the stream info data. |
|
privateslot |
Invoked when the search for Teletext subtitles completes.
[in] | success | True on success, false on error. |
|
privateslot |
Invoked when a search for Closed Captions completes.
[in] | success | True on success, false on error. |
|
private |
Report that new media info has been found.
If no more operation in progress, emit mediaInfoChanged().
|
private |
Create and start a ffprobe process.
[in] | probeTimeDivisor | If positive, this value is used to reduce the probe time duration. The actual probe time is the value from settings, divided by probeTimeDivisor. |
[in] | ffprobeTimeout | Timeout of process execution in seconds. |
|
private |
Where to log errors.
|
private |
Application settings.
|
private |
Name to specify as input to ffmpeg.
|
private |
Name to specify as input file format to ffmpeg.
|
private |
Media info in ffprobe flat format.
|
private |
Stream information.
|
private |
DVD title set access (when the input file comes from a DVD).
|
private |
Smart pointer to PGC inside the DVD VTS.
|
private |
Search for Teletext subtitles in MPEG-TS files.
|
private |
Number of ffprobe in progress.
|
private |
Number of Closed Captions research in progress.
|
private |
Index of video stream to transcode.
|
private |
Index of audio stream to transcode.
|
private |
Index of subtitle stream to transcode.
|
private |
Video stream explicitly selected (vs. default choice).
|
private |
Audio stream explicitly selected (vs. default choice).
|
private |
Subtitle stream explicitly selected (vs. default choice).
|
private |
Subtitle file name, can be empty.
|
private |
File is a transport stream (TS or M2TS format).
|
private |
File has M2TS format.
|
private |
File is a pure subtitle file, no container format.
|
private |
Input file content shall be piped from QtlMovie.
|
private |
On DVD, transcode raw VOB files, don't demux.
|
private |
PGC number when demuxing DVD content.
|
private |
Angle number when demuxing DVD content.