int k = och * bits / 8;
if( map51_2 ) {
- double *center = data[0];
- double *front = data[och+1];
- double *back = data[och+3];
- double *subwoof = data[5];
+ double *front = data[och];
+ double *center = data[2];
+ double *subwoof = data[3];
+ double *back = data[och+4];
if( play_dither ) {
switch( bits ) {
case 8: for( int j=0; j<samples; ++j,k+=frame )
fprintf(fp,"\n");
fclose(fp);
- if( use_wide_audio ) {
- session->audio_channels = session->audio_tracks = BD_WIDE_CHANNELS;
- session->achannel_positions[0] = 90;
- session->achannel_positions[1] = 150;
- session->achannel_positions[2] = 30;
- session->achannel_positions[3] = 210;
- session->achannel_positions[4] = 330;
- session->achannel_positions[5] = 270;
- if( edl->tracks->recordable_audio_tracks() == BD_WIDE_CHANNELS )
- mwindow->remap_audio(MWindow::AUDIO_1_TO_1);
- }
- else {
- session->audio_channels = session->audio_tracks = BD_CHANNELS;
- session->achannel_positions[0] = 180;
- session->achannel_positions[1] = 0;
- if( edl->tracks->recordable_audio_tracks() == BD_WIDE_CHANNELS )
- mwindow->remap_audio(MWindow::AUDIO_5_1_TO_2);
- }
+ session->audio_channels = session->audio_tracks =
+ !use_wide_audio ? BD_CHANNELS : BD_WIDE_CHANNELS;
+ for( int i=0; i<MAX_CHANNELS; ++i )
+ session->achannel_positions[i] = default_audio_channel_position(i, session->audio_channels);
+ int audio_mapping = edl->tracks->recordable_audio_tracks() == BD_WIDE_CHANNELS &&
+ !use_wide_audio ? MWindow::AUDIO_5_1_TO_2 : MWindow::AUDIO_1_TO_1;
+ mwindow->remap_audio(audio_mapping);
double new_samplerate = session->sample_rate;
double new_framerate = session->frame_rate;
fprintf(fp, "ffmpeg -f concat -safe 0 -i <(for f in \"$1/dvd.mpg0\"*; do "
"echo \"file '$f'\"; done) -c copy -y $1/dvd.mpg\n");
}
+ else
+ fprintf(fp, "mplex -f 8 -o $1/dvd.mpg $1/dvd.m2v $1/dvd.ac3\n");
fprintf(fp,"rm -rf $1/iso\n");
fprintf(fp,"mkdir -p $1/iso\n");
fprintf(fp,"\n");
fprintf(fp,"\n");
fclose(fp);
- if( use_wide_audio ) {
- session->audio_channels = session->audio_tracks = DVD_WIDE_CHANNELS;
- session->achannel_positions[0] = 90;
- session->achannel_positions[1] = 150;
- session->achannel_positions[2] = 30;
- session->achannel_positions[3] = 210;
- session->achannel_positions[4] = 330;
- session->achannel_positions[5] = 270;
- if( edl->tracks->recordable_audio_tracks() == DVD_WIDE_CHANNELS )
- mwindow->remap_audio(MWindow::AUDIO_1_TO_1);
- }
- else {
- session->audio_channels = session->audio_tracks = DVD_CHANNELS;
- session->achannel_positions[0] = 180;
- session->achannel_positions[1] = 0;
- if( edl->tracks->recordable_audio_tracks() == DVD_WIDE_CHANNELS )
- mwindow->remap_audio(MWindow::AUDIO_5_1_TO_2);
- }
+ session->audio_channels = session->audio_tracks =
+ !use_wide_audio ? DVD_CHANNELS : DVD_WIDE_CHANNELS;
+ for( int i=0; i<MAX_CHANNELS; ++i )
+ session->achannel_positions[i] = default_audio_channel_position(i, session->audio_channels);
+ int audio_mapping = edl->tracks->recordable_audio_tracks() == DVD_WIDE_CHANNELS &&
+ !use_wide_audio ? MWindow::AUDIO_5_1_TO_2 : MWindow::AUDIO_1_TO_1;
+ mwindow->remap_audio(audio_mapping);
double new_samplerate = session->sample_rate;
double new_framerate = session->frame_rate;
*result = brender_start;
}
-
int EDLSession::load_defaults(BC_Hash *defaults)
{
char string[BCTEXTLEN];
+ audio_channels = defaults->get("ACHANNELS", audio_channels);
+ audio_tracks = defaults->get("ATRACKS", audio_tracks);
// Default channel positions
- for(int i = 0; i < MAXCHANNELS; i++)
- {
+ for( int i=0; i<MAXCHANNELS; ++i ) {
sprintf(string, "ACHANNEL_ANGLE_%d", i);
- int default_position = i * 30;
-
- if(i == 0) default_position = 180;
- else
- if(i == 1) default_position = 0;
- else
- if(default_position == 90) default_position = 300;
- else
- if(default_position == 0) default_position = 330;
-
- achannel_positions[i] = defaults->get(string, default_position);
+ achannel_positions[i] = defaults->get(string,
+ default_audio_channel_position(i, audio_channels));
}
aconfig_in->load_defaults(defaults);
assetlist_format = defaults->get("ASSETLIST_FORMAT", ASSETS_ICONS);
sprintf(string, "ASSET_COLUMN%d", i);
asset_columns[i] = defaults->get(string, 100);
}
- audio_channels = defaults->get("ACHANNELS", audio_channels);
- audio_tracks = defaults->get("ATRACKS", audio_tracks);
auto_conf->load_defaults(defaults);
autos_follow_edits = defaults->get("AUTOS_FOLLOW_EDITS", 1);
brender_start = defaults->get("BRENDER_START", brender_start);
// load channels setting
if(append_mode) return 0;
audio_channels = file->tag.get_property("CHANNELS", (int64_t)audio_channels);
-
-
for(int i = 0; i < audio_channels; i++)
{
sprintf(string, "ACHANNEL_ANGLE_%d", i);
#ifndef MAXCHANNELS
#define MAXCHANNELS 32
#define MAX_CHANNELS 32
+
+static inline int default_audio_channel_position(int channel, int total_channels)
+{
+ int default_position = 0;
+ switch( total_channels ) {
+ case 0: break;
+ case 1: switch( channel ) {
+ case 0: default_position = 90; break;
+ }
+ break;
+ case 2: switch( channel ) {
+ case 0: default_position = 180; break;
+ case 1: default_position = 0; break;
+ }
+ break;
+ case 6: switch( channel ) {
+ case 0: default_position = 150; break;
+ case 1: default_position = 30; break;
+ case 2: default_position = 90; break;
+ case 3: default_position = 270; break;
+ case 4: default_position = 210; break;
+ case 5: default_position = 330; break;
+ }
+ break;
+ default:
+ default_position = 180 - (360 * channel / total_channels);
+ while( default_position < 0 ) default_position += 360;
+ break;
+ }
+ return default_position;
+}
+
#endif
//printf("MWindow::restart_brender 1\n");
if( !brender_active || !preferences->use_brender ) return;
if( !brender ) return;
- int locked = gui->get_window_lock();
- if( locked ) gui->unlock_window();
brender->restart(edl);
- if( locked ) gui->lock_window("MWindow::restart_brender");
}
void MWindow::stop_brender()
{
if( !brender ) return;
- int locked = gui->get_window_lock();
- if( locked ) gui->unlock_window();
brender->stop();
- if( locked ) gui->lock_window("MWindow::stop_brender");
}
int MWindow::brender_available(int position)
if( channels < 1 ) channels = 1;
if( channels > 6 ) channels = 6;
session->audio_tracks = session->audio_channels = channels;
- switch( channels ) {
- case 6:
- session->achannel_positions[0] = 90;
- session->achannel_positions[1] = 150;
- session->achannel_positions[2] = 30;
- session->achannel_positions[3] = 210;
- session->achannel_positions[4] = 330;
- session->achannel_positions[5] = 270;
- break;
- case 2:
- session->achannel_positions[0] = 180;
- session->achannel_positions[1] = 0;
- break;
- case 1:
- session->achannel_positions[1] = 90;
- break;
- default: {
- if( !channels ) break;
- double t = 0, dt = 360./channels;
- for( int i=channels; --i>=0; t+=dt )
- session->achannel_positions[i] = int(t+0.5);
- break; }
- }
+
+ int *achannel_positions = preferences->channel_positions[session->audio_channels-1];
+ memcpy(&session->achannel_positions, achannel_positions, sizeof(session->achannel_positions));
remap_audio(MWindow::AUDIO_1_TO_1);
if( delete_tracks ) {
if( pattern == MWindow::AUDIO_5_1_TO_2 ) {
switch( current_track ) {
case 0:
- pan_auto->values[0] = 0.5;
- pan_auto->values[1] = 0.5;
- break;
- case 1:
+ case 4:
pan_auto->values[0] = 1;
break;
- case 2:
+ case 1:
+ case 5:
pan_auto->values[1] = 1;
break;
+ case 2:
case 3:
- pan_auto->values[0] = 1;
- break;
- case 4:
- pan_auto->values[1] = 1;
- break;
- case 5:
pan_auto->values[0] = 0.5;
pan_auto->values[1] = 0.5;
break;
mwindow->reset_caches();
memcpy(new_edl->session->achannel_positions,
- &mwindow->preferences->channel_positions[
- MAXCHANNELS * (new_edl->session->audio_channels - 1)],
- sizeof(int) * MAXCHANNELS);
+ &mwindow->preferences->channel_positions[new_edl->session->audio_channels - 1],
+ sizeof(new_edl->session->achannel_positions));
new_edl->session->boundaries();
new_edl->create_default_tracks();
#include "filesystem.h"
#include "guicast.h"
#include "indexfile.h"
+#include "maxchannels.h"
#include "mutex.h"
#include "preferences.h"
#include "probeprefs.h"
android_port = 23432;
strcpy(android_pin, "cinelerra");
- for(int i = 0; i < MAXCHANNELS; i++)
- {
- for(int j = 0; j < i + 1; j++)
- {
- int position = 180 - (360 * j / (i + 1));
- while(position < 0) position += 360;
- channel_positions[i * MAXCHANNELS + j] = position;
- }
+ memset(channel_positions, 0, sizeof(channel_positions));
+ int channels = 0;
+ while( channels < MAXCHANNELS ) {
+ int *positions = channel_positions[channels++];
+ for( int i=0; i<channels; ++i )
+ positions[i] = default_audio_channel_position(i, channels);
}
}
strcpy(snapshot_path, "/tmp");
defaults->get("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 * MAXCHANNELS],
- i + 1);
-
+ print_channels(string2, &channel_positions[i][0], i+1);
defaults->get(string, string2);
-
- scan_channels(string2,
- &channel_positions[i * MAXCHANNELS],
- i + 1);
+ scan_channels(string2, &channel_positions[i][0], i+1);
}
-
- brender_asset->load_defaults(defaults,
- "BRENDER_",
- 1,
- 1,
- 1,
- 0,
- 0);
-
-
+ brender_asset->load_defaults(defaults, "BRENDER_", 1, 1, 1, 0, 0);
project_smp = defaults->get("PROJECT_SMP", project_smp);
force_uniprocessor = defaults->get("FORCE_UNIPROCESSOR", force_uniprocessor);
{
char string2[BCTEXTLEN];
sprintf(string, "CHANNEL_POSITIONS%d", i);
- print_channels(string2, &channel_positions[i * MAXCHANNELS], i + 1);
+ print_channels(string2, &channel_positions[i][0], i + 1);
defaults->update(string, string2);
}
int yuv_color_range;
// Default positions for channels
- int channel_positions[MAXCHANNELS * MAXCHANNELS];
+ int channel_positions[MAXCHANNELS][MAXCHANNELS];
Asset *brender_asset;
int use_brender;
// If non interactive, print progress out
if(!render->progress)
- {
- int64_t current_eta = render->progress_timer->get_scaled_difference(1000);
- if(current_eta - render->last_eta > 1000)
- {
- double eta = 0;
-
-
- if(render->total_rendered)
- {
- eta = current_eta /
- 1000 *
- render->progress_max /
- render->total_rendered -
- current_eta /
- 1000;
- }
-
- char string[BCTEXTLEN];
- Units::totext(string,
- eta,
- TIME_HMS2);
-
- printf("\r%d%% %s: %s ",
- (int)(100 * (float)render->total_rendered / render->progress_max),
- _("ETA"), string);
- fflush(stdout);
- render->last_eta = current_eta;
- }
- }
+ render->show_progress();
render->counter_lock->unlock();
}
}
-
-
int Render::check_asset(EDL *edl, Asset &asset)
{
if(asset.video_data &&
progress = 0;
}
+void Render::show_progress()
+{
+ int64_t current_eta = progress_timer->get_scaled_difference(1000);
+ if (current_eta - last_eta < 1000 ) return;
+ double eta = !total_rendered ? 0 :
+ current_eta / 1000. * (progress_max / (double)total_rendered - 1.);
+ char string[BCTEXTLEN]; Units::totext(string, eta, TIME_HMS2);
+ printf("\r%d%% %s: %s ",
+ (int)(100 * (float)total_rendered / progress_max), _("ETA"), string);
+ fflush(stdout);
+ last_eta = current_eta;
+}
+
void Render::start_render()
- if(strategy == SINGLE_PASS_FARM || strategy == FILE_PER_LABEL_FARM)
- {
+ if( strategy == SINGLE_PASS_FARM ||
+ strategy == FILE_PER_LABEL_FARM ) {
+ if( !render->progress ) {
+ while( farm_server->active_clients() > 0 ) {
+ sleep(1);
+ render->show_progress();
+ }
+ }
farm_server->wait_clients();
render->result |= render->packages->packages_are_done();
}
void start_progress();
void stop_progress();
+ void show_progress();
// Procedure the run function should use.
int mode;
return 0;
}
+int RenderFarmServer::active_clients()
+{
+ int n = 0;
+ for( int i=0; i<clients.size(); ++i )
+ if( clients[i]->running() ) ++n;
+ return n;
+}
// Waits for requests from every client.
// Joins when the client is finished.
int start_clients();
// The render farm must wait for all the clients to finish.
int wait_clients();
+// number of running clients
+ int active_clients();
// Likewise the render farm must check the internal render loop before
// dispatching the next job and whenever a client queries for errors.
mwindow->undo->update_undo_before();
- memcpy(&mwindow->preferences->channel_positions[MAXCHANNELS * (new_channels - 1)],
+ memcpy(&mwindow->preferences->channel_positions[new_channels - 1],
new_settings->session->achannel_positions,
- sizeof(int) * MAXCHANNELS);
+ sizeof(mwindow->preferences->channel_positions[new_channels - 1]));
mwindow->edl->copy_session(new_settings, 1);
window->channels->update((int64_t)new_settings->session->audio_channels);
window->frame_rate->update((float)new_settings->session->frame_rate);
- switch( new_settings->session->audio_channels ) {
- case 6:
- new_settings->session->achannel_positions[0] = 90;
- new_settings->session->achannel_positions[1] = 150;
- new_settings->session->achannel_positions[2] = 30;
- new_settings->session->achannel_positions[3] = 210;
- new_settings->session->achannel_positions[4] = 330;
- new_settings->session->achannel_positions[5] = 270;
- break;
- case 2:
- new_settings->session->achannel_positions[0] = 180;
- new_settings->session->achannel_positions[1] = 0;
- break;
- }
auto_aspect = 0;
window->auto_aspect->update(0);
- presets = new SetFormatPresets(mwindow,
- this,
- x,
- y);
+ presets = new SetFormatPresets(mwindow, this, x, y);
presets->create_objects();
- x = presets->x;
- y = presets->y;
-
+ x = presets->x; // y = presets->y;
y = mwindow->theme->setformat_y2;
- add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
- y,
- _("Audio"),
- LARGEFONT));
+ add_subwindow(new BC_Title(mwindow->theme->setformat_x1, y,
+ _("Audio"), LARGEFONT));
y = mwindow->theme->setformat_y3;
- add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
- y,
+ add_subwindow(new BC_Title(mwindow->theme->setformat_x1, y,
_("Samplerate:")));
add_subwindow(sample_rate = new SetSampleRateTextBox(thread,
mwindow->theme->setformat_x2,
y));
- add_subwindow(new SampleRatePulldown(mwindow,
- sample_rate,
- mwindow->theme->setformat_x2 + sample_rate->get_w(),
- y));
+ add_subwindow(new SampleRatePulldown(mwindow, sample_rate,
+ mwindow->theme->setformat_x2 + sample_rate->get_w(), y));
y += mwindow->theme->setformat_margin;
- add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
- y,
+ add_subwindow(new BC_Title(mwindow->theme->setformat_x1, y,
_("Channels:")));
add_subwindow(channels = new SetChannelsTextBox(thread,
- mwindow->theme->setformat_x2,
- y));
- add_subwindow(new BC_ITumbler(channels,
- 1,
- MAXCHANNELS,
- mwindow->theme->setformat_x2 + channels->get_w(),
- y));
+ mwindow->theme->setformat_x2, y));
+ add_subwindow(new BC_ITumbler(channels, 1, MAXCHANNELS,
+ mwindow->theme->setformat_x2 + channels->get_w(), y));
y += mwindow->theme->setformat_margin;
- add_subwindow(new BC_Title(mwindow->theme->setformat_x1,
- y,
+ add_subwindow(new BC_Title(mwindow->theme->setformat_x1, y,
_("Channel positions:")));
y += mwindow->theme->setformat_margin;
+ add_subwindow(new SetChannelsReset(thread,
+ mwindow->theme->setformat_x1, y,
+ _("Reset")));
add_subwindow(canvas = new SetChannelsCanvas(mwindow,
thread,
mwindow->theme->setformat_channels_x,
-
-
-
-
-
-
y = mwindow->theme->setformat_y2;
add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
y,
-
-
-
-
-
-
-
-
-
-
-
-
SetSampleRateTextBox::SetSampleRateTextBox(SetFormatThread *thread, int x, int y)
: BC_TextBox(x, y, 100, 1, (int64_t)thread->new_settings->session->sample_rate)
{
if(new_channels > 0)
{
memcpy(thread->new_settings->session->achannel_positions,
- &thread->mwindow->preferences->channel_positions[MAXCHANNELS * (new_channels - 1)],
- sizeof(int) * MAXCHANNELS);
+ &thread->mwindow->preferences->channel_positions[new_channels - 1],
+ sizeof(thread->new_settings->session->achannel_positions));
}
return 1;
}
+SetChannelsReset::SetChannelsReset(SetFormatThread *thread, int x, int y, const char *text)
+ : BC_GenericButton(x, y, text)
+{
+ this->thread = thread;
+}
+
+int SetChannelsReset::handle_event()
+{
+ int channels = thread->new_settings->session->audio_channels;
+ int *achannels = thread->new_settings->session->achannel_positions;
+ for( int i=0; i<MAX_CHANNELS; ++i )
+ achannels[i] = default_audio_channel_position(i, channels);
+ thread->window->canvas->draw();
+ return 1;
+}
SetChannelsCanvas::SetChannelsCanvas(MWindow *mwindow,
- SetFormatThread *thread,
- int x,
- int y,
- int w,
- int h)
- : BC_SubWindow(x,
- y,
- w,
- h)
+ SetFormatThread *thread, int x, int y, int w, int h)
+ : BC_SubWindow(x, y, w, h)
{
this->thread = thread;
this->mwindow = mwindow;
{
thread->new_settings->session->achannel_positions[active_channel] = new_d;
int new_channels = thread->new_settings->session->audio_channels;
- memcpy(&thread->mwindow->preferences->channel_positions[MAXCHANNELS * (new_channels - 1)],
+ memcpy(&thread->mwindow->preferences->channel_positions[new_channels - 1],
thread->new_settings->session->achannel_positions,
- sizeof(int) * MAXCHANNELS);
+ sizeof(thread->mwindow->preferences->channel_positions[new_channels - 1]));
draw(thread->new_settings->session->achannel_positions[active_channel]);
}
return 1;
}
-
-
-
-
-
-
-
SetFrameRateTextBox::SetFrameRateTextBox(SetFormatThread *thread, int x, int y)
: BC_TextBox(x, y, 100, 1, (float)thread->new_settings->session->frame_rate)
{
}
-
ScaleAspectAuto::ScaleAspectAuto(int x, int y, SetFormatThread *thread)
: BC_CheckBox(x, y, thread->auto_aspect, _("Auto"))
{
}
-
-
-
-
SetFormatApply::SetFormatApply(int x, int y, SetFormatThread *thread)
: BC_GenericButton(x, y, _("Apply"))
{
}
-
-
-
-
-
-
-
-
-
-
-
FormatSwapExtents::FormatSwapExtents(MWindow *mwindow,
SetFormatThread *thread,
SetFormatWindow *gui,
return 1;
}
-
-
-
MWindow *mwindow;
};
+class SetChannelsReset : public BC_GenericButton
+{
+public:
+ SetChannelsReset(SetFormatThread *thread, int x, int y, const char *text);
+ int handle_event();
+
+ SetFormatThread *thread;
+};
class SetChannelsCanvas : public BC_SubWindow
{
// if( a.ctx->codec_id != b.ctx->codec_id ) { printf("codec mismatch\n"); return 1;}
if( a.width != b.width ) { printf("width mismatch\n"); return 1;}
if( a.height != b.height ) { printf("height mismatch\n"); return 1;}
- if( a.frame_rate != b.frame_rate ) { printf("framerate mismatch\n"); return 1;}
+// if( a.frame_rate != b.frame_rate ) { printf("framerate mismatch\n"); return 1;}
// if( a.pix_fmt != b.pix_fmt ) { printf("format mismatch\n"); return 1;}
signal(SIGINT,sigint);
TheLock TheLocker::the_lock;
TheList TheList::the_list;
-TheChk TheChk::the_chk;
int lock_item::table_id = 0;
static void dbg_add(pthread_t tid, pthread_t owner, const char *nm);
static void dbg_del(pthread_t tid);
static void reset() { the_list.remove_all_objects(); TheLocker::reset(); }
- TheList() {}
- ~TheList() { reset(); }
-};
-
-class TheChk {
-public:
- static TheChk the_chk;
-
- TheChk() {}
- ~TheChk() {
- int i = TheList::the_list.size();
+ void check() {
+ int i = the_list.size();
if( !i ) return;
printf("unjoined tids / owner %d\n", i);
while( --i >= 0 ) printf(" %016lx / %016lx %s\n",
- (unsigned long)TheList::the_list[i]->tid,
- (unsigned long)TheList::the_list[i]->owner,
- TheList::the_list[i]->name);
+ (unsigned long)the_list[i]->tid,
+ (unsigned long)the_list[i]->owner,
+ the_list[i]->name);
}
+ TheList() {}
+ ~TheList() { check(); reset(); }
};
#endif
this->grab_active = 0;
return 1;
}
+int BC_WindowBase::grab_event_count()
+{
+ int result = 0;
+#ifndef SINGLE_THREAD
+ result = grab_active->get_event_count();
+#endif
+ return result;
+}
int BC_WindowBase::grab_buttons()
{
XSync(top_level->display, False);
// Reroute toplevel events
int grab(BC_WindowBase *window);
int ungrab(BC_WindowBase *window);
+ int grab_event_count();
// Grab button events
int grab_buttons();
void ungrab_buttons();
points->set_point(hot_point, PT_X, v);
}
points->update_list();
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
return 1;
}
int CriKeyPointY::handle_event()
points->set_point(hot_point, PT_Y, v);
}
points->update_list();
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
return 1;
}
this->mode = mode;
set_text(draw_modes[mode]);
gui->plugin->config.draw_mode = mode;
- if( send ) gui->plugin->send_configure_change();
+ if( send ) gui->send_configure_change();
}
CriKeyColorButton::CriKeyColorButton(CriKeyWindow *gui, int x, int y)
gui->lock_window("CriKeyColorPicker::handle_done_event");
gui->update_color(color);
gui->plugin->config.color = color;
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
gui->unlock_window();
}
gui->update_color(this->color = color);
gui->flush();
gui->plugin->config.color = color;
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
gui->unlock_window();
return 1;
}
this->drag = 0; this->dragging = 0;
this->last_x = 0; this->last_y = 0;
this->points = 0; this->cur_point = 0;
+ this->pending_config = 0;
}
CriKeyWindow::~CriKeyWindow()
show_window(1);
}
+void CriKeyWindow::send_configure_change()
+{
+ pending_config = 0;
+ plugin->send_configure_change();
+}
+int CriKeyWindow::check_configure_change(int ret)
+{
+ if( pending_config && !grab_event_count() )
+ send_configure_change();
+ return ret;
+}
+
int CriKeyWindow::grab_event(XEvent *event)
{
switch( event->type ) {
case ButtonPress: break;
case ButtonRelease: break;
case MotionNotify: break;
- default: return 0;
+ default:
+ return check_configure_change(0);
}
MWindow *mwindow = plugin->server->mwindow;
cy -= mwindow->theme->ccanvas_y;
if( !dragging ) {
- if( cx < 0 || cx >= mwindow->theme->ccanvas_w ) return 0;
- if( cy < 0 || cy >= mwindow->theme->ccanvas_h ) return 0;
+ if( cx < 0 || cx >= mwindow->theme->ccanvas_w ||
+ cy < 0 || cy >= mwindow->theme->ccanvas_h )
+ return check_configure_change(0);
}
switch( event->type ) {
case ButtonPress:
- if( dragging ) return 0;
+ if( dragging ) return check_configure_change(0);
dragging = event->xbutton.state & ShiftMask ? -1 : 1;
break;
case ButtonRelease:
- if( !dragging ) return 0;
+ if( !dragging ) return check_configure_change(0);
dragging = 0;
return 1;
case MotionNotify:
- if( !dragging ) return 0;
+ if( !dragging ) return check_configure_change(0);
break;
default:
- return 0;
+ return check_configure_change(0);
}
float cursor_x = cx, cursor_y = cy;
}
last_x = output_x; last_y = output_y;
- plugin->send_configure_change();
+ if( !grab_event_count() )
+ send_configure_change();
+ else
+ pending_config = 1;
return 1;
}
gui->point_y->update(y_text);
plugin->config.selected = hot_point;
update(hot_point);
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
return 1;
}
{
float v = get_value();
gui->plugin->config.threshold = v;
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
return 1;
}
gui->plugin->config.selected = hot_point;
gui->points->update(hot_point);
}
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
return 1;
}
gui->plugin->config.selected = hot_point;
gui->points->update(hot_point);
}
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
return 1;
}
else
gui->ungrab(cwindow_gui);
gui->plugin->config.drag = value;
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
return 1;
}
{
int k = plugin->new_point();
gui->points->update(k);
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
return 1;
}
if( hot_point >= n && hot_point > 0 ) --hot_point;
gui->plugin->config.selected = hot_point;
gui->points->update(hot_point);
- gui->plugin->send_configure_change();
+ gui->send_configure_change();
}
return 1;
}
void start_color_thread();
int grab_event(XEvent *event);
void done_event(int result);
+ int check_configure_change(int ret);
+ void send_configure_change();
CriKey *plugin;
CriKeyThreshold *threshold;
CriKeyPointUp *point_up;
CriKeyPointDn *point_dn;
CriKeyCurPoint *cur_point;
- int dragging;
+ int dragging, pending_config;
float last_x, last_y;
CriKeyDrag *drag;
CriKeyPoints *points;
background = 0;
background_path = 0;
loop_playback = 0;
+ pending_config = 0;
}
void TitleWindow::done_event(int result)
x1 += motion_title->get_w()+margin;
motion = new TitleMotion(client, this, x1, y);
motion->create_objects();
- add_tool(loop = new TitleLoop(client, x, y1));
+ add_tool(loop = new TitleLoop(client, this, x, y1));
x = margin; y = y1 + loop->get_h()+20;
add_tool(dropshadow_title = new BC_Title(x, y, _("Drop shadow:")));
x += stroker->get_w() + margin;
#endif
y += outline_title->get_h() + margin;
- add_tool(timecode = new TitleTimecode(client, x1=x, y));
+ add_tool(timecode = new TitleTimecode(client, this, x1=x, y));
x += timecode->get_w() + margin;
- add_tool(timecode_format = new TitleTimecodeFormat(client, x, y,
+ add_tool(timecode_format = new TitleTimecodeFormat(client, this, x, y,
Units::print_time_format(client->config.timecode_format, string)));
timecode_format->create_objects();
y += timecode_format->get_h() + margin;
client->server->mwindow->theme, this, background_path,
x, y, "", _("background media"), _("Select background media path")));
x += background_browse->get_w() + 3*margin;
- add_tool(loop_playback = new TitleLoopPlayback(client, x, y));
+ add_tool(loop_playback = new TitleLoopPlayback(client, this, x, y));
y += loop_playback->get_h() + 10;
x = 10;
return 1;
}
+void TitleWindow::send_configure_change()
+{
+ pending_config = 0;
+ client->send_configure_change();
+}
+int TitleWindow::check_configure_change(int ret)
+{
+ if( pending_config && !grab_event_count() )
+ send_configure_change();
+ return ret;
+}
+
int TitleWindow::grab_event(XEvent *event)
{
switch( event->type ) {
case ButtonPress: break;
case ButtonRelease: break;
case MotionNotify: break;
- default: return 0;
+ default:
+ return check_configure_change(0);
}
MWindow *mwindow = client->server->mwindow;
cy -= mwindow->theme->ccanvas_y;
if( !dragging ) {
- if( cx < 0 || cx >= mwindow->theme->ccanvas_w ) return 0;
- if( cy < 0 || cy >= mwindow->theme->ccanvas_h ) return 0;
+ if( cx < 0 || cx >= mwindow->theme->ccanvas_w ||
+ cy < 0 || cy >= mwindow->theme->ccanvas_h )
+ return check_configure_change(0);
}
switch( event->type ) {
if( !dragging ) break;
return 1;
case ButtonRelease:
- if( !dragging ) return 0;
+ if( !dragging ) return check_configure_change(0);
dragging = 0;
return 1;
case MotionNotify:
- if( !dragging ) return 0;
+ if( !dragging ) return check_configure_change(0);
break;
default:
- return 0;
+ return check_configure_change(0);
}
float cursor_x = cx, cursor_y = cy;
this->title_y->update((int64_t)(client->config.title_y += dy));
}
}
- client->send_configure_change();
+ if( !grab_event_count() )
+ send_configure_change();
+ else
+ pending_config = 1;
return 1;
}
font->update(fonts.values[current_font]->get_text());
strcpy(client->config.font, fonts.values[current_font]->get_text());
check_style(client->config.font,1);
- client->send_configure_change();
+ send_configure_change();
}
void TitleWindow::next_font()
font->update(fonts.values[current_font]->get_text());
strcpy(client->config.font, fonts.values[current_font]->get_text());
check_style(client->config.font,1);
- client->send_configure_change();
+ send_configure_change();
}
int TitleWindow::insert_ibeam(const char *txt, int ofs)
ibeam = client->config.wlen;
text->wset_selection(-1, -1, ibeam);
text->update(client->config.wtext);
- client->send_configure_change();
+ send_configure_change();
return 1;
}
client->config.size = atoi(window->sizes.get(current_index)->get_text());
window->size->update(client->config.size);
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
client->config.size = atoi(window->sizes.get(current_index)->get_text());
window->size->update(client->config.size);
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
client->config.style =
(client->config.style & ~BC_FONT_BOLD) |
(get_value() ? BC_FONT_BOLD : 0);
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
client->config.style =
(client->config.style & ~BC_FONT_ITALIC) |
(get_value() ? BC_FONT_ITALIC : 0);
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
{
client->config.size = atol(get_text());
//printf("TitleSize::handle_event 1 %s\n", get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
void TitleSize::update(int size)
int TitlePitch::handle_event()
{
*value = atol(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleMotion::handle_event()
{
client->config.motion_strategy = client->text_to_motion(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
-TitleLoop::TitleLoop(TitleMain *client, int x, int y)
+TitleLoop::TitleLoop(TitleMain *client, TitleWindow *window, int x, int y)
: BC_CheckBox(x, y, client->config.loop, _("Loop"))
{
this->client = client;
+ this->window = window;
}
int TitleLoop::handle_event()
{
client->config.loop = get_value();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
-TitleTimecode::TitleTimecode(TitleMain *client, int x, int y)
+TitleTimecode::TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y)
: BC_CheckBox(x, y, client->config.timecode, _("Stamp timecode"))
{
this->client = client;
+ this->window = window;
}
int TitleTimecode::handle_event()
{
return 1;
}
-TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, int x, int y, const char *text)
+TitleTimecodeFormat::TitleTimecodeFormat(TitleMain *client, TitleWindow *window,
+ int x, int y, const char *text)
: BC_PopupMenu(x, y, 100, text, 1)
{
this->client = client;
+ this->window = window;
}
int TitleTimecodeFormat::handle_event()
{
client->config.timecode_format = Units::text_to_format(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleFade::handle_event()
{
*value = atof(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
{
strcpy(client->config.font, get_text());
window->check_style(client->config.font, 1);
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
client->config.wtext[len-1] = 0;
client->config.wlen = wcslen(client->config.wtext);
window->update_stats();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
TitleTextChars::TitleTextChars(int x, int y, int w)
int TitleDropShadow::handle_event()
{
client->config.dropshadow = atol(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleOutline::handle_event()
{
client->config.outline_size = atol(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
client->config.style |= BC_FONT_OUTLINE;
else
client->config.style &= ~BC_FONT_OUTLINE;
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleX::handle_event()
{
client->config.title_x = atol(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleY::handle_event()
{
client->config.title_y = atol(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleW::handle_event()
{
client->config.title_w = atol(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleH::handle_event()
{
client->config.title_h = atol(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
(float)0, (float)1000, x, y, 100)
{
this->client = client;
+ this->window = window;
set_precision(2);
set_increment(10);
}
int TitleSpeed::handle_event()
{
client->config.pixels_per_second = atof(get_text());
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
{
client->config.hjustification = JUSTIFY_LEFT;
window->update_justification();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
{
client->config.hjustification = JUSTIFY_CENTER;
window->update_justification();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
{
client->config.hjustification = JUSTIFY_RIGHT;
window->update_justification();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
{
client->config.vjustification = JUSTIFY_TOP;
window->update_justification();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
{
client->config.vjustification = JUSTIFY_MID;
window->update_justification();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
{
client->config.vjustification = JUSTIFY_BOTTOM;
window->update_justification();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
window->flush();
window->unlock_window();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
else
window->ungrab(cwindow_gui);
client->config.drag = value;
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleBackground::handle_event()
{
client->config.background = get_value();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
int TitleBackgroundPath::handle_event()
{
strncpy(client->config.background_path, get_text(), sizeof(client->config.background_path));
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
-TitleLoopPlayback::TitleLoopPlayback(TitleMain *client, int x, int y)
+TitleLoopPlayback::TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y)
: BC_CheckBox(x, y, client->config.loop_playback, _("Loop playback"))
{
this->client = client;
+ this->window = window;
}
int TitleLoopPlayback::handle_event()
{
client->config.loop_playback = get_value();
- client->send_configure_change();
+ window->send_configure_change();
return 1;
}
void check_style(const char *font_name, int update);
int insert_ibeam(const char *txt, int ofs=0);
void done_event(int result);
+ void send_configure_change();
+ int check_configure_change(int ret);
TitleMain *client;
int color_x, color_y;
int outline_color_x, outline_color_y;
int drag_dx, drag_dy, dragging;
- int cur_ibeam;
+ int cur_ibeam, pending_config;
BC_Title *size_title;
TitleSize *size;
class TitleLoop : public BC_CheckBox
{
public:
- TitleLoop(TitleMain *client, int x, int y);
+ TitleLoop(TitleMain *client, TitleWindow *window, int x, int y);
int handle_event();
TitleMain *client;
TitleWindow *window;
class TitleLinePitch : public BC_CheckBox
{
public:
- TitleLinePitch(TitleMain *client, int x, int y);
+ TitleLinePitch(TitleMain *client, TitleWindow *window, int x, int y);
int handle_event();
TitleMain *client;
TitleWindow *window;
class TitleTimecode : public BC_CheckBox
{
public:
- TitleTimecode(TitleMain *client, int x, int y);
+ TitleTimecode(TitleMain *client, TitleWindow *window, int x, int y);
int handle_event();
TitleMain *client;
+ TitleWindow *window;
};
class TitleTimecodeFormat : public BC_PopupMenu
{
public:
- TitleTimecodeFormat(TitleMain *client, int x, int y, const char *text);
+ TitleTimecodeFormat(TitleMain *client, TitleWindow *window, int x, int y, const char *text);
void create_objects();
int update(int timecode_format);
int handle_event();
TitleMain *client;
+ TitleWindow *window;
};
class TitleFade : public BC_TextBox
TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y);
int handle_event();
TitleMain *client;
+ TitleWindow *window;
};
class TitleLeft : public BC_Radial
class TitleLoopPlayback : public BC_CheckBox
{
public:
- TitleLoopPlayback(TitleMain *client, int x, int y);
+ TitleLoopPlayback(TitleMain *client, TitleWindow *window, int x, int y);
int handle_event();
TitleMain *client;
TitleWindow *window;
esound.cfg_params= --enable-shared=no --with-pic
esound.mak_vars+= CFLAGS=""
esound.ldflags=" -lm -lstdc++"
-faac.cfg_params= --enable-shared=no --without-mp4v2
-faad2.cfg_params= --enable-shared=no
#fdk.cfg_vars= ./autogen.sh ; CFLAGS+=" -Wno-narrowing" CXXFLAGS+=" -Wno-narrowing"
fdk.cfg_params= --enable-shared=no
fdk.mak_params= ; for f in $(call bld_path,fdk,/lib*/include); do ln -s . $$$$f/fdk-aac; done
libuuid.cfg_params?=--enable-shared=no
libvorbis.cfg_params?= --disable-oggtest --enable-shared=no
openjpeg.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
-openjpeg.cfg_params?= -DBUILD_SHARED_LIBS:BOOL=OFF
openjpeg.cfg_vars?=$(call cmake_config,.)
openjpeg.mak_params?= ; cd $(call bld_path,openjpeg,src/lib/openjp2); ln -sf . openjpeg-2.1
opencv.cfg_vars?=$(call cmake_config,.)
$(call rules,$(call std-build,audiofile))
$(call rules,$(call std-build,encore))
$(call rules,$(call std-build,esound,audiofile))
-$(call rules,$(call std-build,faac))
-$(call rules,$(call std-build,faad2))
$(call rules,$(call std-build,fdk))
-$(call rules,$(call std-build,ffmpeg, faad2 faac fdk twolame lame openjpeg opus libtheora x264 x265 libvpx))
+$(call rules,$(call std-build,ffmpeg, fdk twolame lame openjpeg opus libtheora x264 x265 libvpx))
$(call rules,$(call std-build,fftw))
$(call rules,$(call std-build,flac,libogg))
$(call rules,$(call std-build,giflib))