1 #ifndef RENDERFARMCLIENT_H
2 #define RENDERFARMCLIENT_H
9 #include "packagerenderer.h"
10 #include "pluginserver.inc"
11 #include "preferences.inc"
12 #include "renderfarm.inc"
13 #include "renderfarmclient.inc"
14 //#include "renderfarmfsclient.inc"
17 class RenderFarmClient
20 RenderFarmClient(int port
,
31 // After a socket times out, kill the render node.
34 // RenderFarmClientThread *thread;
38 // PID to be returned to background render object
40 // The plugin paths must be known before any threads are started
41 BC_Hash
*boot_defaults
;
42 Preferences
*boot_preferences
;
43 ArrayList
<PluginServer
*> *plugindb
;
46 class RenderFarmClientThread
: public Thread
49 RenderFarmClientThread(RenderFarmClient
*client
);
50 ~RenderFarmClientThread();
52 // Commands call this to send the request packet.
53 // The ID of the request followed by the size of the data that follows is sent.
54 int send_request_header(int request
,
56 // These are local functions to handle errors the right way for a client.
57 // They simply call the RenderFarmServerThread functions and abort if error.
58 int write_socket(char *data
, int len
);
59 int read_socket(char *data
, int len
);
61 int write_int64(int64_t number
);
62 int64_t read_int64(int *error
= 0);
63 void read_string(char* &string
);
65 // Lock access to the socket during complete transactions
66 void lock(char *location
);
71 void do_tuner(int socket_fd
);
72 void do_packages(int socket_fd
);
75 void get_command(int socket_fd
, int *command
);
76 void read_preferences(int socket_fd
,
77 Preferences
*preferences
);
78 void read_asset(int socket_fd
, Asset
*asset
);
79 void read_edl(int socket_fd
,
81 Preferences
*preferences
);
82 int read_package(int socket_fd
, RenderPackage
*package
);
83 int send_completion(int socket_fd
);
85 void init_client_keepalive();
87 void main_loop(int socket_fd
);
90 // Everything must be contained in run()
93 RenderFarmClient
*client
;
94 // RenderFarmFSClient *fs_client;
95 double frames_per_second
;
97 RenderFarmWatchdog
*watchdog
;
98 RenderFarmKeepalive
*keep_alive
;
99 // pid of forked process
109 class FarmPackageRenderer
: public PackageRenderer
112 FarmPackageRenderer(RenderFarmClientThread
*thread
,
114 ~FarmPackageRenderer();
118 void set_result(int value
);
119 void set_progress(int64_t total_samples
);
120 int set_video_map(int64_t position
, int value
);
124 RenderFarmClientThread
*thread
;
134 class RenderFarmKeepalive
: public Thread
137 RenderFarmKeepalive(RenderFarmClientThread
*client_thread
);
138 ~RenderFarmKeepalive();
142 RenderFarmClientThread
*client_thread
;