[vdr] eHD and DVB subtitles sync

Antti Hartikainen ami+vdr at ah.fi
Sat Feb 28 11:30:09 CET 2009


I had a little time to track down the issue with reelbox plugin and DVB subtitle sync.

Subtitles works fine when using MPEG audio track, with live and recorings (i have set analog audio 
to soundcard from settings as suggested here earlier)

When changing to Dolby Digital audio track, subtitles don't even get displayed.

Problem seems to be how reelbox plugin returns STC. I copied line
-- CLIP --
dbgconverter("PTS: %lld  STC: %lld (%lld) timeout: %d\n", sb->Pts(), cDevice::PrimaryDevice()->GetSTC(), Delta, sb->Timeout());
-- CLIP -
in dvbsubtitle.c to just before if (Delta <= MAXDELTA) (because STC is wrong and delta is more than 
MAXDELTA, and it would never be shown).

With Dolby Digital track reelbox plugin always returns same STC:
-- CLIP --
Converter PTS: 7576263738
GET STC c0bdfd77
GET STC c0bdfd77
Before delta <= MAXDELTA: PTS: 7576263738  STC: 3233676663 (529108) timeout: 8
Converter PTS: 7576688500
GET STC c0bdfd77
GET STC c0bdfd77
Before delta <= MAXDELTA: PTS: 7576688500  STC: 3233676663 (533828) timeout: 3
Converter PTS: 7576696884
GET STC c0bdfd77
GET STC c0bdfd77
Before delta <= MAXDELTA: PTS: 7576696884  STC: 3233676663 (533921) timeout: 6
Converter PTS: 7581177356
GET STC c0bdfd77
GET STC c0bdfd77
Before delta <= MAXDELTA: PTS: 7581177356  STC: 3233676663 (583704) timeout: 7
Converter PTS: 7581486822
GET STC c0bdfd77
GET STC c0bdfd77
Before delta <= MAXDELTA: PTS: 7581486822  STC: 3233676663 (587142) timeout: 3
-- CLIP --

With PCM audio everything is working fine (note that "GET STC" doesn't appear here):
-- CLIP --
Converter PTS: 7591193232
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296037783 (2090) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296045463 (2005) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296056983 (1877) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296064663 (1791) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296076183 (1663) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296080023 (1621) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296091543 (1493) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296103063 (1365) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296106903 (1322) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296118423 (1194) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296129943 (1066) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296133783 (1023) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296141463 (938) timeout: 6 
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296149143 (853) timeout: 6 
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296160663 (725) timeout: 6 
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296168343 (639) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296176023 (554) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296187543 (426) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296195223 (341) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296206743 (213) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296214423 (127) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296222103 (42) timeout: 6
Before delta <= MAXDELTA: PTS: 7591193232  STC: 3296225943 (0) timeout: 6
Got 1 bitmaps, showing #1
PTS: 7591193232  STC: 3296225943 (0) timeout: 6
-- CLIP --

So next i checked out from where this "GET STC" is from. It's from reelbox plugin ReelBoxDevice.c:

-- CLIP --
    int64_t ReelBoxDevice::GetSTC()
    {
        UInt stc = stc_;
        if (audioPlayerHd_) {
                printf("GET STC %x\n",HdCommChannel::hda->player[0].stc+stc_);
                return HdCommChannel::hda->player[0].stc+stc_;
        }
        return (stc == 0) ? -1LL : stc;
    }
-- CLIP --

So i hope someone who has more experience with coding and with VDR can continue from here and try 
to find cure for this.I tried to comment whole "if (audioPlayerHd_)" statement but it 
didn't help, wrong STC will be returned always anyway.



More information about the vdr mailing list