// XXX the above stuff is leaked,
//PRINT_TRACE
// Initialize stuff which MWindow does.
- signals->initialize();
+ signals->initialize("/tmp/cinelerra_batch%d.dmp");
MWindow::init_defaults(boot_defaults, config_path);
load_defaults(boot_defaults);
preferences = new Preferences;
preferences->load_defaults(boot_defaults);
+ BC_Signals::set_trap_hook(trap_hook, this);
+ BC_Signals::set_catch_segv(preferences->trap_sigsegv);
+ BC_Signals::set_catch_intr(0);
+ if( preferences->trap_sigsegv ) {
+ BC_Trace::enable_locks();
+ }
+ else {
+ BC_Trace::disable_locks();
+ }
+
MWindow::init_plugins(0, preferences);
char font_path[BCTEXTLEN];
strcpy(font_path, preferences->plugin_dir);
}
}
-
+void BatchRenderThread::trap_hook(FILE *fp, void *vp)
+{
+ MWindow *mwindow = ((BatchRenderThread *)vp)->mwindow;
+ fprintf(fp, "\nEDL:\n");
+ mwindow->dump_edl(fp);
+ fprintf(fp, "\nUNDO:\n");
+ mwindow->dump_undo(fp);
+ fprintf(fp, "\nEXE:\n");
+ mwindow->dump_exe(fp);
+}
{
char default_path[BCTEXTLEN];
sprintf(default_path, "~");
- BC_FileBox filewindow(100,
- 100,
- this->thread->mwindow->defaults->get("DEFAULT_BATCHLOADPATH", default_path),
- _("Save Batch Render List"),
- _("Enter a Batch Render filename to save as:"),
- 0,
- 0,
- 0,
- 0);
-
+ BC_FileBox filewindow(100, 100,
+ this->thread->mwindow->defaults->get("DEFAULT_BATCHLOADPATH", default_path),
+ _("Save Batch Render List"), _("Enter a Batch Render filename to save as:"),
+ 0, 0, 0, 0);
gui = &filewindow;
startup_lock->unlock();
this->port = port;
this->deamon_path = deamon_path;
SigHandler *signals = new SigHandler;
- signals->initialize();
+ signals->initialize("/tmp/cinelerra_farm%d.dmp");
this_pid = getpid();
(void)nice(nice_value);
boot_preferences = new Preferences;
boot_preferences->load_defaults(boot_defaults);
MWindow::init_plugins(0, boot_preferences);
+ BC_Signals::set_catch_segv(boot_preferences->trap_sigsegv);
+ BC_Signals::set_catch_intr(0);
+ if( boot_preferences->trap_sigsegv ) {
+ BC_Trace::enable_locks();
+ }
+ else {
+ BC_Trace::disable_locks();
+ }
strcpy(string, boot_preferences->plugin_dir);
strcat(string, "/" FONT_SEARCHPATH);
RenderFarmClient::~RenderFarmClient()
{
-// delete thread;
delete boot_defaults;
delete boot_preferences;
- plugindb->remove_all_objects();
- delete plugindb;
}
printf("RenderFarmClient::main_loop: client started\n");
while(1)
{
- if(listen(socket_fd, 256) < 0)
- {
- perror(_("RenderFarmClient::main_loop: listen"));
- return;
- }
+ if(listen(socket_fd, 256) < 0) {
+ perror(_("RenderFarmClient::main_loop: listen"));
+ return;
+ }
int new_socket_fd;
-
-
if(!deamon_path)
{
struct sockaddr_in clientname;
socklen_t size = sizeof(clientname);
- if((new_socket_fd = accept(socket_fd,
- (struct sockaddr*)&clientname,
- &size)) < 0)
- {
- perror(_("RenderFarmClient::main_loop: accept"));
- return;
- }
- else
- {
-printf("RenderFarmClient::main_loop: Session started from %s\n", inet_ntoa(clientname.sin_addr));
- RenderFarmClientThread *thread =
- new RenderFarmClientThread(this);
- thread->main_loop(new_socket_fd);
+ if( (new_socket_fd = accept(socket_fd,
+ (struct sockaddr*)&clientname, &size) ) < 0 ) {
+ perror(_("RenderFarmClient::main_loop: accept"));
+ return;
}
+printf("RenderFarmClient::main_loop: Session started from %s\n", inet_ntoa(clientname.sin_addr));
+ RenderFarmClientThread *thread =
+ new RenderFarmClientThread(this);
+ thread->main_loop(new_socket_fd);
}
else
{
struct sockaddr_un clientname;
socklen_t size = sizeof(clientname);
- if((new_socket_fd = accept(socket_fd,
- (struct sockaddr*)&clientname,
- &size)) < 0)
- {
- perror(_("RenderFarmClient::main_loop: accept"));
- return;
- }
- else
- {
-printf("RenderFarmClient::main_loop: Session started from %s\n", clientname.sun_path);
- RenderFarmClientThread *thread =
- new RenderFarmClientThread(this);
- thread->main_loop(new_socket_fd);
+ if( (new_socket_fd = accept(socket_fd,
+ (struct sockaddr*)&clientname, &size)) < 0 ) {
+ perror(_("RenderFarmClient::main_loop: accept"));
+ return;
}
+printf("RenderFarmClient::main_loop: Session started from %s\n", clientname.sun_path);
+ RenderFarmClientThread *thread =
+ new RenderFarmClientThread(this);
+ thread->main_loop(new_socket_fd);
}
}
}
: Thread(0, 0, 1)
{
this->client = client;
+ this->edl = 0;
frames_per_second = 0;
Thread::set_synchronous(0);
// fs_client = 0;
}
void RenderFarmClientThread::read_edl(int socket_fd,
- EDL *edl,
- Preferences *preferences)
+ EDL *edl, Preferences *preferences)
{
lock("RenderFarmClientThread::read_edl");
- send_request_header(RENDERFARM_EDL,
- 0);
+ send_request_header(RENDERFARM_EDL, 0);
char *string;
read_string(string);
-
FileXML file;
file.read_from_string((char*)string);
delete [] string;
-
-
-
-
-
-
-
- edl->load_xml(&file,
- LOAD_ALL);
-
-
+ edl->load_xml(&file, LOAD_ALL);
unlock();
}
// Get the pid of the fork if inside the fork
pid = getpid();
-
-
+ BC_Signals::set_trap_hook(trap_hook, this);
int socket_fd = this->socket_fd;
void RenderFarmClientThread::do_packages(int socket_fd)
{
-
- EDL *edl;
RenderPackage *package;
Asset *default_asset;
Preferences *preferences;
edl = new EDL;
edl->create_objects();
-
-
-
-
-
//printf("RenderFarmClientThread::run 3\n");
read_preferences(socket_fd, preferences);
//printf("RenderFarmClientThread::run 4\n");
//edl->dump();
//printf("RenderFarmClientThread::run 6\n");
-
-
-
-
-
-
-
- package_renderer.initialize(0,
- edl,
- preferences,
- default_asset);
+ package_renderer.initialize(0, edl, preferences, default_asset);
// Read packages
while(1)
default_asset->Garbage::remove_user();
//printf("RenderFarmClientThread::run 10\n");
edl->Garbage::remove_user();
+ edl = 0;
//printf("RenderFarmClientThread::run 11\n");
delete preferences;
printf(_("RenderFarmClientThread::run: Session finished.\n"));
}
-
-
-
-
-
+void RenderFarmClientThread::trap_hook(FILE *fp, void *vp)
+{
+ RenderFarmClientThread *thread = (RenderFarmClientThread*)vp;
+ fprintf(fp, "\nEDL:\n");
+ if( thread->edl ) thread->edl->dump(fp);
+}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
FarmPackageRenderer::FarmPackageRenderer(RenderFarmClientThread *thread,
int socket_fd)
: PackageRenderer()
}
-
FarmPackageRenderer::~FarmPackageRenderer()
{
}
}
-
-
-
-
-
-
-
-
void main_loop();
-
-
-
// After a socket times out, kill the render node.
void kill_client();
-// RenderFarmClientThread *thread;
-
int port;
char *deamon_path;
// PID to be returned to background render object
// The plugin paths must be known before any threads are started
BC_Hash *boot_defaults;
Preferences *boot_preferences;
- ArrayList<PluginServer*> *plugindb;
};
class RenderFarmClientThread : public Thread
// Lock access to the socket during complete transactions
void lock(const char *location);
void unlock();
-
-
+ static void trap_hook(FILE *fp, void *vp);
void do_tuner(int socket_fd);
void do_packages(int socket_fd);
-
void get_command(int socket_fd, int *command);
void read_preferences(int socket_fd,
Preferences *preferences);
void read_asset(int socket_fd, Asset *asset);
- void read_edl(int socket_fd,
- EDL *edl,
- Preferences *preferences);
+ void read_edl(int socket_fd, EDL *edl, Preferences *preferences);
int read_package(int socket_fd, RenderPackage *package);
int send_completion(int socket_fd);
void ping_server();
void main_loop(int socket_fd);
void run();
+ EDL *edl;
// Everything must be contained in run()
int socket_fd;
// Read only