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
30 #include "threadwin.h"
44 class VDR_RequestPacket;
45 class VDR_ResponsePacket;
49 typedef vector<Event*> EventList;
50 typedef vector<Channel*> ChannelList;
51 typedef vector<RecTimer*> RecTimerList;
59 struct RecTimerSorter // : public binary_function<double, double, bool>
61 bool operator() (const RecTimer* a, const RecTimer* b)
63 return a->startTime < b->startTime;
69 bool operator() (const VDRServer& a, const VDRServer& b)
71 if (strcmp(b.name, a.name) > 0) return true;
82 const static ULONG VIDEO = 1;
83 const static ULONG RADIO = 2;
87 static VDR* getInstance();
92 void findServers(vector<VDRServer>& servers);
93 void cancelFindingServer();
94 void setServerIP(char*);
95 void setReceiveWindow(size_t size);
98 bool isConnected() { return connected; }
99 ULONG getChannelNumberWidth() { return channelNumberWidth; }
101 // protocol functions
102 // for the following, if result == false then the connection has died
106 // getChannelSchedule
108 // isConnected can be called after the following to determine if still ok
111 // positionFromFrameNumber
120 bool getRecordingsList(RecMan* recman);
121 RecInfo* getRecInfo(char* fileName);
122 int deleteRecording(char* fileName);
123 char* moveRecording(char* fileName, char* newPath);
124 ULLONG streamRecording(char* fileName, ULONG* lengthFrames);
125 ULLONG positionFromFrameNumber(ULONG frameNumber);
126 ULONG frameNumberFromPosition(ULLONG position);
127 bool getNextIFrame(ULONG frameNumber, ULONG direction, ULLONG* rfilePosition, ULONG* rframeNumber, ULONG* rframeLength);
128 // Direction: 0=backwards, 1=forwards
129 MarkList* getMarks(char* fileName);
130 int deleteTimer(RecTimer* delTimer);
131 ChannelList* getChannelsList(ULONG type);
132 int streamChannel(ULONG number);
133 void getChannelPids(Channel* channel);
134 UCHAR* getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived);
135 //get image blocks separate - we can do this in parallel
136 UCHAR* getImageBlock(ULONG position, UINT maxAmount, UINT* amountReceived);
138 EventList* getChannelSchedule(ULONG number);
139 EventList* getChannelSchedule(ULONG number, time_t start, ULONG duration);
140 int configSave(const char* section, const char* key, const char* value);
141 char* configLoad(const char* section, const char* key);
142 ULONG setEventTimer(char* timerString);
143 RecTimerList* getRecTimersList();
145 * ge a list of media entries
146 * if parent==NULL this is the configured base list
148 MediaList* getMediaList(const char* parent=NULL,int mediaType=MEDIA_TYPE_ALL);
150 * start loading a JPEG image
151 * return size, 0 if not found
153 ULONG loadImage(const char * filename, ULONG xsize=0,ULONG ysize=0);
155 // end protocol functions
159 ULLONG rescanRecording(ULONG* lengthFrames); // FIXME obselete
164 static VDR* instance;
166 VDR_ResponsePacket* RequestResponse(VDR_RequestPacket* request);
167 UCHAR* getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived, ULONG cmd);
176 ULONG maxChannelNumber;
177 ULONG channelNumberWidth;
180 pthread_mutex_t mutex;
188 pthread_t waitingRequestThread;
193 const static ULONG VDR_LOGIN = 1;
194 const static ULONG VDR_GETRECORDINGLIST = 2;
195 const static ULONG VDR_DELETERECORDING = 3;
196 const static ULONG VDR_GETCHANNELLIST = 5;
197 const static ULONG VDR_STREAMCHANNEL = 6;
198 const static ULONG VDR_GETBLOCK = 7;
199 const static ULONG VDR_STOPSTREAMING = 8;
200 const static ULONG VDR_STREAMRECORDING = 9;
201 const static ULONG VDR_GETCHANNELSCHEDULE = 10;
202 const static ULONG VDR_CONFIGSAVE = 11;
203 const static ULONG VDR_CONFIGLOAD = 12;
204 const static ULONG VDR_RESCANRECORDING = 13; // FIXME obselete
205 const static ULONG VDR_GETTIMERS = 14;
206 const static ULONG VDR_SETTIMER = 15;
207 const static ULONG VDR_POSFROMFRAME = 16;
208 const static ULONG VDR_FRAMEFROMPOS = 17;
209 const static ULONG VDR_MOVERECORDING = 18;
210 const static ULONG VDR_GETNEXTIFRAME = 19;
211 const static ULONG VDR_GETRECINFO = 20;
212 const static ULONG VDR_GETMARKS = 21;
213 const static ULONG VDR_GETCHANNELPIDS = 22;
214 const static ULONG VDR_DELETETIMER = 23;
215 const static ULONG VDR_GETMEDIALIST = 30;
216 const static ULONG VDR_GETIMAGE = 31;
217 const static ULONG VDR_GETIMAGEBLOCK = 32;
227 index.vdr file format for video:
229 For every video frame: