Generate subtitles in SubRip format (aka SRT).
More...
|
static QString | formatDuration (quint64 showTimestamp, quint64 hideTimestamp) |
| Format a duration as SRT header. More...
|
|
static QString | formatTime (quint64 timestamp) |
| Format a timestamp as SRT time. More...
|
|
Generate subtitles in SubRip format (aka SRT).
◆ QtlSubRipGenerator() [1/2]
QtlSubRipGenerator::QtlSubRipGenerator |
( |
const QString & |
fileName = QString() | ) |
|
|
explicit |
Constructor.
- Parameters
-
[in] | fileName | Optional output file name. If non-empty, the file is created and open. Use isOpen() to check if the file was correctly created. |
◆ QtlSubRipGenerator() [2/2]
QtlSubRipGenerator::QtlSubRipGenerator |
( |
QTextStream * |
stream | ) |
|
|
explicit |
Constructor.
- Parameters
-
[in] | stream | Output text stream. The generator is considered "open" if stream is not zero. |
◆ ~QtlSubRipGenerator()
QtlSubRipGenerator::~QtlSubRipGenerator |
( |
| ) |
|
◆ open()
bool QtlSubRipGenerator::open |
( |
const QString & |
fileName | ) |
|
Open or re-open the generator to a new file.
The previous file is closed.
- Parameters
-
[in] | fileName | Output file name. |
- Returns
- True if the file was correctly created and open, false otherwise.
◆ setStream()
bool QtlSubRipGenerator::setStream |
( |
QTextStream * |
stream | ) |
|
Open or re-open the generator to a new text stream.
The previous file is closed.
- Parameters
-
[in] | stream | Output text stream. |
- Returns
- True if stream is not zero, false otherwise.
◆ close()
void QtlSubRipGenerator::close |
( |
| ) |
|
◆ isOpen()
bool QtlSubRipGenerator::isOpen |
( |
| ) |
|
|
inline |
Check if the generator is open and ready to output frames.
◆ addFrame() [1/2]
void QtlSubRipGenerator::addFrame |
( |
quint64 |
showTimestamp, |
|
|
quint64 |
hideTimestamp, |
|
|
const QStringList & |
lines |
|
) |
| |
Add a multi-lines subtitle frame.
- Parameters
-
[in] | showTimestamp | Show frame at this timestamp (in ms from start of stream) |
[in] | hideTimestamp | Hide frame at this timestamp (in ms from start of stream) |
[in] | lines | Text lines. |
◆ addFrame() [2/2]
void QtlSubRipGenerator::addFrame |
( |
quint64 |
showTimestamp, |
|
|
quint64 |
hideTimestamp, |
|
|
const QString & |
line |
|
) |
| |
|
inline |
Add a one-line subtitle frame.
- Parameters
-
[in] | showTimestamp | Show frame at this timestamp (in ms from start of stream) |
[in] | hideTimestamp | Hide frame at this timestamp (in ms from start of stream) |
[in] | line | Text line. |
◆ frameCount()
int QtlSubRipGenerator::frameCount |
( |
| ) |
const |
|
inline |
Get the number of generated frames fo far.
- Returns
- The number of generated frames fo far.
◆ formatTime()
QString QtlSubRipGenerator::formatTime |
( |
quint64 |
timestamp | ) |
|
|
static |
Format a timestamp as SRT time.
- Parameters
-
[in] | timestamp | Timestamp in milliseconds. |
- Returns
- SRT formatted time.
◆ formatDuration()
QString QtlSubRipGenerator::formatDuration |
( |
quint64 |
showTimestamp, |
|
|
quint64 |
hideTimestamp |
|
) |
| |
|
static |
Format a duration as SRT header.
- Parameters
-
[in] | showTimestamp | Show frame at this timestamp (in ms from start of stream) |
[in] | hideTimestamp | Hide frame at this timestamp (in ms from start of stream) |
- Returns
- SRT formatted duration.
◆ configureStream()
void QtlSubRipGenerator::configureStream |
( |
| ) |
|
|
private |
Configure the output stream.
◆ _outputFile
QFile QtlSubRipGenerator::_outputFile |
|
private |
◆ _outputStream
QTextStream QtlSubRipGenerator::_outputStream |
|
private |
Text stream for output file.
◆ _stream
QTextStream* QtlSubRipGenerator::_stream |
|
private |
◆ _frameCount
int QtlSubRipGenerator::_frameCount |
|
private |
The documentation for this class was generated from the following files: