]> git.vomp.tv Git - vompclient.git/blob - playerlivetv.h
Fix text corruption in channel number display on live tv
[vompclient.git] / playerlivetv.h
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
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 #ifndef PLAYERLIVETV_H
22 #define PLAYERLIVETV_H
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #ifndef WIN32
27 #include <sys/time.h>
28 #endif
29 #include <time.h>
30
31 #include <queue>
32
33 #include "playerlive.h"
34
35 #ifdef WIN32
36 #include "threadwin.h"
37 #else
38 #include "threadp.h"
39 #endif
40
41 #include "callback.h"
42 #include "defines.h"
43 #include "vfeed.h"
44 #include "afeed.h"
45 #include "tfeed.h"
46 #include "vdr.h"
47
48 #include "teletextdecodervbiebu.h"
49
50 class MessageQueue;
51 class Audio;
52 class Video;
53 class Log;
54 class DemuxerTS;
55 class OSDReceiver;
56 class DVBSubtitles;
57
58 class PlayerLiveTV : public PlayerLive, public Thread_TYPE, public Callback, public StreamReceiver
59 {
60   public:
61     PlayerLiveTV(MessageQueue* messageQueue, void* messageReceiver, OSDReceiver* tosdReceiver, ChannelList* chanList);
62     virtual ~PlayerLiveTV();
63
64     virtual int init();
65     virtual int shutdown();
66
67     virtual void go(ULONG index);
68     virtual void setChannel(ULONG index);
69     virtual void stop();
70     virtual void setAudioChannel(int newChannel,int type,int streamtype);
71     virtual void setSubtitleChannel(int newChannel);
72     virtual bool toggleSubtitles();
73     virtual void turnSubtitlesOn(bool ison); 
74     virtual bool isSubtitlesOn() {return subtitlesShowing;};
75     virtual void tellSubtitlesOSDVisible(bool visible);
76
77     virtual bool* getDemuxerMpegAudioChannels();
78     virtual bool* getDemuxerAc3AudioChannels();
79     virtual int getCurrentAudioChannel();
80     virtual int getCurrentSubtitleChannel();
81     virtual int *getTeletxtSubtitlePages();
82
83     TeletextDecoderVBIEBU * getTeletextDecoder(){return teletext;};
84
85     void call(void*); // for callback interface
86
87     virtual void streamReceive(ULONG, void*, ULONG); // stream receiver interface
88     
89     // Player events
90
91     // FIXME so far this just duplicates the old system + the wss
92
93     const static UCHAR CONNECTION_LOST = 1;
94     const static UCHAR STOP_PLAYBACK = 2;
95     const static UCHAR STREAM_END = 3;
96     const static UCHAR ASPECT43 = 4;
97     const static UCHAR ASPECT169 = 5;
98     const static UCHAR PREBUFFERING = 6;
99
100   protected:
101     void threadMethod();
102     void threadPostStopCleanup() {};
103
104   private:
105     bool subtitlesShowing;
106     MessageQueue* messageQueue;
107     void* messageReceiver;
108     OSDReceiver* osdReceiver;
109     Log* logger;
110     Audio* audio;
111     Video* video;
112     DemuxerTS* demuxer;
113     DVBSubtitles* subtitles;
114     TeletextDecoderVBIEBU *teletext;
115     VDR* vdr;
116     VFeed vfeed;
117     AFeed afeed;
118     TFeed tfeed;
119     ChannelList* chanList;
120
121     queue<PLInstruction> instructions;
122     const static UCHAR I_SETCHANNEL = 1;
123     const static UCHAR I_STOP = 2;
124     
125     queue<StreamChunk> streamChunks;
126     
127     bool initted;
128
129     UCHAR state;
130     const static UCHAR S_STOP = 1;
131     const static UCHAR S_VIDEOSTARTUP = 2;
132     const static UCHAR S_PREBUFFERING = 3;
133     const static UCHAR S_PLAY = 4;
134     void switchState(UCHAR newState);
135     bool checkError();
136
137     bool videoStartup;
138     bool pendingAudioPlay;
139     bool stopNow;
140     bool h264;
141     int preBufferCount;
142     const static int preBufferAmount = 3;
143
144     void clearStreamChunks();
145     void chunkToDemuxer();
146     void optimizeInstructionQueue();
147 };
148
149 #endif
150