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

◆ Subtitle()

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

◆ ~Subtitle()

virtual QtAV::Subtitle::~Subtitle ( )
virtual

Member Function Documentation

◆ canRender()

bool QtAV::Subtitle::canRender ( ) const

canRender wether current processor supports rendering.

Check before getImage()

Returns

◆ canRenderChanged

void QtAV::Subtitle::canRenderChanged ( )
signal

◆ codec()

QByteArray QtAV::Subtitle::codec ( ) const

◆ codecChanged

void QtAV::Subtitle::codecChanged ( )
signal

◆ contentChanged

void QtAV::Subtitle::contentChanged ( )
signal

contentChanged emitted when text content changed.

◆ delay()

qreal QtAV::Subtitle::delay ( ) const

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

Returns

◆ delayChanged

void QtAV::Subtitle::delayChanged ( )
signal

◆ dirs()

QStringList QtAV::Subtitle::dirs ( ) const

◆ dirsChanged

void QtAV::Subtitle::dirsChanged ( )
signal

◆ engine()

QString QtAV::Subtitle::engine ( ) const

engine

Returns
The engine in use for current subtitle

◆ engineChanged

void QtAV::Subtitle::engineChanged ( )
signal

◆ engines()

QStringList QtAV::Subtitle::engines ( ) const

◆ enginesChanged

void QtAV::Subtitle::enginesChanged ( )
signal

◆ fileName()

QString QtAV::Subtitle::fileName ( ) const

◆ fileNameChanged

void QtAV::Subtitle::fileNameChanged ( )
signal

◆ fontFile()

QString QtAV::Subtitle::fontFile ( ) const

◆ fontFileChanged

void QtAV::Subtitle::fontFileChanged ( )
signal

◆ fontFileForcedChanged

void QtAV::Subtitle::fontFileForcedChanged ( )
signal

◆ fontsDir()

QString QtAV::Subtitle::fontsDir ( ) const

fontsDir Not tested for dwrite provider.

FontConfig can work.

◆ fontsDirChanged

void QtAV::Subtitle::fontsDirChanged ( )
signal

◆ fuzzyMatch()

bool QtAV::Subtitle::fuzzyMatch ( ) const

◆ fuzzyMatchChanged

void QtAV::Subtitle::fuzzyMatchChanged ( )
signal

◆ getImage()

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

◆ getSubImages()

SubImageSet QtAV::Subtitle::getSubImages ( int  width,
int  height,
QRect *  boundingRect = 0 
)

◆ getText()

QString QtAV::Subtitle::getText ( ) const

◆ isFontFileForced()

bool QtAV::Subtitle::isFontFileForced ( ) const

◆ isLoaded()

bool QtAV::Subtitle::isLoaded ( ) const

isValid indicate whether the subtitle can be found and processed

Returns

◆ load

void QtAV::Subtitle::load ( )
slot

start start to process the whole subtitle content in a thread

◆ loadAsync

void QtAV::Subtitle::loadAsync ( )
slot

◆ loaded

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

empty path if load from raw data

◆ processHeader()

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.

◆ processLine()

bool QtAV::Subtitle::processLine ( const QByteArray &  data,
qreal  pts = -1,
qreal  duration = 0 
)

◆ rawData()

QByteArray QtAV::Subtitle::rawData ( ) const

◆ rawDataChanged

void QtAV::Subtitle::rawDataChanged ( )
signal

◆ setCodec()

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

◆ setDelay()

void QtAV::Subtitle::setDelay ( qreal  value)

◆ setDirs()

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

setDirs Set subtitle search directories.

Video's dir will always be added.

◆ setEngines()

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

◆ setFileName()

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

◆ setFontFile()

void QtAV::Subtitle::setFontFile ( const QString &  value)

◆ setFontFileForced()

void QtAV::Subtitle::setFontFileForced ( bool  value)

◆ setFontsDir()

void QtAV::Subtitle::setFontsDir ( const QString &  value)

◆ setFuzzyMatch()

void QtAV::Subtitle::setFuzzyMatch ( bool  value)

◆ setRawData()

void QtAV::Subtitle::setRawData ( const QByteArray &  data)

◆ setSuffixes()

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

setSuffixes default is using SubtitleProcessor.

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

◆ setTimestamp

void QtAV::Subtitle::setTimestamp ( qreal  t)
slot

◆ suffixes()

QStringList QtAV::Subtitle::suffixes ( ) const

◆ suffixesChanged

void QtAV::Subtitle::suffixesChanged ( )
signal

◆ supportedSuffixes()

QStringList QtAV::Subtitle::supportedSuffixes ( ) const

supportedFormats the suffix names supported by all engines.

for example ["ass", "ssa"]

Returns

◆ supportedSuffixesChanged

void QtAV::Subtitle::supportedSuffixesChanged ( )
signal

◆ timestamp()

qreal QtAV::Subtitle::timestamp ( ) const

Property Documentation

◆ canRender

bool QtAV::Subtitle::canRender
read

◆ codec

QByteArray QtAV::Subtitle::codec
readwrite

◆ delay

qreal QtAV::Subtitle::delay
readwrite

◆ dirs

QStringList QtAV::Subtitle::dirs
readwrite

◆ engine

QString QtAV::Subtitle::engine
read

◆ engines

QStringList QtAV::Subtitle::engines
readwrite

◆ fileName

QString QtAV::Subtitle::fileName
readwrite

◆ fontFile

QString QtAV::Subtitle::fontFile
readwrite

◆ fontFileForced

bool QtAV::Subtitle::fontFileForced
readwrite

◆ fontsDir

QString QtAV::Subtitle::fontsDir
readwrite

◆ fuzzyMatch

bool QtAV::Subtitle::fuzzyMatch
readwrite

◆ loaded

bool QtAV::Subtitle::loaded
read

◆ rawData

QByteArray QtAV::Subtitle::rawData
readwrite

◆ suffixes

QStringList QtAV::Subtitle::suffixes
readwrite

◆ supportedSuffixes

QStringList QtAV::Subtitle::supportedSuffixes
read

◆ text

QString QtAV::Subtitle::text
read

◆ timestamp

qreal QtAV::Subtitle::timestamp
readwrite

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