]> git.vomp.tv Git - vompclient.git/blob - tfeed.cc
Preparations for dynamic mode switching
[vompclient.git] / tfeed.cc
1 /*\r\r
2     Copyright 2008 Marten Richter\r\r
3     This file is part of VOMP.\r\r
4     VOMP is free software; you can redistribute it and/or modify\r
5     it under the terms of the GNU General Public License as published by\r
6     the Free Software Foundation; either version 2 of the License, or\r
7     (at your option) any later version.\r\r
8     VOMP is distributed in the hope that it will be useful,\r
9     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
11     GNU General Public License for more details.\r\r
12     You should have received a copy of the GNU General Public License\r
13     along with VOMP; if not, write to the Free Software\r
14     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
15 */\r\r
16 \r\r
17 #include "tfeed.h"\r\r
18 #include "log.h"\r#include "demuxer.h"\r#include "callback.h"\r\r
19 \r\r
20 TFeed::TFeed(Callback* tcb)\r: cb(*tcb)\r{\r  teletextEnabled = 1;\r}\r\r
21 \r\r
22 int TFeed::init()\r{\r  return 1;\r}\r\r
23 \r\r
24 int TFeed::shutdown()\r{\r\r
25   // FIXME\r  return 1;\r}\r\r
26 \r\r
27 void TFeed::disable()\r\r
28 {\r  teletextEnabled = 0;\r
29 }\r\r
30 \r\r
31 void TFeed::enable()\r
32 {\r      teletextEnabled = 1;\r\r
33 }\r\r
34 \r\r
35 int TFeed::start()\r
36 {\r
37   teletextEnabled = 1;\r
38   return threadStart();\r
39 }\r\r
40 \r\r
41 void TFeed::stop()\r
42 {\r
43   threadCancel();\r
44 }\r\r
45 \r\r
46 void TFeed::threadMethod()\r
47 {\r
48   bool tlen;\r\r
49   while(1)\r  {\r
50     threadCheckExit();\r
51     tlen = Demuxer::getInstance()->writeTeletext();\r\r
52     if (tlen)\r
53     {\r
54       cb.call(this);\r
55 //        Log::getInstance()->log("Tfeed", Log::DEBUG, "written");\r
56     }\r
57     else\r
58     {\r
59       //MILLISLEEP(100);\r
60         MILLISLEEP(20); //Performance Issue Marten\r
61     }\r
62   }\r
63 }\r