mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
libdvbsub: hacks to try to improve the situation on TD
those don't really help yet, unfortunately
Origin commit data
------------------
Branch: ni/coolstream
Commit: ae38a828f0
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-02-27 (Sun, 27 Feb 2011)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -56,7 +56,7 @@ cDvbSubtitleBitmaps::cDvbSubtitleBitmaps(int64_t pPts)
|
||||
|
||||
cDvbSubtitleBitmaps::~cDvbSubtitleBitmaps()
|
||||
{
|
||||
dbgconverter("cDvbSubtitleBitmaps::delete: PTS: %lld rects %d\n", pts, Count());
|
||||
// dbgconverter("cDvbSubtitleBitmaps::delete: PTS: %lld rects %d\n", pts, Count());
|
||||
int i;
|
||||
|
||||
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();
|
||||
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 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;
|
||||
}
|
||||
|
||||
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);
|
||||
// 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);
|
||||
|
||||
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))
|
||||
max_y = yoff + nh;
|
||||
}
|
||||
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("\n");
|
||||
// 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("\n");
|
||||
}
|
||||
|
||||
// --- cDvbSubtitleConverter -------------------------------------------------
|
||||
@@ -232,7 +232,7 @@ void cDvbSubtitleConverter::Pause(bool pause)
|
||||
|
||||
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)) {
|
||||
CFrameBuffer::getInstance()->paintBackgroundBoxRel (min_x, min_y, max_x-min_x, max_y-min_y);
|
||||
//CFrameBuffer::getInstance()->paintBackground();
|
||||
@@ -268,18 +268,18 @@ int cDvbSubtitleConverter::Convert(const uchar *Data, int Length, int64_t pts)
|
||||
avpkt.data = (uint8_t*) Data;
|
||||
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 !
|
||||
|
||||
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(DebugConverter) {
|
||||
unsigned int 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,
|
||||
sub->rects[i]->x, sub->rects[i]->y, sub->rects[i]->w, sub->rects[i]->h, sub->rects[i]->nb_colors);
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
bitmaps->Add(Bitmaps);
|
||||
@@ -300,7 +300,8 @@ void dvbsub_get_stc(int64_t * STC);
|
||||
int cDvbSubtitleConverter::Action(void)
|
||||
{
|
||||
int WaitMs = WAITMS;
|
||||
|
||||
retry:
|
||||
bool shown = false;
|
||||
if (!running)
|
||||
return 0;
|
||||
|
||||
@@ -317,11 +318,12 @@ int cDvbSubtitleConverter::Action(void)
|
||||
|
||||
Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC);
|
||||
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 <= 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) {
|
||||
Clear();
|
||||
sb->Draw(min_x, min_y, max_x, max_y);
|
||||
@@ -330,12 +332,16 @@ int cDvbSubtitleConverter::Action(void)
|
||||
if(sb->Count())
|
||||
WaitMs = MIN_DISPLAY_TIME;
|
||||
bitmaps->Del(sb, true);
|
||||
shown = true;
|
||||
}
|
||||
else if (Delta < WaitMs)
|
||||
WaitMs = (Delta > SHOW_DELTA) ? Delta - SHOW_DELTA : Delta;
|
||||
}
|
||||
else
|
||||
{
|
||||
dbgconverter("deleted because delta (%lld) > MAXDELTA (%d)\n", Delta, MAXDELTA);
|
||||
bitmaps->Del(sb, true);
|
||||
}
|
||||
} else {
|
||||
if (Timeout.TimedOut()) {
|
||||
dbgconverter("cDvbSubtitleConverter::Action: timeout, elapsed %lld\n", Timeout.Elapsed());
|
||||
@@ -344,6 +350,9 @@ int cDvbSubtitleConverter::Action(void)
|
||||
}
|
||||
}
|
||||
Unlock();
|
||||
if (shown)
|
||||
goto retry;
|
||||
|
||||
if(WaitMs != WAITMS)
|
||||
dbgconverter("cDvbSubtitleConverter::Action: finish, WaitMs %d\n", WaitMs);
|
||||
|
||||
|
Reference in New Issue
Block a user