#include <stdarg.h>
#include <fcntl.h>
#include <limits.h>
+#include <ctype.h>
+
// work arounds (centos)
#include <lzma.h>
#ifndef INT64_MAX
need_packet = 1;
frame = fframe = 0;
bsfc = 0;
+ stats_fp = 0;
+ stats_filename = 0;
+ stats_in = 0;
+ pass = 0;
}
FFStream::~FFStream()
if( frame ) av_frame_free(&frame);
if( fframe ) av_frame_free(&fframe);
delete frm_lock;
+ if( stats_fp ) fclose(stats_fp);
+ if( stats_in ) av_freep(&stats_in);
+ delete [] stats_filename;
}
void FFStream::ff_lock(const char *cp)
ret = write_packet(opkt);
if( ret < 0 ) break;
++pkts;
+ if( stats_fp ) {
+ ret = write_stats_file();
+ if( ret < 0 ) break;
+ }
}
ff_err(ret, "FFStream::encode_frame: encode failed\n");
return -1;
if( writing < 0 )
return -1;
int ret = encode_frame(0);
+ if( ret >= 0 && stats_fp ) {
+ ret = write_stats_file();
+ close_stats_file();
+ }
if( ret < 0 )
ff_err(ret, "FFStream::flush");
return ret >= 0 ? 0 : 1;
}
+
+int FFStream::open_stats_file()
+{
+ stats_fp = fopen(stats_filename,"w");
+ return stats_fp ? 0 : AVERROR(errno);
+}
+
+int FFStream::close_stats_file()
+{
+ if( stats_fp ) {
+ fclose(stats_fp); stats_fp = 0;
+ }
+ return 0;
+}
+
+int FFStream::read_stats_file()
+{
+ int64_t len = 0; struct stat stats_st;
+ int fd = open(stats_filename, O_RDONLY);
+ int ret = fd >= 0 ? 0: ENOENT;
+ if( !ret && fstat(fd, &stats_st) )
+ ret = EINVAL;
+ if( !ret ) {
+ len = stats_st.st_size;
+ stats_in = (char *)av_malloc(len+1);
+ if( !stats_in )
+ ret = ENOMEM;
+ }
+ if( !ret && read(fd, stats_in, len+1) != len )
+ ret = EIO;
+ if( !ret ) {
+ stats_in[len] = 0;
+ avctx->stats_in = stats_in;
+ }
+ if( fd >= 0 )
+ close(fd);
+ return !ret ? 0 : AVERROR(ret);
+}
+
+int FFStream::write_stats_file()
+{
+ int ret = 0;
+ if( avctx->stats_out && (ret=strlen(avctx->stats_out)) > 0 ) {
+ int len = fwrite(avctx->stats_out, 1, ret, stats_fp);
+ if( ret != len )
+ ff_err(ret = AVERROR(errno), "FFStream::write_stats_file");
+ }
+ return ret;
+}
+
+int FFStream::init_stats_file()
+{
+ int ret = 0;
+ if( (pass & 2) && (ret = read_stats_file()) < 0 )
+ ff_err(ret, "stat file read: %s", stats_filename);
+ if( (pass & 1) && (ret=open_stats_file()) < 0 )
+ ff_err(ret, "stat file open: %s", stats_filename);
+ return ret >= 0 ? 0 : ret;
+}
+
int FFStream::seek(int64_t no, double rate)
{
// default ffmpeg native seek
ret = 1;
break;
}
+ av_reduce(&frame_rate.num, &frame_rate.den,
+ frame_rate.num, frame_rate.den, INT_MAX);
+ ctx->framerate = (AVRational) { frame_rate.num, frame_rate.den };
ctx->time_base = (AVRational) { frame_rate.den, frame_rate.num };
st->avg_frame_rate = frame_rate;
st->time_base = ctx->time_base;
eprintf(_("not audio/video, %s:%s\n"), codec_name, filename);
ret = 1;
}
+
+ if( ctx ) {
+ AVDictionaryEntry *tag;
+ if( (tag=av_dict_get(sopts, "cin_stats_filename", NULL, 0)) != 0 ) {
+ char suffix[BCSTRLEN]; sprintf(suffix,"-%d.log",fst->fidx);
+ fst->stats_filename = cstrcat(2, tag->value, suffix);
+ }
+ if( (tag=av_dict_get(sopts, "flags", NULL, 0)) != 0 ) {
+ int pass = fst->pass;
+ char *cp = tag->value;
+ while( *cp ) {
+ int ch = *cp++, pfx = ch=='-' ? -1 : ch=='+' ? 1 : 0;
+ if( !isalnum(!pfx ? ch : (ch=*cp++)) ) continue;
+ char id[BCSTRLEN], *bp = id, *ep = bp+sizeof(id)-1;
+ for( *bp++=ch; isalnum(ch=*cp); ++cp )
+ if( bp < ep ) *bp++ = ch;
+ *bp = 0;
+ if( !strcmp(id, "pass1") ) {
+ pass = pfx<0 ? (pass&~1) : pfx>0 ? (pass|1) : 1;
+ }
+ else if( !strcmp(id, "pass2") ) {
+ pass = pfx<0 ? (pass&~2) : pfx>0 ? (pass|2) : 2;
+ }
+ }
+ if( (fst->pass=pass) ) {
+ if( pass & 1 ) ctx->flags |= AV_CODEC_FLAG_PASS1;
+ if( pass & 2 ) ctx->flags |= AV_CODEC_FLAG_PASS2;
+ }
+ }
+ }
}
if( !ret ) {
if( fmt_ctx->oformat->flags & AVFMT_GLOBALHEADER )
ctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
-
+ if( fst->stats_filename && (ret=fst->init_stats_file()) )
+ eprintf(_("error: stats file = %s\n"), fst->stats_filename);
+ }
+ if( !ret ) {
av_dict_set(&sopts, "cin_bitrate", 0, 0);
av_dict_set(&sopts, "cin_quality", 0, 0);
if( ret < 0 )
fprintf(stderr, "Could not copy the stream parameters\n");
}
+ if( ret >= 0 ) {
+_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+ ret = avcodec_copy_context(st->codec, ctx);
+_Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
+ if( ret < 0 )
+ fprintf(stderr, "Could not copy the stream context\n");
+ }
if( ret < 0 ) {
ff_err(ret,"FFMPEG::open_encoder");
eprintf(_("open failed %s:%s\n"), codec_name, filename);
int load_filter(AVFrame *frame);
int read_filter(AVFrame *frame);
int read_frame(AVFrame *frame);
+ int open_stats_file();
+ int close_stats_file();
+ int read_stats_file();
+ int write_stats_file();
+ int init_stats_file();
FFMPEG *ffmpeg;
AVStream *st;
int reading, writing;
int seeked, eof;
+ FILE *stats_fp;
+ char *stats_filename;
+ char *stats_in;
+ int pass;
+
int st_eof() { return eof; }
void st_eof(int v) { eof = v; }
};
}
}
+ BC_ListBoxItem::sort_items(ffmpeg_types);
update(&ffmpeg_types, 0, 0, 1);
}
void MWindow::stop_brender()
{
if( !brender ) return;
+// cannot be holding mwindow->gui display lock
brender->stop();
}
}
else {
edl->session->brender_start = edl->session->brender_end = 0;
+ gui->unlock_window();
stop_brender();
+ gui->lock_window("MWindow::set_brender_active");
}
if( update ) {
gui->update_timebar(0);
const int debug = 0;
if(debug) PRINT_TRACE
- init_brender();
edl->tracks->update_y_pixels(theme);
if(debug) PRINT_TRACE
gui->update(1, 1, 1, 1, 1, 1, 1);
if(debug) PRINT_TRACE
gui->unlock_window();
+ init_brender();
cwindow->gui->lock_window("MWindow::update_project 1");
cwindow->update(0, 0, 1, 1, 1);
xmargin1 = x = mwindow->theme->preferencesoptions_x;
y = mwindow->theme->preferencesoptions_y;
-// add_subwindow(new BC_Title(x,
-// y,
-// _("Time Format"),
-// LARGEFONT,
-// resources->text_default));
-//
-// y += get_text_height(LARGEFONT) + 5;
-
int y0 = y;
-
win = add_subwindow(new BC_Title(x, y + 5, _("Cache size (MB):"), MEDIUMFONT, resources->text_default));
maxw = win->get_w();
y += win->get_h() + 10;
win = add_subwindow(new BC_Title(x, y, _("Frames per background rendering job:")));
y += win->get_h() + 5;
- PrefsBRenderFragment *brender_fragment = new PrefsBRenderFragment(pwindow,
- this,
- x + xmargin3,
- y);
+ PrefsBRenderFragment *brender_fragment = new PrefsBRenderFragment(pwindow, this,
+ x + xmargin3, y);
brender_fragment->create_objects();
y += brender_fragment->get_h() + 5;
win = add_subwindow(new BC_Title(x, y, _("Frames to preroll background:")));
y += win->get_h() + 5;
- PrefsBRenderPreroll *bpreroll = new PrefsBRenderPreroll(pwindow,
- this,
- x + xmargin3,
- y + 5);
+ PrefsBRenderPreroll *bpreroll = new PrefsBRenderPreroll(pwindow, this,
+ x + xmargin3, y + 5);
bpreroll->create_objects();
y += bpreroll->get_h() + 20;
-
x += xmargin4;
add_subwindow(new BC_Title(x, y1, _("Output for background rendering:")));
y1 += 20;
- brender_tools =
- new FormatTools(mwindow,
- this,
+ brender_tools = new FormatTools(mwindow, this,
pwindow->thread->preferences->brender_asset);
- brender_tools->create_objects(x,
- y1,
+ brender_tools->create_objects(x, y1,
0, // Include tools for audio
1, // Include tools for video
0, // Include checkbox for audio
add_subwindow(new BC_Bar(5, y, get_w() - 10));
y += 5;
add_subwindow(new BC_Title(x, y, _("Render Farm"), LARGEFONT, resources->text_default));
+ x1 = get_w() - BC_GenericButton::calculate_w(this, _("Reset rates")) - x;
+ add_subwindow(new PrefsRenderFarmReset(pwindow, this, x1, y));
x1 = x + xmargin4;
BC_Title *node_title = new BC_Title(x1, y, _("Nodes:"));
add_subwindow(node_title);
- x1 += node_title->get_w() + 25;
+ x1 += node_title->get_w() + 15;
sprintf(string, _(MASTER_NODE_FRAMERATE_TEXT),
pwindow->thread->preferences->local_rate);
add_subwindow(master_rate = new BC_Title(x1, y, string));
- y += 25;
- add_subwindow(node_list = new PrefsRenderFarmNodes(pwindow,
- this,
- x + xmargin4,
- y));
- y += 5;
- add_subwindow(new PrefsRenderFarm(pwindow, x, y));
- y += 30;
- add_subwindow(new BC_Title(x, y, _("Hostname:")));
+ add_subwindow(node_list = new PrefsRenderFarmNodes(pwindow, this, x + xmargin4, y+=25));
+ add_subwindow(new PrefsRenderFarm(pwindow, x, y+=5));
+ add_subwindow(new BC_Title(x, y+=30, _("Hostname:")));
add_subwindow(new BC_Title(x + xmargin3, y, _("Port:")));
-
- y += 25;
- add_subwindow(edit_node = new PrefsRenderFarmEditNode(pwindow,
- this,
- x,
- y));
- edit_port = new PrefsRenderFarmPort(pwindow,
- this,
- x + xmargin3,
- y);
+ add_subwindow(edit_node = new PrefsRenderFarmEditNode(pwindow, this, x, y+=25));
+ edit_port = new PrefsRenderFarmPort(pwindow, this, x+xmargin3, y);
edit_port->create_objects();
- y += 30;
-
-
- add_subwindow(new PrefsRenderFarmReplaceNode(pwindow,
- this,
- x,
- y));
- add_subwindow(new PrefsRenderFarmNewNode(pwindow,
- this,
- x + xmargin2,
- y));
- y += 30;
- add_subwindow(new PrefsRenderFarmDelNode(pwindow,
- this,
- x + xmargin2,
- y));
- add_subwindow(new PrefsRenderFarmSortNodes(pwindow,
- this,
- x,
- y));
- y += 30;
- add_subwindow(new PrefsRenderFarmReset(pwindow,
- this,
- x,
- y));
- y += 35;
- add_subwindow(new BC_Title(x,
- y,
- _("Total jobs to create:")));
- add_subwindow(new BC_Title(x,
- y + 30,
- _("(overridden if new file at each label is checked)")));
- PrefsRenderFarmJobs *jobs = new PrefsRenderFarmJobs(pwindow,
- this,
- x + xmargin3,
- y);
+ add_subwindow(new PrefsRenderFarmReplaceNode(pwindow, this, x, y+=30));
+ add_subwindow(new PrefsRenderFarmNewNode(pwindow, this, x+xmargin2, y));
+ add_subwindow(new PrefsRenderFarmSortNodes(pwindow, this, x, y+=30));
+ add_subwindow(new PrefsRenderFarmDelNode(pwindow, this, x+xmargin2, y));
+ add_subwindow(new BC_Title(x, y+=35, _("Client Watchdog Timeout:")));
+ renderfarm_watchdog = new PrefsRenderFarmWatchdog(pwindow, this, x+xmargin3, y-5);
+ renderfarm_watchdog->create_objects();
+ add_subwindow(new BC_Title(x, y+=35, _("Total jobs to create:")));
+ PrefsRenderFarmJobs *jobs = new PrefsRenderFarmJobs(pwindow, this,
+ x + xmargin3, y-5);
jobs->create_objects();
- y += 55;
-// add_subwindow(new PrefsRenderFarmVFS(pwindow,
-// this,
-// x,
-// y));
-// add_subwindow(new BC_Title(x,
-// y,
+ y += jobs->get_h() + 5;
+ win = add_subwindow(new BC_Title(x, y,
+ _("(overridden if new file at each label is checked)")));
+// y += win->get_h() + 5;
+// add_subwindow(new PrefsRenderFarmVFS(pwindow, this, x, y));
+// add_subwindow(new BC_Title(x, y,
// _("Filesystem prefix on remote nodes:")));
-// add_subwindow(new PrefsRenderFarmMountpoint(pwindow,
-// this,
-// x + xmargin3,
-// y));
+// add_subwindow(new PrefsRenderFarmMountpoint(pwindow, this, x + xmargin3, y));
// y += 30;
}
}
}
-static const char *default_titles[] =
-{
- N_("On"),
- N_("Hostname"),
- N_("Port"),
- N_("Framerate")
+
+static const char *default_titles[] = {
+ N_("On"), N_("Hostname"), N_("Port"), N_("Framerate")
};
-static int default_widths[] =
-{
- 30,
- 150,
- 50,
- 50
+static int default_widths[] = {
+ 30, 150, 50, 50
};
}
-
-
-
-
PrefsBRenderFragment::PrefsBRenderFragment(PreferencesWindow *pwindow,
- PerformancePrefs *subwindow,
- int x,
- int y)
+ PerformancePrefs *subwindow, int x, int y)
: BC_TumbleTextBox(subwindow,
(int64_t)pwindow->thread->preferences->brender_fragment,
- (int64_t)1,
- (int64_t)65535,
- x,
- y,
- 100)
+ (int64_t)1, (int64_t)65535, x, y, 100)
{
this->pwindow = pwindow;
}
return 1;
}
-
-
-
-
-
-
-
-
-
-
-CICacheSize::CICacheSize(int x,
- int y,
- PreferencesWindow *pwindow,
- PerformancePrefs *subwindow)
+CICacheSize::CICacheSize(int x, int y,
+ PreferencesWindow *pwindow, PerformancePrefs *subwindow)
: BC_TumbleTextBox(subwindow,
(int64_t)pwindow->thread->preferences->cache_size / 0x100000,
(int64_t)MIN_CACHE_SIZE / 0x100000,
(int64_t)MAX_CACHE_SIZE / 0x100000,
- x,
- y,
- 100)
+ x, y, 100)
{
this->pwindow = pwindow;
set_increment(1);
}
-
-
-
-
-
-
-
-
-
PrefsRenderFarm::PrefsRenderFarm(PreferencesWindow *pwindow, int x, int y)
: BC_CheckBox(x,
y,
}
-
-
PrefsForceUniprocessor::PrefsForceUniprocessor(PreferencesWindow *pwindow, int x, int y)
: BC_CheckBox(x,
y,
}
-
-
-
-
-
PrefsRenderFarmEditNode::PrefsRenderFarmEditNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
: BC_TextBox(x, y, 240, 1, "")
{
}
-
-
-
-
PrefsRenderFarmNewNode::PrefsRenderFarmNewNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
: BC_GenericButton(x, y, _("Add Nodes"))
{
}
-
-
-
-
-
PrefsRenderFarmReplaceNode::PrefsRenderFarmReplaceNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
: BC_GenericButton(x, y, _("Apply Changes"))
{
}
-
-
-
PrefsRenderFarmDelNode::PrefsRenderFarmDelNode(PreferencesWindow *pwindow, PerformancePrefs *subwindow, int x, int y)
: BC_GenericButton(x, y, _("Delete Nodes"))
{
}
-
-
-
PrefsRenderFarmSortNodes::PrefsRenderFarmSortNodes(PreferencesWindow *pwindow,
PerformancePrefs *subwindow,
int x,
}
-
-
-
PrefsRenderFarmReset::PrefsRenderFarmReset(PreferencesWindow *pwindow,
- PerformancePrefs *subwindow,
- int x,
- int y)
+ PerformancePrefs *subwindow, int x, int y)
: BC_GenericButton(x, y, _("Reset rates"))
{
this->pwindow = pwindow;
char string[BCTEXTLEN];
sprintf(string,
- MASTER_NODE_FRAMERATE_TEXT,
+ _(MASTER_NODE_FRAMERATE_TEXT),
pwindow->thread->preferences->local_rate);
subwindow->master_rate->update(string);
subwindow->hot_node = -1;
}
-
-
-
PrefsProjectSMP::PrefsProjectSMP(PreferencesWindow *pwindow,
PerformancePrefs *subwindow, int x, int y)
: BC_TumbleTextBox(subwindow,
}
-
-
-
PrefsRenderFarmJobs::PrefsRenderFarmJobs(PreferencesWindow *pwindow,
PerformancePrefs *subwindow,
int x,
int y)
: BC_TumbleTextBox(subwindow,
(int64_t)pwindow->thread->preferences->renderfarm_job_count,
- (int64_t)1,
- (int64_t)100,
- x,
- y,
- 100)
+ (int64_t)1, (int64_t)100, x, y, 100)
{
this->pwindow = pwindow;
}
}
-
PrefsRenderFarmMountpoint::PrefsRenderFarmMountpoint(PreferencesWindow *pwindow,
- PerformancePrefs *subwindow,
- int x,
- int y)
- : BC_TextBox(x,
- y,
- 100,
- 1,
+ PerformancePrefs *subwindow, int x, int y)
+ : BC_TextBox(x, y, 100, 1,
pwindow->thread->preferences->renderfarm_mountpoint)
{
this->pwindow = pwindow;
}
-
-
PrefsRenderFarmVFS::PrefsRenderFarmVFS(PreferencesWindow *pwindow,
PerformancePrefs *subwindow, int x, int y)
: BC_CheckBox(x, y, pwindow->thread->preferences->renderfarm_vfs,
return 1;
}
+
+PrefsRenderFarmWatchdog::PrefsRenderFarmWatchdog(PreferencesWindow *pwindow,
+ PerformancePrefs *subwindow, int x, int y)
+ : BC_TumbleTextBox(subwindow,
+ (int64_t)pwindow->thread->preferences->renderfarm_watchdog_timeout,
+ (int64_t)0, (int64_t)1000, x, y, 100)
+{
+ this->pwindow = pwindow;
+ set_increment(15);
+}
+
+int PrefsRenderFarmWatchdog::handle_event()
+{
+ pwindow->thread->preferences->renderfarm_watchdog_timeout = atol(get_text());
+ return 1;
+}
+
+
PrefsRenderFarmEditNode *edit_node;
PrefsRenderFarmPort *edit_port;
PrefsRenderFarmNodes *node_list;
+ PrefsRenderFarmWatchdog *renderfarm_watchdog;
FormatTools *brender_tools;
BC_Title *master_rate;
};
-
class PrefsUseBRender : public BC_CheckBox
{
public:
PrefsUseBRender(PreferencesWindow *pwindow,
- int x,
- int y);
+ int x, int y);
int handle_event();
PreferencesWindow *pwindow;
};
public:
PrefsBRenderFragment(PreferencesWindow *pwindow,
PerformancePrefs *subwindow,
- int x,
- int y);
+ int x, int y);
int handle_event();
PreferencesWindow *pwindow;
};
-
-
class PrefsRenderPreroll : public BC_TumbleTextBox
{
public:
PerformancePrefs *perf_prefs;
};
-
-
-
class PrefsRenderFarm : public BC_CheckBox
{
public:
int handle_event();
-
PreferencesWindow *pwindow;
};
int handle_event();
-
PreferencesWindow *pwindow;
};
public:
PrefsRenderFarmPort(PreferencesWindow *pwindow,
PerformancePrefs *subwindow,
- int x,
- int y);
+ int x, int y);
~PrefsRenderFarmPort();
int handle_event();
public:
PrefsRenderFarmJobs(PreferencesWindow *pwindow,
PerformancePrefs *subwindow,
- int x,
- int y);
+ int x, int y);
~PrefsRenderFarmJobs();
int handle_event();
public:
PrefsRenderFarmMountpoint(PreferencesWindow *pwindow,
PerformancePrefs *subwindow,
- int x,
- int y);
+ int x, int y);
~PrefsRenderFarmMountpoint();
int handle_event();
int handle_event();
PerformancePrefs *subwindow;
-
PreferencesWindow *pwindow;
};
PreferencesWindow *pwindow;
};
-
class PrefsRenderFarmReset : public BC_GenericButton
{
public:
PrefsRenderFarmReset(PreferencesWindow *pwindow,
- PerformancePrefs *subwindow,
- int x, int y);
+ PerformancePrefs *subwindow, int x, int y);
+
+ int handle_event();
+
+ PerformancePrefs *subwindow;
+ PreferencesWindow *pwindow;
+};
+
+class PrefsRenderFarmWatchdog : public BC_TumbleTextBox
+{
+public:
+ PrefsRenderFarmWatchdog(PreferencesWindow *pwindow,
+ PerformancePrefs *subwindow, int x, int y);
int handle_event();
class CICacheSize : public BC_TumbleTextBox
{
public:
- CICacheSize(int x,
- int y,
+ CICacheSize(int x, int y,
PreferencesWindow *pwindow,
PerformancePrefs *subwindow);
+
int handle_event();
+
PreferencesWindow *pwindow;
};
class PrefsRenderFarmDelNode;
class PrefsRenderFarmSortNodes;
class PrefsRenderFarmReset;
+class PrefsRenderFarmWatchdog;
class CICacheSize;
#endif
#include "videoconfig.h"
#include "videodevice.inc"
+#include <ctype.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-//#define CLAMP(x, y, z) (x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
-
Preferences::Preferences()
{
// Set defaults
FileSystem fs;
-
preferences_lock = new Mutex("Preferences::preferences_lock");
-
// initial plugin path from build -DPLUGIN_DIR="..."
sprintf(plugin_dir, "%s/", File::get_plugin_path());
sprintf(index_directory, "%s/", File::get_config_path());
- if(strlen(index_directory))
+ if( strlen(index_directory) )
fs.complete_path(index_directory);
cache_size = 0x10000000;
index_size = 0x400000;
renderfarm_mountpoint[0] = 0;
renderfarm_vfs = 0;
renderfarm_job_count = 20;
+ renderfarm_watchdog_timeout = 60;
project_smp = processors = calculate_processors(0);
real_processors = calculate_processors(1);
ffmpeg_marker_indexes = 1;
forward_render_displacement = 0;
dvd_yuv420p_interlace = 0;
highlight_inverse = 0xffffff;
- yuv_color_space = 0; // bt601
- yuv_color_range = 0; // jpeg
+ yuv_color_space = BC_COLORS_BT601;
+ yuv_color_range = BC_COLORS_JPEG;
// Default brender asset
brender_asset = new Asset;
// one of the nodes in the source is the master node.
local_rate = preferences->local_rate;
- for(int j = 0;
- j < preferences->renderfarm_nodes.total;
- j++)
- {
+ for( int j=0; j<preferences->renderfarm_nodes.total; ++j ) {
double new_rate = preferences->renderfarm_rate.values[j];
// Put in the master node
- if(preferences->renderfarm_nodes.values[j][0] == '/')
- {
- if(!EQUIV(new_rate, 0.0))
+ if( preferences->renderfarm_nodes.values[j][0] == '/' ) {
+ if( !EQUIV(new_rate, 0.0) )
local_rate = new_rate;
}
else
// Search for local node and copy it to that node
- if(!EQUIV(new_rate, 0.0))
- {
- for(int i = 0; i < renderfarm_nodes.total; i++)
- {
- if(!strcmp(preferences->renderfarm_nodes.values[j], renderfarm_nodes.values[i]) &&
- preferences->renderfarm_ports.values[j] == renderfarm_ports.values[i])
- {
+ if( !EQUIV(new_rate, 0.0) ) {
+ for( int i=0; i<renderfarm_nodes.total; ++i ) {
+ if( !strcmp(preferences->renderfarm_nodes.values[j], renderfarm_nodes.values[i]) &&
+ preferences->renderfarm_ports.values[j] == renderfarm_ports.values[i] ) {
renderfarm_rate.values[i] = new_rate;
break;
}
renderfarm_enabled.remove_all();
renderfarm_rate.remove_all();
local_rate = that->local_rate;
- for(int i = 0; i < that->renderfarm_nodes.size(); i++)
- {
+ for( int i=0; i<that->renderfarm_nodes.size(); ++i ) {
add_node(that->renderfarm_nodes.get(i),
that->renderfarm_ports.get(i),
that->renderfarm_enabled.get(i),
render_preroll = that->render_preroll;
brender_preroll = that->brender_preroll;
renderfarm_job_count = that->renderfarm_job_count;
+ renderfarm_watchdog_timeout = that->renderfarm_watchdog_timeout;
renderfarm_vfs = that->renderfarm_vfs;
strcpy(renderfarm_mountpoint, that->renderfarm_mountpoint);
renderfarm_consolidate = that->renderfarm_consolidate;
// Check boundaries
FileSystem fs;
- if(strlen(index_directory))
- {
+ if( strlen(index_directory) ) {
fs.complete_path(index_directory);
fs.add_end_slash(index_directory);
}
-// if(strlen(global_plugin_dir))
+// if( strlen(global_plugin_dir) )
// {
// fs.complete_path(global_plugin_dir);
// fs.add_end_slash(global_plugin_dir);
return *this;
}
-void Preferences::print_channels(char *string,
- int *channel_positions,
- int channels)
+void Preferences::print_channels(char *string, int *channel_positions, int channels)
{
- char string3[BCTEXTLEN];
- string[0] = 0;
- for(int j = 0; j < channels; j++)
- {
- sprintf(string3, "%d", channel_positions[j]);
- strcat(string, string3);
- if(j < channels - 1)
- strcat(string, ",");
+ char *cp = string, *ep = cp+BCTEXTLEN-1;
+ for( int i=0; i<channels; ++i ) {
+ if( i ) cp += snprintf(cp, ep-cp, ", ");
+ cp += snprintf(cp, ep-cp, "%d", channel_positions[i]);
}
+ *cp = 0;
}
-void Preferences::scan_channels(char *string,
- int *channel_positions,
- int channels)
+void Preferences::scan_channels(char *string, int *channel_positions, int channels)
{
- char string2[BCTEXTLEN];
- int len = strlen(string);
+ char *cp = string;
int current_channel = 0;
- for(int i = 0; i < len; i++)
- {
- strcpy(string2, &string[i]);
- for(int j = 0; j < BCTEXTLEN; j++)
- {
- if(string2[j] == ',' || string2[j] == 0)
- {
- i += j;
- string2[j] = 0;
- break;
- }
- }
- channel_positions[current_channel++] = atoi(string2);
- if(current_channel >= channels) break;
+ for(;;) {
+ while( isspace(*cp) ) ++cp;
+ if( !cp ) break;
+ channel_positions[current_channel++] = strtol(cp, &cp, 0);
+ if( current_channel >= channels ) break;
+ while( isspace(*cp) ) ++cp;
+ if( *cp == ',' ) ++cp;
+ }
+ while( current_channel < channels ) {
+ int pos = default_audio_channel_position(current_channel, channels);
+ channel_positions[current_channel++] = pos;
}
}
render_preroll = defaults->get("RENDERFARM_PREROLL", render_preroll);
brender_preroll = defaults->get("BRENDER_PREROLL", brender_preroll);
renderfarm_job_count = defaults->get("RENDERFARM_JOBS_COUNT", renderfarm_job_count);
+ renderfarm_watchdog_timeout = defaults->get("RENDERFARM_WATCHDOG_TIMEOUT", renderfarm_watchdog_timeout);
renderfarm_consolidate = defaults->get("RENDERFARM_CONSOLIDATE", renderfarm_consolidate);
// renderfarm_vfs = defaults->get("RENDERFARM_VFS", renderfarm_vfs);
defaults->get("RENDERFARM_MOUNTPOINT", renderfarm_mountpoint);
int renderfarm_total = defaults->get("RENDERFARM_TOTAL", 0);
- for(int i = 0; i < renderfarm_total; i++)
- {
+ for( int i = 0; i < renderfarm_total; i++ ) {
sprintf(string, "RENDERFARM_NODE%d", i);
char result[BCTEXTLEN];
int result_port = 0;
sprintf(string, "RENDERFARM_RATE%d", i);
result_rate = defaults->get(string, result_rate);
- if(result[0] != 0)
- {
+ if( result[0] != 0 ) {
add_node(result, result_port, result_enabled, result_rate);
}
}
defaults->update("PLUGIN_ICONS", plugin_icons);
defaults->update("SNAPSHOT_PATH", snapshot_path);
- for(int i = 0; i < MAXCHANNELS; i++)
- {
+ for( int i = 0; i < MAXCHANNELS; i++ ) {
char string2[BCTEXTLEN];
sprintf(string, "CHANNEL_POSITIONS%d", i);
print_channels(string2, &channel_positions[i][0], i + 1);
// defaults->update("RENDERFARM_VFS", renderfarm_vfs);
defaults->update("RENDERFARM_MOUNTPOINT", renderfarm_mountpoint);
defaults->update("RENDERFARM_JOBS_COUNT", renderfarm_job_count);
+ defaults->update("RENDERFARM_WATCHDOG_TIMEOUT", renderfarm_watchdog_timeout);
defaults->update("RENDERFARM_CONSOLIDATE", renderfarm_consolidate);
defaults->update("RENDERFARM_TOTAL", (int64_t)renderfarm_nodes.total);
- for(int i = 0; i < renderfarm_nodes.total; i++)
- {
+ for( int i = 0; i < renderfarm_nodes.total; i++ ) {
sprintf(string, "RENDERFARM_NODE%d", i);
defaults->update(string, renderfarm_nodes.values[i]);
sprintf(string, "RENDERFARM_PORT%d", i);
void Preferences::add_node(const char *text, int port, int enabled, float rate)
{
- if(text[0] == 0) return;
+ if( text[0] == 0 ) return;
preferences_lock->lock("Preferences::add_node");
char *new_item = new char[strlen(text) + 1];
void Preferences::delete_node(int number)
{
preferences_lock->lock("Preferences::delete_node");
- if(number < renderfarm_nodes.total && number >= 0)
- {
+ if( number < renderfarm_nodes.total && number >= 0 ) {
delete [] renderfarm_nodes.values[number];
renderfarm_nodes.remove_number(number);
renderfarm_ports.remove_number(number);
void Preferences::delete_nodes()
{
preferences_lock->lock("Preferences::delete_nodes");
- for(int i = 0; i < renderfarm_nodes.total; i++)
+ for( int i = 0; i < renderfarm_nodes.total; i++ )
delete [] renderfarm_nodes.values[i];
renderfarm_nodes.remove_all();
renderfarm_ports.remove_all();
void Preferences::reset_rates()
{
- for(int i = 0; i < renderfarm_nodes.total; i++)
- {
+ for( int i = 0; i < renderfarm_nodes.total; i++ ) {
renderfarm_rate.values[i] = 0.0;
}
local_rate = 0.0;
float Preferences::get_rate(int node)
{
- if(node < 0)
- {
+ if( node < 0 ) {
return local_rate;
}
- else
- {
+ else {
int total = 0;
- for(int i = 0; i < renderfarm_nodes.size(); i++)
- {
- if(renderfarm_enabled.get(i)) total++;
- if(total == node + 1)
- {
+ for( int i = 0; i < renderfarm_nodes.size(); i++ ) {
+ if( renderfarm_enabled.get(i) ) total++;
+ if( total == node + 1 ) {
return renderfarm_rate.get(i);
}
}
void Preferences::set_rate(float rate, int node)
{
//printf("Preferences::set_rate %f %d\n", rate, node);
- if(node < 0)
- {
+ if( node < 0 ) {
local_rate = rate;
}
- else
- {
+ else {
int total = 0;
- for(int i = 0; i < renderfarm_nodes.size(); i++)
- {
- if(renderfarm_enabled.get(i)) total++;
- if(total == node + 1)
- {
+ for( int i = 0; i < renderfarm_nodes.size(); i++ ) {
+ if( renderfarm_enabled.get(i) ) total++;
+ if( total == node + 1 ) {
renderfarm_rate.set(i, rate);
return;
}
{
preferences_lock->lock("Preferences::get_avg_rate");
float total = 0.0;
- if(renderfarm_rate.total)
- {
+ if( renderfarm_rate.total ) {
int enabled = 0;
- if(use_master_node)
- {
- if(EQUIV(local_rate, 0.0))
- {
+ if( use_master_node ) {
+ if( EQUIV(local_rate, 0.0) ) {
preferences_lock->unlock();
return 0.0;
}
- else
- {
+ else {
enabled++;
total += local_rate;
}
}
- for(int i = 0; i < renderfarm_rate.total; i++)
- {
- if(renderfarm_enabled.values[i])
- {
+ for( int i = 0; i < renderfarm_rate.total; i++ ) {
+ if( renderfarm_enabled.values[i] ) {
enabled++;
total += renderfarm_rate.values[i];
- if(EQUIV(renderfarm_rate.values[i], 0.0))
- {
+ if( EQUIV(renderfarm_rate.values[i], 0.0) ) {
preferences_lock->unlock();
return 0.0;
}
}
}
- if(enabled)
+ if( enabled )
total /= enabled;
else
total = 0.0;
while(!done)
{
done = 1;
- for(int i = 0; i < renderfarm_nodes.total - 1; i++)
- {
- if(strcmp(renderfarm_nodes.values[i], renderfarm_nodes.values[i + 1]) > 0)
- {
+ for( int i = 0; i < renderfarm_nodes.total - 1; i++ ) {
+ if( strcmp(renderfarm_nodes.values[i], renderfarm_nodes.values[i + 1]) > 0 ) {
char *temp = renderfarm_nodes.values[i];
int temp_port = renderfarm_ports.values[i];
int Preferences::get_enabled_nodes()
{
int result = 0;
- for(int i = 0; i < renderfarm_enabled.total; i++)
- if(renderfarm_enabled.values[i]) result++;
+ for( int i = 0; i < renderfarm_enabled.total; i++ )
+ if( renderfarm_enabled.values[i] ) result++;
return result;
}
const char* Preferences::get_node_hostname(int number)
{
int total = 0;
- for(int i = 0; i < renderfarm_nodes.total; i++)
- {
- if(renderfarm_enabled.values[i])
- {
- if(total == number)
+ for( int i = 0; i < renderfarm_nodes.total; i++ ) {
+ if( renderfarm_enabled.values[i] ) {
+ if( total == number )
return renderfarm_nodes.values[i];
else
total++;
int Preferences::get_node_port(int number)
{
int total = 0;
- for(int i = 0; i < renderfarm_ports.total; i++)
- {
- if(renderfarm_enabled.values[i])
- {
- if(total == number)
+ for( int i = 0; i < renderfarm_ports.total; i++ ) {
+ if( renderfarm_enabled.values[i] ) {
+ if( total == number )
return renderfarm_ports.values[i];
else
total++;
int Preferences::calculate_processors(int interactive)
{
- if(force_uniprocessor && !interactive) return 1;
+ if( force_uniprocessor && !interactive ) return 1;
return BC_WindowBase::get_resources()->machine_cpus;
}
int renderfarm_job_count;
// Consolidate output files
int renderfarm_consolidate;
+// watchdog timeout, zero disabled
+ int renderfarm_watchdog_timeout;
// Tip of the day
int use_tipwindow;
{
int result = 0;
- for(int i = 0; i < preferences->get_enabled_nodes() && !result; i++)
- {
+ for( int i=0; i<preferences->get_enabled_nodes() && !result; ++i ) {
client_lock->lock("RenderFarmServer::start_clients");
- RenderFarmServerThread *client = new RenderFarmServerThread(this,
- i);
+ RenderFarmServerThread *client = new RenderFarmServerThread(this, i);
clients.append(client);
result = client->start_loop();
RenderFarmServerThread::~RenderFarmServerThread()
{
-//printf("RenderFarmServerThread::~RenderFarmServerThread 1 %p\n", this);
Thread::join();
-//printf("RenderFarmServerThread::~RenderFarmServerThread 1\n");
- if(socket_fd >= 0) close(socket_fd);
- if(watchdog) delete watchdog;
- if(buffer) delete [] buffer;
- if(datagram) delete [] datagram;
-//printf("RenderFarmServerThread::~RenderFarmServerThread 2\n");
+ if( socket_fd >= 0 ) close(socket_fd);
+ delete watchdog;
+ delete [] buffer;
+ delete [] datagram;
}
int result = 0;
// Open file for master node
- if(hostname[0] == '/')
- {
- if((socket_fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
- {
- perror(_("RenderFarmServerThread::start_loop: socket\n"));
+ if( hostname[0] == '/' ) {
+ if( (socket_fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0 ) {
+ perror(_("RenderFarmServerThread::open_client: socket\n"));
result = 1;
}
- else
- {
+ else {
struct sockaddr_un addr;
addr.sun_family = AF_FILE;
strcpy(addr.sun_path, hostname);
do
{
- if(connect(socket_fd, (struct sockaddr*)&addr, size) < 0)
- {
+ if( connect(socket_fd, (struct sockaddr*)&addr, size) < 0 ) {
attempt++;
- if(attempt > 30000000 / ATTEMPT_DELAY)
- {
+ if( attempt > 30000000 / ATTEMPT_DELAY ) {
fprintf(stderr, _("RenderFarmServerThread::open_client: %s: %s\n"),
hostname,
strerror(errno));
else
// Open socket
{
- if((socket_fd = socket(PF_INET, SOCK_STREAM, 0)) < 0)
- {
+ if( (socket_fd = socket(PF_INET, SOCK_STREAM, 0)) < 0 ) {
perror(_("RenderFarmServerThread::start_loop: socket"));
result = 1;
}
- else
- {
+ else {
// Open port
struct sockaddr_in addr;
struct hostent *hostinfo;
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
hostinfo = gethostbyname(hostname);
- if(hostinfo == NULL)
- {
+ if( hostinfo == NULL ) {
fprintf(stderr, _("RenderFarmServerThread::open_client: unknown host %s.\n"),
hostname);
result = 1;
}
- else
- {
+ else {
addr.sin_addr = *(struct in_addr *) hostinfo->h_addr;
- if(connect(socket_fd, (struct sockaddr*)&addr, sizeof(addr)) < 0)
- {
+ if( connect(socket_fd, (struct sockaddr*)&addr, sizeof(addr)) < 0 ) {
fprintf(stderr, _("RenderFarmServerThread::open_client: %s: %s\n"),
hostname,
strerror(errno));
}
}
- if(result) socket_fd = -1;
+ if( result ) socket_fd = -1;
return socket_fd;
}
int RenderFarmServerThread::start_loop()
{
int result = 0;
-
socket_fd = open_client(server->preferences->get_node_hostname(number),
server->preferences->get_node_port(number));
+ if( socket_fd < 0 ) result = 1;
- if(socket_fd < 0) result = 1;
-
- if(!result)
- {
- watchdog = new RenderFarmWatchdog(this, 0);
- watchdog->start();
+ if( !result ) {
+ int watchdog_timeout = server->preferences->renderfarm_watchdog_timeout;
+ if( watchdog_timeout > 0 ) {
+ watchdog = new RenderFarmWatchdog(watchdog_timeout, this, 0);
+ watchdog->start();
+ }
}
- if(!result) Thread::start();
+ if( !result ) Thread::start();
return result;
}
int64_t RenderFarmServerThread::read_int64(int *error)
{
int temp = 0;
- if(!error) error = &temp;
+ if( !error ) error = &temp;
unsigned char data[sizeof(int64_t)];
*error = (read_socket((char*)data, sizeof(int64_t)) !=
// Make it return 1 if error so it can be used to read a result code from the
// server.
int64_t result = 1;
- if(!*error)
- {
+ if( !*error ) {
result = (((int64_t)data[0]) << 56) |
(((uint64_t)data[1]) << 48) |
(((uint64_t)data[2]) << 40) |
int bytes_read = 0;
int offset = 0;
//printf("RenderFarmServerThread::read_socket 1\n");
- watchdog->begin_request();
+ if( watchdog )
+ watchdog->begin_request();
while(len > 0 && bytes_read >= 0)
{
enable_cancel();
bytes_read = read(socket_fd, data + offset, len);
disable_cancel();
- if(bytes_read > 0)
- {
+ if( bytes_read > 0 ) {
len -= bytes_read;
offset += bytes_read;
}
else
- if(bytes_read < 0)
+ if( bytes_read < 0 )
break;
}
- watchdog->end_request();
+ if( watchdog )
+ watchdog->end_request();
//printf("RenderFarmServerThread::read_socket 10\n");
return offset;
void RenderFarmServerThread::reallocate_buffer(int size)
{
- if(buffer && buffer_allocated < size)
- {
+ if( buffer && buffer_allocated < size ) {
delete [] buffer;
buffer = 0;
}
- if(!buffer && size)
- {
+ if( !buffer && size ) {
buffer = new unsigned char[size];
buffer_allocated = size;
}
- while(!done)
- {
+ while(!done) {
// Wait for requests.
// Requests consist of request ID's and accompanying buffers.
// Get request ID.
bytes_read = read_socket((char*)header, 5);
//printf("RenderFarmServerThread::run 1\n");
- if(bytes_read != 5)
- {
+ if( bytes_read != 5 ) {
done = 1;
continue;
}
int request_id = header[0];
int64_t request_size = (((u_int32_t)header[1]) << 24) |
- (((u_int32_t)header[2]) << 16) |
- (((u_int32_t)header[3]) << 8) |
- (u_int32_t)header[4];
+ (((u_int32_t)header[2]) << 16) |
+ (((u_int32_t)header[3]) << 8) |
+ (u_int32_t)header[4];
reallocate_buffer(request_size);
bytes_read = read_socket((char*)buffer, request_size);
//printf("RenderFarmServerThread::run 2 %d %jd %d\n", request_id, request_size, bytes_read);
- if(bytes_read != request_size)
- {
+ if( bytes_read != request_size ) {
done = 1;
continue;
}
//printf("RenderFarmServerThread::run 3\n");
- switch(request_id)
- {
- case RENDERFARM_PREFERENCES:
- send_preferences();
- break;
+ switch( request_id ) {
+ case RENDERFARM_PREFERENCES:
+ send_preferences();
+ break;
- case RENDERFARM_ASSET:
- send_asset();
- break;
+ case RENDERFARM_ASSET:
+ send_asset();
+ break;
- case RENDERFARM_EDL:
- send_edl();
- break;
+ case RENDERFARM_EDL:
+ send_edl();
+ break;
- case RENDERFARM_PACKAGE:
- send_package(buffer);
- break;
+ case RENDERFARM_PACKAGE:
+ send_package(buffer);
+ break;
- case RENDERFARM_PROGRESS:
- set_progress(buffer);
- break;
+ case RENDERFARM_PROGRESS:
+ set_progress(buffer);
+ break;
- case RENDERFARM_SET_RESULT:
- set_result(buffer);
- break;
+ case RENDERFARM_SET_RESULT:
+ set_result(buffer);
+ break;
- case RENDERFARM_SET_VMAP:
- set_video_map(buffer);
- break;
+ case RENDERFARM_SET_VMAP:
+ set_video_map(buffer);
+ break;
- case RENDERFARM_GET_RESULT:
- get_result();
- break;
+ case RENDERFARM_GET_RESULT:
+ get_result();
+ break;
- case RENDERFARM_DONE:
+ case RENDERFARM_DONE:
//printf("RenderFarmServerThread::run 10\n");
- done = 1;
- break;
+ done = 1;
+ break;
- case RENDERFARM_KEEPALIVE:
- break;
+ case RENDERFARM_KEEPALIVE:
+ break;
- default:
-// if(!fs_server->handle_request(request_id, request_size, (unsigned char*)buffer))
- {
- printf(_("RenderFarmServerThread::run: unknown request %02x\n"), request_id);
- }
- break;
+ default:
+// if( fs_server->handle_request(request_id, request_size, (unsigned char*)buffer) ) break;
+ printf(_("RenderFarmServerThread::run: unknown request %02x\n"), request_id);
+ break;
}
//printf("RenderFarmServerThread::run 10 %d %jd\n", request_id, request_size);
}
-
-// Don't let watchdog kill the entire renderfarm when a client finishes
-// normally.
- if(watchdog)
- {
//printf("RenderFarmServerThread::run 20\n");
- delete watchdog;
- watchdog = 0;
- }
+// Don't let watchdog kill the entire renderfarm when a client finishes normally.
+ delete watchdog; watchdog = 0;
// delete fs_server;
}
datagram = new char[BCTEXTLEN];
// No more packages
- if(!package)
- {
+ if( !package ) {
//printf("RenderFarmServerThread::send_package 1\n");
datagram[0] = datagram[1] = datagram[2] = datagram[3] = 0;
write_socket(datagram, 4);
server->preferences->set_rate(frames_per_second, number);
// This locks the preferences
- if(server->mwindow) server->mwindow->preferences->copy_rates_from(
+ if( server->mwindow ) server->mwindow->preferences->copy_rates_from(
server->preferences);
}
int RenderFarmServerThread::set_video_map(unsigned char *buffer)
{
- if(server->brender)
- {
+ if( server->brender ) {
server->brender->set_video_map((int64_t)(((u_int32_t)buffer[0]) << 24) |
(((u_int32_t)buffer[1]) << 16) |
(((u_int32_t)buffer[2]) << 8) |
void RenderFarmServerThread::set_result(unsigned char *buffer)
{
//printf("RenderFarmServerThread::set_result %p\n", buffer);
- if(!*server->result_return)
+ if( !*server->result_return )
*server->result_return = buffer[0];
}
-RenderFarmWatchdog::RenderFarmWatchdog(
+RenderFarmWatchdog::RenderFarmWatchdog(int timeout_secs,
RenderFarmServerThread *server,
RenderFarmClientThread *client)
: Thread(1, 0, 0)
{
+ this->timeout_usecs = timeout_secs * 1000000;
this->server = server;
this->client = client;
next_request = new Condition(0, "RenderFarmWatchdog::next_request", 0);
void RenderFarmWatchdog::run()
{
- while(!done)
- {
+ while(!done) {
next_request->lock("RenderFarmWatchdog::run");
-
- int result = request_complete->timed_lock(RENDERFARM_TIMEOUT * 1000000,
- "RenderFarmWatchdog::run");
+ int result = request_complete->timed_lock(timeout_usecs, "RenderFarmWatchdog::run");
//printf("RenderFarmWatchdog::run 1 %d\n", result);
- if(result)
- {
- if(client)
- {
+ if( result ) {
+ if( client ) {
printf("RenderFarmWatchdog::run 1 killing client pid %d\n", client->pid);
kill(client->pid, SIGKILL);
}
- else
- if(server)
- {
+ else if( server ) {
printf("RenderFarmWatchdog::run 1 killing server thread %p\n", server);
server->cancel();
unsigned char buffer[4];
class RenderFarmWatchdog : public Thread
{
public:
-// use_pid - causes it to kill the pid instead of cancel the thread
-// Used for client.
- RenderFarmWatchdog(RenderFarmServerThread *server,
- RenderFarmClientThread *client);
+ RenderFarmWatchdog(int timeout_secs,
+ RenderFarmServerThread *server, RenderFarmClientThread *client);
~RenderFarmWatchdog();
// Called at the beginning of a socket read
Condition *request_complete;
int done;
int pid;
+ int timeout_usecs;
};
TheList::reset();
int socket_fd = this->socket_fd;
-
- init_client_keepalive();
+ int watchdog_timeout = client->boot_preferences->renderfarm_watchdog_timeout;
+ if( watchdog_timeout > 0 )
+ init_client_keepalive(watchdog_timeout);
// Get command to run
int command;
}
-void RenderFarmClientThread::init_client_keepalive()
+void RenderFarmClientThread::init_client_keepalive(int timeout_secs)
{
keep_alive = new RenderFarmKeepalive(this);
keep_alive->start();
- watchdog = new RenderFarmWatchdog(0, this);
+ watchdog = new RenderFarmWatchdog(timeout_secs, 0, this);
watchdog->start();
}
enable_cancel();
sleep(5);
disable_cancel();
- if(!done)
- {
+ if( !done ) {
//printf("RenderFarmKeepalive::run 1\n");
// watchdog thread kills this if it gets stuck
client_thread->ping_server();
int read_package(int socket_fd, RenderPackage *package);
int send_completion(int socket_fd);
void ping_server();
- void init_client_keepalive();
+ void init_client_keepalive(int timeout_secs);
void main_loop(int socket_fd);
void run();
--- /dev/null
+webm libvpx-vp9
+# pass 1 of 2, you must render the 2nd pass using pass2of2...
+cin_stats_filename /tmp/cin_video_vp9_webm
+flags +pass1
+bitrate=1024k
+minrate=512k
+maxrate=1485k
+tile-columns=2
+g=240
+threads=8
+quality=good
+crf=32
+speed=4
--- /dev/null
+webm libvpx-vp9
+# Pass 2 of 2, you must first render using pass1of2...
+cin_stats_filename /tmp/cin_video_vp9_webm
+flags +pass2
+bitrate=1024k
+minrate=512k
+maxrate=1485k
+tile-columns=2
+g=240
+threads=8
+quality=good
+crf=32
+speed=4
return sublist;
}
+int BC_ListBoxItem::compare_item_text(const void *a, const void *b)
+{
+ BC_ListBoxItem *ap = *(BC_ListBoxItem**)a, *bp = *(BC_ListBoxItem**)b;
+ return strcmp(ap->text, bp->text);
+}
+
+void BC_ListBoxItem::sort_items(ArrayList<BC_ListBoxItem*> &items)
+{
+ qsort(&items[0], items.size(), sizeof(items[0]), compare_item_text);
+}
+
// Return if it's expanded
int get_expand() { return expand; }
void set_expand(int value) { expand = value; }
+// alpha sort on text
+ static void sort_items(ArrayList<BC_ListBoxItem*> &items);
private:
int initialize();
void set_in_view(int v) { in_view = v; }
+ static int compare_item_text(const void *a, const void *b);
BC_Pixmap *icon;
VFrame *icon_vframe;