break;
}
// //eDebug("inserting %d bytes (into region %d)", len, region->region_id);
+// eDebug("put data to region_buffer %p", &(*region->region_buffer));
memcpy((__u8*)region->region_buffer->surface->data + region->region_width * y + x, data, len);
}
object = object->next;
segment_length |= *segment++;
if (segment_type == 0xFF)
return segment_length + 6;
+ if (page_id != m_composition_page_id && page_id != m_ancillary_page_id)
+ return segment_length + 6;
// //eDebug("have %d bytes of segment data", segment_length);
// //eDebug("page_id %d, segtype %02x", page_id, segment_type);
subtitle_page *page, **ppage;
- page = this->pages; ppage = &this->pages;
+ page = m_pages; ppage = &m_pages;
while (page)
{
// if no update, just skip this data.
if (page->page_version_number == page_version_number)
{
- eDebug("skip data... ");
+// eDebug("skip data... ");
break;
}
}
{
*pregion = region = new subtitle_region;
region->next = 0;
+ region->committed = false;
}
else if (region->region_version_number != region_version_number)
{
}
if (region->region_buffer)
{
- if (region->region_buffer->surface)
- delete region->region_buffer->surface;
+// eDebug("no more need of region_buffer %p", &(*region->region_buffer));
region->region_buffer=0;
}
+ region->committed = false;
}
else
break;
processed_length += 2;
region->region_buffer = new gPixmap(eSize(region->region_width, region->region_height), 8);
+// eDebug("new region_buffer %p", &(*region->region_buffer));
int region_level_of_compatibility, region_depth;
if (region_fill_flag)
{
+// eDebug("region fill region_buffer %p", &(*region->region_buffer));
if (region_depth == 1)
memset(region->region_buffer->surface->data, region_2bit_pixel_code, region->region_height * region->region_width);
else if (region_depth == 2)
void eDVBSubtitleParser::subtitle_process_pes(__u8 *pkt, int len)
{
// eDebug("subtitle_process_pes");
- if (!extract_pts(show_time, pkt))
+ if (!extract_pts(m_show_time, pkt))
{
pkt += 6; len -= 6;
// skip PES header
void eDVBSubtitleParser::subtitle_redraw_all()
{
#if 1
- subtitle_page *page = this->pages;
+ subtitle_page *page = m_pages;
while(page)
{
subtitle_redraw(page->page_id);
page = page->next;
}
#else
- subtitle_page *page = this->pages;
+ subtitle_page *page = m_pages;
//eDebug("----------- end of display set");
//eDebug("active pages:");
while (page)
void eDVBSubtitleParser::subtitle_reset()
{
- while (subtitle_page *page = this->pages)
+ while (subtitle_page *page = m_pages)
{
/* free page regions */
while (page->page_regions)
if (region->region_buffer)
{
- if (region->region_buffer->surface)
- delete region->region_buffer->surface;
+// eDebug("no more need of region_buffer 2 %p", &(*region->region_buffer));
region->region_buffer=0;
}
delete clut;
}
- this->pages = page->next;
+ m_pages = page->next;
delete page;
}
}
void eDVBSubtitleParser::subtitle_redraw(int page_id)
{
- subtitle_page *page = this->pages;
+ subtitle_page *page = m_pages;
- //eDebug("displaying page id %d", page_id);
+// eDebug("displaying page id %d", page_id);
while (page)
{
subtitle_page_region *region = page->page_regions;
eDVBSubtitlePage Page;
- Page.m_show_time = show_time;
+ Page.m_show_time = m_show_time;
for (; region; region=region->next)
{
// eDebug("region %d", region->region_id);
}
if (reg)
{
+ if (reg->committed)
+ continue;
// eDebug("copy region %d to %d, %d", region->region_id, region->region_horizontal_address, region->region_vertical_address);
int x0 = region->region_horizontal_address;
int y0 = region->region_vertical_address;
- int x1 = x0 + reg->region_width;
- int y1 = y0 + reg->region_height;
if ((x0 < 0) || (y0 < 0))
{
int clut_size = reg->region_buffer->surface->clut.colors = reg->region_depth == subtitle_region::bpp2 ?
4 : reg->region_depth == subtitle_region::bpp4 ? 16 : 256;
- if (reg->region_buffer->surface->clut.data &&
- clut_size != reg->region_buffer->surface->clut.colors)
- {
- delete [] reg->region_buffer->surface->clut.data;
- reg->region_buffer->surface->clut.data = 0;
- }
-
- if (!reg->region_buffer->surface->clut.data)
- reg->region_buffer->surface->clut.data = new gRGB[clut_size];
+ reg->region_buffer->surface->clut.data = new gRGB[clut_size];
+// eDebug("create clut data for region_buffer %p", &(*reg->region_buffer));
gRGB *palette = reg->region_buffer->surface->clut.data;
}
}
}
-
+
+// eDebug("commit region_buffer %p", &(*reg->region_buffer));
eDVBSubtitleRegion Region;
Region.m_pixmap = reg->region_buffer;
Region.m_position.setX(x0);
Region.m_position.setY(y0);
Page.m_regions.push_back(Region);
+ reg->committed = true;
}
else
eDebug("region not found");
DEFINE_REF(eDVBSubtitleParser);
eDVBSubtitleParser::eDVBSubtitleParser(iDVBDemux *demux)
- :pages(0)
+ :m_pages(0)
{
setStreamID(0xBD);
subtitle_reset();
}
-int eDVBSubtitleParser::start(int pid)
+int eDVBSubtitleParser::stop()
+{
+ if (m_pes_reader)
+ {
+ eDebug("disable dvb subtitles");
+ return m_pes_reader->stop();
+ }
+ return -1;
+}
+
+int eDVBSubtitleParser::start(int pid, int composition_page_id, int ancillary_page_id)
{
-#if 1
- eDebug("eDVBSubtitleParser::start(%04x)", pid);
if (m_pes_reader)
+ {
+ eDebug("start dvb subtitles on pid 0x%04x with composition_page_id %d and ancillary_page_id %d",
+ pid, composition_page_id, ancillary_page_id);
+ m_composition_page_id = composition_page_id;
+ m_ancillary_page_id = ancillary_page_id;
return m_pes_reader->start(pid);
- else
- return -1;
-#endif
+ }
+ return -1;
}
void eDVBSubtitleParser::connectNewPage(const Slot1<void, const eDVBSubtitlePage&> &slot, ePtr<eConnection> &connection)