From: Good Guy <good1.2guy@gmail.com>
Date: Wed, 16 Nov 2016 23:35:29 +0000 (-0700)
Subject: cleanup of hv6 merge, add webm rendering
X-Git-Url: http://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=9db053d413fde01439cc72ec2109913dfda2ec7b;p=goodguy%2Fhistory.git

cleanup of hv6 merge, add webm rendering
---

diff --git a/cinelerra-5.1/cinelerra/batchrender.C b/cinelerra-5.1/cinelerra/batchrender.C
index 0f698f4f..d0714452 100644
--- a/cinelerra-5.1/cinelerra/batchrender.C
+++ b/cinelerra-5.1/cinelerra/batchrender.C
@@ -595,11 +595,21 @@ void BatchRenderThread::start_rendering(char *config_path,
 	// 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);
@@ -731,7 +741,16 @@ void BatchRenderThread::move_batch(int src, int dst)
 	}
 }
 
-
+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);
+}
 
 
 
@@ -1126,16 +1145,10 @@ void BatchRenderSaveList::run()
 {
 	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();
diff --git a/cinelerra-5.1/cinelerra/batchrender.h b/cinelerra-5.1/cinelerra/batchrender.h
index 2791d0e4..c24eb088 100644
--- a/cinelerra-5.1/cinelerra/batchrender.h
+++ b/cinelerra-5.1/cinelerra/batchrender.h
@@ -118,6 +118,7 @@ public:
 	void update_active(int number);
 	void update_done(int number, int create_list, double elapsed_time);
 	void move_batch(int src, int dst);
+	static void trap_hook(FILE *fp, void *vp);
 
 	MWindow *mwindow;
 	double current_start;
diff --git a/cinelerra-5.1/cinelerra/filexml.h b/cinelerra-5.1/cinelerra/filexml.h
index 4cff6758..270b763d 100644
--- a/cinelerra-5.1/cinelerra/filexml.h
+++ b/cinelerra-5.1/cinelerra/filexml.h
@@ -100,7 +100,6 @@ public:
 	int64_t get_property(const char *property, int64_t default_);
 	float get_property(const char *property, float default_);
 	double get_property(const char *property, double default_);
-	const char* get_property_text(const char *property);
 
 	int set_title(const char *text);
 	int set_property(const char *text, const char *value);
diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C
index 4884c641..9f597d27 100644
--- a/cinelerra-5.1/cinelerra/mwindow.C
+++ b/cinelerra-5.1/cinelerra/mwindow.C
@@ -785,7 +785,6 @@ void MWindow::init_preferences()
 	session->load_defaults(defaults);
 	// set x11_host, screens, window_config
 	screens = session->set_default_x11_host();
-	BC_Signals::set_trap_path("/tmp/cinelerra_%d.dmp");
 	BC_Signals::set_trap_hook(trap_hook, this);
 	BC_Signals::set_catch_segv(preferences->trap_sigsegv);
 	BC_Signals::set_catch_intr(preferences->trap_sigintr);
@@ -1098,7 +1097,7 @@ void MWindow::init_gui()
 void MWindow::init_signals()
 {
 	sighandler = new SigHandler;
-	sighandler->initialize();
+	sighandler->initialize("/tmp/cinelerra_%d.dmp");
 ENABLE_BUFFER
 }
 
diff --git a/cinelerra-5.1/cinelerra/renderfarmclient.C b/cinelerra-5.1/cinelerra/renderfarmclient.C
index 5895710f..7a3507a8 100644
--- a/cinelerra-5.1/cinelerra/renderfarmclient.C
+++ b/cinelerra-5.1/cinelerra/renderfarmclient.C
@@ -65,7 +65,7 @@ RenderFarmClient::RenderFarmClient(int port,
 	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);
@@ -75,6 +75,14 @@ RenderFarmClient::RenderFarmClient(int port,
 	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);
@@ -86,11 +94,8 @@ RenderFarmClient::RenderFarmClient(int port,
 
 RenderFarmClient::~RenderFarmClient()
 {
-//	delete thread;
 	delete boot_defaults;
 	delete boot_preferences;
-	plugindb->remove_all_objects();
-	delete plugindb;
 }
 
 
@@ -157,53 +162,40 @@ void RenderFarmClient::main_loop()
 	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);
 		}
 	}
 }
@@ -228,6 +220,7 @@ RenderFarmClientThread::RenderFarmClientThread(RenderFarmClient *client)
  : Thread(0, 0, 1)
 {
 	this->client = client;
+	this->edl = 0;
 	frames_per_second = 0;
 	Thread::set_synchronous(0);
 //	fs_client = 0;
@@ -447,32 +440,19 @@ void RenderFarmClientThread::read_asset(int socket_fd, Asset *asset)
 }
 
 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();
 }
 
@@ -571,8 +551,7 @@ void RenderFarmClientThread::run()
 
 // 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;
 
@@ -621,8 +600,6 @@ void RenderFarmClientThread::do_tuner(int socket_fd)
 
 void RenderFarmClientThread::do_packages(int socket_fd)
 {
-
-	EDL *edl;
 	RenderPackage *package;
 	Asset *default_asset;
 	Preferences *preferences;
@@ -642,11 +619,6 @@ void RenderFarmClientThread::do_packages(int socket_fd)
 	edl = new EDL;
 	edl->create_objects();
 
-
-
-
-
-
 //printf("RenderFarmClientThread::run 3\n");
 	read_preferences(socket_fd, preferences);
 //printf("RenderFarmClientThread::run 4\n");
@@ -656,17 +628,7 @@ void RenderFarmClientThread::do_packages(int socket_fd)
 //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)
@@ -712,16 +674,18 @@ void RenderFarmClientThread::do_packages(int socket_fd)
 	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);
+}
 
 
 
@@ -758,19 +722,6 @@ void RenderFarmKeepalive::run()
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
 FarmPackageRenderer::FarmPackageRenderer(RenderFarmClientThread *thread,
 		int socket_fd)
  : PackageRenderer()
@@ -780,7 +731,6 @@ FarmPackageRenderer::FarmPackageRenderer(RenderFarmClientThread *thread,
 }
 
 
-
 FarmPackageRenderer::~FarmPackageRenderer()
 {
 }
@@ -857,11 +807,3 @@ int FarmPackageRenderer::set_video_map(int64_t position, int value)
 }
 
 
-
-
-
-
-
-
-
-
diff --git a/cinelerra-5.1/cinelerra/renderfarmclient.h b/cinelerra-5.1/cinelerra/renderfarmclient.h
index 1ee7ce53..1da3893f 100644
--- a/cinelerra-5.1/cinelerra/renderfarmclient.h
+++ b/cinelerra-5.1/cinelerra/renderfarmclient.h
@@ -46,14 +46,9 @@ public:
 
 	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
@@ -61,7 +56,6 @@ public:
 // 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
@@ -86,20 +80,16 @@ public:
 // 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();
@@ -108,6 +98,7 @@ public:
 	void main_loop(int socket_fd);
 	void run();
 
+	EDL *edl;
 // Everything must be contained in run()
 	int socket_fd;
 // Read only
diff --git a/cinelerra-5.1/ffmpeg/audio/webm.dfl b/cinelerra-5.1/ffmpeg/audio/webm.dfl
new file mode 100644
index 00000000..d546cbf9
--- /dev/null
+++ b/cinelerra-5.1/ffmpeg/audio/webm.dfl
@@ -0,0 +1 @@
+webm.webm
diff --git a/cinelerra-5.1/ffmpeg/audio/webm.webm b/cinelerra-5.1/ffmpeg/audio/webm.webm
new file mode 100644
index 00000000..d380c117
--- /dev/null
+++ b/cinelerra-5.1/ffmpeg/audio/webm.webm
@@ -0,0 +1 @@
+webm libvorbis
diff --git a/cinelerra-5.1/ffmpeg/video/webm.dfl b/cinelerra-5.1/ffmpeg/video/webm.dfl
new file mode 100644
index 00000000..d546cbf9
--- /dev/null
+++ b/cinelerra-5.1/ffmpeg/video/webm.dfl
@@ -0,0 +1 @@
+webm.webm
diff --git a/cinelerra-5.1/ffmpeg/video/webm.webm b/cinelerra-5.1/ffmpeg/video/webm.webm
new file mode 100644
index 00000000..da4b56ed
--- /dev/null
+++ b/cinelerra-5.1/ffmpeg/video/webm.webm
@@ -0,0 +1 @@
+webm libvpx
diff --git a/cinelerra-5.1/guicast/bcsignals.C b/cinelerra-5.1/guicast/bcsignals.C
index e1e5aa38..2a6c8943 100644
--- a/cinelerra-5.1/guicast/bcsignals.C
+++ b/cinelerra-5.1/guicast/bcsignals.C
@@ -266,10 +266,11 @@ int BC_Signals::x_error_handler(Display *display, XErrorEvent *event)
 }
 
 
-void BC_Signals::initialize()
+void BC_Signals::initialize(const char *trap_path)
 {
 	BC_Signals::global_signals = this;
 	BC_Trace::global_trace = this;
+	set_trap_path(trap_path);
 	handler_lock = (pthread_mutex_t*)calloc(1, sizeof(pthread_mutex_t));
 	pthread_mutex_init(handler_lock, 0);
 	old_err_handler = XSetErrorHandler(x_error_handler);
diff --git a/cinelerra-5.1/guicast/bcsignals.h b/cinelerra-5.1/guicast/bcsignals.h
index 0d6d9d74..42fbebeb 100644
--- a/cinelerra-5.1/guicast/bcsignals.h
+++ b/cinelerra-5.1/guicast/bcsignals.h
@@ -43,7 +43,7 @@ class BC_Signals : public BC_Trace
 public:
 	BC_Signals();
 	~BC_Signals();
-	void initialize();
+	void initialize(const char *trap_path=0);
 	void initialize2();
 	void terminate();