2 Copyright 2004-2006 Chris Tallon
\r
4 This file is part of VOMP.
\r
6 VOMP is free software; you can redistribute it and/or modify
\r
7 it under the terms of the GNU General Public License as published by
\r
8 the Free Software Foundation; either version 2 of the License, or
\r
9 (at your option) any later version.
\r
11 VOMP is distributed in the hope that it will be useful,
\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 GNU General Public License for more details.
\r
16 You should have received a copy of the GNU General Public License
\r
17 along with VOMP; if not, write to the Free Software
\r
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
21 #ifndef PLAYERRADIO_H
\r
22 #define PLAYERRADIO_H
\r
27 #include <sys/time.h>
\r
31 #include "threadsystem.h"
\r
33 #include "callback.h"
\r
34 #include "defines.h"
\r
44 class PlayerRadio : public Thread_TYPE, public Callback
\r
47 PlayerRadio(MessageQueue* messageQueue, void* messageReceiver);
\r
48 virtual ~PlayerRadio();
\r
50 int init(ULLONG lengthBytes, ULONG lengthPackets, bool IsPesRecording);
\r
52 void setStartBytes(ULLONG startBytes);
\r
58 void jumpToPercent(double percent);
\r
59 void skipForward(UINT seconds);
\r
60 void skipBackward(UINT seconds);
\r
62 UCHAR getState() { return state; }
\r
63 ULONG getCurrentSeconds();
\r
64 ULONG getLengthSeconds();
\r
66 void call(void*); // for callback interface
\r
68 const static UCHAR S_PLAY = 1;
\r
69 const static UCHAR S_PAUSE_P = 2;
\r
70 const static UCHAR S_STOP = 6;
\r
71 const static UCHAR S_JUMP = 7;
\r
75 const static UCHAR CONNECTION_LOST = 1;
\r
76 const static UCHAR STOP_PLAYBACK = 2;
\r
77 const static UCHAR STREAM_END = 3;
\r
80 void threadMethod();
\r
81 void threadPostStopCleanup();
\r
84 void switchState(UCHAR newState, ULONG jumpPacket=0);
\r
86 void threadFeedPlay();
\r
87 void threadFeedScan();
\r
89 void doConnectionLost();
\r
90 void restartAtPacket(ULONG newPacket);
\r
91 bool setLengthSeconds();
\r
93 MessageQueue* messageQueue;
\r
94 void* messageReceiver;
\r
105 ULONG lengthSeconds;
\r
108 pthread_mutex_t mutex;
\r
115 ULLONG lengthBytes;
\r
117 ULONG lengthPackets;
\r
118 ULONG currentPacketNumber;
\r
120 UINT startupBlockSize;
\r
121 UCHAR* threadBuffer;
\r
132 Play, Pause, FFwd, FBwd, (Stop), [Jump]
\r