]> git.vomp.tv Git - vompclient.git/blob - playerlivetv.h
Vogel Media Player 2008-11-28
[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 "vdr.h"
46
47 class MessageQueue;
48 class Audio;
49 class Video;
50 class Log;
51 class DemuxerTS;
52 class OSDReceiver;
53 class DVBSubtitles;
54
55 class PlayerLiveTV : public PlayerLive, public Thread_TYPE, public Callback, public StreamReceiver
56 {
57   public:
58     PlayerLiveTV(MessageQueue* messageQueue, void* messageReceiver, OSDReceiver* tosdReceiver, ChannelList* chanList);
59     virtual ~PlayerLiveTV();
60
61     virtual int init();
62     virtual int shutdown();
63
64     virtual void go(ULONG index);
65     virtual void setChannel(ULONG index);
66     virtual void stop();
67     virtual void setAudioChannel(int newChannel,int type);
68     virtual bool toggleSubtitles();
69
70     virtual bool* getDemuxerMpegAudioChannels();
71     virtual bool* getDemuxerAc3AudioChannels();
72     virtual int getCurrentAudioChannel();
73
74     void call(void*); // for callback interface
75
76     virtual void streamReceive(ULONG, void*, ULONG); // stream receiver interface
77     
78     // Player events
79
80     // FIXME so far this just duplicates the old system + the wss
81
82     const static UCHAR CONNECTION_LOST = 1;
83     const static UCHAR STOP_PLAYBACK = 2;
84     const static UCHAR STREAM_END = 3;
85     const static UCHAR ASPECT43 = 4;
86     const static UCHAR ASPECT169 = 5;
87     const static UCHAR PREBUFFERING = 6;
88
89   protected:
90     void threadMethod();
91     void threadPostStopCleanup() {};
92
93   private:
94     bool subtitlesShowing;
95     MessageQueue* messageQueue;
96     void* messageReceiver;
97     OSDReceiver* osdReceiver;
98     Log* logger;
99     Audio* audio;
100     Video* video;
101     DemuxerTS* demuxer;
102     DVBSubtitles* subtitles;
103     VDR* vdr;
104     VFeed vfeed;
105     AFeed afeed;
106     ChannelList* chanList;
107
108     queue<PLInstruction> instructions;
109     const static UCHAR I_SETCHANNEL = 1;
110     const static UCHAR I_STOP = 2;
111     
112     queue<StreamChunk> streamChunks;
113     
114     bool initted;
115
116     UCHAR state;
117     const static UCHAR S_STOP = 1;
118     const static UCHAR S_VIDEOSTARTUP = 2;
119     const static UCHAR S_PREBUFFERING = 3;
120     const static UCHAR S_PLAY = 4;
121     void switchState(UCHAR newState);
122     bool checkError();
123
124     bool videoStartup;
125     bool stopNow;
126     int preBufferCount;
127     const static int preBufferAmount = 3;
128
129     void clearStreamChunks();
130     void chunkToDemuxer();
131     void optimizeInstructionQueue();
132 };
133
134 #endif
135