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>
30 #include "playerlive.h"
39 #include "teletextdecodervbiebu.h"
42 class MessageReceiver;
50 class PlayerVideoLive : public PlayerLive, public Callback, public StreamReceiver
53 PlayerVideoLive(MessageQueue* messageQueue, MessageReceiver* messageReceiver, OSDReceiver* tosdReceiver, std::shared_ptr<ChannelList> chanList);
54 virtual ~PlayerVideoLive();
57 virtual int shutdown();
59 virtual void go(u4 index);
60 virtual void setChannel(u4 index);
62 virtual void setAudioChannel(int newChannel,int type,int streamtype);
63 virtual void setSubtitleChannel(int newChannel);
64 virtual bool toggleSubtitles();
65 virtual void turnSubtitlesOn(bool ison);
66 virtual bool isSubtitlesOn() {return subtitlesShowing;};
67 virtual void tellSubtitlesOSDVisible(bool visible);
69 virtual bool* getDemuxerMpegAudioChannels();
70 virtual bool* getDemuxerAc3AudioChannels();
71 virtual int getCurrentAudioChannel();
72 virtual int getCurrentSubtitleChannel();
73 virtual int *getTeletxtSubtitlePages();
75 TeletextDecoderVBIEBU * getTeletextDecoder(){return teletext;};
77 void call(void*); // for callback interface
79 virtual void streamReceive(u4, void*, u4); // stream receiver interface
83 // FIXME so far this just duplicates the old system + the wss
85 const static u1 CONNECTION_LOST = 1;
86 const static u1 STOP_PLAYBACK = 2;
87 const static u1 STREAM_END = 3;
88 const static u1 ASPECT43 = 4;
89 const static u1 ASPECT169 = 5;
90 const static u1 PREBUFFERING = 6;
96 MessageQueue* messageQueue;
97 MessageReceiver* messageReceiver;
98 OSDReceiver* osdReceiver;
99 std::shared_ptr<ChannelList> chanList;
104 DVBSubtitles* subtitles;
105 TeletextDecoderVBIEBU *teletext;
108 std::queue<PLInstruction> instructions;
109 const static u1 I_SETCHANNEL = 1;
110 const static u1 I_STOP = 2;
112 std::queue<StreamChunk> streamChunks;
114 std::thread playerThread;
115 std::mutex playerThreadMutex;
116 std::condition_variable playerThreadCond;
119 const static u1 S_STOP = 1;
120 const static u1 S_VIDEOSTARTUP = 2;
121 const static u1 S_PREBUFFERING = 3;
122 const static u1 S_PLAY = 4;
123 void switchState(u1 newState);
128 bool subtitlesShowing{};
129 bool firstStart{true};
131 bool pendingAudioPlay{};
134 const static int preBufferAmount = 3;
136 void clearStreamChunks();
137 void chunkToDemuxer();
138 void optimizeInstructionQueue();