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