vdr  1.7.27
vdrttxtsubshooks.c
Go to the documentation of this file.
00001 /*
00002  * vdr-ttxtsubs - A plugin for the Linux Video Disk Recorder
00003  * Copyright (c) 2003 - 2008 Ragnar Sundblad <ragge@nada.kth.se>
00004  *
00005  * This program is free software; you can redistribute it and/or modify it
00006  * under the terms of the GNU General Public License as published by the
00007  * Free Software Foundation; either version 2 of the License, or (at your option)
00008  * any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful, but
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc.,
00017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00018  *
00019  */
00020 
00021 #include <stdlib.h>
00022 #include <stdio.h>
00023 #include <stdint.h>
00024 
00025 #include "vdrttxtsubshooks.h"
00026 
00027 // XXX Really should be a list...
00028 static cVDRTtxtsubsHookListener *gListener;
00029 
00030 // ------ class cVDRTtxtsubsHookProxy ------
00031 
00032 class cVDRTtxtsubsHookProxy : public cVDRTtxtsubsHookListener
00033 {
00034  public:
00035   virtual void HideOSD(void) { if(gListener) gListener->HideOSD(); };
00036   virtual void ShowOSD(void) { if(gListener) gListener->ShowOSD(); };
00037   virtual void PlayerTeletextData(uint8_t *p, int length, bool IsPesRecording, const struct tTeletextSubtitlePage teletextSubtitlePages[] = NULL, int pageCount = 0)
00038     { if(gListener) gListener->PlayerTeletextData(p, length, IsPesRecording, teletextSubtitlePages, pageCount); };
00039   virtual int ManualPageNumber(const cChannel *channel)
00040     { if(gListener) return gListener->ManualPageNumber(channel); else return 0; };
00041 };
00042 
00043 
00044 // ------ class cVDRTtxtsubsHookListener ------
00045 
00046 cVDRTtxtsubsHookListener::~cVDRTtxtsubsHookListener()
00047 {
00048   gListener = 0;
00049 }
00050 
00051 void cVDRTtxtsubsHookListener::HookAttach(void)
00052 {
00053   gListener = this;
00054   //printf("cVDRTtxtsubsHookListener::HookAttach\n");
00055 }
00056 
00057 static cVDRTtxtsubsHookProxy gProxy;
00058 
00059 cVDRTtxtsubsHookListener *cVDRTtxtsubsHookListener::Hook(void)
00060 {
00061   return &gProxy;
00062 }
00063