2 Copyright 2004-2020 Chris Tallon
4 This file is part of VOMP.
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.
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.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
20 #ifndef PLAYERVIDEOLIVE_H
21 #define PLAYERVIDEOLIVE_H
25 #include <condition_variable>
29 #include "playerlive.h"
38 #include "teletextdecodervbiebu.h"
48 class PlayerVideoLive : public PlayerLive, public Callback, public StreamReceiver
51 PlayerVideoLive(MessageQueue* messageQueue, void* messageReceiver, OSDReceiver* tosdReceiver, ChannelList* chanList);
52 virtual ~PlayerVideoLive();
55 virtual int shutdown();
57 virtual void go(ULONG index);
58 virtual void setChannel(ULONG index);
60 virtual void setAudioChannel(int newChannel,int type,int streamtype);
61 virtual void setSubtitleChannel(int newChannel);
62 virtual bool toggleSubtitles();
63 virtual void turnSubtitlesOn(bool ison);
64 virtual bool isSubtitlesOn() {return subtitlesShowing;};
65 virtual void tellSubtitlesOSDVisible(bool visible);
67 virtual bool* getDemuxerMpegAudioChannels();
68 virtual bool* getDemuxerAc3AudioChannels();
69 virtual int getCurrentAudioChannel();
70 virtual int getCurrentSubtitleChannel();
71 virtual int *getTeletxtSubtitlePages();
73 TeletextDecoderVBIEBU * getTeletextDecoder(){return teletext;};
75 void call(void*); // for callback interface
77 virtual void streamReceive(ULONG, void*, ULONG); // stream receiver interface
81 // FIXME so far this just duplicates the old system + the wss
83 const static UCHAR CONNECTION_LOST = 1;
84 const static UCHAR STOP_PLAYBACK = 2;
85 const static UCHAR STREAM_END = 3;
86 const static UCHAR ASPECT43 = 4;
87 const static UCHAR ASPECT169 = 5;
88 const static UCHAR PREBUFFERING = 6;
94 MessageQueue* messageQueue;
95 void* messageReceiver;
96 OSDReceiver* osdReceiver;
97 ChannelList* chanList;
102 DVBSubtitles* subtitles;
103 TeletextDecoderVBIEBU *teletext;
106 std::queue<PLInstruction> instructions;
107 const static UCHAR I_SETCHANNEL = 1;
108 const static UCHAR I_STOP = 2;
110 std::queue<StreamChunk> streamChunks;
112 std::thread playerThread;
113 std::mutex playerThreadMutex;
114 std::condition_variable playerThreadCond;
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);
126 bool subtitlesShowing{};
127 bool firstStart{true};
129 bool pendingAudioPlay{};
132 const static int preBufferAmount = 3;
134 void clearStreamChunks();
135 void chunkToDemuxer();
136 void optimizeInstructionQueue();