r954: Improve icons of the liveaudio and livevideo effects.
[cinelerra_cv.git] / cinelerra / renderfarmclient.h
blob699c12334bdafab691f77eb08ae29f1363b8fd46
1 #ifndef RENDERFARMCLIENT_H
2 #define RENDERFARMCLIENT_H
4 #include "arraylist.h"
5 #include "asset.inc"
6 #include "bchash.inc"
7 #include "edl.inc"
8 #include "mutex.inc"
9 #include "packagerenderer.h"
10 #include "pluginserver.inc"
11 #include "preferences.inc"
12 #include "renderfarm.inc"
13 #include "renderfarmclient.inc"
14 //#include "renderfarmfsclient.inc"
15 #include "thread.h"
17 class RenderFarmClient
19 public:
20 RenderFarmClient(int port,
21 char *deamon_path,
22 int nice_value,
23 char *config_path);
24 ~RenderFarmClient();
26 void main_loop();
31 // After a socket times out, kill the render node.
32 void kill_client();
34 // RenderFarmClientThread *thread;
36 int port;
37 char *deamon_path;
38 // PID to be returned to background render object
39 int this_pid;
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
48 public:
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,
55 int len);
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);
60 // Return 1 if error
61 int write_int64(int64_t number);
62 int64_t read_int64(int *error = 0);
63 void read_string(char* &string);
64 void abort();
65 // Lock access to the socket during complete transactions
66 void lock(char *location);
67 void unlock();
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,
80 EDL *edl,
81 Preferences *preferences);
82 int read_package(int socket_fd, RenderPackage *package);
83 int send_completion(int socket_fd);
84 void ping_server();
85 void init_client_keepalive();
87 void main_loop(int socket_fd);
88 void run();
90 // Everything must be contained in run()
91 int socket_fd;
92 // Read only
93 RenderFarmClient *client;
94 // RenderFarmFSClient *fs_client;
95 double frames_per_second;
96 Mutex *mutex_lock;
97 RenderFarmWatchdog *watchdog;
98 RenderFarmKeepalive *keep_alive;
99 // pid of forked process
100 int pid;
109 class FarmPackageRenderer : public PackageRenderer
111 public:
112 FarmPackageRenderer(RenderFarmClientThread *thread,
113 int socket_fd);
114 ~FarmPackageRenderer();
117 int get_result();
118 void set_result(int value);
119 void set_progress(int64_t total_samples);
120 int set_video_map(int64_t position, int value);
123 int socket_fd;
124 RenderFarmClientThread *thread;
134 class RenderFarmKeepalive : public Thread
136 public:
137 RenderFarmKeepalive(RenderFarmClientThread *client_thread);
138 ~RenderFarmKeepalive();
140 void run();
142 RenderFarmClientThread *client_thread;
143 int done;
152 #endif