QtlMovie 1.12 (A specialized FFmpeg front-end)
QtsTeletextDemux Class Reference

This class extracts Teletext subtitles from TS packets. More...

Inheritance diagram for QtsTeletextDemux:
QtsPesDemux QtsDemux

Classes

class  PidContext
 This internal structure contains the analysis context for one PID. More...
 
class  TeletextPage
 Structure of a Teletext page. More...
 

Public Member Functions

 QtsTeletextDemux (QtsTeletextHandlerInterface *handler=0, const QtsPidSet &pidFilter=QtsAllPids)
 Constructor. More...
 
virtual ~QtsTeletextDemux ()
 Destructor. More...
 
void flushTeletext ()
 Flush any pending Teletext message. More...
 
int frameCount (int page, QtsPid pid=QTS_PID_NULL) const
 Get the number of Teletext frames found in a given page. More...
 
bool getAddColors () const
 Check if font colors tags are inserted in the output text. More...
 
virtual void reset () Q_DECL_OVERRIDE
 Reset the analysis context. More...
 
virtual void resetPid (QtsPid pid) Q_DECL_OVERRIDE
 Reset the analysis context for one single PID. More...
 
void setAddColors (bool addColors)
 Activate or deactivate the font color tags in the output text. More...
 
void setTeletextHandler (QtsTeletextHandlerInterface *handler)
 Set the Teletext handler. More...
 
- Public Member Functions inherited from QtsPesDemux
 QtsPesDemux (QtsPesHandlerInterface *handler=0, const QtsPidSet &pidFilter=QtsAllPids)
 Constructor. More...
 
void setPesHandler (QtsPesHandlerInterface *handler)
 Set the PES packet handler. More...
 
- Public Member Functions inherited from QtsDemux
 QtsDemux (const QtsPidSet &pidFilter=QtsAllPids)
 Constructor. More...
 
virtual ~QtsDemux ()
 Virtual destructor. More...
 
virtual void addPid (QtsPid pid)
 Add a PID to filter. More...
 
void feedPacket (const QtsTsPacket &packet)
 Feed the demux with a TS packet. More...
 
int filteredPidCount () const
 Get the number of PID's which are filtered by the demux. More...
 
qint64 lastPcr () const
 Get the last PCR found in the stream. More...
 
QtsPacketCounter packetCount () const
 Get the number of process TS packets. More...
 
virtual void removePid (QtsPid pid)
 Remove a PID to filter. More...
 
void resetPacketCount ()
 Reset the number of process TS packets. More...
 
virtual void setPidFilter (const QtsPidSet &pidFilter)
 Set the list of PID's to filter. More...
 

Protected Member Functions

virtual void handlePesPacket (const QtsPesPacket &packet) Q_DECL_OVERRIDE
 This hook is invoked when a complete PES packet is available. More...
 

Private Types

typedef QMap< QtsPid, PidContextPidContextMap
 Map of PID analysis contexts, indexed by PID value. More...
 
typedef QMap< int, TeletextPageTeletextPageMap
 Map of TeletextPage, indexed by page number. More...
 
enum  TransMode {
  TRANSMODE_PARALLEL = 0,
  TRANSMODE_SERIAL = 1
}
 Teletext transmission mode. More...
 

Private Member Functions

 QtsTeletextDemux () Q_DECL_EQ_DELETE
 
int magazineOf (int page)
 Extract Teletext magazine number from Teletext page. More...
 
int pageOf (int page)
 Extract Teletext page number from Teletext page. More...
 
void processTeletextPacket (QtsPid pid, PidContext &pc, quint8 dataUnitId, const quint8 *pkt)
 Process one Teletext packet. More...
 
void processTeletextPage (QtsPid pid, PidContext &pc, int pageNumber)
 Process one Teletext page. More...
 

Static Private Member Functions

static int pageBcdToBinary (int bcd)
 Converts a page number from BCD to binary. More...
 
static int pageBinaryToBcd (int bin)
 Converts a page number from binary to BCD. More...
 
static quint32 unham_24_18 (quint32 a)
 Remove 24/18 Hamming code. More...
 
static quint8 unham_8_4 (quint8 a)
 Remove 8/4 Hamming code. More...
 

Private Attributes

bool _addColors
 Add font color tags. More...
 
bool _inHandler
 True when in the context of a handler. More...
 
QtsPid _pidInHandler
 PID which is currently processed by handler. More...
 
PidContextMap _pids
 Map of PID analysis contexts. More...
 
bool _resetPending
 Delayed reset(). More...
 
QtsTeletextHandlerInterface_txtHandler
 User handler. More...
 

Detailed Description

This class extracts Teletext subtitles from TS packets.

Member Typedef Documentation

◆ TeletextPageMap

Map of TeletextPage, indexed by page number.

◆ PidContextMap

Map of PID analysis contexts, indexed by PID value.

Member Enumeration Documentation

◆ TransMode

Teletext transmission mode.

Don't change values, they must match the binary format.

Enumerator
TRANSMODE_PARALLEL 

Parallel mode.

TRANSMODE_SERIAL 

Serial mode.

Constructor & Destructor Documentation

◆ QtsTeletextDemux() [1/2]

QtsTeletextDemux::QtsTeletextDemux ( QtsTeletextHandlerInterface handler = 0,
const QtsPidSet pidFilter = QtsAllPids 
)
explicit

Constructor.

Parameters
[in]handlerUser handler for Teletext notification.
[in]pidFilterSet of PID's to filter.

◆ ~QtsTeletextDemux()

QtsTeletextDemux::~QtsTeletextDemux ( )
virtual

Destructor.

◆ QtsTeletextDemux() [2/2]

QtsTeletextDemux::QtsTeletextDemux ( )
private

Member Function Documentation

◆ setAddColors()

void QtsTeletextDemux::setAddColors ( bool  addColors)
inline

Activate or deactivate the font color tags in the output text.

Parameters
[in]addColorsIf true, font colors tags will be inserted in the output text.

◆ getAddColors()

bool QtsTeletextDemux::getAddColors ( ) const
inline

Check if font colors tags are inserted in the output text.

Returns
True when font colors tags are inserted in the output text.

◆ flushTeletext()

void QtsTeletextDemux::flushTeletext ( )

Flush any pending Teletext message.

Useful only after receiving the last packet in the stream. Implicitly called by destructor.

◆ setTeletextHandler()

void QtsTeletextDemux::setTeletextHandler ( QtsTeletextHandlerInterface handler)
inline

Set the Teletext handler.

Parameters
[in]handlerThe Teletext handler.

◆ frameCount()

int QtsTeletextDemux::frameCount ( int  page,
QtsPid  pid = QTS_PID_NULL 
) const

Get the number of Teletext frames found in a given page.

Parameters
[in]pageTeletext page number.
[in]pidTeletext PID. If omitted, use the first PID containing frames from the specified page.
Returns
Number of Teletext frames found so far on page.

◆ reset()

void QtsTeletextDemux::reset ( )
virtual

Reset the analysis context.

Useful when the transport stream changes. The PID filter and the handlers are not modified.

Reimplemented from QtsPesDemux.

◆ resetPid()

void QtsTeletextDemux::resetPid ( QtsPid  pid)
virtual

Reset the analysis context for one single PID.

Parameters
[in]pidPID to reset.

Reimplemented from QtsPesDemux.

◆ handlePesPacket()

void QtsTeletextDemux::handlePesPacket ( const QtsPesPacket packet)
protectedvirtual

This hook is invoked when a complete PES packet is available.

Overloaded from QtsPesDemux.

Parameters
[in]packetThe PES packet.

Reimplemented from QtsPesDemux.

◆ processTeletextPacket()

void QtsTeletextDemux::processTeletextPacket ( QtsPid  pid,
QtsTeletextDemux::PidContext pc,
quint8  dataUnitId,
const quint8 *  pkt 
)
private

Process one Teletext packet.

Parameters
[in]pidPID number.
[in,out]pcPID context.
[in]dataUnitIdTeletext packet data unit id.
[in]pktAddress of Teletext packet (44 bytes, QTS_TELETEXT_PACKET_SIZE).

◆ processTeletextPage()

void QtsTeletextDemux::processTeletextPage ( QtsPid  pid,
QtsTeletextDemux::PidContext pc,
int  pageNumber 
)
private

Process one Teletext page.

Parameters
[in]pidPID number.
[in,out]pcPID context.
[in]pageNumberPage number.

◆ unham_8_4()

quint8 QtsTeletextDemux::unham_8_4 ( quint8  a)
staticprivate

Remove 8/4 Hamming code.

Parameters
[in]aHamming-encoded byte.
Returns
Decoded byte.
See also
ETSI 300 706, section 8.2.

◆ unham_24_18()

quint32 QtsTeletextDemux::unham_24_18 ( quint32  a)
staticprivate

Remove 24/18 Hamming code.

Parameters
[in]aHamming-encoded word.
Returns
Decoded word.
See also
ETSI 300 706, section 8.3.

◆ magazineOf()

int QtsTeletextDemux::magazineOf ( int  page)
inlineprivate

Extract Teletext magazine number from Teletext page.

Parameters
[in]pageTeletext page.
Returns
The Teletext magazine number.

◆ pageOf()

int QtsTeletextDemux::pageOf ( int  page)
inlineprivate

Extract Teletext page number from Teletext page.

Parameters
[in]pageTeletext page.
Returns
The Teletext page number.

◆ pageBcdToBinary()

int QtsTeletextDemux::pageBcdToBinary ( int  bcd)
staticprivate

Converts a page number from BCD to binary.

Teletext page numbers are stored in Binary-Coded Decimal.

Parameters
[in]bcdBCD page number.
Returns
Binary page number.

◆ pageBinaryToBcd()

int QtsTeletextDemux::pageBinaryToBcd ( int  bin)
staticprivate

Converts a page number from binary to BCD.

Teletext page numbers are stored in Binary-Coded Decimal.

Parameters
[in]binBinary page number.
Returns
BCD page number.

Member Data Documentation

◆ _txtHandler

QtsTeletextHandlerInterface* QtsTeletextDemux::_txtHandler
private

User handler.

◆ _pids

PidContextMap QtsTeletextDemux::_pids
private

Map of PID analysis contexts.

◆ _addColors

bool QtsTeletextDemux::_addColors
private

Add font color tags.

◆ _inHandler

bool QtsTeletextDemux::_inHandler
private

True when in the context of a handler.

◆ _pidInHandler

QtsPid QtsTeletextDemux::_pidInHandler
private

PID which is currently processed by handler.

◆ _resetPending

bool QtsTeletextDemux::_resetPending
private

Delayed reset().


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