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;
11 struct subtitle_clut_entry
19 unsigned char clut_id;
20 unsigned char CLUT_version_number;
21 subtitle_clut_entry entries_2bit[4];
22 subtitle_clut_entry entries_4bit[16];
23 subtitle_clut_entry entries_8bit[256];
27 struct subtitle_page_region
30 int region_horizontal_address;
31 int region_vertical_address;
32 subtitle_page_region *next;
35 struct subtitle_region_object
39 int object_provider_flag;
41 int object_horizontal_position;
42 int object_vertical_position;
44 // not supported right now...
45 int foreground_pixel_value;
46 int background_pixel_value;
48 subtitle_region_object *next;
51 struct subtitle_region
54 int region_version_number;
55 int region_height, region_width;
56 enum depth { bpp2=1, bpp4=2, bpp8=3 } region_depth;
58 ePtr<gPixmap> region_buffer;
62 subtitle_region_object *region_objects;
64 subtitle_region *next;
73 int page_version_number;
75 subtitle_page_region *page_regions;
77 subtitle_region *regions;
92 struct eDVBSubtitleRegion
94 ePtr<gPixmap> m_pixmap;
96 eDVBSubtitleRegion &operator=(const eDVBSubtitleRegion &s)
98 m_pixmap = s.m_pixmap;
99 m_position = s.m_position;
104 struct eDVBSubtitlePage
106 std::list<eDVBSubtitleRegion> m_regions;
110 class eDVBSubtitleParser
111 :public iObject, public ePESParser, public Object
113 DECLARE_REF(eDVBSubtitleParser);
114 subtitle_page *m_pages;
115 ePtr<iDVBPESReader> m_pes_reader;
116 ePtr<eConnection> m_read_connection;
118 Signal1<void,const eDVBSubtitlePage&> m_new_subtitle_page;
119 int m_composition_page_id, m_ancillary_page_id;
121 eDVBSubtitleParser(iDVBDemux *demux);
122 virtual ~eDVBSubtitleParser();
123 int start(int pid, int composition_page_id, int ancillary_page_id);
125 void connectNewPage(const Slot1<void, const eDVBSubtitlePage&> &slot, ePtr<eConnection> &connection);
127 void subtitle_process_line(subtitle_page *page, int object_id, int line, __u8 *data, int len);
128 int subtitle_process_pixel_data(subtitle_page *page, int object_id, int *linenr, int *linep, __u8 *data);
129 int subtitle_process_segment(__u8 *segment);
130 void subtitle_process_pes(__u8 *buffer, int len);
131 void subtitle_redraw_all();
132 void subtitle_reset();
133 void subtitle_redraw(int page_id);
134 void processPESPacket(__u8 *pkt, int len) { subtitle_process_pes(pkt, len); }