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