ZWindow *zwindow = mwindow->get_mixer(mixer);
while( track ) {
track->play = track->record = 0;
+ if( track->data_type == TRACK_VIDEO ) {
+ sprintf(track->title, _("Mixer %d"), zwindow->idx);
+ }
mixer->mixer_ids.append(track->get_mixer_id());
track = track->next;
}
Auto *result = 0;
get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result);
+ if( edl->session->auto_keyframes && (!result || result->is_default ||
+ !EQUIV(track->from_units(result->position), position)) ) {
//printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result);
- if( !result || !EQUIV(track->from_units(result->position), position) ) {
- if( edl->session->auto_keyframes ) {
- position = edl->align_to_frame(position, 0);
- result = insert_auto(track->to_units(position, 0));
- }
+ position = edl->align_to_frame(position, 0);
+ result = insert_auto(track->to_units(position, 0));
}
//printf("Autos::get_auto_for_editing %p %p\n", first, default_auto);
void CWindowCameraGUI::update_preview()
{
- mwindow->restart_brender();
- mwindow->sync_parameters(CHANGE_PARAMS);
-
- mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
- CHANGE_NONE,
- mwindow->edl,
- 1);
mwindow->gui->lock_window("CWindowCameraGUI::update_preview");
+ mwindow->restart_brender();
mwindow->gui->draw_overlays(1);
+ mwindow->sync_parameters(CHANGE_PARAMS);
mwindow->gui->unlock_window();
+ mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
+ CHANGE_NONE, mwindow->edl, 1);
mwindow->cwindow->gui->lock_window("CWindowCameraGUI::update_preview");
mwindow->cwindow->gui->canvas->draw_refresh();
mwindow->cwindow->gui->unlock_window();
void CWindowProjectorGUI::update_preview()
{
+ mwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
mwindow->restart_brender();
mwindow->sync_parameters(CHANGE_PARAMS);
- mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
- CHANGE_NONE,
- mwindow->edl,
- 1);
- // TODO: really need to lock the main window??
- mwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
mwindow->gui->draw_overlays(1);
mwindow->gui->unlock_window();
+ mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
+ CHANGE_NONE, mwindow->edl, 1);
mwindow->cwindow->gui->lock_window("CWindowProjectorGUI::update_preview");
mwindow->cwindow->gui->canvas->draw_refresh();
mwindow->cwindow->gui->unlock_window();
void CWindowMaskGUI::update_preview()
{
+ mwindow->gui->lock_window("CWindowMaskGUI::update_preview");
mwindow->restart_brender();
mwindow->sync_parameters(CHANGE_PARAMS);
+ mwindow->gui->draw_overlays(1);
+ mwindow->gui->unlock_window();
mwindow->cwindow->playback_engine->que->send_command(CURRENT_FRAME,
- CHANGE_NONE,
- mwindow->edl,
- 1);
+ CHANGE_NONE, mwindow->edl, 1);
mwindow->cwindow->gui->lock_window("CWindowMaskGUI::update_preview");
mwindow->cwindow->gui->canvas->draw_refresh();
mwindow->cwindow->gui->unlock_window();
update_plugin_guis();
gui->update(1, 2, 1, 1, 1, 1, 0);
cwindow->update(1, 0, 0, 0, 1);
+ awindow->gui->async_update_assets();
cwindow->playback_engine->que->
send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1);
}
sync_parameters(CHANGE_EDL);
update_plugin_guis();
gui->update(1, 2, 1, 1, 1, 1, 0);
+// label list can be modified
+ awindow->gui->async_update_assets();
cwindow->update(1, 0, 0, 0, 1);
}
save_backup();
update_plugin_states();
update_plugin_guis();
+ awindow->gui->async_update_assets();
restart_brender();
gui->update(1, 2, 1, 1, 1, 1, 1);
cwindow->update(1, 1, 1, 1, 1);
update_plugin_guis();
gui->update(1, 2, 1, 1, 1, 1, 0);
cwindow->update(1, 0, 0, 0, 1);
+ awindow->gui->async_update_assets();
restart_brender();
cwindow->playback_engine->que->
send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1);
void Mixer::set_title(const char *tp)
{
+ if( tp == title ) return;
strncpy(title, tp, sizeof(title));
title[sizeof(title)-1] = 0;
}
char *cp = title, *ep = cp + sizeof(title)-1;
cp += snprintf(title, ep-cp, _("Mixer %d"), idx);
if( tp ) cp += snprintf(cp, ep-cp, ": %s", tp);
+ else tp = title;
Mixer *mixer = mwindow->edl->mixers.get_mixer(idx);
- if( mixer && tp != mixer->title ) mixer->set_title(tp);
+ if( mixer ) mixer->set_title(title);
}
void ZWindow::reposition(int x, int y, int w, int h)
#include "mwindow.h"
#include "mwindowgui.h"
#include "playbackengine.h"
-#include "playtransport.h"
-#include "renderengine.h"
#include "theme.h"
#include "tracks.h"
-#include "transportque.h"
#include "zwindow.h"
#include "zwindowgui.h"
#include "bcwindow.h"
#include "canvas.h"
#include "mwindow.h"
-#include "renderengine.inc"
+#include "playbackengine.inc"
+#include "zwindow.inc"
+#include "zwindowgui.inc"
class ZWindowGUI;
class ZWindowCanvas;
ZWindow *zwindow;
ZWindowCanvas *canvas;
- TransportCommand *command;
PlaybackEngine *playback_engine;
- RenderEngine *render_engine;
int highlighted;
};
BC_Trace::dump_traces();
BC_Trace::dump_locks();
BC_Trace::dump_buffers();
+ BC_Trace::dump_shm_stats();
BC_Trace::delete_temps();
// Call user defined signal handler
signal(SIGINT, SIG_DFL);
// gotta be root, or the dump is worthless
int uid = getuid();
- if( uid != 0 ) return;
+// it is not necessary to be root if ptrace is allowed via:
+// echo 0 > /proc/sys/kernel/yama/ptrace_scope (usually set to 1)
+// if( uid != 0 ) return;
ucontext_t *uc = (ucontext_t *)sc;
int pid = getpid(), tid = gettid();
struct sigcontext *c = (struct sigcontext *)&uc->uc_mcontext;
fprintf(fp,"\nTRACES:\n"); BC_Trace::dump_traces(fp);
fprintf(fp,"\nLOCKS:\n"); BC_Trace::dump_locks(fp);
fprintf(fp,"\nBUFFERS:\n"); BC_Trace::dump_buffers(fp);
+ fprintf(fp,"\nSHMMEM:\n"); BC_Trace::dump_shm_stats(fp);
if( BC_Signals::trap_hook ) {
fprintf(fp,"\nMAIN HOOK:\n");
BC_Signals::trap_hook(fp, BC_Signals::trap_data);
-BC_SubWindow::BC_SubWindow(int x, int y, int w, int h, int bg_color, int opts)
- : BC_WindowBase(opts)
+BC_SubWindow::BC_SubWindow(int x, int y, int w, int h, int bg_color)
{
this->x = x;
this->y = y;
class BC_SubWindow : public BC_WindowBase
{
public:
- BC_SubWindow(int x, int y, int w, int h,
- int bg_color=-1,
- int opts=0);
+ BC_SubWindow(int x, int y, int w, int h, int bg_color=-1);
virtual ~BC_SubWindow();
virtual int initialize();
{
if( !is_started ) return;
is_started = 0;
- BC_SynchronousCommand *command = new_command();
+ BC_SynchronousCommand *command = BC_Synchronous::new_command();
command->command = BC_SynchronousCommand::QUIT;
- command_lock->lock("BC_Synchronous::quit");
- commands.append(command);
- command_lock->unlock();
- next_command->unlock();
+ send_garbage(command);
command->command_done->lock("BC_Synchronous::quit");
delete command;
}
case BC_SynchronousCommand::DELETE_WINDOW:
delete_window_sync(command);
- break;
+ command->command_done->unlock();
+ return;
case BC_SynchronousCommand::DELETE_PIXMAP:
delete_pixmap_sync(command);
void BC_Synchronous::delete_window(BC_WindowBase *window)
{
#ifdef HAVE_GL
- BC_SynchronousCommand *command = new_command();
+ BC_SynchronousCommand *command = BC_Synchronous::new_command();
command->command = BC_SynchronousCommand::DELETE_WINDOW;
command->window_id = window->get_id();
command->display = window->get_display();
command->glx_context = window->glx_win_context;
send_garbage(command);
+ command->command_done->lock("BC_Synchronous::quit");
+ delete command;
#endif
}
#ifdef HAVE_GL
int window_id = command->window_id;
Display *display = command->display;
- Window win = command->win;
+// Window win = command->win;
GLXWindow glx_win = command->glx_win;
GLXContext glx_context = command->glx_context;
XLockDisplay(display);
table_lock->unlock();
- XDestroyWindow(display, win);
+ glXMakeContextCurrent(display, None, None, 0);
if( glx_context )
glXDestroyContext(display, glx_context);
- command->command_done->unlock();
+// causes xerror BadWindow (invalid Window parameter)
+// XDestroyWindow(display, glx_win);
+// win destroyed in bcwindowbase
XUnlockDisplay(display);
#endif
}
void BC_Synchronous::delete_display(BC_WindowBase *window)
{
#ifdef HAVE_GL
- BC_SynchronousCommand *command = new_command();
+ BC_SynchronousCommand *command = BC_Synchronous::new_command();
command->command = BC_SynchronousCommand::DELETE_DISPLAY;
command->display = window->get_display();
void BC_Synchronous::delete_pixmap(BC_WindowBase *window,
GLXPixmap glx_pixmap, GLXContext glx_context)
{
- BC_SynchronousCommand *command = new_command();
+ BC_SynchronousCommand *command = BC_Synchronous::new_command();
command->command = BC_SynchronousCommand::DELETE_PIXMAP;
command->window_id = window->get_id();
command->display = window->get_display();
}
+void BC_Trace::dump_shm_stat(const char *fn, FILE *fp)
+{
+ char path[BCTEXTLEN];
+ sprintf(path, "/proc/sys/kernel/%s",fn);
+ FILE *sfp = fopen(path,"r");
+ if( !sfp ) return;
+ uint64_t v = 0;
+ fscanf(sfp, "%ju", &v);
+ fclose(sfp);
+ fprintf(fp, "%s = %ju\n", fn, v);
+}
+
+void BC_Trace::dump_shm_stats(FILE *fp)
+{
+ dump_shm_stat("shmall", fp);
+ dump_shm_stat("shmmax", fp);
+ dump_shm_stat("shmmni", fp);
+ FILE *sfp = fopen("/proc/sysvipc/shm","r");
+ if( !sfp ) return;
+ char line[BCTEXTLEN];
+ int pid = getpid();
+ if( !fgets(line,sizeof(line), sfp) ) return;
+ int64_t used = 0, other = 0;
+ int n_used = 0, n_other = 0;
+ while( fgets(line,sizeof(line), sfp) ) {
+ int key, shmid, perms, cpid, lpid, uid, gid, cuid, cgid;
+ int64_t size, nattch, atime, dtime, ctime, rss, swap;
+ if( sscanf(line,
+ "%d %d %o %ju %u %u %ju %u %u %u %u %ju %ju %ju %ju %ju",
+ &key, &shmid, &perms, &size, &cpid, &lpid, &nattch,
+ &uid, &gid, &cuid, &cgid, &atime, &dtime, &ctime,
+ &rss, &swap) != 16 ) break;
+ if( cpid == pid ) {
+ used += size;
+ ++n_used;
+ }
+ else {
+ other += size;
+ ++n_other;
+ }
+ }
+ fclose(sfp);
+ fprintf(fp, "shmused = %jd (%d items)\n", used, n_used);
+ fprintf(fp, "shmother = %jd (%d items)\n", other, n_other);
+}
+
static void dump_locks(FILE *fp=stdout);
static void dump_buffers(FILE *fp=stdout);
static void dump_threads(FILE *fp=stdout);
+
+ static void dump_shm_stat(const char *fn, FILE *fp=stdout);
+ static void dump_shm_stats(FILE *fp=stdout);
};
class bc_trace_list : public List<trace_item> {
BC_Window::BC_Window(const char *title,
int x, int y, int w, int h, int minw, int minh, int allow_resize,
int private_color, int hide, int bg_color, const char *display_name,
- int group_it, int options)
- : BC_WindowBase(options)
+ int group_it)
{
create_window(0, title, x, y, w, h,
(minw < 0) ? w : minw, (minh < 0) ? h : minh,
{
static char default_x11_host[BCTEXTLEN];
public:
- BC_Window(const char *title,
- int x,
- int y,
- int w,
- int h,
- int minw = -1,
- int minh = -1,
- int allow_resize = 1,
- int private_color = 0,
- int hide = 0,
- int bg_color = -1,
- const char *display_name = 0,
- int group_it = 1,
- int options = 0);
+ BC_Window(const char *title, int x, int y, int w, int h,
+ int minw = -1, int minh = -1, int allow_resize = 1,
+ int private_color = 0, int hide = 0, int bg_color = -1,
+ const char *display_name = 0, int group_it = 1);
+
virtual ~BC_Window();
static void set_default_x11_host(const char *host);
GLXWindow BC_WindowBase::glx_window()
{
if( !glx_win ) {
- top_level->options |= GLX_DISPLAY;
glx_win = glXCreateWindow(top_level->display, top_level->glx_fb_config, win, 0);
}
return glx_win;
Mutex BC_KeyboardHandlerLock::keyboard_listener_mutex("keyboard_listener",0);
ArrayList<BC_KeyboardHandler*> BC_KeyboardHandler::listeners;
-BC_WindowBase::BC_WindowBase(int opts)
+BC_WindowBase::BC_WindowBase()
{
- this->options = opts;
//printf("BC_WindowBase::BC_WindowBase 1\n");
BC_WindowBase::initialize();
}
delete pixmap;
+//printf("delete glx=%08x, win=%08x %s\n", (unsigned)glx_win, (unsigned)win, title);
#ifdef HAVE_GL
- if( get_resources()->get_synchronous() &&
- (top_level->options & GLX_WINDOW) && glx_win != 0 )
+ if( get_resources()->get_synchronous() && glx_win != 0 ) {
get_resources()->get_synchronous()->delete_window(this);
- else
+ }
#endif
- XDestroyWindow(top_level->display, win);
+ XDestroyWindow(top_level->display, win);
if(bg_pixmap && !shared_bg_pixmap) delete bg_pixmap;
if(icon_pixmap) delete icon_pixmap;
XvUngrabPort(display, xvideo_port_id, CurrentTime);
unlock_window();
-// Can't close display if another thread is waiting for events.
-// Synchronous thread must delete display it owns a GLX_WINDOW
// Must be last reference to display.
-#ifndef SINGLE_THREAD
-#ifdef HAVE_GL
- if( (options & GLX_DISPLAY) != 0 && get_resources()->get_synchronous() ) {
- printf(_("BC_WindowBase::~BC_WindowBase window deleted but opengl deletion is not\n"
- "implemented for BC_Pixmap.\n"));
- get_resources()->get_synchronous()->delete_display(this);
- }
- else
-#endif
- {
// _XftDisplayInfo needs a lock.
- get_resources()->create_window_lock->lock("BC_WindowBase::~BC_WindowBase");
- XCloseDisplay(display);
- get_resources()->create_window_lock->unlock();
- }
+ get_resources()->create_window_lock->lock("BC_WindowBase::~BC_WindowBase");
+ XCloseDisplay(display);
+ get_resources()->create_window_lock->unlock();
+
// clipboard uses a different display connection
clipboard->stop_clipboard();
delete clipboard;
-#endif // SINGLE_THREAD
}
resize_history.remove_all_objects();
class BC_WindowBase : public trace_info
{
public:
- BC_WindowBase(int opts=0);
+ BC_WindowBase();
virtual ~BC_WindowBase();
friend class BC_Bar;
// Popup window for tooltip
BC_Popup *tooltip_popup;
// If this subwindow has already shown a tooltip since the last EnterNotify
- int options;
int flash_enabled;
// Milliseconds before cursor disappears during video playback
#define VIDEO_CURSOR_TIMEOUT 2000
-// Window options
-#define WINDOW_UTF8 0x0001
-//used to flag top_level window in glx_window / glXCreateWindow
-#define GLX_DISPLAY 0x0002
-
// mouse wheel
#define WHEEL_UP 4
#define WHEEL_DOWN 5
}
else {
memory_type = VFrame::PRIVATE;
+ this->data = 0;
int size = calculate_data_size(this->w, this->h,
this->bytes_per_line, this->color_model);
if(BC_WindowBase::get_resources()->use_vframe_shm() && use_shm) {
this->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
- if(this->shmid < 0) {
- printf("VFrame::allocate_data %d could not allocate shared memory\n", __LINE__);
- }
-
- this->data = (unsigned char*)shmat(this->shmid, NULL, 0);
-//printf("VFrame::allocate_data %d %d %d\n", __LINE__, size, this->shmid);
-
-//printf("VFrame::allocate_data %d %p\n", __LINE__, this->data);
+ if( this->shmid >= 0 ) {
+ this->data = (unsigned char*)shmat(this->shmid, NULL, 0);
+//printf("VFrame::allocate_data %d %d %d %p\n", __LINE__, size, this->shmid, this->data);
// This causes it to automatically delete when the program exits.
- shmctl(this->shmid, IPC_RMID, 0);
+ shmctl(this->shmid, IPC_RMID, 0);
+ }
+ else {
+ printf("VFrame::allocate_data %d could not allocate"
+ " shared memory, %dx%d (model %d) size=0x%08x\n",
+ __LINE__, w, h, color_model, size);
+ BC_Trace::dump_shm_stats(stdout);
+ }
}
- else {
// Have to use malloc for libpng
-//printf("==vframe %d from %p\n", size, __builtin_return_address(0));
+ if( !data ) {
this->data = (unsigned char *)malloc(size);
+ this->shmid = -1;
}
-
// Memory check
// if(this->w * this->h > 1500 * 1100)
// printf("VFrame::allocate_data 2 this=%p w=%d h=%d this->data=%p\n",