set pat/pmt timeout back to 20 seconds... to get rid of recordings without
[enigma2.git] / lib / dvb / teletext.h
1 #ifndef __lib_dvb_teletext_h
2 #define __lib_dvb_teletext_h
3
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>
9 #include <map>
10
11 struct eDVBTeletextSubtitlePageElement
12 {
13         gRGB m_color;
14         std::string m_text;
15         eRect m_area;
16         eDVBTeletextSubtitlePageElement(const gRGB &color, const std::string &text)
17                 : m_color(color), m_text(text)
18         {
19         }
20 };
21
22 struct eDVBTeletextSubtitlePage
23 {
24         pts_t m_pts;
25         int m_have_pts;
26         int m_timeout; /* in pts */
27         std::vector<eDVBTeletextSubtitlePageElement> m_elements;
28         
29         void clear() { m_elements.clear(); }
30 };
31
32 class eDVBTeletextParser: public iObject, public ePESParser, public Object
33 {
34         DECLARE_REF(eDVBTeletextParser);
35 public:
36         eDVBTeletextParser(iDVBDemux *demux);
37         virtual ~eDVBTeletextParser();
38         int start(int pid);
39         void setPageAndMagazine(int page, int magazine);
40         void setMagazine(int magazine);
41         void connectNewPage(const Slot1<void,const eDVBTeletextSubtitlePage &> &slot, ePtr<eConnection> &connection);
42         std::set<eDVBServicePMTHandler::subtitleStream> m_found_subtitle_pages;
43 private:
44         std::map<int, unsigned int> m_modifications;
45         void processPESPacket(__u8 *pkt, int len);
46         
47         ePtr<iDVBPESReader> m_pes_reader;
48         ePtr<eConnection> m_read_connection;
49         
50         eDVBTeletextSubtitlePage m_subtitle_page;
51         
52         int m_C, m_Y, m_pid, m_page_M, m_page_X, m_page_open, m_double_height, m_box_open;
53         
54         void handlePageStart();
55         void handleLine(unsigned char *line, int len);
56         void handlePageEnd(int have_pts, const pts_t &pts);
57         
58         std::string m_subtitle_text;
59         int m_subtitle_color;
60         
61         void addSubtitleString(int color, std::string string);
62         
63         void sendSubtitlePage();
64         
65         Signal1<void,const eDVBTeletextSubtitlePage&> m_new_subtitle_page;
66 };
67
68 #endif