2 Copyright 2004-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 //Find threading replacements
45 typedef vector<Event*> EventList;
46 typedef vector<Channel*> ChannelList;
47 typedef vector<RecTimer*> RecTimerList;
55 struct RecTimerSorter // : public binary_function<double, double, bool>
57 bool operator() (const RecTimer* a, const RecTimer* b)
59 return a->startTime < b->startTime;
65 bool operator() (const VDRServer& a, const VDRServer& b)
67 if (strcmp(b.name, a.name) > 0) return true;
79 static VDR* getInstance();
84 void findServers(vector<VDRServer>& servers);
85 void cancelFindingServer();
86 void setServerIP(char*);
89 bool isConnected() { return connected; }
90 ULONG getResumePoint(char* fileName); // uses configLoad
92 void setReceiveWindow(size_t size);
95 // for the following, if result == false then the connection has died
101 // isConnected can be called after the following to determine if still ok
102 // getRecordingSummary
106 // positionFromFrameNumber
116 bool getRecordingsList(RecMan* recman);
117 char* getRecordingSummary(char* fileName);
118 int deleteRecording(char* fileName);
119 char* moveRecording(char* fileName, char* newPath);
120 ULLONG streamRecording(char* fileName, ULONG* lengthFrames);
121 ULLONG rescanRecording(ULONG* lengthFrames);
122 ULLONG positionFromFrameNumber(ULONG frameNumber);
123 ULONG frameNumberFromPosition(ULLONG position);
124 bool getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePosition, ULONG* rframeNumber, ULONG* rframeLength);
125 // Direction: 0=backwards, 1=forwards
127 ChannelList* getChannelsList(ULONG type);
128 int streamChannel(ULONG number);
130 UCHAR* getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived);
132 EventList* getChannelSchedule(ULONG number);
133 EventList* getChannelSchedule(ULONG number, time_t start, ULONG duration);
134 int configSave(char* section, char* key, const char* value);
135 char* configLoad(char* section, char* key);
136 ULONG setEventTimer(char* timerString);
138 RecTimerList* getRecTimersList();
142 const static ULONG VIDEO = 1;
143 const static ULONG RADIO = 2;
146 static VDR* instance;
155 pthread_mutex_t mutex;
164 const static ULONG VDR_LOGIN = 1;
165 const static ULONG VDR_GETRECORDINGLIST = 2;
166 const static ULONG VDR_DELETERECORDING = 3;
167 const static ULONG VDR_GETSUMMARY = 4;
168 const static ULONG VDR_GETCHANNELLIST = 5;
169 const static ULONG VDR_STREAMCHANNEL = 6;
170 const static ULONG VDR_GETBLOCK = 7;
171 const static ULONG VDR_STOPSTREAMING = 8;
172 const static ULONG VDR_STREAMRECORDING = 9;
173 const static ULONG VDR_GETCHANNELSCHEDULE = 10;
174 const static ULONG VDR_CONFIGSAVE = 11;
175 const static ULONG VDR_CONFIGLOAD = 12;
176 const static ULONG VDR_RESCANRECORDING = 13;
177 const static ULONG VDR_GETTIMERS = 14;
178 const static ULONG VDR_SETTIMER = 15;
179 const static ULONG VDR_POSFROMFRAME = 16;
180 const static ULONG VDR_FRAMEFROMPOS = 17;
181 const static ULONG VDR_MOVERECORDING = 18;
182 const static ULONG VDR_GETNEXTIFRAME = 19;
187 char* extractString();
188 ULONG extractULONG();
189 ULLONG extractULLONG();