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>
29 #include "playerlive.h"
40 class PlayerRadioLive : public PlayerLive, public Callback, public StreamReceiver
43 PlayerRadioLive(MessageQueue* messageQueue, void* messageReceiver, ChannelList* chanList);
44 virtual ~PlayerRadioLive();
47 virtual int shutdown();
49 virtual void go(ULONG index);
50 virtual void setChannel(ULONG index);
52 virtual void setAudioChannel(int newChannel, int type,int streamtype);
53 virtual void setSubtitleChannel(int newChannel);
55 virtual bool* getDemuxerMpegAudioChannels();
56 virtual bool* getDemuxerAc3AudioChannels();
57 virtual int getCurrentAudioChannel();
58 virtual int* getTeletxtSubtitlePages();
59 virtual int getCurrentSubtitleChannel();
61 void call(void*); // for callback interface
63 virtual void streamReceive(ULONG, void*, ULONG); // stream receiver interface
67 // FIXME so far this just duplicates the old system + the wss
69 const static UCHAR CONNECTION_LOST = 1;
70 const static UCHAR STOP_PLAYBACK = 2;
71 const static UCHAR STREAM_END = 3;
72 const static UCHAR ASPECT43 = 4;
73 const static UCHAR ASPECT169 = 5;
74 const static UCHAR PREBUFFERING = 6;
77 MessageQueue* messageQueue;
78 void* messageReceiver;
84 ChannelList* chanList;
86 std::queue<PLInstruction> instructions;
87 const static UCHAR I_SETCHANNEL = 1;
88 const static UCHAR I_STOP = 2;
90 std::queue<StreamChunk> streamChunks;
95 const static UCHAR S_STOP = 1;
96 const static UCHAR S_PREBUFFERING = 2;
97 const static UCHAR S_PLAY = 3;
98 void switchState(UCHAR newState);
102 const static int preBufferAmount = 3;
104 std::thread playerThread;
105 std::mutex playerThreadMutex;
106 std::condition_variable playerThreadCond;
109 void clearStreamChunks();
110 void chunkToDemuxer();
111 void optimizeInstructionQueue();