vicon drawing segv fix, beeper consolidation, render_effect resize wdw fix, valgrind...
authorGood Guy <[email protected]>
Thu, 26 Dec 2019 23:28:31 +0000 (16:28 -0700)
committerGood Guy <[email protected]>
Thu, 26 Dec 2019 23:28:31 +0000 (16:28 -0700)
15 files changed:
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/convert.C
cinelerra-5.1/cinelerra/convert.h
cinelerra-5.1/cinelerra/formattools.C
cinelerra-5.1/cinelerra/mainsession.C
cinelerra-5.1/cinelerra/mainundo.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/preferences.C
cinelerra-5.1/cinelerra/proxy.C
cinelerra-5.1/cinelerra/proxy.h
cinelerra-5.1/cinelerra/render.C
cinelerra-5.1/cinelerra/resourcepixmap.C
cinelerra-5.1/cinelerra/zwindow.C
cinelerra-5.1/guicast/bcresources.C

index 6f504db82b27cd33c11ef4a1cd4388fcb4285a52..9cf4999915b00c7ee9fcff9e9d6aca1313a88c01 100644 (file)
@@ -120,7 +120,8 @@ AssetVIcon::~AssetVIcon()
 VFrame *AssetVIcon::frame()
 {
        AssetVIconThread *avt = picon->gui->vicon_thread;
-       Asset *asset = (Asset *)picon->indexable;
+       Indexable *idxbl = picon->indexable;
+       Asset *asset = idxbl && idxbl->is_asset ? (Asset *)idxbl : 0;
        if( !asset ) return vframes()>0 ? (VFrame*)*images[0] : 0;
        if( !asset->video_data && audio_data && audio_size && length > 0 ) {
                if( !temp ) temp = new VFrame(0, -1, w, h, BC_RGB888, -1);
index 370adcc9ca401f7d0f3339f2a46039ed3c06c414..18791e1e8cb95d7be255497feeeafb022b727566 100644 (file)
@@ -719,84 +719,3 @@ int ConvertBeepOnDone::handle_event()
        return 1;
 }
 
-ConvertBeep::ConvertBeep(MWindow *mwindow)
- : Thread(1, 0, 0)
-{
-       this->mwindow = mwindow;
-       audio = new AudioDevice(mwindow);
-       playing_audio = 0;
-       interrupted = -1;
-}
-
-ConvertBeep::~ConvertBeep()
-{
-       stop(0);
-       delete audio;
-}
-
-void ConvertBeep::run()
-{
-       int channels = 2;
-       int64_t bfrsz = BEEP_SAMPLE_RATE;
-       EDL *edl = mwindow->edl;
-       EDLSession *session = edl->session;
-       AudioOutConfig *aconfig = session->playback_config->aconfig;
-       audio->open_output(aconfig, BEEP_SAMPLE_RATE, bfrsz, channels, 0);
-       audio->start_playback();
-
-       double out0[bfrsz], out1[bfrsz], *out[2] = { out0, out1 };
-       const double two_pi = 2*M_PI;
-       int64_t audio_len = BEEP_SAMPLE_RATE * secs;
-       const double dt = two_pi * freq/BEEP_SAMPLE_RATE;
-       double th = 0;
-
-       audio_pos = 0;
-       playing_audio = 1;
-       while( !interrupted ) {
-               int len = audio_len - audio_pos;
-               if( len <= 0 ) break;
-               if( len > bfrsz ) len = bfrsz;
-               int k = audio_pos;
-               for( int i=0; i<len; ++i,++k,th+=dt ) {
-                       double t = th - two_pi;
-                       if( t >= 0 ) th = t;
-                       out0[i] = out1[i] = sin(th) * gain;
-               }
-               audio->write_buffer(out, channels, len);
-               audio_pos = k;
-       }
-
-       if( !interrupted )
-               audio->set_last_buffer();
-       audio->stop_audio(interrupted ? 0 : 1);
-       playing_audio = 0;
-
-       audio->close_all();
-}
-
-void ConvertBeep::start()
-{
-       if( running() ) return;
-       audio_pos = -1;
-       interrupted = 0;
-       Thread::start();
-}
-
-void ConvertBeep::stop(int wait)
-{
-       if( running() && !interrupted ) {
-               interrupted = 1;
-               audio->stop_audio(wait);
-       }
-       Thread::join();
-}
-
-void ConvertBeep::tone(double freq, double secs, double gain)
-{
-       stop(0);
-       this->freq = freq;
-       this->secs = secs;
-       this->gain = gain;
-       start();
-}
-
index 74717e504d58ea0b2524c7b9831d08090a921f26..36c2c8c7c9cc74f04950750b5654868559f8ab3a 100644 (file)
@@ -204,24 +204,4 @@ public:
        float beep;
 };
 
-class ConvertBeep : public Thread
-{
-public:
-       enum { BEEP_SAMPLE_RATE=48000 };
-       typedef int16_t audio_data_t;
-       ConvertBeep(MWindow *mwindow);
-       ~ConvertBeep();
-
-       void run();
-       void start();
-       void stop(int wait);
-       void tone(double freq, double secs, double gain);
-
-       MWindow *mwindow;
-       double freq, secs, gain;
-       AudioDevice *audio;
-       int playing_audio, interrupted;
-       int audio_pos;
-};
-
 #endif
index 03d8e83ece22dabb9d211683c0aa1974965d8326..0979dfa46f7d22a956e7ac9bc5bc0f81386dfaa6 100644 (file)
@@ -466,6 +466,10 @@ void FormatTools::reposition_window(int &init_x, int &init_y)
        format_text->reposition_window(x, y);
        x += format_text->get_w();
        format_button->reposition_window(x, y);
+       x += format_button->get_w() + 5;
+       ffmpeg_type->reposition_window(x, y);
+       x += ffmpeg_type->get_w();
+       format_ffmpeg->reposition_window(x, y);
 
        x = init_x;
        y += format_button->get_h() + ys10;
index e0a8a8265f57752e73b347788500a9f8b4a3b116..5862b9432f7dfd27b5e7a2a09ea46cca9c959933 100644 (file)
@@ -368,8 +368,12 @@ void MainSession::default_window_positions(int window_config)
 int MainSession::load_defaults(BC_Hash *defaults)
 {
 // Setup main windows
-       strcpy(a_x11_host, defaults->get("A_X11_HOST", a_x11_host));
-       strcpy(b_x11_host, defaults->get("B_X11_HOST", b_x11_host));
+       char *a_host = defaults->get("A_X11_HOST", a_x11_host);
+       if( a_host != a_x11_host )
+               strcpy(a_x11_host, defaults->get("A_X11_HOST", a_x11_host));
+       char *b_host = defaults->get("B_X11_HOST", b_x11_host);
+       if( b_host != b_x11_host )
+               strcpy(b_x11_host, defaults->get("B_X11_HOST", b_x11_host));
        window_config = defaults->get("WINDOW_CONFIG", window_config);
        default_window_positions(window_config);
 
index 0c149cd40acc445d8626a060b7f7cae831ce0e00..ba9b6c337ed85ca1e1a8a824cc41add662e27783 100644 (file)
@@ -209,12 +209,10 @@ int MainUndo::undo()
 //printf("MainUndo::undo %d %s\n", __LINE__, current->get_filename());
                        mwindow->set_filename(current->get_filename());
 
-                       if( mwindow->gui ) {
 // Now update the menu with the after entry
-                               UndoStackItem *prev = PREVIOUS;
-                               mwindow->gui->mainmenu->undo->
-                                       update_caption(prev ? prev->get_description() : "");
-                       }
+                       UndoStackItem *prev = PREVIOUS;
+                       mwindow->gui->mainmenu->undo->
+                               update_caption(prev ? prev->get_description() : "");
                }
        }
 
index 39c996433da4473abcbfeea39961dcfe64d6dc64..75e3bb14723041cc0e7747513c89240526888e06 100644 (file)
@@ -240,7 +240,7 @@ MWindow::MWindow()
        screens = 1;
        in_destructor = 0;
        speed_edl = 0;
-       proxy_beep = 0;
+       beeper = 0;
        shuttle = 0;
        mixers_align = 0;
 }
@@ -261,7 +261,7 @@ MWindow::~MWindow()
 #ifdef HAVE_DVB
        gui->channel_info->stop();
 #endif
-       delete proxy_beep;
+       delete beeper;
        delete create_bd;       create_bd = 0;
        delete create_dvd;      create_dvd = 0;
        delete shuttle;         shuttle = 0;
@@ -1825,10 +1825,92 @@ void MWindow::undo_after(const char *description, uint32_t load_flags, int chang
 
 void MWindow::beep(double freq, double secs, double gain)
 {
-       if( !proxy_beep ) proxy_beep = new ProxyBeep(this);
-       proxy_beep->tone(freq, secs, gain);
+       if( !beeper ) beeper = new Beeper(this);
+       beeper->tone(freq, secs, gain);
 }
 
+Beeper::Beeper(MWindow *mwindow)
+ : Thread(1, 0, 0)
+{
+       this->mwindow = mwindow;
+       audio = new AudioDevice(mwindow);
+       playing_audio = 0;
+       interrupted = -1;
+}
+
+Beeper::~Beeper()
+{
+       stop(0);
+       delete audio;
+}
+
+void Beeper::run()
+{
+       int channels = 2;
+       int64_t bfrsz = BEEP_SAMPLE_RATE;
+       EDL *edl = mwindow->edl;
+       EDLSession *session = edl->session;
+       AudioOutConfig *aconfig = session->playback_config->aconfig;
+       audio->open_output(aconfig, BEEP_SAMPLE_RATE, bfrsz, channels, 0);
+       audio->start_playback();
+
+       double out0[bfrsz], out1[bfrsz], *out[2] = { out0, out1 };
+       const double two_pi = 2*M_PI;
+       int64_t audio_len = BEEP_SAMPLE_RATE * secs;
+       const double dt = two_pi * freq/BEEP_SAMPLE_RATE;
+       double th = 0;
+
+       audio_pos = 0;
+       playing_audio = 1;
+       while( !interrupted ) {
+               int len = audio_len - audio_pos;
+               if( len <= 0 ) break;
+               if( len > bfrsz ) len = bfrsz;
+               int k = audio_pos;
+               for( int i=0; i<len; ++i,++k,th+=dt ) {
+                       double t = th - two_pi;
+                       if( t >= 0 ) th = t;
+                       out0[i] = out1[i] = sin(th) * gain;
+               }
+               audio->write_buffer(out, channels, len);
+               audio_pos = k;
+       }
+
+       if( !interrupted )
+               audio->set_last_buffer();
+       audio->stop_audio(interrupted ? 0 : 1);
+       playing_audio = 0;
+
+       audio->close_all();
+}
+
+void Beeper::start()
+{
+       if( running() ) return;
+       audio_pos = -1;
+       interrupted = 0;
+       Thread::start();
+}
+
+void Beeper::stop(int wait)
+{
+       if( running() && !interrupted ) {
+               interrupted = 1;
+               audio->stop_audio(wait);
+       }
+       Thread::join();
+}
+
+void Beeper::tone(double freq, double secs, double gain)
+{
+       stop(0);
+       this->freq = freq;
+       this->secs = secs;
+       this->gain = gain;
+       start();
+}
+
+
 int MWindow::load_filenames(ArrayList<char*> *filenames,
        int load_mode,
        int update_filename)
@@ -2116,6 +2198,8 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
                                edl->session->autos_follow_edits,
                                0); // overwrite
                }
+               else if( load_mode == LOADMODE_NEW_TRACKS )
+                       paste_edls(&new_edls, load_mode, 0, -1, 0, 0, 0, 0);
                else
                        paste_edls(&new_edls, load_mode, 0, -1, 1, 1, 1, 0);
        }
@@ -2219,11 +2303,12 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
                gui->unlock_window(); // to update progress bar
                int ret = render_proxy(orig_idxbls);
                gui->lock_window("MWindow::load_filenames");
-               if( ret >= 0 && edl->session->proxy_beep ) {
+               float gain = edl->session->proxy_beep;
+               if( ret >= 0 && gain > 0 ) {
                        if( ret > 0 )
-                               beep(2000., 1.5, 0.5);
+                               beep(2000., 1.5, gain);
                        else
-                               beep(4000., 0.25, 0.5);
+                               beep(4000., 0.25, gain);
                }
        }
 
@@ -2307,14 +2392,19 @@ int MWindow::enable_proxy()
            edl->session->proxy_disabled_scale != 1 ) {
                int new_scale = edl->session->proxy_disabled_scale;
                int new_use_scaler = edl->session->proxy_use_scaler;
-               edl->session->proxy_disabled_scale = 1;
                Asset *asset = new Asset;
                asset->format = FILE_FFMPEG;
                asset->load_defaults(defaults, "PROXY_", 1, 1, 0, 0, 0);
                ret = to_proxy(asset, new_scale, new_use_scaler);
                asset->remove_user();
-               if( ret > 0 )
-                       beep(2000., 1.5, 0.5);
+               if( ret > 0 ) {
+                       float gain = edl->session->proxy_beep;
+                       beep(2000., 1.5, gain);
+               }
+               edl->session->proxy_disabled_scale = 1;
+               gui->lock_window("MWindow::to_proxy");
+               update_project(LOADMODE_REPLACE);
+               gui->unlock_window();
        }
        return 1;
 }
@@ -2323,14 +2413,17 @@ int MWindow::disable_proxy()
 {
        if( edl->session->proxy_scale != 1 &&
            edl->session->proxy_disabled_scale == 1 ) {
-               int new_scale = 1;
+               int old_scale = edl->session->proxy_scale, new_scale = 1;
                int new_use_scaler = edl->session->proxy_use_scaler;
-               edl->session->proxy_disabled_scale = edl->session->proxy_scale;
                Asset *asset = new Asset;
                asset->format = FILE_FFMPEG;
                asset->load_defaults(defaults, "PROXY_", 1, 1, 0, 0, 0);
                to_proxy(asset, new_scale, new_use_scaler);
                asset->remove_user();
+               edl->session->proxy_disabled_scale = old_scale;
+               gui->lock_window("MWindow::to_proxy");
+               update_project(LOADMODE_REPLACE);
+               gui->unlock_window();
        }
        return 1;
 }
@@ -2461,10 +2554,6 @@ int MWindow::to_proxy(Asset *asset, int new_scale, int new_use_scaler)
        edl->Garbage::remove_user();
        restart_brender();
 
-       gui->lock_window("MWindow::to_proxy");
-       update_project(LOADMODE_REPLACE);
-       gui->unlock_window();
-
        return !result ? proxy_render.needed_proxies.size() : -1;
 }
 
@@ -3737,6 +3826,7 @@ void MWindow::stack_push(EDL *new_edl)
 // needs gui lock
        gui->lock_window("MWindow::stack_push");
        if( stack.size() < 9 ) {
+               save_backup();
                undo_before();
                StackItem &item = stack.append();
                item.edl = edl;
@@ -3939,6 +4029,8 @@ void MWindow::save_backup()
        edl->set_path(session->filename);
 
        char backup_path[BCTEXTLEN], backup_path1[BCTEXTLEN];
+       snprintf(backup_path1, sizeof(backup_path1), "%s/%s",
+               File::get_config_path(), BACKUP_FILE1);
        get_backup_path(backup_path, sizeof(backup_path));
        rename(backup_path, backup_path1);
        edl->save_xml(&file, backup_path);
index e938b743c8fb7beaa4566bc1e7c16ee1e9a4cdca..a38d057d35876af3039d187e09dd61034b061530 100644 (file)
@@ -118,6 +118,28 @@ public:
 };
 
 
+#define BEEP_SAMPLE_RATE 48000
+
+class Beeper : public Thread
+{
+public:
+       typedef int16_t audio_data_t;
+       Beeper(MWindow *mwindow);
+       ~Beeper();
+
+       void run();
+       void start();
+       void stop(int wait);
+       void tone(double freq, double secs, double gain);
+
+       MWindow *mwindow;
+       double freq, secs, gain;
+       AudioDevice *audio;
+       int playing_audio, interrupted;
+       int audio_pos;
+};
+
+
 class MWindow : public Thread
 {
 public:
@@ -554,7 +576,7 @@ public:
        int enable_proxy();
        int disable_proxy();
        int to_proxy(Asset *asset, int new_scale, int new_use_scaler);
-       ProxyBeep *proxy_beep;
+       Beeper *beeper;
 
        void dump_plugins(FILE *fp=stdout);
        void dump_edl(FILE *fp=stdout);
index c9153a95b21917bb503eb17de49cdffa8001fd65..02bccb13335c449b5fa18b6340d67f7069944cd8 100644 (file)
@@ -78,6 +78,7 @@ Preferences::Preferences()
        use_renderfarm = 0;
        force_uniprocessor = 0;
        renderfarm_port = DEAMON_PORT;
+       renderfarm_consolidate = 0;
        render_preroll = 0.5;
        brender_preroll = 0;
        renderfarm_mountpoint[0] = 0;
index 23f6e7b7fbfbd212ee3c28723f1d8f3d3fc2b605..522287bd420f3e2eee217e1feac6aebfbb258b56 100644 (file)
@@ -172,10 +172,6 @@ void ProxyDialog::handle_close_event(int result)
        }
        mwindow->edl->session->proxy_auto_scale = auto_scale;
        mwindow->edl->session->proxy_beep = beep;
-       mwindow->edl->session->proxy_disabled_scale = 1;
-       mwindow->gui->lock_window("ProxyDialog::handle_close_event");
-       mwindow->gui->update_proxy_toggle();
-       mwindow->gui->unlock_window();
        asset->save_defaults(mwindow->defaults, "PROXY_", 1, 1, 0, 0, 0); 
        result = mwindow->to_proxy(asset, new_scale, use_scaler);
        if( result >= 0 && beep > 0 && new_scale != 1 ) {
@@ -189,6 +185,10 @@ void ProxyDialog::handle_close_event(int result)
                else
                        mwindow->beep(2000., 2.0, beep);
        }
+       mwindow->edl->session->proxy_disabled_scale = 1;
+       mwindow->gui->lock_window("ProxyDialog::handle_close_event");
+       mwindow->update_project(LOADMODE_REPLACE);
+       mwindow->gui->unlock_window();
 }
 
 void ProxyRender::to_proxy_path(char *new_path, Indexable *indexable, int scale)
@@ -778,85 +778,3 @@ LoadPackage* ProxyFarm::new_package()
        return new ProxyPackage;
 }
 
-
-ProxyBeep::ProxyBeep(MWindow *mwindow)
- : Thread(1, 0, 0)
-{
-       this->mwindow = mwindow;
-       audio = new AudioDevice(mwindow);
-       playing_audio = 0;
-       interrupted = -1;
-}
-
-ProxyBeep::~ProxyBeep()
-{
-       stop(0);
-       delete audio;
-}
-
-void ProxyBeep::run()
-{
-       int channels = 2;
-       int64_t bfrsz = BEEP_SAMPLE_RATE;
-       EDL *edl = mwindow->edl;
-       EDLSession *session = edl->session;
-       AudioOutConfig *aconfig = session->playback_config->aconfig;
-       audio->open_output(aconfig, BEEP_SAMPLE_RATE, bfrsz, channels, 0);
-       audio->start_playback();
-
-       double out0[bfrsz], out1[bfrsz], *out[2] = { out0, out1 };
-       const double two_pi = 2*M_PI;
-       int64_t audio_len = BEEP_SAMPLE_RATE * secs;
-       const double dt = two_pi * freq/BEEP_SAMPLE_RATE;
-       double th = 0;
-
-       audio_pos = 0;
-       playing_audio = 1;
-       while( !interrupted ) {
-               int len = audio_len - audio_pos;
-               if( len <= 0 ) break;
-               if( len > bfrsz ) len = bfrsz;
-               int k = audio_pos;
-               for( int i=0; i<len; ++i,++k,th+=dt ) {
-                       double t = th - two_pi;
-                       if( t >= 0 ) th = t;
-                       out0[i] = out1[i] = sin(th) * gain;
-               }
-               audio->write_buffer(out, channels, len);
-               audio_pos = k;
-       }
-
-       if( !interrupted )
-               audio->set_last_buffer();
-       audio->stop_audio(interrupted ? 0 : 1);
-       playing_audio = 0;
-
-       audio->close_all();
-}
-
-void ProxyBeep::start()
-{
-       if( running() ) return;
-       audio_pos = -1;
-       interrupted = 0;
-       Thread::start();
-}
-
-void ProxyBeep::stop(int wait)
-{
-       if( running() && !interrupted ) {
-               interrupted = 1;
-               audio->stop_audio(wait);
-       }
-       Thread::join();
-}
-
-void ProxyBeep::tone(double freq, double secs, double gain)
-{
-       stop(0);
-       this->freq = freq;
-       this->secs = secs;
-       this->gain = gain;
-       start();
-}
-
index 699d7ac43e8b8786d9e5b5eb921ee38b5b5c493f..7f88686dda1b7579a550cbf4a5fe70555525f821 100644 (file)
@@ -244,24 +244,4 @@ public:
        ArrayList<Asset*> *proxy_assets;
 };
 
-class ProxyBeep : public Thread
-{
-public:
-       enum { BEEP_SAMPLE_RATE=48000 };
-       typedef int16_t audio_data_t;
-       ProxyBeep(MWindow *mwindow);
-       ~ProxyBeep();
-
-       void run();
-       void start();
-       void stop(int wait);
-       void tone(double freq, double secs, double gain);
-
-       MWindow *mwindow;
-       double freq, secs, gain;
-       AudioDevice *audio;
-       int playing_audio, interrupted;
-       int audio_pos;
-};
-
 #endif
index 55f88606eb48a1a2bf89a04cbd7605e562f8bd81..d6de73782ce6077da4f0c2f4605d2204eb34dcd3 100644 (file)
@@ -955,8 +955,9 @@ void RenderThread::run()
                        render_frames, render_time, render_rate);
        }
 
-       if( render->mode == Render::INTERACTIVE && render->beep > 0 )
-               mwindow->beep(3000., 1.5, render->beep);
+       float gain = render->beep;
+       if( render->mode == Render::INTERACTIVE && gain > 0 )
+               mwindow->beep(3000., 1.5, gain);
 
        if( script ) {
                if( !render->result )
index 82dd7c802329f85cd65dde4eea3c839ae0564cfe..9ed12d9357dc71fdef5f83de4f277ec43e408f33 100644 (file)
@@ -236,32 +236,50 @@ VFrame *ResourcePixmap::change_title_color(VFrame *title_bg, int color)
        int bpp = BC_CModels::calculate_pixelsize(colormodel);
        int tw = title_bg->get_w(), tw1 = tw-1, th = title_bg->get_h();
        VFrame *title_bar = new VFrame(tw, th, colormodel);
-       uint8_t cr = (color>>16), cg = (color>>8), cb = (color>>0);
        uint8_t **bar_rows = title_bar->get_rows();
        const uint8_t gap_grey = 0x4a;
-       if( th > 0 ) {
-               uint8_t *cp = bar_rows[0];
-               for( int x=0; x<tw; ++x ) {
-                       cp[0] = cp[1] = cp[2] = gap_grey;
-                       if( bpp > 3 ) cp[3] = 0xff;
-                       cp += bpp;
+       if( BC_CModels::has_alpha(colormodel) && // fast path
+           BC_CModels::calculate_pixelsize(colormodel) == sizeof(unsigned) ) {
+               const unsigned gap_rgba = (0xff<<24) |
+                       (gap_grey<<16) | (gap_grey<<8) | (gap_grey<<0);
+               if( th > 0 ) {
+                       unsigned *bp = (unsigned *)bar_rows[0];
+                       for( int i=tw; --i>=0; ) *bp++ = gap_rgba;
                }
-       }
-       for( int y=1; y<th; ++y ) {
-               uint8_t *cp = bar_rows[y];
-               if( tw > 0 ) {
-                       cp[0] = cp[1] = cp[2] = gap_grey;
-                       if( bpp > 3 ) cp[3] = 0xff;
-                       cp += bpp;
+               unsigned rgba = (0xff<<24) | (color & 0xffffff);
+               for( int y=1; y<th; ++y ) {
+                       unsigned *bp = (unsigned *)bar_rows[y];
+                       if( tw > 0 ) *bp++ = gap_rgba;
+                       for( int i=tw1; --i>0; ++bp ) *bp = rgba;
+                       if( tw > 1 ) *bp = gap_rgba;
                }
-               for( int x=1; x<tw1; ++x ) {
-                       cp[0] = cr; cp[1] = cg; cp[2] = cb;
-                       if( bpp > 3 ) cp[3] = 0xff;
-                       cp += bpp;
+       }
+       else {
+               uint8_t cr = (color>>16), cg = (color>>8), cb = (color>>0);
+               if( th > 0 ) {
+                       uint8_t *cp = bar_rows[0];
+                       for( int x=0; x<tw; ++x ) {
+                               cp[0] = cp[1] = cp[2] = gap_grey;
+                               if( bpp > 3 ) cp[3] = 0xff;
+                               cp += bpp;
+                       }
                }
-               if( tw > 1 ) {
-                       cp[0] = cp[1] = cp[2] = gap_grey;
-                       if( bpp > 3 ) cp[3] = 0xff;
+               for( int y=1; y<th; ++y ) {
+                       uint8_t *cp = bar_rows[y];
+                       if( tw > 0 ) {
+                               cp[0] = cp[1] = cp[2] = gap_grey;
+                               if( bpp > 3 ) cp[3] = 0xff;
+                               cp += bpp;
+                       }
+                       for( int x=1; x<tw1; ++x ) {
+                               cp[0] = cr; cp[1] = cg; cp[2] = cb;
+                               if( bpp > 3 ) cp[3] = 0xff;
+                               cp += bpp;
+                       }
+                       if( tw > 1 ) {
+                               cp[0] = cp[1] = cp[2] = gap_grey;
+                               if( bpp > 3 ) cp[3] = 0xff;
+                       }
                }
        }
        return title_bar;
@@ -270,17 +288,28 @@ VFrame *ResourcePixmap::change_title_color(VFrame *title_bg, int color)
 VFrame *ResourcePixmap::change_picon_alpha(VFrame *picon_frame, int alpha)
 {
        uint8_t **picon_rows = picon_frame->get_rows();
-       int w = picon_frame->get_w(), h = picon_frame->get_h();
+       int pw = picon_frame->get_w(), ph = picon_frame->get_h();
        int color_model = picon_frame->get_color_model();
        int bpp = BC_CModels::calculate_pixelsize(color_model);
-       VFrame *frame = new VFrame(w, h, BC_RGBA8888);
+       VFrame *frame = new VFrame(pw, ph, BC_RGBA8888);
        uint8_t **rows = frame->get_rows();
-       for( int y=0; y<h; ++y ) {
-               uint8_t *bp = picon_rows[y], *rp = rows[y];
-               for( int x=0; x<w; ++x ) {
-                       rp[0] = bp[0];  rp[1] = bp[1];
-                       rp[2] = bp[2];  bp += bpp;
-                       rp[3] = alpha;  rp += 4;
+       if( BC_CModels::has_alpha(color_model) && // fast path
+           BC_CModels::calculate_pixelsize(color_model) == sizeof(unsigned) ) {
+               unsigned a = alpha << 24;
+               for( int y=0; y<ph; ++y ) {
+                       unsigned *bp = (unsigned *)picon_rows[y];
+                       unsigned *rp = (unsigned *)rows[y];
+                       for( int i=pw; --i>=0; ++bp,++rp ) *rp = (*bp & 0xffffff) | a;
+               }
+       }
+       else {
+               for( int y=0; y<ph; ++y ) {
+                       uint8_t *bp = picon_rows[y], *rp = rows[y];
+                       for( int x=0; x<pw; ++x ) {
+                               rp[0] = bp[0];  rp[1] = bp[1];
+                               rp[2] = bp[2];  bp += bpp;
+                               rp[3] = alpha;  rp += 4;
+                       }
                }
        }
        return frame;
index f40e804b19d3f73e412366e4ad1883d24e04ea80..786ecc5449e1342f2f7fdcf5d4282fd3fbfc1d15 100644 (file)
@@ -32,6 +32,7 @@
 #include "renderengine.h"
 #include "timelinepane.h"
 #include "track.h"
+#include "tracks.h"
 #include "transportque.h"
 #include "zwindow.h"
 #include "zwindowgui.h"
@@ -258,10 +259,20 @@ void ZWindow::update_mixer_ids()
 
 void ZWindow::set_title(const char *tp)
 {
+       Track *track = 0;
        Mixer *mixer = mwindow->edl->mixers.get_mixer(idx);
-       if( mixer ) mixer->set_title(tp);
+       if( mixer ) {
+               mixer->set_title(tp);
+               for( track=mwindow->edl->tracks->first; track; track=track->next ) {
+                       if( track->data_type != TRACK_VIDEO ) continue;
+                       int mixer_id = track->get_mixer_id();
+                       int k = mixer->mixer_ids.size();
+                       while( --k >= 0 && mixer_id != mixer->mixer_ids[k] );
+                       if( k >= 0 ) break;
+               }
+       }
        char *cp = title, *ep = cp + sizeof(title)-1;
-       cp += snprintf(title, ep-cp, _("Mixer %d"), idx);
+       cp += snprintf(title, ep-cp, track ? track->title : _("Mixer %d"), idx);
        if( tp ) cp += snprintf(cp, ep-cp, ": %s", tp);
        *cp = 0;
 }
index 667192920626c4ab7151d63cf6d3c3376db9c842..1d52855990ee9e7e5a10eb32f518e446e98d3087 100644 (file)
@@ -367,6 +367,9 @@ BC_Resources::BC_Resources(float x_scale, float y_scale)
        BC_WindowBase::resources = this;
        synchronous = 0;
        vframe_shm = 0;
+       use_shm = -1;
+       shm_reply = 1;
+
        if( x_scale <= 0 ) x_scale = 1;
        if( y_scale <= 0 ) y_scale = x_scale;
        this->x_scale = x_scale;
@@ -756,9 +759,6 @@ new_vframes(10,default_vscroll_data,
        generic_button_margin = xS(15);
        draw_clock_background=1;
 
-       use_shm = -1;
-       shm_reply = 1;
-
 // Initialize
        bg_color = ORANGE;
        bg_shadow1 = DKGREY;