1 #ifndef __lib_dvb_subtitle_h
2 #define __lib_dvb_subtitle_h
4 #include <lib/base/object.h>
5 #include <lib/dvb/idvb.h>
6 #include <lib/dvb/pesparse.h>
7 #include <lib/gdi/gpixmap.h>
9 typedef unsigned char __u8;
33 struct subtitle_clut_entry
41 unsigned char clut_id;
42 unsigned char CLUT_version_number;
43 subtitle_clut_entry entries_2bit[4];
44 subtitle_clut_entry entries_4bit[16];
45 subtitle_clut_entry entries_8bit[256];
49 struct subtitle_page_region
52 int region_horizontal_address;
53 int region_vertical_address;
54 subtitle_page_region *next;
57 struct subtitle_region_object
61 int object_provider_flag;
63 int object_horizontal_position;
64 int object_vertical_position;
66 // not supported right now...
67 int foreground_pixel_value;
68 int background_pixel_value;
70 subtitle_region_object *next;
73 struct subtitle_region
78 enum tDepth { bpp2=1, bpp4=2, bpp8=3 } depth;
84 subtitle_region_object *objects;
86 subtitle_region *next;
95 int page_version_number;
98 subtitle_page_region *page_regions;
100 subtitle_region *regions;
102 subtitle_clut *cluts;
115 struct eDVBSubtitleRegion
117 ePtr<gPixmap> m_pixmap;
119 eDVBSubtitleRegion &operator=(const eDVBSubtitleRegion &s)
121 m_pixmap = s.m_pixmap;
122 m_position = s.m_position;
127 struct eDVBSubtitlePage
129 std::list<eDVBSubtitleRegion> m_regions;
131 eSize m_display_size;
134 class eDVBSubtitleParser
135 :public iObject, public ePESParser, public Object
137 DECLARE_REF(eDVBSubtitleParser);
138 subtitle_page *m_pages;
139 ePtr<iDVBPESReader> m_pes_reader;
140 ePtr<eConnection> m_read_connection;
142 Signal1<void,const eDVBSubtitlePage&> m_new_subtitle_page;
143 int m_composition_page_id, m_ancillary_page_id;
145 eSize m_display_size;
147 eDVBSubtitleParser(iDVBDemux *demux);
148 virtual ~eDVBSubtitleParser();
149 int start(int pid, int composition_page_id, int ancillary_page_id);
151 void connectNewPage(const Slot1<void, const eDVBSubtitlePage&> &slot, ePtr<eConnection> &connection);
153 void subtitle_process_line(subtitle_region *region, subtitle_region_object *object, int line, __u8 *data, int len);
154 int subtitle_process_pixel_data(subtitle_region *region, subtitle_region_object *object, int *linenr, int *linep, __u8 *data);
155 int subtitle_process_segment(__u8 *segment);
156 void subtitle_process_pes(__u8 *buffer, int len);
157 void subtitle_redraw_all();
158 void subtitle_reset();
159 void subtitle_redraw(int page_id);
160 void processPESPacket(__u8 *pkt, int len) { subtitle_process_pes(pkt, len); }