1 // mainwindow.h 2 // LiVES (lives-exe) 3 // (c) G. Finch <salsaman+lives@gmail.com> 2003 - 2019 4 // Released under the GPL 3 or later 5 // see file ../COPYING for licensing details 6 7 #ifndef HAS_LIVES_MAINWINDOW_H 8 #define HAS_LIVES_MAINWINDOW_H 9 10 #include <pthread.h> 11 12 #include "effects-data.h" 13 14 #include "audio.h" 15 16 #ifdef ALSA_MIDI 17 #include <alsa/asoundlib.h> 18 #endif 19 20 #ifdef HAVE_PULSE_AUDIO 21 #include "pulse.h" 22 #endif 23 24 #define BILLIONS(n) (n##000000000l) 25 #define ONE_BILLION BILLIONS(1) 26 #define MILLIONS(n) (n##000000l) 27 #define ONE_MILLION MILLIONS(1) 28 29 #define BILLIONS_DBL(n) (n##000000000.f) 30 #define ONE_BILLION_DBL BILLIONS_DBL(1) 31 #define MILLIONS_DBL(n) (n##000000.) 32 #define ONE_MILLION_DBL MILLIONS_DBL(1) 33 34 // hardware related prefs 35 36 #define TICKS_PER_SECOND ((ticks_t)MILLIONS(100)) ///< ticks per second - GLOBAL TIMEBASE 37 #define TICKS_PER_SECOND_DBL ((double)TICKS_PER_SECOND) ///< actually microseconds / 100. 38 #define USEC_TO_TICKS (TICKS_PER_SECOND / ONE_MILLION) ///< multiplying factor uSec -> ticks_t (def. 100) 39 #define TICKS_TO_NANOSEC (ONE_BILLION / TICKS_PER_SECOND) /// multiplying factor ticks_t -> nSec (def 10) 40 41 #define LIVES_SHORTEST_TIMEOUT (2. * TICKS_PER_SECOND_DBL) // 2 sec timeout 42 #define LIVES_SHORT_TIMEOUT (5. * TICKS_PER_SECOND_DBL) // 5 sec timeout 43 #define LIVES_DEFAULT_TIMEOUT (10. * TICKS_PER_SECOND_DBL) // 10 sec timeout 44 #define LIVES_LONGER_TIMEOUT (20. * TICKS_PER_SECOND_DBL) // 20 sec timeout 45 #define LIVES_LONGEST_TIMEOUT (30. * TICKS_PER_SECOND_DBL) // 30 sec timeout 46 47 #define DEF_FPS 25. 48 49 /// rate to change pb fps when faster/slower pressed (TODO: make pref) 50 #define DEF_FPSCHANGE_AMOUNT 30000 51 52 /// forward/back scratch value (TODO: make pref) 53 #define DEF_SCRATCHBACK_AMOUNT 80000 54 #define DEF_SCRATCHFWD_AMOUNT 80000 55 56 /// adjustment amount for effect parameter via keyboard (TODO: make pref) 57 #define DEF_BLENDCHANGE_AMOUNT 100 58 59 #define LOOP_LOCK_MIN_FRAMES (cfile->pb_fps + 1) 60 61 #define DEF_DL_BANDWIDTH 5000 ///< Kb / sec 62 63 /////// GUI related constants ///////////////////////////////////////////////////////// 64 65 // parameters for resizing the image frames, and for capture 66 #define H_RESIZE_ADJUST (widget_opts.packing_width * 2) 67 #define V_RESIZE_ADJUST (widget_opts.packing_height * 2) 68 69 // space to reserve for the CE timeline 70 // IMPORTANT to fine tune this - TODO 71 #define CE_TIMELINE_VSPACE ((int)(420. * widget_opts.scale)) 72 73 /// char width of combo entries (default) 74 #define COMBOWIDTHCHARS 12 75 76 /// char width of framecounter 77 #define FCWIDTHCHARS 22 78 79 /// char width of preview spinbutton 80 #define PREVSBWIDTHCHARS 8 81 82 // min sizes for the separate play window 83 #define MIN_SEPWIN_WIDTH 600 84 #define MIN_SEPWIN_HEIGHT 36 85 86 #define MENU_HIDE_LIM 24 87 88 /// sepwin/screen size safety margins in pixels 89 #define SCR_WIDTH_SAFETY ((int)(100. * widget_opts.scale)) 90 #define SCR_HEIGHT_SAFETY ((int)(200. * widget_opts.scale)) 91 92 /// height of preview widgets in sepwin 93 #define PREVIEW_BOX_HT ((int)(100. * widget_opts.scale)) 94 95 /// (unexpanded) height of rows in treeviews 96 #define TREE_ROW_HEIGHT ((int)(60. * widget_opts.scale)) 97 98 // a few GUI specific settings 99 #define GUI_SCREEN_WIDTH (mainw->mgeom[widget_opts.monitor].width) 100 #define GUI_SCREEN_HEIGHT (mainw->mgeom[widget_opts.monitor].height) 101 #define GUI_SCREEN_PHYS_WIDTH (mainw->mgeom[widget_opts.monitor].phys_width) 102 #define GUI_SCREEN_PHYS_HEIGHT (mainw->mgeom[widget_opts.monitor].phys_height) 103 #define GUI_SCREEN_X (mainw->mgeom[widget_opts.monitor].x) 104 #define GUI_SCREEN_Y (mainw->mgeom[widget_opts.monitor].y) 105 106 // scaling limits 107 #define SCREEN_SCALE_DEF_WIDTH 1600 108 109 #define SCREEN_169_MIN_WIDTH 1280 110 #define SCREEN_169_MIN_HEIGHT 720 111 112 /// default size for frames 113 #define DEF_FRAME_HSIZE_4K_UNSCALED 3840. 114 #define DEF_FRAME_VSIZE_4K_UNSCALED 2160. 115 116 #define DEF_FRAME_HSIZE_HDTV_UNSCALED 1920. 117 #define DEF_FRAME_VSIZE_HDTV_UNSCALED 1080. 118 119 #define DEF_FRAME_HSIZE_169_UNSCALED 1280. 120 #define DEF_FRAME_VSIZE_169_UNSCALED 720. 121 122 #define DEF_FRAME_HSIZE_43_UNSCALED 1024. 123 #define DEF_FRAME_VSIZE_43_UNSCALED 768. 124 125 #define DEF_FRAME_HSIZE_43S_UNSCALED 640. 126 #define DEF_FRAME_VSIZE_43S_UNSCALED 480. 127 128 #define SCREEN_43S_LIMIT_WIDTH DEF_FRAME_HSIZE_43_UNSCALED 129 #define SCREEN_43S_LIMIT_HEIGHT DEF_FRAME_VSIZE_169_UNSCALED 130 131 #define DEF_FRAME_HSIZE_GUI (((int)(DEF_FRAME_HSIZE_43S_UNSCALED * widget_opts.scale) >> 2) << 1) 132 #define DEF_FRAME_VSIZE_GUI (((int)(DEF_FRAME_VSIZE_43S_UNSCALED * widget_opts.scale) >> 1) << 1) 133 134 // min screen height to show the message area 135 #define MIN_MSGBAR_HEIGHT (widget_opts.scale >= 1. ? ((int)32. * widget_opts.scale) : 46) 136 #define MIN_MSG_AREA_SCRNHEIGHT (DEF_FRAME_VSIZE_GUI + CE_TIMELINE_VSPACE - MIN_MSGBAR_HEIGHT) 137 #define MIN_MSGBOX_LLINES 2 138 139 #define DEF_FRAME_HSIZE_UNSCALED ((GUI_SCREEN_PHYS_WIDTH >= SCREEN_169_MIN_WIDTH && GUI_SCREEN_PHYS_HEIGHT >= SCREEN_169_MIN_HEIGHT) ? \ 140 DEF_FRAME_HSIZE_169_UNSCALED : \ 141 (GUI_SCREEN_PHYS_WIDTH >= SCREEN_43S_LIMIT_WIDTH && GUI_SCREEN_PHYS_HEIGHT >= SCREEN_43S_LIMIT_HEIGHT) ? \ 142 DEF_FRAME_HSIZE_43_UNSCALED : DEF_FRAME_HSIZE_43S_UNSCALED) 143 144 #define DEF_FRAME_VSIZE_UNSCALED ((GUI_SCREEN_PHYS_WIDTH >= SCREEN_169_MIN_WIDTH && GUI_SCREEN_PHYS_HEIGHT >= SCREEN_169_MIN_HEIGHT) ? \ 145 DEF_FRAME_VSIZE_169_UNSCALED : \ 146 (GUI_SCREEN_PHYS_WIDTH >= SCREEN_43S_LIMIT_WIDTH && GUI_SCREEN_PHYS_HEIGHT >= SCREEN_43S_LIMIT_HEIGHT) ? \ 147 DEF_FRAME_VSIZE_43_UNSCALED : DEF_FRAME_VSIZE_43S_UNSCALED) 148 149 #define DEF_GEN_WIDTH DEF_FRAME_HSIZE_UNSCALED 150 #define DEF_GEN_HEIGHT DEF_FRAME_VSIZE_UNSCALED 151 152 #define DEF_FRAME_HSIZE ((((int)((double)DEF_FRAME_HSIZE_UNSCALED * widget_opts.scale)) >> 2) << 2) 153 #define DEF_FRAME_VSIZE ((((int)((double)DEF_FRAME_VSIZE_UNSCALED * widget_opts.scale)) >> 1) << 1) 154 155 #define FRAMEBLANK_MIN_WIDTH ((int)(240. * widget_opts.scale)) 156 #define FRAMEBLANK_MAX_WIDTH ((int)(600. * widget_opts.scale)) 157 158 #define FRAMEBLANK_MIN_HEIGHT ((int)(180. * widget_opts.scale)) 159 #define FRAMEBLANK_MAX_HEIGHT ((int)(400. * widget_opts.scale)) 160 161 #define IMSEP_MAX_HEIGHT ((int)(64. * widget_opts.scale)) 162 #define IMSEP_MAX_WIDTH (GUI_SCREEN_WIDTH - 20) 163 164 #define MAIN_SPIN_SPACER ((int)52. * widget_opts.scale) ///< pixel spacing for start/end spins for clip and multitrack editors 165 166 ///< horizontal size in pixels of the encoder output window 167 #define ENC_DETAILS_WIN_H ((int)(DEF_FRAME_HSIZE_43S_UNSCALED * widget_opts.scale)) 168 ///< vertical size in pixels of the encoder output window 169 #define ENC_DETAILS_WIN_V (((int)(DEF_FRAME_VSIZE_43S_UNSCALED * widget_opts.scale)) >> 1) 170 171 #define MIN_MSG_WIDTH_CHARS ((int)(40. * widget_opts.scale)) ///< min width of text on warning/error labels 172 #define MAX_MSG_WIDTH_CHARS ((int)(200. * widget_opts.scale)) ///< max width of text on warning/error labels 173 174 /// size of the fx dialog windows scrollwindow 175 #define RFX_WINSIZE_H ((int)(GUI_SCREEN_WIDTH >= SCREEN_SCALE_DEF_WIDTH ? 210. * (1. + widget_opts.scale) : \ 176 DEF_FRAME_HSIZE_43S_UNSCALED)) 177 #define RFX_WINSIZE_V ((int)(DEF_FRAME_VSIZE_43S_UNSCALED * widget_opts.scale)) 178 179 #define DLG_BUTTON_WIDTH ((int)(180. * widget_opts.scale)) 180 #define DLG_BUTTON_HEIGHT (widget_opts.css_min_height * 3) 181 182 #define DEF_BUTTON_WIDTH ((int)(180. * widget_opts.scale)) 183 #define DEF_BUTTON_HEIGHT ((((widget_opts.css_min_height >> 1) + 2) >> 1) << 3) 184 185 #define DEF_DIALOG_WIDTH RFX_WINSIZE_H 186 #define DEF_DIALOG_HEIGHT RFX_WINSIZE_V 187 188 #define LIVES_MAIN_WINDOW_WIDGET (mainw->LiVES) 189 #define LIVES_MAIN_WIDGET_WINDOW LIVES_MAIN_WINDOW_WIDGET ///< since I can never remember which way round it is ! 190 191 //////////////////////////////////////////////////////////////////////////////////////////////////////// 192 #define ALL_USED -1 193 194 /// number of function keys 195 #define FN_KEYS 12 196 197 /// FX keys, 1 - 9 normally 198 #define FX_KEYS_PHYSICAL 9 199 #define FX_KEYS_PHYSICAL_EXTRA FX_KEYS_PHYSICAL + 2 200 201 /// must be >= FX_KEYS_PHYSICAL, and <=64 (number of bits in a 64bit int mask) 202 /// (max number of keys accesible through rte window or via OSC) 203 #define FX_KEYS_MAX_VIRTUAL 64 ///< the "metaphysical" keys 204 205 /// the rest of the keys are accessible through the multitrack renderer (must, be > FX_KEYS_MAX_VIRTUAL) 206 #define FX_KEYS_MAX 65536 207 208 #define EFFECT_NONE 0 209 #define GU641 ((uint64_t)1) 210 211 #define MAX_FX_THREADS 1024 ///< may be increased if necessary 212 213 #define LIVES_DEF_DCLICK_TIME 400 ///< default double click time (milliseconds), can be overriden by system settings 214 #define LIVES_DEF_DCLICK_DIST 5 ///< default double click dist. (pixels), can be overriden by system settings 215 216 /// external control types 217 typedef enum { 218 EXT_CNTL_NONE = -1, ///< not used 219 EXT_CNTL_JS, 220 EXT_CNTL_MIDI, 221 MAX_EXT_CNTL 222 } lives_ext_cntl_t; 223 224 /// timebase sources 225 typedef enum { 226 LIVES_TIME_SOURCE_NONE = 0, 227 LIVES_TIME_SOURCE_SYSTEM, 228 LIVES_TIME_SOURCE_SOUNDCARD, 229 LIVES_TIME_SOURCE_EXTERNAL 230 } lives_time_source_t; 231 232 /// toy types 233 typedef enum { 234 LIVES_TOY_NONE = 0, 235 LIVES_TOY_MAD_FRAMES, 236 LIVES_TOY_TV 237 } lives_toy_t; 238 239 typedef enum { 240 LIVES_DIALOG_INFO, 241 LIVES_DIALOG_ERROR, 242 LIVES_DIALOG_WARN, 243 LIVES_DIALOG_WARN_WITH_CANCEL, 244 LIVES_DIALOG_YESNO, 245 LIVES_DIALOG_QUESTION, 246 LIVES_DIALOG_ABORT_OK, 247 LIVES_DIALOG_ABORT_RETRY, 248 LIVES_DIALOG_RETRY_CANCEL, 249 LIVES_DIALOG_ABORT_CANCEL_RETRY, 250 LIVES_DIALOG_CANCEL_RETRY_BROWSE, 251 LIVES_DIALOG_SKIP_RETRY_BROWSE, 252 LIVES_DIALOG_ABORT 253 } lives_dialog_t; 254 255 #define DVD_AUDIO_CHAN_MIN 128 256 #define DVD_AUDIO_CHAN_DEFAULT 128 257 #define DVD_AUDIO_CHAN_MAX 159 258 259 enum { 260 LIVES_DEVICE_CD = 0, 261 LIVES_DEVICE_DVD, // 1 262 LIVES_DEVICE_VCD, // 2 263 LIVES_DEVICE_INTERNAL, // 2 264 LIVES_DEVICE_TV_CARD, // 4 265 LIVES_DEVICE_FW_CARD, // 5 266 }; 267 268 #define USE_LIVES_THEMEING (1 << 0) 269 #define LIVES_THEME_DARK (1 << 1) 270 #define LIVES_THEME_COMPACT (1 << 2) 271 272 #define THEME_DETAIL_NAME "theme_name" 273 #define THEME_DETAIL_STYLE "theme_style" 274 #define THEME_DETAIL_SEPWIN_IMAGE "sepwin_image" 275 #define THEME_DETAIL_FRAMEBLANK_IMAGE "frameblank_image" 276 #define THEME_DETAIL_NORMAL_FORE "normal_fore" 277 #define THEME_DETAIL_NORMAL_BACK "normal_back" 278 #define THEME_DETAIL_ALT_FORE "alt_fore" 279 #define THEME_DETAIL_ALT_BACK "alt_back" 280 #define THEME_DETAIL_INFO_TEXT "info_text" 281 #define THEME_DETAIL_INFO_BASE "info_base" 282 283 #define THEME_DETAIL_AUDCOL "audcol" 284 #define THEME_DETAIL_VIDCOL "vidcol" 285 #define THEME_DETAIL_FXCOL "fxcol" 286 #define THEME_DETAIL_MT_TLREG "mt_tlreg" 287 #define THEME_DETAIL_MT_MARK "mt_mark" 288 #define THEME_DETAIL_MT_EVBOX "mt_evbox" 289 #define THEME_DETAIL_MT_TCFG "mt_timecode_fg" 290 #define THEME_DETAIL_MT_TCBG "mt_timecode_bg" 291 #define THEME_DETAIL_FRAME_SURROUND "frame_surround" 292 #define THEME_DETAIL_CE_SEL "ce_sel" 293 #define THEME_DETAIL_CE_UNSEL "ce_unsel" 294 295 /// set in set_palette_colours() 296 typedef struct { 297 int style; 298 #define STYLE_PLAIN 0 ///< no theme (theme 'none') 299 #define STYLE_1 (1<<0) ///< turn on theming if set 300 #define STYLE_2 (1<<1) ///< colour the spinbuttons on the front page if set 301 #define STYLE_3 (1<<2) ///< style is lightish - allow themeing of widgets with dark text, otherwise use menu bg 302 #define STYLE_4 (1<<3) ///< separator col. in mt 303 304 #define STYLE_LIGHT STYLE_3 305 306 LiVESWidgetColor white; 307 LiVESWidgetColor black; 308 LiVESWidgetColor pink; 309 LiVESWidgetColor light_red; 310 LiVESWidgetColor light_green; 311 LiVESWidgetColor dark_red; 312 LiVESWidgetColor dark_orange; 313 314 LiVESWidgetColor grey20; 315 LiVESWidgetColor grey25; 316 LiVESWidgetColor grey45; 317 LiVESWidgetColor grey60; 318 LiVESWidgetColor fade_colour; 319 320 LiVESWidgetColor banner_fade_text; 321 322 // set via theme API 323 324 LiVESWidgetColor normal_back; 325 LiVESWidgetColor normal_fore; 326 327 LiVESWidgetColor menu_and_bars; 328 LiVESWidgetColor menu_and_bars_fore; 329 LiVESWidgetColor info_text; 330 LiVESWidgetColor info_base; 331 332 LiVESWidgetColor mt_timecode_bg; 333 LiVESWidgetColor mt_timecode_fg; 334 335 LiVESWidgetColor nice1; 336 LiVESWidgetColor nice2; 337 LiVESWidgetColor nice3; 338 339 lives_colRGBA64_t audcol; 340 lives_colRGBA64_t vidcol; 341 lives_colRGBA64_t fxcol; 342 lives_colRGBA64_t mt_timeline_reg; 343 344 lives_colRGBA64_t frame_surround; 345 lives_colRGBA64_t mt_mark; 346 lives_colRGBA64_t mt_evbox; 347 348 lives_colRGBA64_t ce_sel; 349 lives_colRGBA64_t ce_unsel; 350 } _palette; 351 352 /// screen details 353 typedef struct { 354 int x, y; 355 int width, height; 356 int phys_width, phys_height; 357 LiVESXDevice *mouse_device; ///< unused for gtk+ < 3.0.0 358 LiVESXDisplay *disp; 359 LiVESXScreen *screen; 360 #if GTK_CHECK_VERSION(3, 22, 0) 361 LiVESXMonitor *monitor; 362 #endif 363 double dpi; 364 double scale; 365 boolean primary; 366 } lives_mgeometry_t; 367 368 /// constant strings 369 enum { 370 LIVES_STRING_CONSTANT_ANY = 0, 371 LIVES_STRING_CONSTANT_NONE, 372 LIVES_STRING_CONSTANT_RECOMMENDED, 373 LIVES_STRING_CONSTANT_DISABLED, 374 LIVES_STRING_CONSTANT_CL, ///< "the current layout" 375 LIVES_STRING_CONSTANT_BUILTIN, 376 LIVES_STRING_CONSTANT_CUSTOM, 377 LIVES_STRING_CONSTANT_TEST, 378 LIVES_STRING_CONSTANT_CLOSE_WINDOW, 379 NUM_LIVES_STRING_CONSTANTS 380 }; 381 382 // executables 383 // mandatory 384 #define EXEC_SMOGRIFY "smogrify" 385 #define EXEC_PERL "perl" 386 #define EXEC_MPLAYER "mplayer" 387 #define EXEC_MPLAYER2 "mplayer2" 388 #define EXEC_MPV "mpv" 389 390 // recommended 391 #define EXEC_SOX "sox" 392 #define EXEC_PULSEAUDIO "pulseaudio" 393 #define EXEC_CONVERT "convert" 394 #define EXEC_COMPOSITE "composite" 395 #define EXEC_IDENTIFY "identify" 396 #define EXEC_FFPROBE "ffprobe" 397 #define EXEC_FFMPEG "ffmpeg" 398 #define EXEC_FILE "file" 399 #define EXEC_YOUTUBE_DL "youtube-dl" 400 #define EXEC_YOUTUBE_DLC "youtube-dlc" 401 #define EXEC_PIP "pip" 402 #if defined(IS_FREEBSD) || defined(__DragonFly__) 403 #define EXEC_MD5SUM "md5" 404 #else 405 #define EXEC_MD5SUM "md5sum" 406 #endif 407 #define EXEC_GZIP "gzip" 408 #define EXEC_DU "du" 409 #define EXEC_WGET "wget" 410 #define EXEC_CURL "curl" 411 412 // optional 413 #define EXEC_PYTHON "python" 414 #define EXEC_AUTOLIVES_PL "autolives.pl" ///< shipped 415 #define EXEC_MIDISTART "lives-midistart" ///< shipped 416 #define EXEC_MIDISTOP "lives-midistop" ///< shipped 417 #define EXEC_JACKD "jackd" ///< recommended if (!have_pulseaudio) 418 #define EXEC_DVGRAB "dvgrab" 419 #define EXEC_CDDA2WAV "cdda2wav" 420 #define EXEC_ICEDAX "icedax" 421 #define EXEC_GDB "gdb" 422 #define EXEC_XWININFO "xwininfo" 423 #define EXEC_GCONFTOOL_2 "gconftool-2" 424 #define EXEC_XDG_SCREENSAVER "xdg-screensaver" 425 //#define EXEC_XDG_OPEN "xdg-open" 426 #define EXEC_WMCTRL "wmctrl" 427 #define EXEC_XDOTOOL "xdotool" 428 #define EXEC_PLAY "play" 429 #define EXEC_GIO "gio" 430 #define EXEC_MKTEMP "mktemp" 431 #define EXEC_SNAP "snap" 432 433 /// other executables 434 #define EXEC_SUDO "sudo" 435 436 // file types 437 #define LIVES_FILE_TYPE_UNKNOWN (0ul) 438 439 #define LIVES_FILE_TYPE_FIFO (1ul << 0) 440 #define LIVES_FILE_TYPE_CHAR_DEV (1ul << 1) 441 #define LIVES_FILE_TYPE_DIRECTORY (1ul << 2) 442 #define LIVES_FILE_TYPE_BLOCK_DEV ((1ul << 1) | (1ul << 2)) 443 #define LIVES_FILE_TYPE_FILE (1ul << 3) 444 #define LIVES_FILE_TYPE_SYMLINK (1ul << 4) 445 #define LIVES_FILE_TYPE_SOCKET (1ul << 5) 446 447 #define LIVES_FILE_TYPE_PIPE (1ul << 6) 448 #define LIVES_FILE_TYPE_STREAM_LOCAL (1ul << 7) 449 #define LIVES_FILE_TYPE_STREAM_REMOTE (1ul << 8) 450 451 #define LIVES_FILE_TYPE_MASK (0xFFFF) 452 453 #define LIVES_FILE_TYPE_FLAG_SYMLINK (1ul << 32) 454 #define LIVES_FILE_TYPE_FLAG_EXECUTABLE (1ul << 33) 455 #define LIVES_FILE_TYPE_FLAG_UNWRITEABLE (1ul << 34) 456 #define LIVES_FILE_TYPE_FLAG_INACCESSIBLE (1ul << 35) 457 458 #define LIVES_FILE_TYPE_FLAG_EMPTY (1ul << 59) 459 #define LIVES_FILE_TYPE_FLAG_MISSING (1ul << 60) 460 #define LIVES_FILE_TYPE_FLAG_DAMAGED (1ul << 61) 461 #define LIVES_FILE_TYPE_FLAG_INCOMPLETE (1ul << 62) 462 #define LIVES_FILE_TYPE_FLAG_SPECIAL (1ul << 63) 463 464 #define LIVES_FILE_IS_FILE(ftype) ((ftype & LIVES_FILE_TYPE_FILE) ? TRUE : FALSE) 465 #define LIVES_FILE_IS_DIRECTORY(ftype) ((ftype & LIVES_FILE_TYPE_DIRECTORY) ? TRUE : FALSE) 466 #define LIVES_FILE_IS_BLOCK_DEV(ftype) ((ftype & LIVES_FILE_TYPE_BLOCK_DEV) == LIVES_FILE_TYPE_BLOCK_DEV \ 467 ? TRUE : FALSE) 468 #define LIVES_FILE_IS_CHAR_DEV(ftype) ((ftype & LIVES_FILE_TYPE_CHAR_DEV) ? TRUE : FALSE) 469 470 #define LIVES_FILE_IS_EMPTYY_FILE(ftype) ((ftype & LIVES_FILE_TYPE_FLAG_EMPTY) && LIVES_FILE_IS_FILE(ftype) \ 471 ? TRUE : FALSE) 472 #define LIVES_FILE_IS_EMPTY_DIR(ftype) ((ftype & LIVES_FILE_TYPE_FLAG_EMPTY) && LIVES_FILE_IS_DIR(ftype) \ 473 ? TRUE : FALSE) 474 475 #define LIVES_FILE_IS_MISSING(ftype) ((ftype & LIVES_FILE_TYPE_FLAG_MISSING) ? TRUE : FALSE) 476 477 // image types (string) 478 #define LIVES_IMAGE_TYPE_UNKNOWN "" 479 #define LIVES_IMAGE_TYPE_JPEG "jpeg" 480 #define LIVES_IMAGE_TYPE_PNG "png" 481 482 // audio types (string) 483 #define LIVES_AUDIO_TYPE_PCM "pcm" 484 485 // file extensions 486 #define LIVES_FILE_EXT_TMP "tmp" 487 #define LIVES_FILE_EXT_PNG "png" 488 #define LIVES_FILE_EXT_JPG "jpg" 489 #define LIVES_FILE_EXT_MGK "mgk" 490 #define LIVES_FILE_EXT_PRE "pre" 491 #define LIVES_FILE_EXT_NEW "new" 492 #define LIVES_FILE_EXT_MAP "map" 493 #define LIVES_FILE_EXT_SCRAP "scrap" 494 #define LIVES_FILE_EXT_TEXT "txt" 495 #define LIVES_FILE_EXT_BAK "bak" 496 #define LIVES_FILE_EXT_BACK "back" 497 #define LIVES_FILE_EXT_WEBM "webm" 498 #define LIVES_FILE_EXT_MP4 "mp4" 499 500 #define LIVES_FILE_EXT_BACKUP "lv1" 501 #define LIVES_FILE_EXT_PROJECT "lv2" 502 503 #define LIVES_FILE_EXT_TAR "tar" 504 #define LIVES_FILE_EXT_GZIP "gz" 505 #define LIVES_FILE_EXT_TAR_GZ LIVES_FILE_EXT_TAR "." LIVES_FILE_EXT_GZIP 506 507 #define LIVES_FILE_EXT_SRT "srt" 508 #define LIVES_FILE_EXT_SUB "sub" 509 510 #define LIVES_FILE_EXT_PCM "pcm" 511 #define LIVES_FILE_EXT_WAV "wav" 512 513 #define LIVES_FILE_EXT_LAYOUT "lay" 514 515 #define LIVES_FILE_EXT_RFX_SCRIPT "script" 516 517 ////////////////////////////// 518 519 // URLs 520 #define LIVES_WEBSITE PACKAGE_URL 521 #define LIVES_MANUAL_URL LIVES_WEBSITE "/manual/" 522 #define LIVES_MANUAL_FILENAME "LiVES_manual.html" 523 #define LIVES_AUTHOR_EMAIL "salsaman+lives@gmail.com" 524 #define LIVES_DONATE_URL "https://sourceforge.net/p/lives/donate/" 525 #define LIVES_BUG_URL PACKAGE_BUGREPORT 526 #define LIVES_FEATURE_URL "https://sourceforge.net/p/lives/feature-requests/" 527 #define LIVES_TRANSLATE_URL "https://translations.launchpad.net/lives/trunk" 528 529 // file names 530 #define DLL_NAME "so" 531 532 #define LIVES_STATUS_FILE_NAME ".status" 533 #define LIVES_ENC_DEBUG_FILE_NAME ".debug_out" 534 535 #define TOTALSAVE_NAME "totalsave" 536 #define CLIP_BINFMT_CHECK "LiVESXXX" 537 #define CLIP_AUDIO_FILENAME "audio" 538 #define CLIP_TEMP_AUDIO_FILENAME "audiodump." LIVES_FILE_EXT_PCM 539 540 #define WORKDIR_LITERAL "workdir" 541 #define WORKDIR_LITERAL_LEN 7 542 543 #define HEADER_LITERAL "header" 544 #define AHEADER_LITERAL "aheader" 545 546 #define THEME_LITERAL "theme" 547 #define THEME_SEP_IMG_LITERAL "main" 548 #define THEME_FRAME_IMG_LITERAL "frame" 549 #define THEME_HEADER HEADER_LITERAL "." THEME_LITERAL 550 #define THEME_HEADER_2 THEME_HEADER "_gtk2" 551 552 #define LIVES_THEME_NONE "none" 553 #define LIVES_THEME_CAMERA "camera" 554 555 #define LIVES_CLIP_HEADER HEADER_LITERAL ".lives" 556 #define LIVES_ACLIP_HEADER AHEADER_LITERAL ".lives" 557 #define LIVES_CLIP_HEADER_NEW HEADER_LITERAL "." LIVES_FILE_EXT_NEW 558 #define LIVES_ACLIP_HEADER_NEW AHEADER_LITERAL "." LIVES_FILE_EXT_NEW 559 #define LIVES_CLIP_HEADER_OLD HEADER_LITERAL 560 #define LIVES_CLIP_HEADER_OLD2 LIVES_CLIP_HEADER_OLD "2" 561 562 #define SUBS_FILENAME "subs" 563 564 #define CLIP_ORDER_FILENAME "order" 565 566 #define SET_LOCK_FILENAME "lock" 567 568 #define CLIP_ARCHIVE_NAME "__CLIP_ARCHIVE-" 569 570 #define LAYOUT_FILENAME "layout" 571 #define LAYOUT_MAP_FILENAME LAYOUT_FILENAME "." LIVES_FILE_EXT_MAP 572 #define LAYOUT_NUMBERING_FILENAME LAYOUT_FILENAME "_numbering" 573 574 #define TEMPFILE_MARKER "can_remove" 575 576 // trash removal 577 #define LIVES_FILENAME_NOREMOVE ".noremove" 578 #define LIVES_FILENAME_INUSE ".inuse" 579 #define LIVES_FILENAME_NOCLEAN ".noclean" 580 581 #define TRASH_NAME "__TRASH-" 582 #define TRASH_REMOVE "remove" 583 #define TRASH_RECOVER "recover" 584 #define TRASH_LEAVE "leave" 585 586 #define UNREC_CLIPS_DIR "unrecoverable_clips" 587 #define UNREC_LAYOUTS_DIR "unrecoverable_layouts" 588 589 // directory names 590 #define DATA_DIR "share/lives" 591 #define LIVES_DEVICE_DIR "/dev/" 592 #define LIVES_DEVNULL "/dev/null" 593 594 // system-wide defaults in prefs->prefix_dir 595 #define THEME_DIR "/share/lives/themes/" 596 #define PLUGIN_SCRIPTS_DIR "/share/lives/plugins/" 597 #define PLUGIN_COMPOUND_DIR "/share/lives/plugins/" 598 #define DOC_DIR "/share/doc/lives-" 599 #define PLUGIN_EXEC_DIR "/lives/plugins/" 600 #define ICON_DIR "/share/lives/icons/" 601 #define DESKTOP_ICON_DIR "/share/icons/hicolor/256x256/apps" 602 603 // per-user defaults 604 #define LOCAL_HOME_DIR ".local" 605 #define LIVES_DEF_CONFIG_DATADIR DATA_DIR /// 606 607 #define LIVES_DEF_CONFIG_DIR ".config" ///< in $HOME : used once to set configfile, and then discarded 608 #define LIVES_DEF_CONFIG_FILE "settings" ///< in LIVES_DEF_CONFIG_DIR unless overridden 609 610 #define LIVES_DEF_CONFIG_FILE_OLD ".lives" ///< pre 3.2.0 611 #define LIVES_DEF_CONFIG_DATADIR_OLD ".lives-dir" ///< pre 3.2.0 612 613 #define STOCK_ICONS_DIR "stock-icons" 614 615 #define LIVES_DEVICEMAP_DIR "devicemaps" 616 #define LIVES_DEF_WORK_NAME "livesprojects" 617 #define LIVES_RESOURCES_DIR "resources" 618 619 #define LAYOUTS_DIRNAME "layouts" 620 #define CLIPS_DIRNAME "clips" 621 #define IMPORTS_DIRNAME "imports" 622 623 #define SET_LOCK_FILE(set_name, lockfile) lives_build_filename(prefs->workdir, set_name, lockfile, NULL); 624 #define SET_LOCK_FILES(set_name) SET_LOCK_FILE(set_name, SET_LOCK_FILENAME); 625 626 // directory where we store 1 clip / all clips if handle is NULL 627 #define MAKE_CLIPS_DIRNAME(set, handle) lives_build_filename(prefs->workdir, set, CLIPS_DIRNAME, handle, NULL); 628 629 // directory of a clip in the current set 630 #define CLIPDIR(handle) MAKE_CLIPS_DIRNAME(mainw->set_name, handle) 631 632 // directory for all clips in set 633 #define CLIPS_DIR(set) MAKE_CLIPS_DIRNAME(set, NULL) 634 635 // filters 636 #define LIVES_SUBS_FILTER {"*.srt", "*.sub", NULL} 637 #define LIVES_AUDIO_LOAD_FILTER {"*.it", "*.mp3", "*.wav", "*.ogg", "*.mod", "*.xm", "*.wma", "*.flac", NULL} 638 #define LIVES_TV_CARD_TYPES {"v4l2", "v4l", "bsdbt848", "dummy", "*autodetect", "yv12", "*", "rgb32", "rgb24", "rgb16", \ 639 "rgb15", "uyvy", "yuy2", "i2420", NULL} 640 641 #define NUM_VOL_LIGHTS 10 ///< unused 642 643 /* actions */ 644 #define UNMATCHED -1 645 #define START_PLAYBACK 0 646 #define STOP_PLAYBACK 1 647 #define CLIP_SELECT 2 648 #define PLAY_FORWARDS 3 649 #define PLAY_BACKWARDS 4 650 #define REVERSE_PLAYBACK 5 651 #define PLAY_FASTER 6 652 #define PLAY_SLOWER 7 653 #define TOGGLE_FREEZE 8 654 #define SET_FRAMERATE 9 655 #define START_RECORDING 10 656 #define STOP_RECORDING 11 657 #define TOGGLE_RECORDING 12 658 #define SWAP_FOREGROUND_BACKGROUND 13 659 #define RESET_EFFECT_KEYS 14 660 #define ENABLE_EFFECT_KEY 15 661 #define DISABLE_EFFECT_KEY 16 662 #define TOGGLE_EFFECT_KEY 17 663 #define SET_PARAMETER_VALUE 18 664 #define NEXT_CLIP_SELECT 19 665 #define PREV_CLIP_SELECT 20 666 #define SET_FPS_RATIO 21 667 #define RETRIGGER_CLIP 22 668 #define NEXT_MODE_CYCLE 23 669 #define PREV_MODE_CYCLE 24 670 #define SET_VPP_PARAMETER_VALUE 25 671 #define OSC_NOTIFY 26 672 673 typedef struct { 674 int idx; 675 char *key; 676 char *cmdlist; 677 char *futures; 678 } lives_permmgr_t; 679 680 /// helper ptoc_threads 681 #define N_HLP_PROCTHREADS 128 682 #define PT_LAZY_RFX 16 683 #define PT_LAZY_DSUSED 17 684 685 typedef struct { 686 char *name; 687 lives_rect_t *rects; // for future use 688 int z_index; // for future use 689 } lives_screen_area_t; 690 691 typedef struct { 692 ticks_t tleft; 693 volatile ticks_t lastcheck; 694 } lives_timeout_t; 695 696 typedef int lives_alarm_t; 697 698 /// where do we add the builtin tools in the tools menu 699 #define RFX_TOOL_MENU_POSN 2 700 701 /// mainw->msg bytesize 702 #define MAINW_MSG_SIZE 8192 703 704 typedef struct { 705 // processing / busy dialog (TODO - move into dialogs.h / or prog_dialogs.h) 706 LiVESWidget *processing; 707 LiVESWidget *progressbar; 708 LiVESWidget *label; 709 LiVESWidget *label2; 710 LiVESWidget *label3; 711 LiVESWidget *stop_button; 712 LiVESWidget *pause_button; 713 LiVESWidget *preview_button; 714 LiVESWidget *cancel_button; 715 LiVESWidget *scrolledwindow; 716 frames_t progress_start, progress_end; 717 frames_t frames_done; 718 double frac_done; 719 boolean is_ready; 720 int owner; 721 } xprocess; 722 723 typedef struct { 724 char msg[MAINW_MSG_SIZE]; 725 726 // files 727 int current_file; 728 int first_free_file; 729 lives_clip_t *files[MAX_FILES + 1]; ///< +1 for the clipboard 730 char vid_load_dir[PATH_MAX]; 731 char vid_save_dir[PATH_MAX]; 732 char vid_dl_dir[PATH_MAX]; 733 char audio_dir[PATH_MAX]; 734 char image_dir[PATH_MAX]; 735 char proj_load_dir[PATH_MAX]; 736 char proj_save_dir[PATH_MAX]; 737 char recent_file[PATH_MAX]; 738 int untitled_number; 739 int cap_number; 740 int clips_available; 741 742 /// hash table of clips in menu order 743 LiVESList *cliplist; 744 745 LiVESSList *clips_group; 746 747 /// sets 748 #define MAX_SET_NAME_LEN 128 749 char set_name[256]; // actually 128 is the (soft) limit now, filesystem encoding 750 boolean was_set; 751 boolean leave_files; ///< TRUE to leave clip files on disk even when closing (default FALSE) 752 int num_sets; /// number of sets in workdir (minus the current set), -1 if not checked 753 LiVESList *set_list; /// list of set names in current workdir, mau be NULL 754 755 // playback state 756 boolean playing_sel; 757 boolean preview; 758 boolean preview_rendering; 759 boolean faded; 760 boolean double_size; 761 boolean sep_win; 762 boolean fs; 763 boolean loop; 764 volatile boolean loop_cont; 765 volatile boolean ping_pong; 766 boolean oloop; 767 boolean oloop_cont; 768 boolean oping_pong; 769 boolean loop_locked; 770 boolean mute; 771 int audio_start, audio_end; 772 773 boolean ext_playback; ///< using external video playback plugin 774 volatile boolean ext_audio; ///< using external video playback plugin to stream audio 775 776 int ptr_x, ptr_y; 777 778 frames_t fps_measure; ///< show fps stats after playback 779 frames_t fps_mini_measure; ///< show fps stats during playback 780 ticks_t fps_mini_ticks; 781 double inst_fps; 782 783 // flags 784 boolean save_with_sound; 785 boolean ccpd_with_sound; 786 boolean selwidth_locked; 787 boolean is_ready; 788 boolean configured; 789 boolean fatal; ///< got fatal signal 790 boolean opening_loc; ///< opening location (streaming) 791 boolean dvgrab_preview; 792 boolean switch_during_pb; 793 boolean clip_switched; ///< for recording - did we switch clips ? 794 volatile boolean record; 795 796 char *fsp_tmpdir; 797 volatile boolean in_fs_preview; 798 volatile lives_cancel_t cancelled; 799 lives_cancel_type_t cancel_type; 800 801 boolean error; 802 803 weed_event_t *event_list; ///< current event_list, for recording 804 weed_event_t *stored_event_list; ///< stored mt -> clip editor 805 boolean stored_event_list_changed; 806 boolean stored_event_list_auto_changed; 807 boolean stored_layout_save_all_vals; 808 char stored_layout_name[PATH_MAX]; 809 810 LiVESList *stored_layout_undos; 811 size_t sl_undo_buffer_used; 812 unsigned char *sl_undo_mem; 813 int sl_undo_offset; 814 815 LiVESList *new_lmap_errors; 816 817 short endian; 818 819 /// states 820 boolean is_processing; 821 boolean is_rendering; 822 boolean resizing; 823 824 boolean foreign; ///< for external window capture 825 boolean record_foreign; 826 boolean t_hidden; 827 828 // recording from an external window 829 uint32_t foreign_key; 830 831 #ifdef GUI_GTK 832 #if GTK_CHECK_VERSION(3, 0, 0) 833 Window foreign_id; 834 #else 835 GdkNativeWindow foreign_id; 836 GdkColormap *foreign_cmap; 837 GdkPixmap *foreign_map; 838 #endif 839 #else 840 Window foreign_id; 841 #endif 842 843 LiVESXWindow *foreign_window; 844 int foreign_width, foreign_height; 845 int foreign_bpp; 846 char *foreign_visual; 847 848 /// some VJ effects / toys 849 boolean nervous; 850 int swapped_clip; ///< maintains the current cliplist postion even if we swap fg and bg clips 851 lives_toy_t toy_type; 852 boolean toy_go_wild; ///< some silliness 853 854 /// rendered fx 855 lives_rfx_t *rendered_fx; 856 int num_rendered_effects_builtin; 857 int num_rendered_effects_custom; 858 int num_rendered_effects_test; 859 860 // for the merge dialog 861 int last_transition_idx; 862 int last_transition_loops; 863 boolean last_transition_loop_to_fit; 864 boolean last_transition_align_start; 865 boolean last_transition_ins_frames; 866 867 volatile uint64_t rte; ///< current max for VJ mode == 64 effects on fg clip 868 869 uint32_t last_grabbable_effect; // (spelt wrong but I like it this way) 870 int rte_keys; ///< which effect is bound to keyboard (m) modechange and ctrl-alt-up-arrow / ctrl-alt-down-arrow param changes 871 int num_tr_applied; ///< number of transitions active 872 double blend_factor; ///< keyboard control parameter 873 874 int scrap_file; ///< we throw odd sized frames here when recording in real time; used if a source is a generator or stream 875 int ascrap_file; ///< scrap file for recording audio scraps 876 877 lives_pgid_t alives_pgid; // 0, or procid for autolives 878 879 // copy/paste 880 boolean insert_after; 881 boolean with_sound; 882 883 // selection 884 int sel_start; 885 short sel_move; 886 887 /// which bar should we move ? 888 #define SEL_MOVE_START 1 889 #define SEL_MOVE_END 2 890 #define SEL_MOVE_AUTO 3 891 #define SEL_MOVE_SINGLE 4 892 893 // prefs (Save on exit) 894 int prefs_changed; 895 boolean prefs_need_restart; 896 897 /// default sizes for when no file is loaded 898 int def_width, def_height; 899 double ptrtime; 900 ///////////////////////////////////////////////// 901 902 // end of static-ish info 903 int old_scr_width, old_scr_height; 904 905 /// extra parameters for opening special files 906 char *file_open_params; 907 boolean open_deint; 908 909 int aud_file_to_kill; ///< # of audio file to kill on crash 910 911 boolean reverse_pb; ///< used in osc.c 912 913 /// TODO - make this a mutex and more finely grained : things we need to block are (clip switches, clip closure, effects on/off, etc) 914 /// this field may even be totally / partially redundant now since mainw->noswitch has been re-implemented 915 /// combined with filter_mutex_lock() 916 boolean osc_block; 917 918 int osc_auto; ///< bypass user choices automatically 919 920 /// encode width, height and fps set externally 921 int osc_enc_width, osc_enc_height; 922 float osc_enc_fps; 923 924 /// PLAYBACK 925 926 int pwidth; ///< playback width in RGB pixels 927 int pheight; ///< playback height 928 929 volatile lives_whentostop_t whentostop; 930 931 frames_t play_start, play_end; 932 933 // for jack transport 934 boolean jack_can_stop, jack_can_start; 935 936 // a/v seek synchronisation 937 pthread_cond_t avseek_cond; 938 pthread_mutex_t avseek_mutex; 939 volatile boolean video_seek_ready; 940 volatile boolean audio_seek_ready; 941 942 /// which number file we are playing (or -1) [generally mainw->current_file] 943 int playing_file; 944 945 // for the internal player 946 LiVESWidget *play_image; 947 LiVESWidget *play_window; 948 weed_plant_t *frame_layer; 949 950 lives_painter_surface_t *play_surface; 951 lives_painter_surface_t *pwin_surface; 952 953 /// predictive caching apparatus 954 weed_plant_t *frame_layer_preload; 955 frames64_t pred_frame; 956 int pred_clip; 957 958 /// actual / last frame being displayed 959 frames_t actual_frame; 960 961 /// and the audio 'frame' for when we are looping 962 double aframeno; 963 964 frames_t record_frame; ///< frame number to insert in recording 965 966 /// recording values - to be inserted at the following video frame 967 volatile int rec_aclip; 968 volatile double rec_avel; 969 volatile double rec_aseek; 970 971 int pre_src_file; ///< video file we were playing before any ext input started 972 int pre_src_audio_file; ///< audio file we were playing before any ext input started 973 int pre_play_file; ///< the current file before playback started 974 975 /// background clip details 976 int blend_file, last_blend_file, new_blend_file; 977 weed_plant_t *blend_layer; 978 979 /// here we can store the details of the blend file at the insertion point, if nothing changes we can target this to optimise 980 volatile int blend_palette; 981 int blend_width, blend_height; 982 int blend_clamping, blend_sampling, blend_subspace; 983 int blend_gamma; 984 985 /// stored clips (bookmarks) [0] = clip, [1] = frame 986 int clipstore[FN_KEYS - 1][2]; 987 988 /// fixed fps playback; usually fixed_fpsd==0. 989 int fixed_fps_numer, fixed_fps_denom; 990 double fixed_fpsd; ///< <=0. means free playback 991 992 /// timing variables 993 // ticks are measured in 1. / TICKS_PER_SECOND_DBL of a second (by default a tick is 10 nano seconds) 994 995 // for the internal player 996 double period; ///< == 1./cfile->pb_fps (unless cfile->pb_fps is 0.) 997 volatile ticks_t startticks; ///< effective ticks when current frame was (should have been) displayed 998 ticks_t last_startticks; ///< effective ticks when lasty frame was (should have been) displayed 999 ticks_t timeout_ticks; ///< incremented if effect/rendering is paused/previewed 1000 ticks_t origsecs; ///< playback start seconds - subtracted from all other ticks to keep numbers smaller 1001 ticks_t orignsecs; ///< usecs at start of playback - ditto 1002 ticks_t offsetticks; ///< offset for multitrack playback start 1003 volatile ticks_t clock_ticks; ///< unadjusted system time since pb start, measured concurrently with currticks 1004 ticks_t wall_ticks; /// wall clock time, updated whenever lives_get_*_ticks is called 1005 volatile ticks_t currticks; ///< current playback ticks (relative) 1006 ticks_t deltaticks; ///< deltaticks for scratching 1007 ticks_t adjticks; ///< used to equalise the timecode between alternate timer sources (souce -> clock adjustment) 1008 ticks_t cadjticks; ///< used to equalise the timecode between alternate timer sources (clock -> source adjustment) 1009 ticks_t firstticks; ///< ticks when audio started playing (for non-realtime audio plugins) 1010 ticks_t syncticks; ///< adjustment to compensate for missed clock updates when switching time sources 1011 ticks_t stream_ticks; ///< ticks since first frame sent to playback plugin 1012 ticks_t last_display_ticks; /// currticks when last display was shown (used for fixed fps) 1013 int play_sequence; ///< incremented for each playback 1014 1015 double audio_stretch; ///< for fixed fps modes, the value is used to speed up / slow down audio 1016 1017 int size_warn; ///< warn the user that incorrectly sized frames were found (threshold count) 1018 1019 boolean noswitch; ///< value set automatically to prevent 'inopportune' clip switching 1020 boolean cs_permitted; ///< set to TRUE to allow overriding of noswitch in limited circumstances 1021 boolean cs_is_permitted; ///< set automatically when cs_permitted can update the clip 1022 int new_clip; ///< clip we should switch to during playback; switch will happen at the designated SWITCH POINT 1023 boolean ignore_clipswitch; 1024 boolean preview_req; 1025 1026 volatile short scratch; 1027 #define SCRATCH_NONE 0 1028 #define SCRATCH_BACK -1 1029 #define SCRATCH_FWD 1 1030 #define SCRATCH_REV 2 ///< set on direction change (video) 1031 #define SCRATCH_JUMP 3 ///< jump and resync audio 1032 #define SCRATCH_JUMP_NORESYNC 4 ///< jump with no audio resync 1033 1034 #define SCRATCH_FWD_EXTRA 255 1035 #define SCRATCH_BACK_EXTRA 257 1036 1037 ///// 1038 1039 /// video playback plugin was updated; write settings to a file on exit 1040 boolean write_vpp_file; 1041 1042 /// internal fx 1043 boolean internal_messaging; ///< set to indicate that frame processing progress values will be generated internally 1044 lives_render_error_t (*progress_fn)(boolean reset); 1045 1046 volatile boolean threaded_dialog; ///< not really threaded ! but threaded_dialog_spin() can be called to animate it 1047 1048 // fx controls (mostly unused - should be removed and replaced with generic toggle callbacks) 1049 double fx1_val, fx2_val, fx3_val, fx4_val, fx5_val, fx6_val; 1050 int fx1_start, fx2_start, fx3_start, fx4_start; 1051 int fx1_step, fx2_step, fx3_step, fx4_step; 1052 int fx1_end, fx2_end, fx3_end, fx4_end; 1053 boolean fx1_bool, fx2_bool, fx3_bool, fx4_bool, fx5_bool, fx6_bool; 1054 1055 boolean effects_paused; 1056 boolean did_rfx_preview; 1057 1058 uint32_t kb_timer; 1059 1060 volatile boolean clutch; 1061 /// (GUI) function pointers 1062 ulong config_func; 1063 ulong pb_fps_func; 1064 ulong spin_start_func; 1065 ulong spin_end_func; 1066 ulong record_perf_func; 1067 ulong toy_func_none; 1068 ulong toy_func_random_frames; 1069 ulong toy_func_lives_tv; 1070 ulong hnd_id; 1071 ulong loop_cont_func; 1072 ulong mute_audio_func; 1073 ulong fullscreen_cb_func; 1074 ulong sepwin_cb_func; 1075 ulong fsp_func; ///< fileselector preview expose (for image thumbnails) 1076 ulong vj_mode_func; 1077 ulong lb_func; 1078 1079 lives_painter_surface_t *fsp_surface; 1080 1081 lives_funcptr_t abort_hook_func; ///< can be set to point to a function to be run before abort, for critical functions 1082 1083 // selection pointers 1084 ulong mouse_fn1; 1085 boolean mouse_blocked; 1086 1087 lives_mt *multitrack; ///< holds a pointer to the entire multitrack environment; NULL in Clip Edit mode 1088 boolean mt_needs_idlefunc; ///< set if we need to re-add the idlefunc for autobackup 1089 1090 xprocess *proc_ptr; // progress dialog 1091 1092 /// WIDGETS 1093 LiVESWidget *LiVES; ///< toplevel window 1094 LiVESWidget *frame1; 1095 LiVESWidget *frame2; 1096 LiVESWidget *freventbox0; 1097 LiVESWidget *freventbox1; 1098 LiVESWidget *playframe; 1099 LiVESWidget *plug; 1100 LiVESWidget *pl_eventbox; 1101 LiVESWidget *pf_grid; 1102 LiVESPixbuf *imframe; 1103 LiVESPixbuf *camframe; 1104 LiVESPixbuf *imsep; 1105 1106 /// menus 1107 LiVESWidget *open; 1108 LiVESWidget *open_sel; 1109 LiVESWidget *open_vcd_menu; 1110 LiVESWidget *open_vcd_submenu; 1111 LiVESWidget *open_vcd; 1112 LiVESWidget *open_dvd; 1113 LiVESWidget *open_loc; 1114 LiVESWidget *open_utube; 1115 LiVESWidget *open_loc_menu; 1116 LiVESWidget *open_loc_submenu; 1117 LiVESWidget *open_yuv4m; 1118 LiVESWidget *open_lives2lives; 1119 LiVESWidget *send_lives2lives; 1120 LiVESWidget *open_device_menu; 1121 LiVESWidget *open_device_submenu; 1122 LiVESWidget *open_firewire; 1123 LiVESWidget *open_hfirewire; 1124 LiVESWidget *unicap; 1125 LiVESWidget *firewire; 1126 LiVESWidget *tvdev; 1127 LiVESWidget *recent_menu; 1128 LiVESWidget *recent_submenu; 1129 LiVESWidget *recent[N_RECENT_FILES]; 1130 LiVESWidget *save_as; 1131 #ifdef LIBAV_TRANSCODE 1132 LiVESWidget *transcode; 1133 #endif 1134 LiVESWidget *backup; 1135 LiVESWidget *restore; 1136 LiVESWidget *save_selection; 1137 LiVESWidget *close; 1138 LiVESWidget *import_proj; 1139 LiVESWidget *export_proj; 1140 LiVESWidget *import_theme; 1141 LiVESWidget *export_theme; 1142 LiVESWidget *sw_sound; 1143 LiVESWidget *clear_ds; 1144 LiVESWidget *ccpd_sound; 1145 LiVESWidget *quit; 1146 LiVESWidget *undo; 1147 LiVESWidget *redo; 1148 LiVESWidget *copy; 1149 LiVESWidget *cut; 1150 LiVESWidget *insert; 1151 LiVESWidget *paste_as_new; 1152 LiVESWidget *merge; 1153 LiVESWidget *xdelete; 1154 LiVESWidget *select_submenu; 1155 LiVESWidget *select_all; 1156 LiVESWidget *select_new; 1157 LiVESWidget *select_to_end; 1158 LiVESWidget *select_to_aend; 1159 LiVESWidget *select_from_start; 1160 LiVESWidget *select_start_only; 1161 LiVESWidget *select_end_only; 1162 LiVESWidget *select_last; 1163 LiVESWidget *select_invert; 1164 LiVESWidget *lock_selwidth; 1165 LiVESWidget *record_perf; 1166 LiVESWidget *playall; 1167 LiVESWidget *playsel; 1168 LiVESWidget *playclip; 1169 LiVESWidget *rev_clipboard; 1170 LiVESWidget *stop; 1171 LiVESWidget *rewind; 1172 LiVESWidget *full_screen; 1173 LiVESWidget *loop_video; 1174 LiVESWidget *loop_continue; 1175 LiVESWidget *loop_ping_pong; 1176 LiVESWidget *sepwin; 1177 LiVESWidget *mute_audio; 1178 LiVESWidget *sticky; 1179 LiVESWidget *showfct; 1180 LiVESWidget *showsubs; 1181 LiVESWidget *letter; 1182 LiVESWidget *aload_subs; 1183 LiVESWidget *load_subs; 1184 LiVESWidget *erase_subs; 1185 LiVESWidget *fade; 1186 LiVESWidget *dsize; 1187 LiVESWidget *midi_learn; 1188 LiVESWidget *midi_save; 1189 LiVESWidget *change_speed; 1190 LiVESWidget *capture; 1191 LiVESWidget *load_audio; 1192 LiVESWidget *load_cdtrack; 1193 LiVESWidget *eject_cd; 1194 LiVESWidget *recaudio_submenu; 1195 LiVESWidget *recaudio_clip; 1196 LiVESWidget *recaudio_sel; 1197 LiVESWidget *export_submenu; 1198 LiVESWidget *export_allaudio; 1199 LiVESWidget *export_selaudio; 1200 LiVESWidget *append_audio; 1201 LiVESWidget *normalize_audio; 1202 LiVESWidget *trim_submenu; 1203 LiVESWidget *trim_audio; 1204 LiVESWidget *trim_to_pstart; 1205 LiVESWidget *delaudio_submenu; 1206 LiVESWidget *delsel_audio; 1207 LiVESWidget *delall_audio; 1208 LiVESWidget *ins_silence; 1209 LiVESWidget *voladj; 1210 LiVESWidget *fade_aud_in; 1211 LiVESWidget *fade_aud_out; 1212 LiVESWidget *resample_audio; 1213 LiVESWidget *adj_audio_sync; 1214 LiVESWidget *resample_video; 1215 LiVESWidget *preferences; 1216 LiVESWidget *rename; 1217 LiVESWidget *toy_none; 1218 LiVESWidget *toy_random_frames; 1219 LiVESWidget *toy_tv; 1220 LiVESWidget *autolives; 1221 LiVESWidget *show_file_info; 1222 LiVESWidget *show_file_comments; 1223 LiVESWidget *show_clipboard_info; 1224 LiVESWidget *show_messages; 1225 LiVESWidget *show_layout_errors; 1226 LiVESWidget *show_quota; 1227 LiVESWidget *sel_label; 1228 LiVESAccelGroup *accel_group; 1229 LiVESWidget *sep_image; 1230 LiVESWidget *hruler; 1231 LiVESWidget *vj_save_set; 1232 LiVESWidget *vj_load_set; 1233 LiVESWidget *vj_show_keys; 1234 LiVESWidget *rte_defs_menu; 1235 LiVESWidget *rte_defs; 1236 LiVESWidget *save_rte_defs; 1237 LiVESWidget *vj_reset; 1238 LiVESWidget *vj_realize; 1239 LiVESWidget *vj_mode; 1240 LiVESWidget *show_devopts; 1241 LiVESWidget *dev_dabg; 1242 LiVESWidget *dev_timing; 1243 LiVESWidget *mt_menu; 1244 LiVESWidget *troubleshoot; 1245 LiVESWidget *expl_missing; 1246 LiVESWidget *export_custom_rfx; 1247 LiVESWidget *delete_custom_rfx; 1248 LiVESWidget *edit_test_rfx; 1249 LiVESWidget *rename_test_rfx; 1250 LiVESWidget *delete_test_rfx; 1251 LiVESWidget *promote_test_rfx; 1252 1253 ///< for future use 1254 LiVESWidget *vol_checkbuttons[NUM_VOL_LIGHTS][2]; 1255 1256 /// for the fileselection preview 1257 LiVESWidget *fs_playarea; 1258 LiVESWidget *fs_playalign; 1259 LiVESWidget *fs_playframe; 1260 LiVESWidget *fs_playimg; 1261 1262 /// for the framedraw special widget - TODO - use a sub-struct 1263 LiVESWidget *framedraw; ///< the eventbox 1264 LiVESWidget *framedraw_reset; ///< the 'redraw' button 1265 LiVESWidget *framedraw_preview; ///< the 'redraw' button 1266 LiVESWidget *framedraw_spinbutton; ///< the frame number button 1267 LiVESWidget *framedraw_scale; ///< the slider 1268 LiVESWidget *framedraw_maskbox; ///< box for opacity controls 1269 LiVESWidget *framedraw_opscale; ///< opacity 1270 LiVESWidget *framedraw_cbutton; ///< colour for mask 1271 LiVESWidget *fd_frame; ///< surrounding frame widget 1272 1273 lives_painter_surface_t *fd_surface; 1274 1275 weed_plant_t *fd_layer_orig; ///< original layer uneffected 1276 weed_plant_t *fd_layer; ///< framedraw preview layer 1277 1278 int framedraw_frame; ///< current displayed frame 1279 int fd_max_frame; ///< max effected / generated frame 1280 1281 ulong fd_spin_func; ///< spinbutton for framedraw previews 1282 1283 LiVESWidget *hbox3; ///< hbox with start / end spins and selection label (C.E.) 1284 1285 // bars here -> actually text above bars 1286 LiVESWidget *vidbar, *laudbar, *raudbar; 1287 1288 LiVESWidget *spinbutton_end, *spinbutton_start; 1289 1290 LiVESWidget *sa_button; 1291 LiVESWidget *sa_hbox; 1292 1293 LiVESWidget *arrow1; 1294 LiVESWidget *arrow2; 1295 1296 lives_cursor_t cursor_style; 1297 1298 weed_plant_t *filter_map; // the video filter map for rendering 1299 weed_plant_t *afilter_map; // the audio filter map for renering 1300 weed_plant_t *audio_event; // event for audio render tracking 1301 void ** *pchains; // parameter value chains for interpolation 1302 1303 // frame preview in the separate window 1304 LiVESWidget *preview_box; 1305 LiVESWidget *preview_image; 1306 LiVESWidget *preview_spinbutton; 1307 LiVESWidget *preview_scale; 1308 LiVESWidget *preview_hbox; 1309 int preview_frame; 1310 ulong preview_spin_func; 1311 int prv_link; 1312 #define PRV_FREE 0 1313 #define PRV_START 1 1314 #define PRV_END 2 1315 #define PRV_PTR 3 1316 #define PRV_DEFAULT PRV_PTR 1317 1318 lives_painter_surface_t *si_surface, *ei_surface, *pi_surface; 1319 1320 LiVESWidget *start_image, *end_image; 1321 LiVESWidget *playarea; 1322 LiVESWidget *hseparator; 1323 LiVESWidget *message_box; 1324 LiVESWidget *msg_area; 1325 LiVESWidget *msg_scrollbar; 1326 LiVESAdjustment *msg_adj; 1327 1328 lives_painter_surface_t *msg_surface; 1329 1330 LiVESWidget *clipsmenu; 1331 LiVESWidget *eventbox; 1332 LiVESWidget *eventbox2; 1333 LiVESWidget *eventbox3; 1334 LiVESWidget *eventbox4; 1335 LiVESWidget *eventbox5; 1336 1337 // toolbar buttons 1338 LiVESWidget *t_stopbutton; 1339 LiVESWidget *t_fullscreen; 1340 LiVESWidget *t_sepwin; 1341 LiVESWidget *t_infobutton; 1342 1343 LiVESWidget *t_slower; 1344 LiVESWidget *t_faster; 1345 LiVESWidget *t_forward; 1346 LiVESWidget *t_back; 1347 LiVESWidget *t_hide; 1348 1349 LiVESWidget *toolbar; 1350 LiVESWidget *tb_hbox; 1351 LiVESWidget *fs1; 1352 LiVESWidget *top_vbox; 1353 1354 LiVESWidget *l1_tb; 1355 LiVESWidget *l2_tb; 1356 LiVESWidget *l3_tb; 1357 1358 LiVESWidget *int_audio_checkbutton, *ext_audio_checkbutton; 1359 LiVESWidget *ext_audio_mon; 1360 1361 ulong int_audio_func, ext_audio_func; 1362 1363 LiVESWidget *volume_scale; 1364 LiVESWidget *vol_toolitem; 1365 LiVESWidget *vol_label; 1366 1367 // menubar buttons 1368 LiVESWidget *btoolbar; ///< button toolbar - clip editor 1369 LiVESWidget *m_sepwinbutton, *m_playbutton, *m_stopbutton, *m_playselbutton, *m_rewindbutton, 1370 *m_loopbutton, *m_mutebutton; 1371 LiVESWidget *menu_hbox; 1372 LiVESWidget *menubar; 1373 1374 // separate window 1375 int opwx, opwy; 1376 1377 // sepwin buttons 1378 LiVESWidget *preview_controls; 1379 LiVESWidget *p_playbutton, *p_playselbutton, *p_rewindbutton, *p_loopbutton, *p_mutebutton; 1380 LiVESWidget *p_mute_img; 1381 1382 // timer bars 1383 LiVESWidget *video_draw, *laudio_draw, *raudio_draw; 1384 1385 int drawsrc; 1386 lives_painter_surface_t *video_drawable, *laudio_drawable, *raudio_drawable; 1387 1388 // framecounter 1389 LiVESWidget *framebar; 1390 LiVESWidget *framecounter; 1391 LiVESWidget *spinbutton_pb_fps; 1392 LiVESWidget *vps_label; 1393 LiVESWidget *banner; 1394 1395 LiVESWidget *ldg_menuitem; 1396 1397 // (sub)menus 1398 LiVESWidget *files_menu; 1399 LiVESWidget *edit_menu; 1400 LiVESWidget *play_menu; 1401 LiVESWidget *effects_menu; 1402 LiVESWidget *tools_menu; 1403 LiVESWidget *audio_menu; 1404 LiVESWidget *info_menu; 1405 LiVESWidget *advanced_menu; 1406 LiVESWidget *vj_menu; 1407 LiVESWidget *toys_menu; 1408 LiVESWidget *help_menu; 1409 1410 // rendered effects 1411 LiVESWidget *utilities_menu; 1412 LiVESWidget *utilities_submenu; 1413 LiVESWidget *gens_menu; 1414 LiVESWidget *gens_submenu; 1415 LiVESWidget *run_test_rfx_submenu; 1416 LiVESWidget *run_test_rfx_menu; 1417 LiVESWidget *custom_effects_menu; 1418 LiVESWidget *custom_effects_submenu; 1419 LiVESWidget *custom_effects_separator; 1420 LiVESWidget *custom_tools_menu; 1421 LiVESWidget *custom_tools_submenu; 1422 LiVESWidget *custom_tools_separator; 1423 LiVESWidget *custom_gens_menu; 1424 LiVESWidget *custom_gens_submenu; 1425 LiVESWidget *custom_utilities_menu; 1426 LiVESWidget *custom_utilities_submenu; 1427 LiVESWidget *custom_utilities_separator; 1428 LiVESWidget *rte_separator; 1429 1430 int num_tracks; 1431 int *clip_index; 1432 1433 /// maps frame slots to the presentation values (if >= 0, points to a 'virtual' frame in the source clip, -1 indicates a decoded img. frame 1434 frames64_t *frame_index; 1435 1436 LiVESWidget *resize_menuitem; 1437 1438 boolean close_keep_frames; ///< special value for when generating to clipboard 1439 boolean only_close; ///< only close clips - do not exit 1440 volatile boolean is_exiting; ///< set during shutdown (inverse of only_close then) 1441 1442 ulong pw_scroll_func; 1443 boolean msg_area_configed; 1444 1445 /// jack audio player / transport 1446 #ifdef ENABLE_JACK 1447 boolean jack_trans_poll; 1448 jack_driver_t *jackd; ///< jack audio playback device 1449 jack_driver_t *jackd_read; ///< jack audio recorder device 1450 boolean jack_inited; 1451 #define RT_AUDIO 1452 #else 1453 void *jackd; ///< dummy 1454 void *jackd_read; ///< dummy 1455 #endif 1456 1457 /// pulseaudio player 1458 #ifdef HAVE_PULSE_AUDIO 1459 pulse_driver_t *pulsed; ///< pulse audio playback device 1460 pulse_driver_t *pulsed_read; ///< pulse audio recorder device 1461 #define RT_AUDIO 1462 #else 1463 void *pulsed; 1464 void *pulsed_read; 1465 #endif 1466 1467 // layouts 1468 LiVESTextBuffer *layout_textbuffer; ///< stores layout errors 1469 LiVESList *affected_layouts_map; ///< map of layouts with errors 1470 LiVESList *current_layouts_map; ///< map of all layouts for set 1471 1472 /// list of pairs of marks in affected_layouts_map, text between them should be deleted when 1473 /// stored_layout is deleted 1474 LiVESList *affected_layout_marks; 1475 1476 /// immediately (to be) affected layout maps 1477 LiVESList *xlays; 1478 1479 /// crash recovery system 1480 LiVESList *recovery_list; 1481 char *recovery_file; ///< the filename of our recover file 1482 boolean leave_recovery; 1483 boolean recoverable_layout; 1484 boolean invalid_clips; 1485 boolean recovering_files; 1486 boolean recording_recovered; 1487 1488 boolean unordered_blocks; ///< are we recording unordered blocks ? 1489 1490 boolean no_exit; ///< if TRUE, do not exit after saving set 1491 1492 mt_opts multi_opts; ///< some multitrack options that survive between mt calls 1493 1494 /// mutices 1495 pthread_mutex_t abuf_mutex; ///< used to synch audio buffer request count - shared between audio and video threads 1496 pthread_mutex_t abuf_frame_mutex; ///< used to synch audio buffer for generators 1497 pthread_mutex_t fx_mutex[FX_KEYS_MAX]; ///< used to prevent fx processing when it is scheduled for deinit 1498 pthread_mutex_t fxd_active_mutex; ///< prevent simultaneous writing to active_dummy by audio and video threads 1499 pthread_mutex_t event_list_mutex; ///< prevent simultaneous writing to event_list by audio and video threads 1500 pthread_mutex_t clip_list_mutex; ///< prevent adding/removing to cliplist while another thread could be reading it 1501 pthread_mutex_t vpp_stream_mutex; ///< prevent from writing audio when stream is closing 1502 pthread_mutex_t cache_buffer_mutex; ///< sync for jack playback termination 1503 pthread_mutex_t audio_filewriteend_mutex; ///< sync for ending writing audio to file 1504 pthread_mutex_t instance_ref_mutex; ///< refcounting for instances 1505 pthread_mutex_t exit_mutex; ///< prevent multiple threads trying to run cleanup 1506 pthread_mutex_t fbuffer_mutex; /// append / remove with file_buffer list 1507 pthread_mutex_t alarmlist_mutex; /// single access for updating alarm list 1508 1509 ///< set for param window updates from OSC or data connections, notifies main thread to do visual updates 1510 volatile lives_rfx_t *vrfx_update; 1511 1512 lives_fx_candidate_t 1513 ///< effects which can have candidates from which a delegate is selected (current examples are: audio_volume, resize) 1514 fx_candidates[MAX_FX_CANDIDATE_TYPES]; 1515 1516 /// file caches 1517 LiVESList *prefs_cache; ///< cache of preferences, used during startup phase 1518 LiVESList *hdrs_cache; ///< cache of a file header (e.g. header.lives) 1519 LiVESList *gen_cache; ///< general cache of fi 1520 1521 FILE *clip_header; 1522 1523 LiVESList *file_buffers; ///< list of open files for buffered i/o 1524 1525 int aud_rec_fd; ///< fd of file we are recording audio to 1526 double rec_end_time; 1527 int64_t rec_samples; 1528 double rec_fps; 1529 frames_t rec_vid_frames; 1530 1531 ///< values to be written to the event list concurrent with next video ftame event 1532 int rec_arate, rec_achans, rec_asamps, rec_signed_endian; 1533 1534 /// message output settings 1535 int last_dprint_file; 1536 boolean no_switch_dprint; 1537 boolean suppress_dprint; ///< tidy up, e.g. by blocking "switched to file..." and "closed file..." messages 1538 1539 char *string_constants[NUM_LIVES_STRING_CONSTANTS]; 1540 char *any_string; ///< localised text saying "Any", for encoder and output format 1541 char *none_string; ///< localised text saying "None", for playback plugin name, etc. 1542 char *recommended_string; ///< localised text saying "recommended", for encoder and output format, etc. 1543 char *disabled_string; ///< localised text saying "disabled !", for playback plugin name, etc. 1544 char *cl_string; ///< localised text saying "*The current layout*", for layout warnings 1545 1546 frames_t opening_frames; ///< count of frames so far opened, updated after preview (currently) 1547 1548 boolean show_procd; ///< override showing of "processing..." dialog 1549 1550 boolean block_param_updates; ///< block visual param changes from updating real values 1551 boolean no_interp; ///< block interpolation (for single frame previews) 1552 1553 ticks_t cevent_tc; ///< timecode of currently processing event 1554 1555 boolean opening_multi; ///< flag to indicate multiple file selection 1556 1557 volatile boolean record_paused; ///< pause during recording 1558 1559 boolean record_starting; ///< start recording at next frame 1560 1561 int img_concat_clip; ///< when opening multiple, image files can get concatenated here (prefs->concat_images) 1562 1563 /// rendered generators 1564 boolean gen_to_clipboard; 1565 boolean is_generating; 1566 1567 boolean keep_pre; ///< set if previewed frames should be retained as processed frames (for rendered effects / generators) 1568 1569 LiVESWidget *textwidget_focus; 1570 1571 /// video plugin 1572 _vid_playback_plugin *vpp; 1573 const char *new_vpp; 1574 1575 /// multi-head support 1576 lives_mgeometry_t *mgeom; 1577 1578 /// external control inputs 1579 boolean ext_cntl[MAX_EXT_CNTL]; 1580 1581 #ifdef ALSA_MIDI 1582 snd_seq_t *seq_handle; 1583 int alsa_midi_port; 1584 int alsa_midi_dummy; 1585 #endif 1586 1587 boolean midi_channel_lock; 1588 1589 weed_plant_t *rte_textparm; ///< send keyboard input to this paramter (usually NULL) 1590 1591 int write_abuf; ///< audio buffer number to write to (for multitrack) 1592 volatile int abufs_to_fill; 1593 1594 /// splash window 1595 LiVESWidget *splash_window, *splash_label, *splash_progress; 1596 1597 #define SPLASH_LEVEL_BEGIN .0 1598 #define SPLASH_LEVEL_START_GUI .2 1599 #define SPLASH_LEVEL_LOAD_RTE .4 1600 #define SPLASH_LEVEL_LOAD_APLAYER .6 1601 #define SPLASH_LEVEL_LOAD_RFX .8 1602 #define SPLASH_LEVEL_COMPLETE 1. 1603 1604 /// encoder text output 1605 LiVESIOChannel *iochan; 1606 LiVESTextView *optextview; 1607 1608 boolean has_custom_effects, has_custom_tools, has_custom_gens, has_custom_utilities; 1609 1610 /// decoders 1611 boolean decoders_loaded; 1612 LiVESList *decoder_list; 1613 1614 boolean go_away; 1615 boolean debug; ///< debug crashes and asserts 1616 void *debug_ptr; 1617 1618 char *subt_save_file; ///< name of file to save subtitles to 1619 1620 char **fonts_array; 1621 int nfonts; 1622 1623 LiVESTargetEntry *target_table; ///< drag and drop target table 1624 1625 LiVESList *videodevs; 1626 1627 char vpp_defs_file[PATH_MAX]; 1628 1629 int log_fd; /// 1630 1631 /// lives_alarms 1632 #define LIVES_NO_ALARM 0 1633 #define LIVES_MAX_ALARMS 1024 1634 #define LIVES_MAX_USER_ALARMS 512 1635 1636 #define LIVES_URGENCY_ALARM LIVES_MAX_ALARMS // this is fine since we will subtract 1 1637 #define URGENCY_MSG_TIMEOUT 10. // seconds 1638 1639 lives_timeout_t alarms[LIVES_MAX_ALARMS]; ///< reserve 1 for emergency msgs 1640 int next_free_alarm; 1641 1642 /// OSD 1643 char *urgency_msg; 1644 char *overlay_msg; 1645 1646 lives_alarm_t overlay_alarm; 1647 1648 // stuff specific to audio gens (will be extended to all rt audio fx) 1649 volatile int agen_key; ///< which fx key is generating audio [1 based] (or 0 for none) 1650 volatile boolean agen_needs_reinit; 1651 uint64_t agen_samps_count; ///< count of samples since init 1652 1653 boolean aplayer_broken; 1654 1655 boolean add_clear_ds_button; 1656 boolean add_clear_ds_adv; 1657 boolean tried_ds_recover; 1658 1659 boolean has_session_workdir; 1660 boolean startup_error; 1661 1662 int ce_frame_width, ce_frame_height; 1663 1664 lives_render_error_t render_error; 1665 1666 uint64_t next_ds_warn_level; ///< current disk space warning level for the tempdir 1667 1668 lives_pconnect_t *pconx; ///< list of out -> in param connections 1669 lives_cconnect_t *cconx; ///< list of out -> in alpha channel connections 1670 1671 int sepwin_minwidth, sepwin_minheight; 1672 1673 uint32_t signal_caught; 1674 boolean signals_deferred; 1675 1676 boolean ce_thumbs; 1677 boolean ce_upd_clip; 1678 1679 #define SCREEN_AREA_NONE -1 1680 #define SCREEN_AREA_FOREGROUND 0 1681 #define SCREEN_AREA_BACKGROUND 1 1682 #define SCREEN_AREA_USER_DEFINED1 2 1683 1684 int n_screen_areas; // number of screen areas 1685 int active_sa_fx; // active screen area for effects 1686 int active_sa_clips; // active screen area for clips 1687 lives_screen_area_t *screen_areas; // array of screen areas 1688 1689 int active_track_list[MAX_TRACKS]; 1690 boolean ext_src_used[MAX_FILES]; 1691 lives_decoder_t *track_decoders[MAX_TRACKS]; 1692 int old_active_track_list[MAX_TRACKS]; 1693 1694 boolean gen_started_play; 1695 boolean fx_is_auto; 1696 1697 volatile lives_audio_buf_t *audio_frame_buffer; ///< used for buffering / feeding audio to video generators 1698 lives_audio_buf_t *afb[2]; ///< used for buffering / feeding audio to video generators 1699 int afbuffer_clients; /// # of registered clients for the audio frame buffer 1700 int afbuffer_clients_read; /// current read count. When this reaches abuffer_clients, we swap the read / write buffers 1701 1702 pthread_t *libthread; /// GUI thread for liblives 1703 1704 #define LIVES_SENSE_STATE_UNKNOWN 0 1705 #define LIVES_SENSE_STATE_INSENSITIZED (1 << 0) 1706 #define LIVES_SENSE_STATE_PROC_INSENSITIZED (1 << 1) 1707 #define LIVES_SENSE_STATE_SENSITIZED (1 << 16) 1708 #define LIVES_SENSE_STATE_INTERACTIVE (1 << 31) 1709 1710 #define LIVES_IS_INTERACTIVE ((mainw->sense_state & LIVES_SENSE_STATE_INTERACTIVE) ? TRUE : FALSE) 1711 #define LIVES_IS_SENSITIZED ((mainw->sense_state & LIVES_SENSE_STATE_SENSITIZED) ? TRUE : FALSE) 1712 1713 uint32_t sense_state; 1714 1715 int fc_buttonresponse; /// ??? 1716 1717 char frameblank_path[PATH_MAX]; 1718 char sepimg_path[PATH_MAX]; 1719 1720 uint64_t aud_data_written; 1721 1722 int crash_possible; // TODO - check this 1723 1724 LiVESPixbuf *scrap_pixbuf; ///< cached image for speeding up rendering 1725 1726 boolean no_context_update; ///< may be set temporarily to block wodget context updates 1727 boolean no_expose; 1728 1729 weed_plant_t *msg_list; 1730 weed_plant_t *ref_message; // weak ref 1731 int n_messages; 1732 int ref_message_n; 1733 int mbar_res; /// reserved space for mbar 1734 1735 ticks_t flush_audio_tc; ///< when rendering, we can use this to force audio to be rendered up to tc; designed for previews 1736 1737 // main window resizing, no longer very important 1738 int assumed_width; 1739 int assumed_height; 1740 #define DEF_IDLE_MAX 1 1741 int idlemax; 1742 1743 boolean reconfig; ///< set to TRUE if a monitor / screen size change is detected 1744 1745 boolean ignore_screen_size; ///< applied during frame reconfig events 1746 1747 int def_trans_idx; 1748 1749 // disk space in workdir 1750 lives_storage_status_t ds_status; 1751 int ds_mon; 1752 1753 #define CHECK_CRIT (1 << 0) 1754 #define CHECK_WARN (1 << 1) 1755 #define CHECK_QUOTA (1 << 2) 1756 1757 char *version_hash; 1758 char *old_vhash; 1759 1760 /// experimental values, primarily for testing 1761 volatile int uflow_count; 1762 1763 boolean force_show; /// if set to TRUE during playback then a new frame (or possibly the current one) will be displayed ASAP 1764 1765 /// adaptive quality settings 1766 ///< a roughly calibrated value that ranges from -64 (lightly loaded) -> +64 (heavily loaded) 1767 /// (currently only active during playback), i.e higher values represent more machine load 1768 /// some functions may change their behaviour according to this value if prefs->pbq_adaptive is FALSE then such changes 1769 /// should be minimal; if TRUE then more profound changes are permitted 1770 #define EFFORT_RANGE_MAX 64 1771 #define EFFORT_LIMIT_LOW (EFFORT_RANGE_MAX >> 3) ///< default 8 1772 #define EFFORT_LIMIT_MED (EFFORT_RANGE_MAX >> 2) ///< default 32 1773 int effort; 1774 boolean lockstats; 1775 1776 boolean memok; ///< set to FALSE if a segfault is received, ie. we should assume all memory is corrupted and exit ASAP 1777 1778 /// this is not really used yet, but the idea is that in future the clipboard may be reproduced in various 1779 /// sizes / palettes / gamma functions, so instead of having to transform it each time we can cache various versions 1780 #define MAX_CBSTORES 8 1781 int ncbstores; 1782 lives_clip_t *cbstores[8]; 1783 1784 /// caches for start / end / preview images. This avoids having to reload / reread them from the source, which could disrupt playback. 1785 weed_layer_t *st_fcache, *en_fcache, *pr_fcache; 1786 /// these are freed when the clip is switched or closed, or when the source frame changes or is updated 1787 //////////////////// 1788 boolean add_trash_rb; 1789 boolean cs_manage; 1790 1791 boolean dsu_valid; 1792 LiVESWidget *dsu_widget; 1793 1794 int max_textsize; 1795 lives_permmgr_t *permmgr; 1796 boolean pretty_colours; 1797 1798 boolean suppress_layout_warnings; 1799 1800 lives_proc_thread_t helper_procthreads[N_HLP_PROCTHREADS]; 1801 uint32_t lazy; 1802 1803 boolean no_configs; 1804 1805 #define MONITOR_QUOTA (1 << 0) 1806 1807 uint32_t disk_mon; 1808 1809 volatile boolean transrend_ready; 1810 weed_layer_t *transrend_layer; 1811 lives_proc_thread_t transrend_proc; 1812 boolean pr_audio; 1813 double vfade_in_secs, vfade_out_secs; 1814 lives_colRGBA64_t vfade_in_col, vfade_out_col; 1815 } mainwindow; 1816 1817 /// interface colour settings 1818 extern _palette *palette; 1819 1820 typedef struct { 1821 ulong ins_frame_function; 1822 1823 LiVESWidget *merge_dialog; 1824 LiVESWidget *ins_frame_button; 1825 LiVESWidget *drop_frame_button; 1826 LiVESWidget *param_vbox; 1827 LiVESWidget *spinbutton_loops; 1828 1829 boolean loop_to_fit; 1830 boolean align_start; 1831 boolean ins_frames; 1832 1833 int *list_to_rfx_index; 1834 LiVESList *trans_list; 1835 } _merge_opts; 1836 1837 1838 typedef struct { 1839 LiVESWidget *dialog; 1840 LiVESWidget *cancelbutton; 1841 LiVESWidget *okbutton; 1842 LiVESWidget *resetbutton; 1843 lives_rfx_t *rfx; 1844 int key; 1845 int mode; 1846 } _fx_dialog; 1847 1848 1849 _merge_opts *merge_opts; 1850 1851 _fx_dialog *fx_dialog[2]; 1852 1853 #ifndef IS_MINGW 1854 #define LIVES_SIGKILL SIGKILL 1855 #define LIVES_SIGINT SIGINT 1856 #define LIVES_SIGPIPE SIGPIPE 1857 #define LIVES_SIGTRAP SIGTRAP 1858 #define LIVES_SIGUSR1 SIGUSR1 1859 #define LIVES_SIGABRT SIGABRT 1860 #define LIVES_SIGSEGV SIGSEGV 1861 #define LIVES_SIGHUP SIGHUP 1862 #define LIVES_SIGTERM SIGTERM 1863 #define LIVES_SIGQUIT SIGQUIT 1864 #else 1865 #define LIVES_SIGKILL SIGTERM 1866 #define LIVES_SIGINT SIGINT 1867 #define LIVES_SIGPIPE SIGPIPE 1868 #define LIVES_SIGTRAP SIGTRAP 1869 #define LIVES_SIGUSR1 SIGUSR1 1870 #define LIVES_SIGABRT SIGABRT 1871 #define LIVES_SIGSEGV SIGSEGV 1872 #define LIVES_SIGHUP SIGINT 1873 #define LIVES_SIGTERM SIGTERM 1874 #define LIVES_SIGQUIT SIGQUIT 1875 #endif 1876 1877 #ifdef ENABLE_JACK 1878 volatile aserver_message_t jack_message; 1879 volatile aserver_message_t jack_message2; 1880 #endif 1881 1882 #ifdef HAVE_PULSE_AUDIO 1883 volatile aserver_message_t pulse_message; 1884 volatile aserver_message_t pulse_message2; 1885 #endif 1886 1887 #endif // HAS_LIVES_MAINWINDOW_H 1888