audio chan pos rework, batchrender deadlock, titler/crikey grab_event tweak, thread...
authorGood Guy <[email protected]>
Sun, 14 Jan 2018 21:45:33 +0000 (14:45 -0700)
committerGood Guy <[email protected]>
Sun, 14 Jan 2018 21:45:33 +0000 (14:45 -0700)
26 files changed:
cinelerra-5.1/cinelerra/audioodevice.C
cinelerra-5.1/cinelerra/bdcreate.C
cinelerra-5.1/cinelerra/dvdcreate.C
cinelerra-5.1/cinelerra/edlsession.C
cinelerra-5.1/cinelerra/maxchannels.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindowedit.C
cinelerra-5.1/cinelerra/new.C
cinelerra-5.1/cinelerra/preferences.C
cinelerra-5.1/cinelerra/preferences.h
cinelerra-5.1/cinelerra/render.C
cinelerra-5.1/cinelerra/render.h
cinelerra-5.1/cinelerra/renderfarm.C
cinelerra-5.1/cinelerra/renderfarm.h
cinelerra-5.1/cinelerra/setformat.C
cinelerra-5.1/cinelerra/setformat.h
cinelerra-5.1/cinelerra/ydiff.C
cinelerra-5.1/guicast/bctrace.C
cinelerra-5.1/guicast/bctrace.h
cinelerra-5.1/guicast/bcwindowbase.C
cinelerra-5.1/guicast/bcwindowbase.h
cinelerra-5.1/plugins/crikey/crikeywindow.C
cinelerra-5.1/plugins/crikey/crikeywindow.h
cinelerra-5.1/plugins/titler/titlerwindow.C
cinelerra-5.1/plugins/titler/titlerwindow.h
cinelerra-5.1/thirdparty/Makefile

index 32be129670ee468ad7ae71408b4ba94ef667e7d8..2beb4c8c69de58570712671ca5afab572c782e92 100644 (file)
@@ -154,10 +154,10 @@ int AudioDevice::arm_buffer(int buffer_num, double **data, int channels,
                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 )
index f791ed662bebd5e297ff37b3d068716b67f4c136..48c27f99957f995072b6a498ec7c59f8b8abaf09 100644 (file)
@@ -242,24 +242,13 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs, const char
        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;
index 46990386f35bc7a697dff0bfad6e52e32a5a5916..89072ef02faa14382d126cf47bfd5d2d0edbfec6 100644 (file)
@@ -194,6 +194,8 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs, const ch
                        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");
@@ -248,24 +250,13 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs, const ch
        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;
index d4c6df80aa43a408b0cf09036321eed29be1044a..69ac0f73032561ed44056fa72fd60636cedb5412 100644 (file)
@@ -194,25 +194,16 @@ void EDLSession::equivalent_output(EDLSession *session, double *result)
                *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);
@@ -223,8 +214,6 @@ int EDLSession::load_defaults(BC_Hash *defaults)
                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);
@@ -562,8 +551,6 @@ int EDLSession::load_audio_config(FileXML *file, int append_mode, uint32_t load_
 // 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);
index a33436c12142c0f6b1f91b24b37610a24478a6d7..4a207c4d44030f157f9446d6f6f5101a4668ee3f 100644 (file)
 #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
index 1de35cb915b1da82e6fa4dd25292a9c7db759477..9ab96a9ed97e5ba7277b3456244d45a333201338 100644 (file)
@@ -1550,19 +1550,13 @@ void MWindow::restart_brender()
 //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)
@@ -3987,29 +3981,9 @@ int MWindow::select_asset(Asset *asset, int vstream, int astream, int delete_tra
                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 ) {
index ad7d729fd681616a0dc1cd9ffbdde47f918d240e..e27d40373dab38bd51e9ec63dbd3c811fa7d1fad 100644 (file)
@@ -2286,22 +2286,15 @@ void MWindow::remap_audio(int pattern)
                        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;
index 9d7dea8e69222f70e4c4e951d34aa34ff8f57683..58e6eca9d3a463d619a68f9294db76fe2e35525f 100644 (file)
@@ -99,9 +99,8 @@ int New::create_new_project()
        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();
 
index 6f6de774563344eab8e528562885dfa04b78bb5c..edeee836eb0be3cde6a579c29398eadc35a9458c 100644 (file)
@@ -31,6 +31,7 @@
 #include "filesystem.h"
 #include "guicast.h"
 #include "indexfile.h"
+#include "maxchannels.h"
 #include "mutex.h"
 #include "preferences.h"
 #include "probeprefs.h"
@@ -112,14 +113,12 @@ Preferences::Preferences()
        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);
        }
 }
 
@@ -333,30 +332,14 @@ int Preferences::load_defaults(BC_Hash *defaults)
        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);
@@ -489,7 +472,7 @@ int Preferences::save_defaults(BC_Hash *defaults)
        {
                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);
        }
 
index 55d47e890b176e264cb47e0a8cc9d7aba76b8500..8b1bb3b4d251ee85ec87b232adf0ddcd6560381f 100644 (file)
@@ -129,7 +129,7 @@ public:
        int yuv_color_range;
 
 // Default positions for channels
-       int channel_positions[MAXCHANNELS * MAXCHANNELS];
+       int channel_positions[MAXCHANNELS][MAXCHANNELS];
 
        Asset *brender_asset;
        int use_brender;
index 17fd1f89a33f8995c6a5dda4c6f99af80f0d9eeb..5b35292404b0f040ae6ae333433c479ba5a6ca60 100644 (file)
@@ -187,35 +187,7 @@ void MainPackageRenderer::set_progress(int64_t value)
 
 // 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();
 
@@ -431,8 +403,6 @@ void Render::stop_operation()
        }
 }
 
-
-
 int Render::check_asset(EDL *edl, Asset &asset)
 {
        if(asset.video_data &&
@@ -528,6 +498,19 @@ void Render::stop_progress()
        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()
@@ -879,8 +862,14 @@ printf("Render::render_single: Session finished.\n");
 
 
 
-               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();
                }
index 3b17298360637f34f2cdc7bce5ebe74cf76b5ab6..ba7461ec5a8d25edfd0dc974b28c349f16702709 100644 (file)
@@ -152,6 +152,7 @@ public:
 
        void start_progress();
        void stop_progress();
+       void show_progress();
 
 // Procedure the run function should use.
        int mode;
index f0131df9c5a976fac7916d2d13c9f4c270e40a36..9672b1af45cd7245b5acb5e1acd1684029f62f83 100644 (file)
@@ -115,6 +115,13 @@ int RenderFarmServer::wait_clients()
        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.
index ec7fb6a92116932b85d013f4b7206cd52346f1b5..9418213a6ab2c362b23b7b3c609a50bd65a262e3 100644 (file)
@@ -181,6 +181,8 @@ public:
        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.
index 1ca51112e3f86cadeffd185c6c2638f43fcca7de..b70f68824cf1bb8c172dcec863fe9bc35d610ccc 100644 (file)
@@ -151,9 +151,9 @@ void SetFormatThread::apply_changes()
 
        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);
@@ -175,20 +175,6 @@ void SetFormatThread::update()
        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);
 
@@ -322,51 +308,38 @@ void SetFormatWindow::create_objects()
 
 
 
-       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,
@@ -377,12 +350,6 @@ void SetFormatWindow::create_objects()
 
 
 
-
-
-
-
-
-
        y = mwindow->theme->setformat_y2;
        add_subwindow(new BC_Title(mwindow->theme->setformat_x3,
                y,
@@ -558,18 +525,6 @@ EDL* SetFormatPresets::get_edl()
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
 SetSampleRateTextBox::SetSampleRateTextBox(SetFormatThread *thread, int x, int y)
  : BC_TextBox(x, y, 100, 1, (int64_t)thread->new_settings->session->sample_rate)
 {
@@ -596,8 +551,8 @@ int SetChannelsTextBox::handle_event()
        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));
        }
 
 
@@ -605,17 +560,25 @@ int SetChannelsTextBox::handle_event()
        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;
@@ -755,9 +718,9 @@ int SetChannelsCanvas::cursor_motion_event()
                {
                        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;
@@ -766,13 +729,6 @@ int SetChannelsCanvas::cursor_motion_event()
 }
 
 
-
-
-
-
-
-
-
 SetFrameRateTextBox::SetFrameRateTextBox(SetFormatThread *thread, int x, int y)
  : BC_TextBox(x, y, 100, 1, (float)thread->new_settings->session->frame_rate)
 {
@@ -848,7 +804,6 @@ int ScaleRatioText::handle_event()
 }
 
 
-
 ScaleAspectAuto::ScaleAspectAuto(int x, int y, SetFormatThread *thread)
  : BC_CheckBox(x, y, thread->auto_aspect, _("Auto"))
 {
@@ -883,10 +838,6 @@ int ScaleAspectText::handle_event()
 }
 
 
-
-
-
-
 SetFormatApply::SetFormatApply(int x, int y, SetFormatThread *thread)
  : BC_GenericButton(x, y, _("Apply"))
 {
@@ -900,17 +851,6 @@ int SetFormatApply::handle_event()
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
 FormatSwapExtents::FormatSwapExtents(MWindow *mwindow,
        SetFormatThread *thread,
        SetFormatWindow *gui,
@@ -937,6 +877,3 @@ int FormatSwapExtents::handle_event()
        return 1;
 }
 
-
-
-
index bb15cde3274110f358320d27272c76090a83f736..89ede118e40f62291e0f73ff5c7283d0b79f9b79 100644 (file)
@@ -94,6 +94,14 @@ public:
        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
 {
index 403acd2d9161838abf88e10c2552467c8f4d97a0..ebf1e75533bdeb895c10db342cb7f5fd133fe855 100644 (file)
@@ -482,7 +482,7 @@ int main(int ac, char **av)
 //  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);
index 70c7a406ef08f9af5c1509b89478c8dd7fb78cda..027379bcad5faf867cb2d0e0d6acc32da51ba5d3 100644 (file)
@@ -345,7 +345,6 @@ void BC_Trace::unset_temp(char *string)
 
 TheLock TheLocker::the_lock;
 TheList TheList::the_list;
-TheChk TheChk::the_chk;
 
 int lock_item::table_id = 0;
 
index fc35817eadd1405f4951589f37bc7ad80db2915b..8cf58285553d9ef8887d458e7e1e475c1faed4b6 100644 (file)
@@ -220,24 +220,17 @@ public:
        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
index a3719e59b1fab9160bf3da3a98a9e7bd652ebabe..597a0ec99c2f9e265790fa16ee5a8104006b041d 100644 (file)
@@ -3357,6 +3357,14 @@ int BC_WindowBase::ungrab(BC_WindowBase *window)
        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);
index 717f254507f81adb4e5151846c166263e1519258..82e6d57cea0516b210b822b13c62d56e809c3206 100644 (file)
@@ -461,6 +461,7 @@ public:
 // 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();
index a289a6d128a530ebb514e7b50138cf6c57e5cabd..2c8f6d86d8c554431c4d2aa8f8d9d21c81ef0406 100644 (file)
@@ -62,7 +62,7 @@ int CriKeyPointX::handle_event()
                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()
@@ -76,7 +76,7 @@ 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;
 }
 
@@ -106,7 +106,7 @@ void CriKeyDrawMode::update(int mode, int send)
        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)
@@ -139,7 +139,7 @@ void CriKeyColorPicker::handle_done_event(int result)
        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();
 }
 
@@ -150,7 +150,7 @@ int CriKeyColorPicker::handle_new_color(int color, int alpha)
        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;
 }
@@ -179,6 +179,7 @@ CriKeyWindow::CriKeyWindow(CriKey *plugin)
        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()
@@ -243,13 +244,26 @@ void CriKeyWindow::create_objects()
        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;
@@ -260,24 +274,25 @@ int CriKeyWindow::grab_event(XEvent *event)
        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;
@@ -357,7 +372,10 @@ int CriKeyWindow::grab_event(XEvent *event)
        }
 
        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;
 }
 
@@ -412,7 +430,7 @@ int CriKeyPoints::handle_event()
        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;
 }
 
@@ -525,7 +543,7 @@ int CriKeyThreshold::handle_event()
 {
        float v = get_value();
        gui->plugin->config.threshold = v;
-       gui->plugin->send_configure_change();
+       gui->send_configure_change();
        return 1;
 }
 
@@ -551,7 +569,7 @@ int CriKeyPointUp::handle_event()
                gui->plugin->config.selected = hot_point;
                gui->points->update(hot_point);
        }
-       gui->plugin->send_configure_change();
+       gui->send_configure_change();
        return 1;
 }
 
@@ -575,7 +593,7 @@ int CriKeyPointDn::handle_event()
                gui->plugin->config.selected = hot_point;
                gui->points->update(hot_point);
        }
-       gui->plugin->send_configure_change();
+       gui->send_configure_change();
        return 1;
 }
 
@@ -597,7 +615,7 @@ int CriKeyDrag::handle_event()
        else
                gui->ungrab(cwindow_gui);
        gui->plugin->config.drag = value;
-       gui->plugin->send_configure_change();
+       gui->send_configure_change();
        return 1;
 }
 
@@ -614,7 +632,7 @@ int CriKeyNewPoint::handle_event()
 {
        int k = plugin->new_point();
        gui->points->update(k);
-       gui->plugin->send_configure_change();
+       gui->send_configure_change();
        return 1;
 }
 
@@ -637,7 +655,7 @@ int CriKeyDelPoint::handle_event()
                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;
 }
index 46646fd29524204735c8ab2f45cd1a22edf59d9a..01ab8d5a8b54ea13dacedd73c31e78e451e13a75 100644 (file)
@@ -227,6 +227,8 @@ public:
        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;
@@ -243,7 +245,7 @@ public:
        CriKeyPointUp *point_up;
        CriKeyPointDn *point_dn;
        CriKeyCurPoint *cur_point;
-       int dragging;
+       int dragging, pending_config;
        float last_x, last_y;
        CriKeyDrag *drag;
        CriKeyPoints *points;
index c816d607954de7140e4fd817f1b2c96dddfc49de..ada5a6a5354060f631a2f3e1f1f91c51d6f8f881 100644 (file)
@@ -115,6 +115,7 @@ TitleWindow::TitleWindow(TitleMain *client)
        background = 0;
        background_path = 0;
        loop_playback = 0;
+       pending_config = 0;
 }
 
 void TitleWindow::done_event(int result)
@@ -314,7 +315,7 @@ void TitleWindow::create_objects()
        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:")));
@@ -369,9 +370,9 @@ void TitleWindow::create_objects()
        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;
@@ -385,7 +386,7 @@ void TitleWindow::create_objects()
                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;
@@ -468,13 +469,26 @@ int TitleWindow::resize_event(int w, int h)
        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;
@@ -485,8 +499,9 @@ int TitleWindow::grab_event(XEvent *event)
        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 ) {
@@ -494,14 +509,14 @@ int TitleWindow::grab_event(XEvent *event)
                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;
@@ -618,7 +633,10 @@ int TitleWindow::grab_event(XEvent *event)
                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;
 }
 
@@ -637,7 +655,7 @@ void TitleWindow::previous_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();
 }
 
 void  TitleWindow::next_font()
@@ -655,7 +673,7 @@ 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)
@@ -672,7 +690,7 @@ 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;
 }
 
@@ -796,7 +814,7 @@ int TitleSizeTumble::handle_up_event()
 
        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;
 }
 
@@ -819,7 +837,7 @@ int TitleSizeTumble::handle_down_event()
 
        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;
 }
 
@@ -835,7 +853,7 @@ int TitleBold::handle_event()
        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;
 }
 
@@ -850,7 +868,7 @@ int TitleItalic::handle_event()
        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;
 }
 
@@ -869,7 +887,7 @@ int TitleSize::handle_event()
 {
        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)
@@ -896,7 +914,7 @@ TitlePitch::
 int TitlePitch::handle_event()
 {
        *value = atol(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -937,25 +955,27 @@ TitleMotion::TitleMotion(TitleMain *client, TitleWindow *window, int x, int y)
 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()
 {
@@ -964,16 +984,18 @@ 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;
 }
 
@@ -1012,7 +1034,7 @@ TitleFade::TitleFade(TitleMain *client, TitleWindow *window,
 int TitleFade::handle_event()
 {
        *value = atof(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1058,7 +1080,7 @@ int TitleFont::handle_event()
 {
        strcpy(client->config.font, get_text());
        window->check_style(client->config.font, 1);
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1103,7 +1125,7 @@ int TitleText::handle_event()
        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)
@@ -1145,7 +1167,7 @@ TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x,
 int TitleDropShadow::handle_event()
 {
        client->config.dropshadow = atol(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1160,7 +1182,7 @@ TitleOutline::TitleOutline(TitleMain *client, TitleWindow *window, int x, int y)
 int TitleOutline::handle_event()
 {
        client->config.outline_size = atol(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1179,7 +1201,7 @@ int TitleStroker::handle_event()
                client->config.style |= BC_FONT_OUTLINE;
        else
                client->config.style &= ~BC_FONT_OUTLINE;
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1194,7 +1216,7 @@ TitleX::TitleX(TitleMain *client, TitleWindow *window, int x, int y)
 int TitleX::handle_event()
 {
        client->config.title_x = atol(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1208,7 +1230,7 @@ TitleY::TitleY(TitleMain *client, TitleWindow *window, int x, int y)
 int TitleY::handle_event()
 {
        client->config.title_y = atol(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1222,7 +1244,7 @@ TitleW::TitleW(TitleMain *client, TitleWindow *window, int x, int y)
 int TitleW::handle_event()
 {
        client->config.title_w = atol(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1236,7 +1258,7 @@ TitleH::TitleH(TitleMain *client, TitleWindow *window, int x, int y)
 int TitleH::handle_event()
 {
        client->config.title_h = atol(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1245,6 +1267,7 @@ TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
        (float)0, (float)1000, x, y, 100)
 {
        this->client = client;
+       this->window = window;
        set_precision(2);
        set_increment(10);
 }
@@ -1253,7 +1276,7 @@ TitleSpeed::TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y)
 int TitleSpeed::handle_event()
 {
        client->config.pixels_per_second = atof(get_text());
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1268,7 +1291,7 @@ int TitleLeft::handle_event()
 {
        client->config.hjustification = JUSTIFY_LEFT;
        window->update_justification();
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1282,7 +1305,7 @@ int TitleCenter::handle_event()
 {
        client->config.hjustification = JUSTIFY_CENTER;
        window->update_justification();
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1296,7 +1319,7 @@ int TitleRight::handle_event()
 {
        client->config.hjustification = JUSTIFY_RIGHT;
        window->update_justification();
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1312,7 +1335,7 @@ int TitleTop::handle_event()
 {
        client->config.vjustification = JUSTIFY_TOP;
        window->update_justification();
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1326,7 +1349,7 @@ int TitleMid::handle_event()
 {
        client->config.vjustification = JUSTIFY_MID;
        window->update_justification();
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1340,7 +1363,7 @@ int TitleBottom::handle_event()
 {
        client->config.vjustification = JUSTIFY_BOTTOM;
        window->update_justification();
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1370,7 +1393,7 @@ int TitleColorThread::handle_new_color(int output, int alpha)
        window->flush();
        window->unlock_window();
 
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1394,7 +1417,7 @@ int TitleDrag::handle_event()
        else
                window->ungrab(cwindow_gui);
        client->config.drag = value;
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1408,7 +1431,7 @@ TitleBackground::TitleBackground(TitleMain *client, TitleWindow *window, int x,
 int TitleBackground::handle_event()
 {
        client->config.background = get_value();
-       client->send_configure_change();
+       window->send_configure_change();
        return 1;
 }
 
@@ -1422,19 +1445,20 @@ TitleBackgroundPath::TitleBackgroundPath(TitleMain *client, TitleWindow *window,
 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;
 }
 
index 96086c5e28433ac4b18f29050e5e52a6983c30ab..9752b5f943f944f2ae87682b5edac64405ab51f4 100644 (file)
@@ -98,6 +98,8 @@ public:
        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;
 
@@ -130,7 +132,7 @@ public:
        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;
@@ -293,7 +295,7 @@ public:
 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;
@@ -301,7 +303,7 @@ public:
 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;
@@ -310,19 +312,21 @@ public:
 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
@@ -437,6 +441,7 @@ public:
        TitleSpeed(TitleMain *client, TitleWindow *window, int x, int y);
        int handle_event();
        TitleMain *client;
+       TitleWindow *window;
 };
 
 class TitleLeft : public BC_Radial
@@ -516,7 +521,7 @@ public:
 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;
index e2d2d4d483b0ea062283301ee0ddd2daeca084aa..8faa94dd1f3f16da1aa5e505a23883ec6913d5c2 100644 (file)
@@ -105,8 +105,6 @@ esound.cfg_vars+= AUDIOFILE_LIBS="$(call ld_path,audiofile,libaudiofile/.libs)"
 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
@@ -203,7 +201,6 @@ libtheora.cfg_params?= --disable-examples --disable-spec --enable-shared=no
 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,.)
@@ -242,10 +239,8 @@ $(call rules,$(call std-build,djbfft))
 $(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))