This class extracts Teletext subtitles from TS packets. More...
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... | |
![]() | |
QtsPesDemux (QtsPesHandlerInterface *handler=0, const QtsPidSet &pidFilter=QtsAllPids) | |
Constructor. More... | |
void | setPesHandler (QtsPesHandlerInterface *handler) |
Set the PES packet handler. More... | |
![]() | |
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, PidContext > | PidContextMap |
Map of PID analysis contexts, indexed by PID value. More... | |
typedef QMap< int, TeletextPage > | TeletextPageMap |
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... | |
This class extracts Teletext subtitles from TS packets.
|
private |
Map of TeletextPage, indexed by page number.
|
private |
Map of PID analysis contexts, indexed by PID value.
|
private |
|
explicit |
Constructor.
[in] | handler | User handler for Teletext notification. |
[in] | pidFilter | Set of PID's to filter. |
|
virtual |
Destructor.
|
private |
|
inline |
Activate or deactivate the font color tags in the output text.
[in] | addColors | If true, font colors tags will be inserted in the output text. |
|
inline |
Check if font colors tags are inserted in the output text.
void QtsTeletextDemux::flushTeletext | ( | ) |
Flush any pending Teletext message.
Useful only after receiving the last packet in the stream. Implicitly called by destructor.
|
inline |
Set the Teletext handler.
[in] | handler | The Teletext handler. |
int QtsTeletextDemux::frameCount | ( | int | page, |
QtsPid | pid = QTS_PID_NULL |
||
) | const |
Get the number of Teletext frames found in a given page.
[in] | page | Teletext page number. |
[in] | pid | Teletext PID. If omitted, use the first PID containing frames from the specified page. |
|
virtual |
Reset the analysis context.
Useful when the transport stream changes. The PID filter and the handlers are not modified.
Reimplemented from QtsPesDemux.
|
virtual |
Reset the analysis context for one single PID.
[in] | pid | PID to reset. |
Reimplemented from QtsPesDemux.
|
protectedvirtual |
This hook is invoked when a complete PES packet is available.
Overloaded from QtsPesDemux.
[in] | packet | The PES packet. |
Reimplemented from QtsPesDemux.
|
private |
Process one Teletext packet.
[in] | pid | PID number. |
[in,out] | pc | PID context. |
[in] | dataUnitId | Teletext packet data unit id. |
[in] | pkt | Address of Teletext packet (44 bytes, QTS_TELETEXT_PACKET_SIZE). |
|
private |
Process one Teletext page.
[in] | pid | PID number. |
[in,out] | pc | PID context. |
[in] | pageNumber | Page number. |
|
staticprivate |
Remove 8/4 Hamming code.
[in] | a | Hamming-encoded byte. |
|
staticprivate |
Remove 24/18 Hamming code.
[in] | a | Hamming-encoded word. |
|
inlineprivate |
Extract Teletext magazine number from Teletext page.
[in] | page | Teletext page. |
|
inlineprivate |
Extract Teletext page number from Teletext page.
[in] | page | Teletext page. |
|
staticprivate |
Converts a page number from BCD to binary.
Teletext page numbers are stored in Binary-Coded Decimal.
[in] | bcd | BCD page number. |
|
staticprivate |
Converts a page number from binary to BCD.
Teletext page numbers are stored in Binary-Coded Decimal.
[in] | bin | Binary page number. |
|
private |
User handler.
|
private |
Map of PID analysis contexts.
|
private |
Add font color tags.
|
private |
True when in the context of a handler.
|
private |
PID which is currently processed by handler.
|
private |
Delayed reset().