]> git.vomp.tv Git - vompclient.git/blob - vdr.h
Mods to get 250k on first packet for demuxer.scan
[vompclient.git] / vdr.h
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
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.
10
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.
15
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
19 */
20
21 #ifndef VDR_H
22 #define VDR_H
23
24 #include <stdio.h>
25 #include <time.h>
26 #include <pthread.h>
27 #include <vector>
28
29 #include "defines.h"
30 #include "log.h"
31 #include "dsock.h"
32 #include "tcp.h"
33 #include "list.h"
34 #include "directory.h"
35 #include "recording.h"
36 #include "channel.h"
37
38  // FIXME do some tcp connection error checking and kill it!
39
40 class VDR
41 {
42   public:
43     VDR();
44     ~VDR();
45     static VDR* getInstance();
46
47     int init(int port);
48     int shutdown();
49
50     void findServers(std::vector<char*>& serverIPs);
51     void cancelFindingServer();
52     void setServerIP(char*);
53     int connect();
54     void disconnect();
55     ULLONG getResumePoint(char* fileName);  // uses configLoad
56
57     // protocol functions
58
59     int doLogin();
60
61     Directory* getRecordingsList();
62     char*      getRecordingSummary(char* fileName);
63     int        deleteRecording(char* fileName);
64     ULLONG     streamRecording(Recording* rec);
65     ULLONG     rescanRecording();
66
67     List*      getChannelsList(ULONG type);
68     int        streamChannel(ULONG number);
69
70     UCHAR*     getBlock(ULLONG position, UINT maxAmount, UINT* amountReceived);
71     int        stopStreaming();
72     int        getChannelSchedule(ULONG number);
73     int        configSave(char* section, char* key, char* value);
74     char*      configLoad(char* section, char* key);
75
76     // end
77
78     const static ULONG VIDEO = 1;
79     const static ULONG RADIO = 2;
80
81   private:
82     static VDR* instance;
83     Log* logger;
84     int initted;
85     int findingServer;
86     TCP* tcp;
87     int port;
88     char serverIP[16];
89     pthread_mutex_t mutex;
90
91     const static ULONG VDR_LOGIN               = 1;
92     const static ULONG VDR_GETRECORDINGLIST    = 2;
93     const static ULONG VDR_DELETERECORDING     = 3;
94     const static ULONG VDR_GETSUMMARY          = 4;
95     const static ULONG VDR_GETCHANNELLIST      = 5;
96     const static ULONG VDR_STREAMCHANNEL       = 6;
97     const static ULONG VDR_GETBLOCK            = 7;
98     const static ULONG VDR_STOPSTREAMING       = 8;
99     const static ULONG VDR_STREAMRECORDING     = 9;
100     const static ULONG VDR_GETCHANNELSCHEDULE  = 10;
101     const static ULONG VDR_CONFIGSAVE          = 11;
102     const static ULONG VDR_CONFIGLOAD          = 12;
103     const static ULONG VDR_RESCANRECORDING     = 13;
104
105     long getSimpleReply();
106     char* getStringReply();
107 };
108
109 #endif