mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-27 15:32:52 +02:00
libdvbsub: hacks to try to improve the situation on TD
those don't really help yet, unfortunately
Origin commit data
------------------
Commit: ae38a828f0
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-02-27 (Sun, 27 Feb 2011)
This commit is contained in:
@@ -249,7 +249,7 @@ static void* reader_thread(void * /*arg*/)
|
|||||||
uint8_t* buf;
|
uint8_t* buf;
|
||||||
|
|
||||||
dmx = new cDemux(0);
|
dmx = new cDemux(0);
|
||||||
dmx->Open(DMX_PES_CHANNEL, NULL, 64*1024);
|
dmx->Open(DMX_PES_CHANNEL, NULL, 16*1024);
|
||||||
|
|
||||||
while (reader_running) {
|
while (reader_running) {
|
||||||
if(dvbsub_stopped /*dvbsub_paused*/) {
|
if(dvbsub_stopped /*dvbsub_paused*/) {
|
||||||
@@ -377,7 +377,7 @@ static void* dvbsub_thread(void* /*arg*/)
|
|||||||
if(packet_queue.size() == 0) {
|
if(packet_queue.size() == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sub_debug.print(Debug::VERBOSE, "PES: Wakeup, queue size %d\n\n", packet_queue.size());
|
sub_debug.print(Debug::VERBOSE, "PES: Wakeup, queue size %d\n", packet_queue.size());
|
||||||
if(dvbsub_stopped /*dvbsub_paused*/) {
|
if(dvbsub_stopped /*dvbsub_paused*/) {
|
||||||
clear_queue();
|
clear_queue();
|
||||||
continue;
|
continue;
|
||||||
|
@@ -56,7 +56,7 @@ cDvbSubtitleBitmaps::cDvbSubtitleBitmaps(int64_t pPts)
|
|||||||
|
|
||||||
cDvbSubtitleBitmaps::~cDvbSubtitleBitmaps()
|
cDvbSubtitleBitmaps::~cDvbSubtitleBitmaps()
|
||||||
{
|
{
|
||||||
dbgconverter("cDvbSubtitleBitmaps::delete: PTS: %lld rects %d\n", pts, Count());
|
// dbgconverter("cDvbSubtitleBitmaps::delete: PTS: %lld rects %d\n", pts, Count());
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(sub.rects) {
|
if(sub.rects) {
|
||||||
@@ -108,7 +108,7 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
|
|||||||
int ystart = CFrameBuffer::getInstance()->getScreenY();
|
int ystart = CFrameBuffer::getInstance()->getScreenY();
|
||||||
uint32_t *sublfb = CFrameBuffer::getInstance()->getFrameBufferPointer();
|
uint32_t *sublfb = CFrameBuffer::getInstance()->getFrameBufferPointer();
|
||||||
|
|
||||||
dbgconverter("cDvbSubtitleBitmaps::Draw: %d bitmaps, x= %d, width= %d yend=%d stride %d\n", Count(), xstart, wd, yend, stride);
|
// dbgconverter("cDvbSubtitleBitmaps::Draw: %d bitmaps, x= %d, width= %d yend=%d stride %d\n", Count(), xstart, wd, yend, stride);
|
||||||
|
|
||||||
double xc = (double) CFrameBuffer::getInstance()->getScreenWidth(true)/(double) 720;
|
double xc = (double) CFrameBuffer::getInstance()->getScreenWidth(true)/(double) 720;
|
||||||
double yc = (double) CFrameBuffer::getInstance()->getScreenHeight(true)/(double) 576;
|
double yc = (double) CFrameBuffer::getInstance()->getScreenHeight(true)/(double) 576;
|
||||||
@@ -134,8 +134,8 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
|
|||||||
yoff = ystart;
|
yoff = ystart;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgconverter("cDvbSubtitleBitmaps::Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1,
|
// dbgconverter("cDvbSubtitleBitmaps::Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1,
|
||||||
sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h, sub.rects[i]->nb_colors, xoff, yoff, nw, nh);
|
// sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h, sub.rects[i]->nb_colors, xoff, yoff, nw, nh);
|
||||||
|
|
||||||
fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->pict.data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh);
|
fb_pixel_t * newdata = simple_resize32 (sub.rects[i]->pict.data[0], colors, sub.rects[i]->nb_colors, width, height, nw, nh);
|
||||||
|
|
||||||
@@ -156,9 +156,9 @@ void cDvbSubtitleBitmaps::Draw(int &min_x, int &min_y, int &max_x, int &max_y)
|
|||||||
if(max_y < (yoff + nh))
|
if(max_y < (yoff + nh))
|
||||||
max_y = yoff + nh;
|
max_y = yoff + nh;
|
||||||
}
|
}
|
||||||
if(Count())
|
// if(Count())
|
||||||
dbgconverter("cDvbSubtitleBitmaps::Draw: finish, min/max screen: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y);
|
// dbgconverter("cDvbSubtitleBitmaps::Draw: finish, min/max screen: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y);
|
||||||
dbgconverter("\n");
|
// dbgconverter("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- cDvbSubtitleConverter -------------------------------------------------
|
// --- cDvbSubtitleConverter -------------------------------------------------
|
||||||
@@ -232,7 +232,7 @@ void cDvbSubtitleConverter::Pause(bool pause)
|
|||||||
|
|
||||||
void cDvbSubtitleConverter::Clear(void)
|
void cDvbSubtitleConverter::Clear(void)
|
||||||
{
|
{
|
||||||
dbgconverter("cDvbSubtitleConverter::Clear: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y);
|
// dbgconverter("cDvbSubtitleConverter::Clear: x=% d y= %d, w= %d, h= %d\n", min_x, min_y, max_x-min_x, max_y-min_y);
|
||||||
if(running && (max_x-min_x > 0) && (max_y-min_y > 0)) {
|
if(running && (max_x-min_x > 0) && (max_y-min_y > 0)) {
|
||||||
CFrameBuffer::getInstance()->paintBackgroundBoxRel (min_x, min_y, max_x-min_x, max_y-min_y);
|
CFrameBuffer::getInstance()->paintBackgroundBoxRel (min_x, min_y, max_x-min_x, max_y-min_y);
|
||||||
//CFrameBuffer::getInstance()->paintBackground();
|
//CFrameBuffer::getInstance()->paintBackground();
|
||||||
@@ -268,18 +268,18 @@ int cDvbSubtitleConverter::Convert(const uchar *Data, int Length, int64_t pts)
|
|||||||
avpkt.data = (uint8_t*) Data;
|
avpkt.data = (uint8_t*) Data;
|
||||||
avpkt.size = Length;
|
avpkt.size = Length;
|
||||||
|
|
||||||
dbgconverter("cDvbSubtitleConverter::Convert: sub %x pkt %x pts %lld\n", sub, &avpkt, pts);
|
// dbgconverter("cDvbSubtitleConverter::Convert: sub %x pkt %x pts %lld\n", sub, &avpkt, pts);
|
||||||
//avctx->sub_id = (anc_page << 16) | comp_page; //FIXME not patched ffmpeg needs this !
|
//avctx->sub_id = (anc_page << 16) | comp_page; //FIXME not patched ffmpeg needs this !
|
||||||
|
|
||||||
avcodec_decode_subtitle2(avctx, sub, &got_subtitle, &avpkt);
|
avcodec_decode_subtitle2(avctx, sub, &got_subtitle, &avpkt);
|
||||||
dbgconverter("cDvbSubtitleConverter::Convert: pts %lld subs ? %s, %d bitmaps\n", pts, got_subtitle? "yes" : "no", sub->num_rects);
|
// dbgconverter("cDvbSubtitleConverter::Convert: pts %lld subs ? %s, %d bitmaps\n", pts, got_subtitle? "yes" : "no", sub->num_rects);
|
||||||
|
|
||||||
if(got_subtitle) {
|
if(got_subtitle) {
|
||||||
if(DebugConverter) {
|
if(DebugConverter) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for(i = 0; i < sub->num_rects; i++) {
|
for(i = 0; i < sub->num_rects; i++) {
|
||||||
dbgconverter("cDvbSubtitleConverter::Convert: #%d at %d,%d size %d x %d colors %d\n", i+1,
|
// dbgconverter("cDvbSubtitleConverter::Convert: #%d at %d,%d size %d x %d colors %d\n", i+1,
|
||||||
sub->rects[i]->x, sub->rects[i]->y, sub->rects[i]->w, sub->rects[i]->h, sub->rects[i]->nb_colors);
|
// sub->rects[i]->x, sub->rects[i]->y, sub->rects[i]->w, sub->rects[i]->h, sub->rects[i]->nb_colors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bitmaps->Add(Bitmaps);
|
bitmaps->Add(Bitmaps);
|
||||||
@@ -300,7 +300,8 @@ void dvbsub_get_stc(int64_t * STC);
|
|||||||
int cDvbSubtitleConverter::Action(void)
|
int cDvbSubtitleConverter::Action(void)
|
||||||
{
|
{
|
||||||
int WaitMs = WAITMS;
|
int WaitMs = WAITMS;
|
||||||
|
retry:
|
||||||
|
bool shown = false;
|
||||||
if (!running)
|
if (!running)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -317,11 +318,12 @@ int cDvbSubtitleConverter::Action(void)
|
|||||||
|
|
||||||
Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC);
|
Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC);
|
||||||
Delta /= 90; // STC and PTS are in 1/90000s
|
Delta /= 90; // STC and PTS are in 1/90000s
|
||||||
dbgconverter("cDvbSubtitleConverter::Action: PTS: %016llx STC: %016llx (%lld) timeout: %d\n", sb->Pts(), STC, Delta, sb->Timeout());
|
// dbgconverter("cDvbSubtitleConverter::Action: PTS: %016llx STC: %016llx (%lld) timeout: %d\n", sb->Pts(), STC, Delta, sb->Timeout());
|
||||||
|
|
||||||
if (Delta <= MAXDELTA) {
|
if (Delta <= MAXDELTA) {
|
||||||
if (Delta <= SHOW_DELTA) {
|
if (Delta <= SHOW_DELTA) {
|
||||||
dbgconverter("cDvbSubtitleConverter::Action: Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1);
|
dbgconverter("cDvbSubtitleConverter::Action: PTS: %012llx STC: %012llx (%lld) timeout: %d bmp %d/%d\n", sb->Pts(), STC, Delta, sb->Timeout(), bitmaps->Count(), sb->Index() + 1);
|
||||||
|
// dbgconverter("cDvbSubtitleConverter::Action: Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1);
|
||||||
if (running) {
|
if (running) {
|
||||||
Clear();
|
Clear();
|
||||||
sb->Draw(min_x, min_y, max_x, max_y);
|
sb->Draw(min_x, min_y, max_x, max_y);
|
||||||
@@ -330,12 +332,16 @@ int cDvbSubtitleConverter::Action(void)
|
|||||||
if(sb->Count())
|
if(sb->Count())
|
||||||
WaitMs = MIN_DISPLAY_TIME;
|
WaitMs = MIN_DISPLAY_TIME;
|
||||||
bitmaps->Del(sb, true);
|
bitmaps->Del(sb, true);
|
||||||
|
shown = true;
|
||||||
}
|
}
|
||||||
else if (Delta < WaitMs)
|
else if (Delta < WaitMs)
|
||||||
WaitMs = (Delta > SHOW_DELTA) ? Delta - SHOW_DELTA : Delta;
|
WaitMs = (Delta > SHOW_DELTA) ? Delta - SHOW_DELTA : Delta;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
dbgconverter("deleted because delta (%lld) > MAXDELTA (%d)\n", Delta, MAXDELTA);
|
||||||
bitmaps->Del(sb, true);
|
bitmaps->Del(sb, true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Timeout.TimedOut()) {
|
if (Timeout.TimedOut()) {
|
||||||
dbgconverter("cDvbSubtitleConverter::Action: timeout, elapsed %lld\n", Timeout.Elapsed());
|
dbgconverter("cDvbSubtitleConverter::Action: timeout, elapsed %lld\n", Timeout.Elapsed());
|
||||||
@@ -344,6 +350,9 @@ int cDvbSubtitleConverter::Action(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Unlock();
|
Unlock();
|
||||||
|
if (shown)
|
||||||
|
goto retry;
|
||||||
|
|
||||||
if(WaitMs != WAITMS)
|
if(WaitMs != WAITMS)
|
||||||
dbgconverter("cDvbSubtitleConverter::Action: finish, WaitMs %d\n", WaitMs);
|
dbgconverter("cDvbSubtitleConverter::Action: finish, WaitMs %d\n", WaitMs);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user