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
47 typedef vector<Event*> EventList;
48 typedef vector<Channel*> ChannelList;
49 typedef vector<RecTimer*> RecTimerList;
50 typedef vector<Mark*> MarkList;
58 struct RecTimerSorter // : public binary_function<double, double, bool>
60 bool operator() (const RecTimer* a, const RecTimer* b)
62 return a->startTime < b->startTime;
68 bool operator() (const VDRServer& a, const VDRServer& b)
70 if (strcmp(b.name, a.name) > 0) return true;
83 static VDR* getInstance();
88 void findServers(vector<VDRServer>& servers);
89 void cancelFindingServer();
90 void setServerIP(char*);
93 bool isConnected() { return connected; }
94 ULONG getChannelNumberWidth() { return channelNumberWidth; }
96 void setReceiveWindow(size_t size);
99 // for the following, if result == false then the connection has died
103 // getChannelSchedule
105 // isConnected can be called after the following to determine if still ok
108 // positionFromFrameNumber
118 bool getRecordingsList(RecMan* recman);
119 RecInfo* getRecInfo(char* fileName);
120 int deleteRecording(char* fileName);
121 char* moveRecording(char* fileName, char* newPath);
122 ULLONG streamRecording(char* fileName, ULONG* lengthFrames);
123 ULLONG positionFromFrameNumber(ULONG frameNumber);
124 ULONG frameNumberFromPosition(ULLONG position);
125 bool getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePosition, ULONG* rframeNumber, ULONG* rframeLength);
126 // Direction: 0=backwards, 1=forwards
127 MarkList* getMarks(char* fileName);
129 ChannelList* getChannelsList(ULONG type);
130 int streamChannel(ULONG number);
131 void getChannelPids(Channel* channel);
133 UCHAR* getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived);
135 EventList* getChannelSchedule(ULONG number);
136 EventList* getChannelSchedule(ULONG number, time_t start, ULONG duration);
137 int configSave(char* section, char* key, const char* value);
138 char* configLoad(char* section, char* key);
139 ULONG setEventTimer(char* timerString);
141 RecTimerList* getRecTimersList();
145 const static ULONG VIDEO = 1;
146 const static ULONG RADIO = 2;
152 ULLONG rescanRecording(ULONG* lengthFrames); // FIXME obselete
157 static VDR* instance;
166 ULONG maxChannelNumber;
167 ULONG channelNumberWidth;
170 pthread_mutex_t mutex;
179 const static ULONG VDR_LOGIN = 1;
180 const static ULONG VDR_GETRECORDINGLIST = 2;
181 const static ULONG VDR_DELETERECORDING = 3;
182 const static ULONG VDR_GETCHANNELLIST = 5;
183 const static ULONG VDR_STREAMCHANNEL = 6;
184 const static ULONG VDR_GETBLOCK = 7;
185 const static ULONG VDR_STOPSTREAMING = 8;
186 const static ULONG VDR_STREAMRECORDING = 9;
187 const static ULONG VDR_GETCHANNELSCHEDULE = 10;
188 const static ULONG VDR_CONFIGSAVE = 11;
189 const static ULONG VDR_CONFIGLOAD = 12;
190 const static ULONG VDR_RESCANRECORDING = 13; // FIXME obselete
191 const static ULONG VDR_GETTIMERS = 14;
192 const static ULONG VDR_SETTIMER = 15;
193 const static ULONG VDR_POSFROMFRAME = 16;
194 const static ULONG VDR_FRAMEFROMPOS = 17;
195 const static ULONG VDR_MOVERECORDING = 18;
196 const static ULONG VDR_GETNEXTIFRAME = 19;
197 const static ULONG VDR_GETRECINFO = 20;
198 const static ULONG VDR_GETMARKS = 21;
199 const static ULONG VDR_GETCHANNELPIDS = 22;
204 char* extractString();
205 UCHAR extractUCHAR();
206 ULONG extractULONG();
207 ULLONG extractULLONG();
215 index.vdr file format for video:
217 For every video frame: