Miam-Player  0.8.0
A nice music player
QtAV::Subtitle Class Reference

#include <Subtitle.h>

Inheritance diagram for QtAV::Subtitle:

Public Slots

void load ()
 start start to process the whole subtitle content in a thread More...
 
void loadAsync ()
 
void setTimestamp (qreal t)
 

Signals

void loaded (const QString &path=QString())
 empty path if load from raw data More...
 
void canRenderChanged ()
 
void codecChanged ()
 
void enginesChanged ()
 
void fuzzyMatchChanged ()
 
void contentChanged ()
 contentChanged emitted when text content changed. More...
 
void rawDataChanged ()
 
void fileNameChanged ()
 
void dirsChanged ()
 
void suffixesChanged ()
 
void supportedSuffixesChanged ()
 
void engineChanged ()
 
void delayChanged ()
 
void fontFileChanged ()
 
void fontsDirChanged ()
 
void fontFileForcedChanged ()
 

Public Member Functions

 Subtitle (QObject *parent=0)
 
virtual ~Subtitle ()
 
void setCodec (const QByteArray &value)
 setCodec set subtitle encoding that supported by QTextCodec. More...
 
QByteArray codec () const
 
bool isLoaded () const
 isValid indicate whether the subtitle can be found and processed More...
 
void setEngines (const QStringList &value)
 setEngines Set subtitle processor engine names, in priority order. More...
 
QStringList engines () const
 
QString engine () const
 engine More...
 
void setFuzzyMatch (bool value)
 
bool fuzzyMatch () const
 
void setRawData (const QByteArray &data)
 
QByteArray rawData () const
 
void setFileName (const QString &name)
 setFileName the given name will be in the 1st place to try to open(if using fuzzy match). More...
 
QString fileName () const
 
void setDirs (const QStringList &value)
 setDirs Set subtitle search directories. More...
 
QStringList dirs () const
 
QStringList supportedSuffixes () const
 supportedFormats the suffix names supported by all engines. More...
 
void setSuffixes (const QStringList &value)
 setSuffixes default is using SubtitleProcessor. More...
 
QStringList suffixes () const
 
qreal timestamp () const
 
qreal delay () const
 delay unit: second The subtitle from getText() and getImage() is at the time: timestamp() + delay() More...
 
void setDelay (qreal value)
 
bool canRender () const
 canRender wether current processor supports rendering. More...
 
QString getText () const
 
QImage getImage (int width, int height, QRect *boundingRect=0)
 getImage Get a subtitle image with given (video) frame size. More...
 
SubImageSet getSubImages (int width, int height, QRect *boundingRect=0)
 
bool processHeader (const QByteArray &codec, const QByteArray &data)
 processHeader Always called if switch to a new internal subtitle stream. More...
 
bool processLine (const QByteArray &data, qreal pts=-1, qreal duration=0)
 
QString fontFile () const
 
void setFontFile (const QString &value)
 
QString fontsDir () const
 fontsDir Not tested for dwrite provider. More...
 
void setFontsDir (const QString &value)
 
bool isFontFileForced () const
 
void setFontFileForced (bool value)
 

Properties

QByteArray codec
 
QStringList engines
 
QString engine
 
bool fuzzyMatch
 
QByteArray rawData
 
QString fileName
 
QStringList dirs
 
QStringList suffixes
 
QStringList supportedSuffixes
 
qreal timestamp
 
qreal delay
 
QString text
 
bool loaded
 
bool canRender
 
QString fontFile
 
QString fontsDir
 
bool fontFileForced
 

Constructor & Destructor Documentation

QtAV::Subtitle::Subtitle ( QObject *  parent = 0)
explicit
virtual QtAV::Subtitle::~Subtitle ( )
virtual

Member Function Documentation

bool QtAV::Subtitle::canRender ( ) const

canRender wether current processor supports rendering.

Check before getImage()

Returns
void QtAV::Subtitle::canRenderChanged ( )
signal
QByteArray QtAV::Subtitle::codec ( ) const
void QtAV::Subtitle::codecChanged ( )
signal
void QtAV::Subtitle::contentChanged ( )
signal

contentChanged emitted when text content changed.

qreal QtAV::Subtitle::delay ( ) const

delay unit: second The subtitle from getText() and getImage() is at the time: timestamp() + delay()

Returns
void QtAV::Subtitle::delayChanged ( )
signal
QStringList QtAV::Subtitle::dirs ( ) const
void QtAV::Subtitle::dirsChanged ( )
signal
QString QtAV::Subtitle::engine ( ) const

engine

Returns
The engine in use for current subtitle
void QtAV::Subtitle::engineChanged ( )
signal
QStringList QtAV::Subtitle::engines ( ) const
void QtAV::Subtitle::enginesChanged ( )
signal
QString QtAV::Subtitle::fileName ( ) const
void QtAV::Subtitle::fileNameChanged ( )
signal
QString QtAV::Subtitle::fontFile ( ) const
void QtAV::Subtitle::fontFileChanged ( )
signal
void QtAV::Subtitle::fontFileForcedChanged ( )
signal
QString QtAV::Subtitle::fontsDir ( ) const

fontsDir Not tested for dwrite provider.

FontConfig can work.

void QtAV::Subtitle::fontsDirChanged ( )
signal
bool QtAV::Subtitle::fuzzyMatch ( ) const
void QtAV::Subtitle::fuzzyMatchChanged ( )
signal
QImage QtAV::Subtitle::getImage ( int  width,
int  height,
QRect *  boundingRect = 0 
)

getImage Get a subtitle image with given (video) frame size.

The result image size usually smaller than given frame size because subtitle are lines of text. The boundingRect indicates the actual image position and size relative to given size. The result image format is QImage::Format_ARGB32

Returns
empty image if no image, or subtitle processor does not support renderering
SubImageSet QtAV::Subtitle::getSubImages ( int  width,
int  height,
QRect *  boundingRect = 0 
)
QString QtAV::Subtitle::getText ( ) const
bool QtAV::Subtitle::isFontFileForced ( ) const
bool QtAV::Subtitle::isLoaded ( ) const

isValid indicate whether the subtitle can be found and processed

Returns
void QtAV::Subtitle::load ( )
slot

start start to process the whole subtitle content in a thread

void QtAV::Subtitle::loadAsync ( )
slot
void QtAV::Subtitle::loaded ( const QString &  path = QString())
signal

empty path if load from raw data

bool QtAV::Subtitle::processHeader ( const QByteArray &  codec,
const QByteArray &  data 
)

processHeader Always called if switch to a new internal subtitle stream.

But header data can be empty Used by libass to set style etc.

bool QtAV::Subtitle::processLine ( const QByteArray &  data,
qreal  pts = -1,
qreal  duration = 0 
)
QByteArray QtAV::Subtitle::rawData ( ) const
void QtAV::Subtitle::rawDataChanged ( )
signal
void QtAV::Subtitle::setCodec ( const QByteArray &  value)

setCodec set subtitle encoding that supported by QTextCodec.

You have to call load() to manually reload the subtitle with given codec

Parameters
valuecodec name. see QTextCodec.availableCodecs(). Empty value means using the default codec in QTextCodec If linked with libchardet(https://github.com/cnangel/libchardet) or can dynamically load it, set value of "AutoDetect" to detect the charset of subtitle
void QtAV::Subtitle::setDelay ( qreal  value)
void QtAV::Subtitle::setDirs ( const QStringList &  value)

setDirs Set subtitle search directories.

Video's dir will always be added.

void QtAV::Subtitle::setEngines ( const QStringList &  value)

setEngines Set subtitle processor engine names, in priority order.

When loading a subtitle, use the engines one by one until a usable engine is found.

Parameters
value
void QtAV::Subtitle::setFileName ( const QString &  name)

setFileName the given name will be in the 1st place to try to open(if using fuzzy match).

then files in suffixes() order or in processor's supported suffixes order

Parameters
name
void QtAV::Subtitle::setFontFile ( const QString &  value)
void QtAV::Subtitle::setFontFileForced ( bool  value)
void QtAV::Subtitle::setFontsDir ( const QString &  value)
void QtAV::Subtitle::setFuzzyMatch ( bool  value)
void QtAV::Subtitle::setRawData ( const QByteArray &  data)
void QtAV::Subtitle::setSuffixes ( const QStringList &  value)

setSuffixes default is using SubtitleProcessor.

Empty equals default value. But suffixes() will return empty.

void QtAV::Subtitle::setTimestamp ( qreal  t)
slot
QStringList QtAV::Subtitle::suffixes ( ) const
void QtAV::Subtitle::suffixesChanged ( )
signal
QStringList QtAV::Subtitle::supportedSuffixes ( ) const

supportedFormats the suffix names supported by all engines.

for example ["ass", "ssa"]

Returns
void QtAV::Subtitle::supportedSuffixesChanged ( )
signal
qreal QtAV::Subtitle::timestamp ( ) const

Property Documentation

bool QtAV::Subtitle::canRender
read
QByteArray QtAV::Subtitle::codec
readwrite
qreal QtAV::Subtitle::delay
readwrite
QStringList QtAV::Subtitle::dirs
readwrite
QString QtAV::Subtitle::engine
read
QStringList QtAV::Subtitle::engines
readwrite
QString QtAV::Subtitle::fileName
readwrite
QString QtAV::Subtitle::fontFile
readwrite
bool QtAV::Subtitle::fontFileForced
readwrite
QString QtAV::Subtitle::fontsDir
readwrite
bool QtAV::Subtitle::fuzzyMatch
readwrite
bool QtAV::Subtitle::loaded
read
QByteArray QtAV::Subtitle::rawData
readwrite
QStringList QtAV::Subtitle::suffixes
readwrite
QStringList QtAV::Subtitle::supportedSuffixes
read
QString QtAV::Subtitle::text
read
qreal QtAV::Subtitle::timestamp
readwrite

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