diff options
-rw-r--r-- | ttxtsubs.c | 17 | ||||
-rw-r--r-- | ttxtsubsdisplayer.c | 19 | ||||
-rw-r--r-- | ttxtsubsdisplayer.h | 2 |
3 files changed, 33 insertions, 5 deletions
@@ -49,6 +49,9 @@ #if defined(APIVERSNUM) && APIVERSNUM < 10706 #error "This version of ttxtsubs only works with vdr version >= 1.7.6!" #endif +#if TTXTSUBSVERSNUM != 2 +#error "This version of ttxtsubs requires the ttxtsubs patch version 2 to be applied to VDR!!" +#endif static const char *VERSION = "0.1.0"; static const char *DESCRIPTION = trNOOP("Teletext subtitles"); @@ -146,7 +149,7 @@ public: // -- cVDRTtxtsubsHookListener virtual void HideOSD(void) { HideTtxt(); } virtual void ShowOSD(void) { ShowTtxt(); } - virtual void PlayerTeletextData(uint8_t *p, int length, bool IsPesRecording); + virtual void PlayerTeletextData(uint8_t *p, int length, bool IsPesRecording, const struct tTeletextSubtitlePage teletextSubtitlePages[]); virtual int ManualPageNumber(const cChannel *channel); // -- cThread @@ -369,6 +372,11 @@ void cPluginTtxtsubs::Action(void) StartTtxtPlay(page); lastc=cn; } + else + { + StartTtxtPlay(0x000); + lastc=cn; + } } else { cChannel *c = Channels.GetByNumber(cn); @@ -462,8 +470,11 @@ void cPluginTtxtsubs::Replaying(const cControl *Control, const char *Name, const sem_post(&chswitchwait); } -void cPluginTtxtsubs::PlayerTeletextData(uint8_t *p, int length, bool IsPesRecording) +void cPluginTtxtsubs::PlayerTeletextData(uint8_t *p, int length, bool IsPesRecording, const struct tTeletextSubtitlePage teletextSubtitlePages[]) { + if (!mDispl) + return; + cTtxtSubsPlayer *r = dynamic_cast<cTtxtSubsPlayer *>(mDispl); if(!r) { @@ -471,7 +482,7 @@ void cPluginTtxtsubs::PlayerTeletextData(uint8_t *p, int length, bool IsPesRecor return; } - r->PES_data(p, length, IsPesRecording); + r->PES_data(p, length, IsPesRecording, teletextSubtitlePages); } int cPluginTtxtsubs::ManualPageNumber(const cChannel *channel) diff --git a/ttxtsubsdisplayer.c b/ttxtsubsdisplayer.c index b5b9815..295ea8d 100644 --- a/ttxtsubsdisplayer.c +++ b/ttxtsubsdisplayer.c @@ -152,7 +152,7 @@ cTtxtSubsPlayer::cTtxtSubsPlayer(int backup_textpage) // Take PES packets and break out the teletext data // Buffer the data for processing in a separate thread // XXX We should do some filtering here to avoid unneccessary load! -void cTtxtSubsPlayer::PES_data(uchar *p, int Length, bool IsPesRecording) +void cTtxtSubsPlayer::PES_data(uchar *p, int Length, bool IsPesRecording, const struct tTeletextSubtitlePage teletextSubtitlePages[]) { int i; @@ -163,6 +163,23 @@ void cTtxtSubsPlayer::PES_data(uchar *p, int Length, bool IsPesRecording) fprintf(stderr, "cTtxtSubsPlayer::PES_data: bad indata!\n"); } + if (!mFoundLangPage) + { + if (teletextSubtitlePages && teletextSubtitlePages[0].ttxtType) + { + for (int p=0; teletextSubtitlePages[p].ttxtType; p++) { + int ch = globals.langChoise(teletextSubtitlePages[p].ttxtLanguage, teletextSubtitlePages[p].ttxtType == 0x05); + if (ch >= 0 && ch < mLangChoise) { + mLangChoise = ch; + int bcdPage = (teletextSubtitlePages[p].ttxtMagazine << 8) + teletextSubtitlePages[p].ttxtPage; + mDisp->SetPage(bcdPage); + mFoundLangPage = 1; + fprintf(stderr, "Found subtitle page: %03x\n", bcdPage); // XXX + } + } + } + } + // Recorded teletext typically has payload type 0x10. // We use the payload type 0x1f to indicate that we have our own // filtered stream, if we find that we only use that. diff --git a/ttxtsubsdisplayer.h b/ttxtsubsdisplayer.h index 014b6fd..0d30c75 100644 --- a/ttxtsubsdisplayer.h +++ b/ttxtsubsdisplayer.h @@ -54,7 +54,7 @@ class cTtxtSubsLiveReceiver : public cReceiver, public cTtxtSubsDisplayer { class cTtxtSubsPlayer : public cTtxtSubsDisplayer { public: cTtxtSubsPlayer(int backup_textpage); - virtual void PES_data(uchar *Data, int Length, bool IsPesRecording); + virtual void PES_data(uchar *Data, int Length, bool IsPesRecording, const struct tTeletextSubtitlePage teletextSubtitlePages[]); private: void SearchLanguagePage(uint8_t *p, int len); |