2 Copyright 2008-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 PLAYERRADIOLIVE_H
21 #define PLAYERRADIOLIVE_H
25 #include <condition_variable>
30 #include "playerlive.h"
41 class PlayerRadioLive : public PlayerLive, public Callback, public StreamReceiver
44 PlayerRadioLive(MessageQueue* messageQueue, void* messageReceiver, ChannelList* chanList);
45 virtual ~PlayerRadioLive();
48 virtual int shutdown();
50 virtual void go(ULONG index);
51 virtual void setChannel(ULONG index);
53 virtual void setAudioChannel(int newChannel, int type,int streamtype);
54 virtual void setSubtitleChannel(int newChannel);
56 virtual bool* getDemuxerMpegAudioChannels();
57 virtual bool* getDemuxerAc3AudioChannels();
58 virtual int getCurrentAudioChannel();
59 virtual int* getTeletxtSubtitlePages();
60 virtual int getCurrentSubtitleChannel();
62 void call(void*); // for callback interface
64 virtual void streamReceive(ULONG, void*, ULONG); // stream receiver interface
68 // FIXME so far this just duplicates the old system + the wss
70 const static UCHAR CONNECTION_LOST = 1;
71 const static UCHAR STOP_PLAYBACK = 2;
72 const static UCHAR STREAM_END = 3;
73 const static UCHAR ASPECT43 = 4;
74 const static UCHAR ASPECT169 = 5;
75 const static UCHAR PREBUFFERING = 6;
78 MessageQueue* messageQueue;
79 void* messageReceiver;
85 ChannelList* chanList;
87 std::queue<PLInstruction> instructions;
88 const static UCHAR I_SETCHANNEL = 1;
89 const static UCHAR I_STOP = 2;
91 std::queue<StreamChunk> streamChunks;
96 const static UCHAR S_STOP = 1;
97 const static UCHAR S_PREBUFFERING = 2;
98 const static UCHAR S_PLAY = 3;
99 void switchState(UCHAR newState);
103 const static int preBufferAmount = 3;
105 std::thread playerThread;
106 std::mutex playerThreadMutex;
107 std::condition_variable playerThreadCond;
110 void clearStreamChunks();
111 void chunkToDemuxer();
112 void optimizeInstructionQueue();