2 Copyright 2004-2006 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, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 #include "threadsystem.h"
49 * VDR tells me there are around 8.3 "frames" per second in radio recordings.
50 * I don't know where this comes from but things seem to work.
53 class PlayerRadio : public Thread_TYPE, public Callback
56 PlayerRadio(MessageQueue* messageQueue, void* messageReceiver);
57 virtual ~PlayerRadio();
59 bool init(ULLONG lengthBytes, ULONG lengthFrames, bool IsPesRecording);
61 void setCurrentFrameNumber(ULONG num);
67 void jumpToPercent(double percent);
68 void skipForward(UINT seconds);
69 void skipBackward(UINT seconds);
71 UCHAR getState() { return state; }
72 ULONG getCurrentSeconds();
73 ULONG getLengthSeconds();
75 void call(void*); // for callback interface
77 const static UCHAR S_PLAY = 1;
78 const static UCHAR S_PAUSE_P = 2;
79 const static UCHAR S_PAUSE_I = 3;
80 const static UCHAR S_STOP = 6;
81 const static UCHAR S_JUMP = 7;
85 const static UCHAR CONNECTION_LOST = 1;
86 const static UCHAR STOP_PLAYBACK = 2;
87 const static UCHAR STREAM_END = 3;
91 void threadPostStopCleanup();
94 void switchState(UCHAR newState, ULONG jumpToFrame=0);
96 void threadFeedPlay();
97 void threadFeedScan();
99 void doConnectionLost();
100 void restartAtFrame(ULONG newFrame);
101 bool setLengthSeconds();
103 MessageQueue* messageQueue;
104 void* messageReceiver;
115 ULONG lengthSeconds{};
117 std::mutex stateLock;
119 ULLONG lengthBytes{};
120 ULONG lengthFrames{};
121 ULONG currentFrameNumber{};
122 static const UINT blockSize{10000};
123 static const UINT startupBlockSize{20000};
124 UCHAR* threadBuffer{};
135 Play, Pause, FFwd, FBwd, (Stop), [Jump]