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);
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();
-}
-
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
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;
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);
//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() : "");
}
}
screens = 1;
in_destructor = 0;
speed_edl = 0;
- proxy_beep = 0;
+ beeper = 0;
shuttle = 0;
mixers_align = 0;
}
#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;
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)
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);
}
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);
}
}
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;
}
{
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;
}
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;
}
// needs gui lock
gui->lock_window("MWindow::stack_push");
if( stack.size() < 9 ) {
+ save_backup();
undo_before();
StackItem &item = stack.append();
item.edl = edl;
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);
};
+#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:
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);
use_renderfarm = 0;
force_uniprocessor = 0;
renderfarm_port = DEAMON_PORT;
+ renderfarm_consolidate = 0;
render_preroll = 0.5;
brender_preroll = 0;
renderfarm_mountpoint[0] = 0;
}
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 ) {
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)
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();
-}
-
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
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 )
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;
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;
#include "renderengine.h"
#include "timelinepane.h"
#include "track.h"
+#include "tracks.h"
#include "transportque.h"
#include "zwindow.h"
#include "zwindowgui.h"
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;
}
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;
generic_button_margin = xS(15);
draw_clock_background=1;
- use_shm = -1;
- shm_reply = 1;
-
// Initialize
bg_color = ORANGE;
bg_shadow1 = DKGREY;