1 #ifndef __lib_dvb_teletext_h
2 #define __lib_dvb_teletext_h
4 #include <lib/base/object.h>
5 #include <lib/dvb/idvb.h>
6 #include <lib/dvb/pesparse.h>
7 #include <lib/dvb/pmt.h>
8 #include <lib/gdi/gpixmap.h>
11 struct eDVBTeletextSubtitlePageElement
19 eDVBTeletextSubtitlePageElement(const gRGB &color, const std::string &text, int source_line)
20 : m_color(color), m_text(text), m_source_line(source_line)
25 struct eDVBTeletextSubtitlePage
29 int m_timeout; /* in pts */
30 std::vector<eDVBTeletextSubtitlePageElement> m_elements;
32 void clearLine(int line) { for (unsigned int i = 0; i < m_elements.size(); ) if (m_elements[i].m_source_line == line) m_elements.erase(m_elements.begin() + i); else ++i; }
33 void clear() { m_elements.clear(); }
36 class eDVBTeletextParser: public iObject, public ePESParser, public Object
38 DECLARE_REF(eDVBTeletextParser);
40 eDVBTeletextParser(iDVBDemux *demux);
41 virtual ~eDVBTeletextParser();
43 void setPageAndMagazine(int page, int magazine);
44 void setMagazine(int magazine);
45 void connectNewPage(const Slot1<void,const eDVBTeletextSubtitlePage &> &slot, ePtr<eConnection> &connection);
46 std::set<eDVBServicePMTHandler::subtitleStream> m_found_subtitle_pages;
48 std::map<int, unsigned int> m_modifications;
49 void processPESPacket(__u8 *pkt, int len);
51 ePtr<iDVBPESReader> m_pes_reader;
52 ePtr<eConnection> m_read_connection;
54 eDVBTeletextSubtitlePage m_subtitle_page;
56 int m_C, m_Y, m_pid, m_page_M, m_page_X, m_page_open, m_double_height, m_box_open;
57 int m_X28_0_valid, m_X28_t1, m_X28_t2;
58 int m_M29_0_valid, m_M29_t1, m_M29_t2;
60 void handlePageStart();
61 void handleLine(unsigned char *line, int len);
62 void handlePageEnd(int have_pts, const pts_t &pts);
64 std::string m_subtitle_text;
66 int m_current_source_line;
68 void addSubtitleString(int color, std::string string, int source_line);
70 void sendSubtitlePage();
72 Signal1<void,const eDVBTeletextSubtitlePage&> m_new_subtitle_page;