#include <tsSubRipGenerator.h>
|
| | SubRipGenerator (const fs::path &file_name=UString(), Report &report=(ts::NullReport::Instance())) |
| | SubRipGenerator (std::ostream *stream) |
| | ~SubRipGenerator () |
| template<class Rep1, class Period1, class Rep2, class Period2> |
| void | addFrame (const cn::duration< Rep1, Period1 > &show_timestamp, const cn::duration< Rep2, Period2 > &hide_timestamp, const UString &line) |
| template<class Rep1, class Period1, class Rep2, class Period2> |
| void | addFrame (const cn::duration< Rep1, Period1 > &show_timestamp, const cn::duration< Rep2, Period2 > &hide_timestamp, const UStringList &lines) |
| void | close () |
| int | frameCount () const |
| bool | isOpen () |
| bool | open (const fs::path &file_name, Report &report=(ts::NullReport::Instance())) |
| bool | setStream (std::ostream *stream) |
|
| template<class Rep1, class Period1, class Rep2, class Period2> |
| static UString | FormatDuration (const cn::duration< Rep1, Period1 > &show_timestamp, const cn::duration< Rep2, Period2 > &hide_timestamp) |
| template<class Rep, class Period> |
| static UString | FormatTime (const cn::duration< Rep, Period > ×tamp) |
Generate subtitles in SubRip format (aka SRT).
◆ SubRipGenerator() [1/2]
Constructor.
- Parameters
-
| [in] | file_name | Optional output file name. If non-empty, the file is created and open. Use isOpen() to check if the file was correctly created. |
| [in,out] | report | Where to report errors. |
◆ SubRipGenerator() [2/2]
| ts::SubRipGenerator::SubRipGenerator |
( |
std::ostream * | stream | ) |
|
|
explicit |
Constructor.
- Parameters
-
| [in] | stream | Output text stream. The generator is considered "open" if stream is not zero. |
◆ ~SubRipGenerator()
| ts::SubRipGenerator::~SubRipGenerator |
( |
| ) |
|
◆ open()
Open or re-open the generator to a new file. The previous file is closed.
- Parameters
-
| [in] | file_name | Output file name. |
| [in,out] | report | Where to report errors. |
- Returns
- True if the file was correctly created and open, false otherwise.
◆ setStream()
| bool ts::SubRipGenerator::setStream |
( |
std::ostream * | 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 ts::SubRipGenerator::close |
( |
| ) |
|
◆ isOpen()
| bool ts::SubRipGenerator::isOpen |
( |
| ) |
|
|
inline |
Check if the generator is open and ready to output frames.
- Returns
- True if the generator is open and ready.
◆ addFrame() [1/2]
template<class Rep1, class Period1, class Rep2, class Period2>
| void ts::SubRipGenerator::addFrame |
( |
const cn::duration< Rep1, Period1 > & | show_timestamp, |
|
|
const cn::duration< Rep2, Period2 > & | hide_timestamp, |
|
|
const UStringList & | lines ) |
Add a multi-lines subtitle frame.
- Parameters
-
| [in] | show_timestamp | Show frame at this timestamp (from start of stream) |
| [in] | hide_timestamp | Hide frame at this timestamp (from start of stream) |
| [in] | lines | Text lines. |
◆ addFrame() [2/2]
template<class Rep1, class Period1, class Rep2, class Period2>
| void ts::SubRipGenerator::addFrame |
( |
const cn::duration< Rep1, Period1 > & | show_timestamp, |
|
|
const cn::duration< Rep2, Period2 > & | hide_timestamp, |
|
|
const UString & | line ) |
|
inline |
Add a one-line subtitle frame.
- Parameters
-
| [in] | show_timestamp | Show frame at this timestamp (from start of stream) |
| [in] | hide_timestamp | Hide frame at this timestamp (from start of stream) |
| [in] | line | Text line. |
◆ frameCount()
| int ts::SubRipGenerator::frameCount |
( |
| ) |
const |
|
inline |
Get the number of generated frames fo far.
- Returns
- The number of generated frames fo far.
◆ FormatTime()
template<class Rep, class Period>
| UString ts::SubRipGenerator::FormatTime |
( |
const cn::duration< Rep, Period > & | timestamp | ) |
|
|
static |
Format a timestamp as SRT time.
- Parameters
-
| [in] | timestamp | Timestamp in milliseconds. |
- Returns
- SRT formatted time.
◆ FormatDuration()
template<class Rep1, class Period1, class Rep2, class Period2>
| UString ts::SubRipGenerator::FormatDuration |
( |
const cn::duration< Rep1, Period1 > & | show_timestamp, |
|
|
const cn::duration< Rep2, Period2 > & | hide_timestamp ) |
|
inlinestatic |
Format a duration as SRT header.
- Parameters
-
| [in] | show_timestamp | Show frame at this timestamp (in ms from start of stream) |
| [in] | hide_timestamp | Hide frame at this timestamp (in ms from start of stream) |
- Returns
- SRT formatted duration.
The documentation for this class was generated from the following file: