LiVES 3.2.0
main.c
Go to the documentation of this file.
1// main.c
2// LiVES (lives-exe)
3// (c) G. Finch 2003 - 2020 <salsaman+lives@gmail.com>
4
5/* This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 3 or higher as published by
7 the Free Software Foundation.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17*/
18
19// flow is: main() -> real_main() [entry point for liblives]
20// real_main() -> pre_init() [early initialisation, initialise prefs system]
21// initialise prefs
22// initialise weed_memory
23// initialise message log
24// initialise widget_helper
25// real_main() [parse startup opts]
26// real_main() -> lives_startup() [added as idle function]
27// lives_startup ->lives_init
28// lives_startup2 [added as idle from lives_startup]
29// real_main() -> gtk_main()
30
31// idlefuncion:
32// lives_startup() [handle any prefs touched by opts which are needed for the GUI]
33// on fresh install: do_workdir_query()
34// create_LiVES() [create the GUI interface]
35// splash_end -> create MT interface if wanted
36// show_lives()
37// check_for_recovery files, load them if wanted
38// do_layout_recovery
39// lives_init() [set remaining variables and preferences]
40
41#ifdef USE_GLIB
42#include <glib.h>
43#endif
44
45#define NEED_ENDIAN_TEST
46
47#define _MAIN_C_
48#include "main.h"
49#include "interface.h"
50#include "callbacks.h"
51
52#include "effects.h"
53#include "rte_window.h"
54#include "resample.h"
55#include "audio.h"
56#include "paramwindow.h"
57#include "stream.h"
58#include "startup.h"
59#include "cvirtual.h"
60#include "ce_thumbs.h"
61#include "rfx-builder.h"
62
63#ifndef ENABLE_DIAGNOSTICS
64#include "diagnostics.h"
65#endif
66
67#ifdef ENABLE_OSC
68#include "omc-learn.h"
69#endif
70
71#ifdef HAVE_YUV4MPEG
72#include "lives-yuv4mpeg.h"
73#endif
74
75#ifdef HAVE_UNICAP
76#include "videodev.h"
77#endif
78
79#include <getopt.h>
80
81#ifdef IS_DARWIN
82#include <mach/mach.h>
83#include <mach/processor_info.h>
84#include <mach/mach_host.h>
85#endif
86#ifdef USE_LIBPNG
87#include <png.h>
88#include <setjmp.h>
89#endif
90
91#ifdef HAVE_PRCTL
92#include <sys/prctl.h>
93#endif
94
95#ifdef LIVES_OS_UNIX
96#include <glib-unix.h>
97#endif
98
99
104
106static char buff[256];
107
108static char devmap[PATH_MAX];
109
110static boolean no_recover = FALSE, auto_recover = FALSE;
111static boolean upgrade_error = FALSE;
112static boolean info_only;
113
114static char *newconfigfile = NULL;
115
116static char start_file[PATH_MAX];
117static double start = 0.;
118static int end = 0;
119
120static boolean theme_error;
121
122static _ign_opts ign_opts;
123
124static int zargc;
125static char **zargv;
126
127#ifndef NO_PROG_LOAD
128static int xxwidth = 0, xxheight = 0;
129#endif
130
131static char *old_vhash = NULL;
132static int initial_startup_phase = 0;
133static boolean needs_workdir = FALSE;
134static boolean ran_ds_dlg = FALSE;
135
136static void do_start_messages(void);
137
139
140#ifdef GUI_GTK
141LiVESTargetEntry target_table[] = {
142 { "STRING", GTK_TARGET_OTHER_APP, 0 },
143 { "text/uri-list", GTK_TARGET_OTHER_APP, 0 },
144};
145#endif
146
148#ifdef NO_COMPILE // never compile this
149void tr_msg(void) {
150 // TRANSLATORS: do not translate this message
151 char *msg =
152 (_("Attention Translators !\nThis message is intended for you, so please do not translate it.\n\n"
153 "All translators should read the LiVES translation notes at\n"
154 "http://lives-video.com/TRANS-README.txt"));
155}
156#endif
157
158
159void break_me(const char *brkstr) {
160 if (prefs && prefs->show_dev_opts)
161 g_print("BANG ! hit breakpoint %s\n", brkstr ? brkstr : "???");
162 // breakpoint for gdb
163}
164
165
166// in library we run gtk in a thread so we can return to caller
167void *gtk_thread_wrapper(void *data) {
168 gtk_main();
169 return NULL;
170}
171
172
173#ifdef USE_GLIB
174static void lives_log_handler(const char *domain, LiVESLogLevelFlags level, const char *message, livespointer data) {
175 if (prefs && prefs->vj_mode) return;
176 if (level & LIVES_LOG_FATAL_MASK) {
177#ifndef IGNORE_FATAL_ERRORS
178 raise(LIVES_SIGSEGV);
179#endif
180 } else {
181 char *msg;
182 LiVESLogLevelFlags xlevel = level & LIVES_LOG_LEVEL_MASK;
183
184#ifdef LIVES_NO_DEBUG
185 if (prefs && !prefs->show_dev_opts) return;
186#endif
187
188#ifndef SHOW_ALL_ERRORS
189#ifdef LIVES_NO_DEBUG
190 if (xlevel >= LIVES_LOG_LEVEL_DEBUG) return;
191#endif
192 //#define SHOW_INFO_ERRORS
193#ifndef SHOW_INFO_ERRORS
194 if (xlevel == LIVES_LOG_LEVEL_INFO) return;
195#endif
196 //#define SHOW_MSG_ERRORS
197#ifndef SHOW_MSG_ERRORS
198 if (xlevel == LIVES_LOG_LEVEL_MESSAGE) return;
199#endif
200#define NO_WARN_ERRORS
201#ifdef NO_WARN_ERRORS
202 if (xlevel == LIVES_LOG_LEVEL_WARNING) {
203 return;
204 }
205#endif
206 #define NO_CRITICAL_ERRORS
207#ifdef NO_CRITICAL_ERRORS
208 if (xlevel == LIVES_LOG_LEVEL_CRITICAL) return;
209#endif
210#endif
211
212 //#define TRAP_THEME_ERRORS
213 //#define SHOW_THEME_ERRORS
214#ifndef SHOW_THEME_ERRORS
215 if (prefs->show_dev_opts)
216 if (!strncmp(message, "Theme parsing", strlen("Theme parsing"))) {
217#ifdef TRAP_THEME_ERRORS
218 raise(LIVES_SIGTRAP);
219#endif
220 return;
221 }
222#endif
223
224 //#define TRAP_ERRMSG ""
225#ifdef TRAP_ERRMSG
226 if (!strncmp(message, TRAP_ERRMSG, strlen(TRAP_ERRMSG))) {
227 fprintf(stderr, "Trapped message %s\n", message);
228 raise(LIVES_SIGTRAP);
229 }
230#endif
231 if (xlevel == LIVES_LOG_LEVEL_FATAL)
232 msg = lives_strdup_printf("%s Fatal error: %s\n", domain, message);
233 else if (xlevel == LIVES_LOG_LEVEL_CRITICAL)
234 msg = lives_strdup_printf("%s Critical error: %s\n", domain, message);
235 else if (xlevel == LIVES_LOG_LEVEL_WARNING)
236 msg = lives_strdup_printf("%s Warning: %s\n", domain, message);
237 else if (xlevel == LIVES_LOG_LEVEL_MESSAGE)
238 msg = lives_strdup_printf("%s Warning: %s\n", domain, message);
239 else if (xlevel == LIVES_LOG_LEVEL_INFO)
240 msg = lives_strdup_printf("%s Warning: %s\n", domain, message);
241 else if (xlevel == LIVES_LOG_LEVEL_DEBUG)
242 msg = lives_strdup_printf("%s Warning: %s\n", domain, message);
243 else {
244 msg = lives_strdup_printf("%s (Unknown level %u error: %s\n", domain, xlevel, message);
245 }
246
247 if (mainw->is_ready) d_print(msg);
248 fprintf(stderr, "%s", msg);
249 lives_free(msg);
250
251#define BREAK_ON_CRIT
252 if (xlevel <= LIVES_LOG_LEVEL_CRITICAL) {
253#ifdef BREAK_ON_CRIT
254 raise(LIVES_SIGTRAP);
255#endif
256 }
257
258 //#define BREAK_ON_WARN
259#ifdef BREAK_ON_WARN
260 if (xlevel <= LIVES_LOG_LEVEL_WARNING) raise(LIVES_SIGTRAP);
261#endif
262
263 //#define BREAK_ON_ALL
264#ifdef BREAK_ON_ALL
265 raise(LIVES_SIGTRAP);
266#endif
267 }
268}
269#endif // USE_GLIB
270
271
272#ifdef ENABLE_JACK
273LIVES_LOCAL_INLINE void jack_warn() {
275 if (prefs->startup_phase == 4) {
277 } else do_jack_noopen_warn4();
278}
279#endif
280
281
282void defer_sigint(int signum) {
283 mainw->signal_caught = signum;
284 switch (mainw->crash_possible) {
285 case 1:
286 // crash in jack_client_open()
287 //jack_warn();
288 break;
289 default:
290 break;
291 }
292 return;
293}
294
295//#define QUICK_EXIT
296void catch_sigint(int signum) {
297 // trap for ctrl-C and others
298 //if (mainw->jackd) lives_jack_end();
299
305 }
306
307 if (capable && !pthread_equal(capable->main_thread, pthread_self())) {
308 lives_proc_thread_t lpt = THREADVAR(tinfo);
309 weed_set_int_value(lpt, WEED_LEAF_SIGNALLED, signum);
310 weed_set_voidptr_value(lpt, WEED_LEAF_SIGNAL_DATA, THREADVAR(mydata));
311 g_print("Thread got signal %d\n", signum);
312 sleep(3600);
313 pthread_exit(NULL);
314 }
315 if (mainw->record) backup_recording(NULL, NULL);
316#ifdef QUICK_EXIT
317 /* shoatend(); */
318 /* fprintf(stderr, "shoatt end"); */
319 /* fflush(stderr); */
320 exit(signum);
321#endif
322 if (mainw) {
324 if (mainw->foreign) {
325 exit(signum);
326 }
327
328 if (mainw->multitrack) mainw->multitrack->idlefunc = 0;
329 mainw->fatal = TRUE;
330
331 if (signum == LIVES_SIGABRT || signum == LIVES_SIGSEGV) {
332 mainw->memok = FALSE;
333 signal(LIVES_SIGSEGV, SIG_DFL);
334 signal(LIVES_SIGABRT, SIG_DFL);
335 fprintf(stderr, _("\nUnfortunately LiVES crashed.\nPlease report this bug at %s\n"
336 "Thanks. Recovery should be possible if you restart LiVES.\n"), LIVES_BUG_URL);
337 fprintf(stderr, _("\n\nWhen reporting crashes, please include details of your operating system, "
338 "distribution, and the LiVES version (%s)\n"), LiVES_VERSION);
339
340 if (capable->has_gdb) {
341 if (mainw->debug) fprintf(stderr, "%s", _("and any information shown below:\n\n"));
342 else fprintf(stderr, "%s", _("Please try running LiVES with the -debug option to collect more information.\n\n"));
343 } else {
344 fprintf(stderr, "%s", _("Please install gdb and then run LiVES with the -debug option "
345 "to collect more information.\n\n"));
346 }
347
348#ifdef USE_GLIB
349#ifdef LIVES_NO_DEBUG
350 if (mainw->debug) {
351#endif
352#ifdef HAVE_PRCTL
353 prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY);
354#endif
355 g_on_error_query(capable->myname_full);
356#ifdef LIVES_NO_DEBUG
357 }
358#endif
359#endif
360#ifndef GDB_ON
361 _exit(signum);
362#endif
363 }
364
365 if (mainw->was_set) {
366 if (mainw->memok) fprintf(stderr, "%s", _("Preserving set.\n"));
367 }
368
370
372 lives_exit(signum);
373 }
374 }
375 exit(signum);
376}
377
378#ifdef USE_GLIB
379static boolean glib_sighandler(livespointer data) {
380 int signum = LIVES_POINTER_TO_INT(data);
381 catch_sigint(signum);
382 return TRUE;
383}
384#endif
385
386
387#ifdef GUI_GTK
388static double get_screen_scale(GdkScreen *screen, double *pdpi) {
389 double scale = 1.0;
390 double dpi = gdk_screen_get_resolution(screen);
391 if (dpi == 120.) scale = 1.25;
392 else if (dpi == 144.) scale = 1.5;
393 else if (dpi == 192.) scale = 2.0;
394 if (pdpi) *pdpi = dpi;
395 return scale;
396}
397#endif
398
399
400void get_monitors(boolean reset) {
401#ifdef GUI_GTK
402 GdkDisplay *disp;
403 GdkScreen *screen;
404#if GTK_CHECK_VERSION(3, 22, 0)
405 GdkMonitor *moni;
406#endif
407 GdkRectangle rect;
408 GdkDevice *device;
409 double scale, dpi;
410 int play_moni = 1;
411#if !GTK_CHECK_VERSION(3, 22, 0)
412 GSList *dlist, *dislist;
413 int nscreens, nmonitors;
414#if LIVES_HAS_DEVICE_MANAGER
415 GdkDeviceManager *devman;
416 LiVESList *devlist;
417 int k;
418#endif
419 int i, j;
420#endif
421 int idx = 0;
422
423 if (mainw->ignore_screen_size) return;
424
425 lives_freep((void **)&mainw->mgeom);
426 capable->nmonitors = 0;
427
428#if !GTK_CHECK_VERSION(3, 22, 0)
429 dlist = dislist = gdk_display_manager_list_displays(gdk_display_manager_get());
430
431 // for each display get list of screens
432
433 while (dlist) {
434 disp = (GdkDisplay *)dlist->data;
435
436 // get screens
437 nscreens = lives_display_get_n_screens(disp);
438 for (i = 0; i < nscreens; i++) {
439 screen = gdk_display_get_screen(disp, i);
440 capable->nmonitors += gdk_screen_get_n_monitors(screen);
441 }
442 dlist = dlist->next;
443 }
444#else
445 disp = gdk_display_get_default();
446 capable->nmonitors += gdk_display_get_n_monitors(disp);
447#endif
448
450
451
452#if !GTK_CHECK_VERSION(3, 22, 0)
453 dlist = dislist;
454
455 while (dlist) {
456 disp = (GdkDisplay *)dlist->data;
457
459 devman = gdk_display_get_device_manager(disp);
460 devlist = gdk_device_manager_list_devices(devman, GDK_DEVICE_TYPE_MASTER);
461#endif
462 // get screens
463 nscreens = lives_display_get_n_screens(disp);
464 for (i = 0; i < nscreens; i++) {
465 screen = gdk_display_get_screen(disp, i);
466 scale = get_screen_scale(screen, &dpi);
467 nmonitors = gdk_screen_get_n_monitors(screen);
468 for (j = 0; j < nmonitors; j++) {
469 gdk_screen_get_monitor_geometry(screen, j, &(rect));
470 mainw->mgeom[idx].x = rect.x;
471 mainw->mgeom[idx].y = rect.y;
472 mainw->mgeom[idx].width = mainw->mgeom[idx].phys_width = rect.width;
473 mainw->mgeom[idx].height = mainw->mgeom[idx].phys_height = rect.height;
474 mainw->mgeom[idx].mouse_device = NULL;
475 mainw->mgeom[idx].dpi = dpi;
476 mainw->mgeom[idx].scale = scale;
477#if GTK_CHECK_VERSION(3, 4, 0)
478 gdk_screen_get_monitor_workarea(screen, j, &(rect));
479 mainw->mgeom[idx].width = rect.width;
480 mainw->mgeom[idx].height = rect.height;
481#endif
482#if LIVES_HAS_DEVICE_MANAGER
483 // get (virtual) mouse device for this screen
484 for (k = 0; k < lives_list_length(devlist); k++) {
485 device = (GdkDevice *)lives_list_nth_data(devlist, k);
486 if (gdk_device_get_display(device) == disp &&
487 gdk_device_get_source(device) == GDK_SOURCE_MOUSE) {
488 mainw->mgeom[idx].mouse_device = device;
489 break;
490 }
491 }
492#endif
493 mainw->mgeom[idx].disp = disp;
494 mainw->mgeom[idx].screen = screen;
495 idx++;
496 if (idx >= capable->nmonitors) break;
497 }
498 }
499#if LIVES_HAS_DEVICE_MANAGER
500 lives_list_free(devlist);
501#endif
502 dlist = dlist->next;
503 }
504
505 lives_slist_free(dislist);
506#else
507 screen = gdk_display_get_default_screen(disp);
508 scale = get_screen_scale(screen, &dpi);
509 device = gdk_seat_get_pointer(gdk_display_get_default_seat(disp));
510 for (idx = 0; idx < capable->nmonitors; idx++) {
511 mainw->mgeom[idx].disp = disp;
512 mainw->mgeom[idx].monitor = moni = gdk_display_get_monitor(disp, idx);
513 mainw->mgeom[idx].screen = screen;
514 gdk_monitor_get_geometry(moni, (GdkRectangle *)&rect);
515 mainw->mgeom[idx].x = rect.x;
516 mainw->mgeom[idx].y = rect.y;
517 mainw->mgeom[idx].phys_width = rect.width;
518 mainw->mgeom[idx].phys_height = rect.height;
519 mainw->mgeom[idx].mouse_device = device;
520 mainw->mgeom[idx].dpi = dpi;
521 mainw->mgeom[idx].scale = scale;
522 gdk_monitor_get_workarea(moni, &(rect));
523 mainw->mgeom[idx].width = rect.width;
524 mainw->mgeom[idx].height = rect.height;
525 if (gdk_monitor_is_primary(moni)) {
527 mainw->mgeom[idx].primary = TRUE;
528 } else if (play_moni == 1) play_moni = idx + 1;
529 }
530#endif
531#endif
532
533 if (prefs->force_single_monitor) capable->nmonitors = 1; // force for clone mode
534
535 if (!reset) return;
536
537 prefs->gui_monitor = 0;
538 prefs->play_monitor = play_moni;
539
540 if (capable->nmonitors > 1) {
541 get_string_pref(PREF_MONITORS, buff, 256);
542
543 if (*buff && get_token_count(buff, ',') > 1) {
544 char **array = lives_strsplit(buff, ",", 2);
545 prefs->gui_monitor = atoi(array[0]);
546 prefs->play_monitor = atoi(array[1]);
547 lives_strfreev(array);
548 }
549
550 if (prefs->gui_monitor < 1) prefs->gui_monitor = 1;
551 if (prefs->play_monitor < 0) prefs->play_monitor = 0;
554 }
555
557
560
562 if (prefs->screen_scale == 0.) {
564 prefs->screen_scale = (prefs->screen_scale - 1.) * 1.5 + 1.;
565 }
566
568 else prefs->show_msg_area = FALSE;
569
571}
572
573
574static void print_notice(void) {
575 fprintf(stderr, "\nLiVES %s\n", LiVES_VERSION);
576 fprintf(stderr, "Copyright "LIVES_COPYRIGHT_YEARS" Gabriel Finch ("LIVES_AUTHOR_EMAIL") and others.\n");
577 fprintf(stderr, "LiVES comes with ABSOLUTELY NO WARRANTY\nThis is free software, and you are welcome to redistribute it\n"
578 "under certain conditions; "
579 "see the file COPYING for details.\n\n");
580}
581
582
583static boolean pre_init(void) {
584 // stuff which should be done *before* mainwindow is created
585 // returns TRUE if we got an error loading the theme
586
587#ifdef GUI_GTK
588 LiVESError *gerr = NULL;
589 char *icon;
590#endif
591
592 pthread_mutexattr_t mattr;
593
594 char *msg, *tmp, *tmp2, *cfgdir;
595
596 boolean needs_update = FALSE;
597
598 int i;
599
602
603 // need to create directory for configfile before calling get_capabilities()
604 cfgdir = get_dir(prefs->configfile);
606 lives_free(cfgdir);
607
608 // pre-checked conditions. We will check for these agian
612 // check the backend is there, get some system details and prefs
614 }
615
616 //FATAL ERRORS
617
618 if (!mainw->foreign) {
619 if (!capable->has_perl) {
620 startup_message_fatal(lives_strdup(
621 _("\nPerl must be installed and in your path.\n\n"
622 "Please review the README file which came with this package\nbefore running LiVES.\n\n"
623 "Thankyou.\n")));
624 }
625 if (!capable->has_smogrify) {
626 msg = lives_strdup(
627 _("\n`smogrify` must be in your path, and be executable\n\n"
628 "Please review the README file which came with this package\nbefore running LiVES.\n"));
630 }
632 startup_message_fatal(lives_strdup(
633 _("\nAn incorrect version of smogrify was found in your path.\n\n"
634 "Please review the README file which came with this package\nbefore running LiVES."
635 "\n\nThankyou.\n")));
636 }
637
640 _("\nLiVES was unable to read from its configuration file\n%s\n\n"
641 "Please check the file permissions for this file and try again.\n"),
642 (tmp = lives_filename_to_utf8(prefs->configfile, -1, NULL, NULL, NULL)));
643 lives_free(tmp);
645 }
646
649 _("\nAn error occurred when writing to the configuration files\n%s*\n\n"
650 "Please check the file permissions for this file and directory\nand try again.\n"),
651 (tmp2 = ensure_extension((tmp = lives_filename_to_utf8(prefs->configfile, -1, NULL, NULL, NULL)),
653 lives_free(tmp);
654 lives_free(tmp2);
656 }
657
660 tmp2 = lives_strdup_printf(_("Please check the %s setting in \n%s\nand try again.\n"),
661 (mainw->old_vhash && atoi(mainw->old_vhash) != 0 && atoi(mainw->old_vhash) < 3003003)
662 ? "<tempdir>" : "<workdir>",
663 (tmp = lives_filename_to_utf8(prefs->configfile, -1, NULL, NULL, NULL)));
664 lives_free(tmp);
665 } else tmp2 = lives_strdup("");
666
667 msg = lives_strdup_printf(_("\nLiVES was unable to use the working directory\n%s\n\n%s"),
668 prefs->workdir, tmp2);
669 lives_free(tmp2);
671 }
672 if (mainw->error) {
673 msg = lives_strdup_printf(_("\nSomething went wrong during startup\n%s"), mainw->msg);
675 }
676 }
677
678 sizint = sizeof(int);
679 sizdbl = sizeof(double);
680 sizshrt = sizeof(short);
681
682 // TRANSLATORS: text saying "Any", for encoder and output format (as in "does not matter")
684 // TRANSLATORS: text saying "None", for playback plugin name (as in "none specified")
686 // TRANSLATORS: text saying "recommended", for plugin names, etc.
688 // TRANSLATORS: text saying "disabled", (as in "not enabled")
690 // TRANSLATORS: text saying "**The current layout**", to warn users that the current layout is affected
691 mainw->string_constants[LIVES_STRING_CONSTANT_CL] = (_("**The current layout**"));
692 // TRANSLATORS: adjective for "Built in" type effects
694 // TRANSLATORS: adjective for "Custom" type effects
696 // TRANSLATORS: adjective for "Test" type effects
698
699 // now we can use PREFS properly
701
704
706
708 if (!ign_opts.ign_vjmode) prefs->vj_mode = future_prefs->vj_mode;
709
710#ifdef GUI_GTK
711 if (!prefs->show_dev_opts || prefs->vj_mode) {
712 // don't crash on GTK+ fatals
713 g_log_set_always_fatal((GLogLevelFlags)0);
714 }
715#endif
716
717 if (!prefs->vj_mode) {
721
725
728 }
729
733
734#ifdef VALGRIND_ON
735 prefs->nfx_threads = 2;
736#endif
737
739
740 capable->gui_thread = pthread_self();
741
744
745 if (!ign_opts.ign_dscrit)
747 if (prefs->ds_crit_level < 0) prefs->ds_crit_level = 0;
748
754 if (prefs->disk_quota < 0) prefs->disk_quota = 0;
755
756 prefs->quota_limit = 90.0;
757
760 prefs->disk_quota = 0;
761 }
762
764
765 if (!prefs->vj_mode) {
767 if (!needs_workdir && prefs->disk_quota && !needs_workdir && initial_startup_phase == 0)
769
770 if (!needs_workdir && mainw->next_ds_warn_level > 0) {
771 int64_t dsval = disk_monitor_check_result(prefs->workdir);
772 if (dsval > 0) capable->ds_used = dsval;
773 else dsval = capable->ds_used;
775 capable->ds_free = dsval;
778 msg = lives_strdup_printf("\n%s\n", tmp);
779 lives_free(tmp);
783 lives_free(msg);
784 }
785 }
786 }
787
788 // get some prefs we need to set menu options
789 prefs->gui_monitor = -1;
790
791 if (prefs->vj_mode) {
795 }
796 mainw->mgeom = NULL;
797
800
802
803 // sets prefs->screen_scale, capable->nmonitors, mainw->mgeom, prefs->play_monitor, prefs->gui_monitor
804 // prefs->show_msg_area, mainw->old_screen_height, mainw->old_screen_width
805 // widget_opts.monitor, widget_opts.screen and various widget_opts sizes
807
808 // set to allow multiple locking by the same thread
809 pthread_mutexattr_init(&mattr);
810 pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
811
812 // recursive locks
813 pthread_mutex_init(&mainw->abuf_mutex, &mattr);
814 pthread_mutex_init(&mainw->instance_ref_mutex, &mattr);
815
816 // non-recursive
817 pthread_mutex_init(&mainw->abuf_frame_mutex, NULL);
818 pthread_mutex_init(&mainw->fxd_active_mutex, NULL);
819 pthread_mutex_init(&mainw->event_list_mutex, NULL);
820 pthread_mutex_init(&mainw->clip_list_mutex, NULL);
821 pthread_mutex_init(&mainw->vpp_stream_mutex, NULL);
822 pthread_mutex_init(&mainw->cache_buffer_mutex, NULL);
823 pthread_mutex_init(&mainw->audio_filewriteend_mutex, NULL);
824 pthread_mutex_init(&mainw->exit_mutex, NULL);
825 pthread_mutex_init(&mainw->fbuffer_mutex, NULL);
826 pthread_mutex_init(&mainw->avseek_mutex, NULL);
827 pthread_mutex_init(&mainw->alarmlist_mutex, NULL);
828
829 // conds
830 pthread_cond_init(&mainw->avseek_cond, NULL);
831
832 if (prefs->vj_mode)
834 else
836
837 for (i = 0; i < FX_KEYS_MAX; i++) {
838 pthread_mutex_init(&mainw->fx_mutex[i], NULL);
839 }
840
841 mainw->vrfx_update = NULL;
842
843 mainw->kb_timer = -1;
844
845 prefs->sleep_time = 1000;
846
848
850 lives_snprintf(prefs->image_ext, 16, "%s",
852
857
859
862
863 info_only = FALSE;
864 palette = (_palette *)(lives_malloc(sizeof(_palette)));
865
867
868 if (!ign_opts.ign_aplayer) {
870 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_SOX);
871 }
872
874
875#ifdef ENABLE_GIW
877#else
879#endif
880
883
885 get_string_prefd(PREF_PASTARTOPTS, prefs->pa_start_opts, 255, "--high-priority");
886
889
893
894 prefs->bigendbug = 0;
895
896#if GTK_CHECK_VERSION(3, 0, 0)
898#else
900#endif
901
904
905 // get some prefs we need to set menu options
907
909
910 if (!(*prefs->prefix_dir)) {
911 if (strcmp(PREFIX, "NONE")) {
912 lives_snprintf(prefs->prefix_dir, PATH_MAX, "%s", PREFIX);
913 } else {
914 lives_snprintf(prefs->prefix_dir, PATH_MAX, "%s", PREFIX_DEFAULT);
915 }
916 needs_update = TRUE;
917 }
918
919 if (ensure_isdir(prefs->prefix_dir)) needs_update = TRUE;
920
921 if (needs_update) set_string_pref(PREF_PREFIX_DIR, prefs->prefix_dir);
922
923#ifdef GUI_GTK
924 icon = lives_build_filename(prefs->prefix_dir, DESKTOP_ICON_DIR, "lives." LIVES_FILE_EXT_PNG, NULL);
925 gtk_window_set_default_icon_from_file(icon, &gerr);
926 lives_free(icon);
927
928 if (gerr) lives_error_free(gerr);
929#endif
931
932 needs_update = FALSE;
933
935
936 if (!(*prefs->lib_dir)) {
937 lives_snprintf(prefs->lib_dir, PATH_MAX, "%s", LIVES_LIBDIR);
938 needs_update = TRUE;
939 }
940
941 if (ensure_isdir(prefs->lib_dir)) needs_update = TRUE;
942 if (needs_update) set_string_pref(PREF_LIB_DIR, prefs->lib_dir);
943
946
947 mainw->imsep = mainw->imframe = NULL;
948
951
952 mainw->msg_list = NULL;
953 mainw->n_messages = 0;
954 mainw->ref_message = NULL;
955 mainw->ref_message_n = 0;
956 add_messages_to_list(_("Starting...\n"));
957
959
960 if (!(*prefs->theme)) {
961 lives_snprintf(prefs->theme, 64, LIVES_THEME_NONE);
962 }
963
964 lives_snprintf(future_prefs->theme, 64, "%s", prefs->theme);
965
966 if (!set_palette_colours(initial_startup_phase == -1)) {
967 lives_snprintf(prefs->theme, 64, LIVES_THEME_NONE);
968 set_palette_colours(initial_startup_phase != -1);
969 } else if (palette->style & STYLE_1) {
971 }
972 if (!mainw->foreign) {
974 print_notice();
975 }
976
978
980
981 if (!ign_opts.ign_jackopts) {
983 }
984
985#ifdef GUI_GTK
987 lives_widget_object_get(gtk_settings_get_default(), "gtk-enable-tooltips", &prefs->show_tooltips);
988 } else
989#endif
991
994
996
998
999 if (prefs->show_dev_opts) {
1001 }
1002
1003 for (i = 0; i < MAX_FX_CANDIDATE_TYPES; i++) {
1004 mainw->fx_candidates[i].delegate = -1;
1005 mainw->fx_candidates[i].list = NULL;
1006 mainw->fx_candidates[i].func = 0l;
1007 mainw->fx_candidates[i].rfx = NULL;
1008 }
1009
1012 mainw->uflow_count = 0;
1013
1015
1016 for (i = 0; i < MAX_EXT_CNTL; i++) mainw->ext_cntl[i] = FALSE;
1017
1019
1021
1022#ifdef ENABLE_OSC
1023#ifdef OMC_JS_IMPL
1024 if (!*prefs->omc_js_fname) {
1025 const char *tmp = get_js_filename();
1026 if (tmp) {
1027 lives_snprintf(prefs->omc_js_fname, PATH_MAX, "%s", tmp);
1028 }
1029 }
1030#endif
1031#endif
1032
1034#ifdef ENABLE_OSC
1035#ifdef OMC_MIDI_IMPL
1036 if (!*prefs->omc_midi_fname) {
1037 const char *tmp = get_midi_filename();
1038 if (tmp) {
1039 lives_snprintf(prefs->omc_midi_fname, PATH_MAX, "%s", tmp);
1040 }
1041 }
1042#endif
1043#endif
1044
1045#ifdef ALSA_MIDI
1046 prefs->use_alsa_midi = TRUE;
1047 prefs->alsa_midi_dummy = FALSE;
1048 mainw->seq_handle = NULL;
1049
1050 if (prefs->omc_dev_opts & OMC_DEV_FORCE_RAW_MIDI) prefs->use_alsa_midi = FALSE;
1051 if (prefs->omc_dev_opts & OMC_DEV_MIDI_DUMMY) prefs->alsa_midi_dummy = TRUE;
1052#endif
1053
1055
1057 mainw->loop = TRUE;
1059 mainw->fs = FALSE;
1060
1061 if (prefs->vj_mode) {
1062 auto_recover = TRUE;
1063 mainw->loop_cont = TRUE;
1069 prefs->screen_gamma = 1.5;
1070 }
1071
1072#ifdef GUI_GTK
1074#endif
1075
1078
1080
1081 for (i = 0; i < LIVES_MAX_ALARMS; i++) {
1082 mainw->alarms[i].lastcheck = 0;
1083 }
1084
1085 if (lives_ascii_strcasecmp(prefs->theme, future_prefs->theme)) return TRUE;
1086 return FALSE;
1087}
1088
1089
1091 weed_plant_t *filter;
1092
1093 lives_rfx_t *rfx;
1094
1095 int resize_fx;
1096 int deint_idx;
1097
1099 resize_fx = LIVES_POINTER_TO_INT(lives_list_nth_data(mainw->fx_candidates[FX_CANDIDATE_RESIZER].list,
1101 filter = get_weed_filter(resize_fx);
1102 rfx = weed_to_rfx(filter, TRUE);
1103
1104 rfx->is_template = FALSE;
1106
1107 lives_free(rfx->action_desc);
1108 rfx->action_desc = (_("Resizing"));
1109
1110 rfx->min_frames = 1;
1111
1112 lives_free(rfx->menu_text);
1113
1114 if (!mainw->resize_menuitem) {
1115 rfx->menu_text = (_("_Resize All Frames..."));
1119 } else {
1120 // disconnect old menu entry
1122 }
1123 // connect new menu entry
1125 LIVES_WIDGET_ACTIVATE_SIGNAL,
1126 LIVES_GUI_CALLBACK(on_render_fx_pre_activate),
1127 (livespointer)rfx);
1129 }
1130
1132
1133 deint_idx = weed_get_idx_for_hashname("deinterlacedeinterlace", FALSE);
1134 if (deint_idx > -1) {
1136 = lives_list_append(mainw->fx_candidates[FX_CANDIDATE_DEINTERLACE].list,
1137 LIVES_INT_TO_POINTER(deint_idx));
1139 }
1140}
1141
1142
1143static void lives_init(_ign_opts *ign_opts) {
1144 // init mainwindow data
1145 LiVESList *encoders = NULL;
1146 LiVESList *encoder_capabilities = NULL;
1147
1148 char **array;
1149 char mppath[PATH_MAX];
1150
1151 char *weed_plugin_path;
1152#ifdef HAVE_FREI0R
1153 char *frei0r_path;
1154#endif
1155#ifdef HAVE_LADSPA
1156 char *ladspa_path;
1157#endif
1158#ifdef HAVE_LIBVISUAL
1159 char *libvis_path;
1160#endif
1161 char *msg;
1162
1163 boolean needs_free;
1164
1165 int naudp = 0;
1166
1167 int i;
1168
1169 for (i = 0; i <= MAX_FILES; mainw->files[i++] = NULL);
1172 mainw->mute = FALSE;
1173 mainw->faded = FALSE;
1174 if (!prefs->vj_mode)
1175 mainw->save_with_sound = TRUE; // also affects loading
1176 else
1178 mainw->preview = FALSE;
1181 mainw->sel_start = 0;
1184 mainw->play_window = NULL;
1185 mainw->opwx = mainw->opwy = -1;
1186 mainw->frame_layer = NULL;
1189 mainw->play_start = 0;
1193 mainw->fd_layer = NULL;
1194 mainw->fd_layer_orig = NULL;
1198 mainw->resizing = FALSE;
1201 mainw->aframeno = 0;
1202 if (capable->byte_order == LIVES_LITTLE_ENDIAN) {
1203 mainw->endian = 0;
1204 } else {
1206 }
1207
1209 mainw->was_set = FALSE;
1211
1212 for (i = 0; i < FN_KEYS - 1; i++) {
1213 mainw->clipstore[i][0] = -1;
1214 }
1215
1217
1218 mainw->nervous = FALSE;
1219 fx_dialog[0] = fx_dialog[1] = NULL;
1220
1221 mainw->rte_keys = -1;
1222 rte_window = NULL;
1223
1225
1226 mainw->preview_box = NULL;
1228
1230 mainw->progress_fn = NULL;
1231
1233 mainw->blend_file = -1;
1234
1235 mainw->pre_src_file = -2;
1237
1238 mainw->size_warn = 0;
1240
1241 mainw->file_open_params = NULL;
1243
1245 mainw->cliplist = NULL;
1246
1247 // rendered_fx number of last transition
1252 mainw->num_tr_applied = 0;
1253
1254 mainw->blend_factor = 0.;
1255
1256 mainw->fixed_fps_numer = -1;
1258 mainw->fixed_fpsd = -1.;
1261
1264
1265 mainw->framedraw_reset = NULL;
1266
1267 // setting this to TRUE can possibly increase smoothness for lower framerates
1268 // needs more testing and a preference in prefs window- TODO
1269 // can also be set through OSC: /output/nodrop/enable
1271
1274
1275 if (!ign_opts->ign_osc) {
1277 prefs->osc_udp_port = 0;
1278#ifdef ENABLE_OSC
1279 if (!mainw->foreign) {
1280 prefs->osc_udp_port = get_int_prefd(PREF_OSC_PORT, DEF_OSC_LISTEN_PORT);
1282 } else {
1284 }
1285#endif
1286 }
1287
1288 prefs->fps_tolerance = .0005;
1290
1291 if (prefs->rec_opts == -1) {
1294 }
1295
1297
1298 mainw->new_clip = -1;
1299 mainw->record = FALSE;
1300 mainw->event_list = NULL;
1302 mainw->scrap_file = -1;
1303 mainw->ascrap_file = -1;
1304
1307
1310
1311 mainw->filter_map = NULL; // filter map for video rendering
1312 mainw->afilter_map = NULL; // filter map for audio rendering
1313 mainw->audio_event = NULL;
1314
1316
1317 prefsw = NULL;
1318 rdet = NULL;
1319 resaudw = NULL;
1320
1321 mainw->actual_frame = 0;
1322
1324
1325 mainw->clip_index = NULL;
1326 mainw->frame_index = NULL;
1327
1329
1331
1332 mainw->pchains = NULL;
1333
1334 mainw->preview_frame = 0;
1335
1337
1339
1340 mainw->no_exit = FALSE;
1341
1342 mainw->multi_opts.set = FALSE;
1343
1344 mainw->clip_header = NULL;
1345
1346 mainw->new_blend_file = -1;
1347
1348 mainw->jackd = mainw->jackd_read = NULL;
1349
1350 mainw->pulsed = mainw->pulsed_read = NULL;
1351
1353
1355
1357
1358 mainw->cevent_tc = 0;
1359
1361
1362 mainw->img_concat_clip = -1;
1363
1365
1367
1369
1371
1372 mainw->stream_ticks = -1;
1373
1374 mainw->keep_pre = FALSE;
1375
1377
1378 mainw->osc_auto = 0;
1380
1382
1383 mainw->rte_textparm = NULL;
1384
1385 mainw->abufs_to_fill = 0;
1386
1388
1389 mainw->iochan = NULL;
1390
1391 mainw->stored_event_list = NULL;
1394
1396
1397 mainw->stored_layout_undos = NULL;
1398 mainw->sl_undo_mem = NULL;
1400 mainw->sl_undo_offset = 0;
1401
1402 mainw->go_away = TRUE;
1403
1404 mainw->aud_file_to_kill = -1;
1405
1406 mainw->aud_rec_fd = -1;
1407
1409 mainw->decoder_list = NULL;
1410
1411 mainw->subt_save_file = NULL;
1412
1414
1415 mainw->nfonts = 0;
1416 if (mainw->fonts_array)
1417 while (mainw->fonts_array[mainw->nfonts++]);
1418
1419 mainw->videodevs = NULL;
1420
1421 mainw->camframe = NULL;
1422
1427
1428 mainw->log_fd = -2;
1429
1431
1432 mainw->alives_pgid = 0;
1433
1435
1437
1441
1442 mainw->foreign_visual = NULL;
1443
1444 mainw->pconx = NULL;
1445 mainw->cconx = NULL;
1446
1447 cached_key = cached_mod = 0;
1448
1449 mainw->agen_key = 0;
1452
1454
1456
1459
1460 mainw->signal_caught = 0;
1462
1465 mainw->screen_areas[SCREEN_AREA_FOREGROUND].name = (_("Foreground"));
1466 mainw->screen_areas[SCREEN_AREA_BACKGROUND].name = (_("Background"));
1467
1469
1470 mainw->file_buffers = NULL;
1471
1472 mainw->blend_layer = NULL;
1473
1475
1476 mainw->clips_group = NULL;
1477
1480
1481 mainw->audio_frame_buffer = NULL;
1483 mainw->afb[0] = mainw->afb[1] = NULL;
1484
1486
1488
1489 mainw->rendered_fx = NULL;
1490
1492
1493 mainw->crash_possible = 0;
1494
1495 mainw->scrap_pixbuf = NULL;
1496
1498
1499#ifdef ENABLE_JACK
1500 mainw->jack_inited = FALSE;
1501 mainw->jack_trans_poll = FALSE;
1502#endif
1503
1505
1507
1508 mainw->flush_audio_tc = 0;
1509
1510 mainw->idlemax = 0;
1511 mainw->reconfig = FALSE;
1512
1513 mainw->fsp_func = 0;
1514
1515 mainw->swapped_clip = -1;
1516
1518
1519 mainw->xlays = NULL;
1520
1522
1523 mainw->new_lmap_errors = NULL;
1524
1525 mainw->ncbstores = 0;
1526
1528
1530
1531 mainw->blend_palette = WEED_PALETTE_END;
1533
1535
1536 mainw->effort = 0;
1537
1538 mainw->frame_layer_preload = NULL;
1539 mainw->pred_frame = 0;
1540 mainw->pred_clip = 0;
1541
1543
1544 mainw->audio_stretch = 1.0;
1545
1546 mainw->play_sequence = 0;
1547
1548 mainw->record_frame = -1;
1549
1550 mainw->debug_ptr = NULL;
1551
1552 mainw->inst_fps = 0.;
1553
1554 mainw->pre_play_file = -1;
1555
1557
1558 mainw->ptrtime = 0.;
1559
1560 mainw->proc_ptr = NULL;
1561
1562 mainw->permmgr = NULL;
1563
1564 mainw->set_list = NULL;
1565 mainw->num_sets = -1;
1566
1568
1570
1572
1574
1576 mainw->dsu_widget = NULL;
1577
1578 mainw->drawsrc = -1;
1579
1580 mainw->lazy = 0;
1581
1582 mainw->disk_mon = 0;
1583
1584 mainw->wall_ticks = -1;
1585
1587
1588 lives_memset(mainw->set_name, 0, 1);
1590
1592
1596
1598
1600
1604
1607
1608 if (prefs->gui_monitor != 0) {
1610 }
1611
1613 if (prefs->default_fps < 1.) prefs->default_fps = 1.;
1615
1616 // values for trickplay
1621
1623
1626 else prefs->crash_recovery = FALSE;
1627
1628 prefs->acodec_list = NULL;
1629
1632
1634
1635 prefs->safe_symlinks = FALSE; // set to TRUE for dynebolic and other live CDs
1636
1638
1640
1642
1644
1646
1648
1650
1652
1654
1656
1659
1661
1662#if LIVES_HAS_GRID_WIDGET
1664#else
1666#endif
1667
1669
1671
1673
1675
1677
1681 prefs->btgamma = FALSE;
1682
1684
1686
1688
1690
1691 // get window manager capabilities
1692#ifdef GDK_WINDOWING_WAYLAND
1693 if (GDK_IS_WAYLAND_DISPLAY(mainw->mgeom[0].disp))
1694 capable->wm_name = lives_strdup("Wayland");
1695#endif
1696#ifdef GDK_WINDOWING_X11
1697 if (GDK_IS_X11_DISPLAY(mainw->mgeom[0].disp))
1698 capable->wm_name = lives_strdup(gdk_x11_screen_get_window_manager_name(gdk_screen_get_default()));
1699#endif
1700
1701 *capable->wm_caps.wm_name = 0;
1703 get_wm_caps();
1704
1705 if (*capable->wm_caps.panel)
1707 //prefs->show_desktop_panel = TRUE;
1708
1710
1718
1723
1726
1728
1729 if (!mainw->foreign) {
1732
1734
1737
1739
1741
1743
1744 if (!*prefs->video_open_command) {
1745 lives_memset(mppath, 0, 1);
1746
1749 }
1750
1753 }
1754
1755 if (!(*prefs->video_open_command) && capable->has_mpv) {
1756 get_location(EXEC_MPV, mppath, PATH_MAX);
1757 }
1758
1759 if (*mppath) {
1760 lives_snprintf(prefs->video_open_command, PATH_MAX + 2, "\"%s\"", mppath);
1762 }
1763 }
1764
1766
1767 prefs->show_rdet = TRUE;
1771
1772 // default frame sizes (TODO - allow pref)
1775
1783 ? 2 : 0 + ((prefs->mt_def_asamps == 8) ? 1 : 0));
1784
1787
1790
1794
1796
1797 if (!ign_opts->ign_clipset) {
1800 else prefs->ar_clipset = FALSE;
1801 } else set_string_pref(PREF_AR_CLIPSET, "");
1802
1803 if (!ign_opts->ign_layout) {
1806 else prefs->ar_layout = FALSE;
1807 } else set_string_pref(PREF_AR_LAYOUT, "");
1808
1810
1812 if (!ign_opts->ign_stmode) {
1814 }
1815
1816 // scan for encoder plugins
1817 if ((encoders = get_plugin_list(PLUGIN_ENCODERS, FALSE, NULL, NULL)) != NULL) {
1819 lives_list_free_all(&encoders);
1820 }
1821
1824
1826 LiVESList *ofmt_all = NULL;
1827 char **array;
1829 lives_snprintf(prefs->encoder.name, 64, "%s", FFMPEG_ENCODER_NAME);
1830 } else {
1831 if (capable->python_version >= 3000000)
1832 lives_snprintf(prefs->encoder.name, 64, "%s", MULTI_ENCODER3_NAME);
1833 else
1834 lives_snprintf(prefs->encoder.name, 64, "%s", MULTI_ENCODER_NAME);
1835 }
1836 // need to change the output format
1837
1838 if ((ofmt_all = plugin_request_by_line(PLUGIN_ENCODERS, prefs->encoder.name, "get_formats")) != NULL) {
1840
1841 for (i = 0; i < lives_list_length(ofmt_all); i++) {
1842 if (get_token_count((char *)lives_list_nth_data(ofmt_all, i), '|') > 2) {
1843 array = lives_strsplit((char *)lives_list_nth_data(ofmt_all, i), "|", -1);
1844
1845 if (!strcmp(array[0], HI_THEORA_FORMAT)) {
1846 lives_snprintf(prefs->encoder.of_name, 64, "%s", array[0]);
1847 lives_strfreev(array);
1848 break;
1849 }
1850 if (!strcmp(array[0], HI_MPEG_FORMAT)) {
1851 lives_snprintf(prefs->encoder.of_name, 64, "%s", array[0]);
1852 } else if (!strcmp(array[0], HI_H_MKV_FORMAT) && strcmp(prefs->encoder.of_name, HI_MPEG_FORMAT)) {
1853 lives_snprintf(prefs->encoder.of_name, 64, "%s", array[0]);
1854 } else if (!strcmp(array[0], HI_H_AVI_FORMAT) && strcmp(prefs->encoder.of_name, HI_MPEG_FORMAT) &&
1856 lives_snprintf(prefs->encoder.of_name, 64, "%s", array[0]);
1857 } else if (!(*prefs->encoder.of_name)) {
1858 lives_snprintf(prefs->encoder.of_name, 64, "%s", array[0]);
1859 }
1860
1861 lives_strfreev(array);
1862 }
1863 }
1864
1866
1867 lives_list_free_all(&ofmt_all);
1868 }
1869 }
1870
1871 if (!(*prefs->encoder.of_name)) {
1874 }
1875
1879
1880 lives_snprintf(future_prefs->encoder.name, 64, "%s", prefs->encoder.name);
1881
1884
1886 char **array;
1887 int numtok;
1888 LiVESList *ofmt_all, *dummy_list;
1889
1890 dummy_list = plugin_request("encoders", prefs->encoder.name, "init");
1891 lives_list_free_all(&dummy_list);
1892
1893 if (((encoder_capabilities = plugin_request(PLUGIN_ENCODERS, prefs->encoder.name, "get_capabilities")) != NULL)) {
1894 prefs->encoder.capabilities = atoi((char *)lives_list_nth_data(encoder_capabilities, 0));
1895 lives_list_free_all(&encoder_capabilities);
1896 if ((ofmt_all = plugin_request_by_line(PLUGIN_ENCODERS, prefs->encoder.name, "get_formats")) != NULL) {
1897 // get any restrictions for the current format
1898 LiVESList *list = ofmt_all;
1899 while (list) {
1900 if ((numtok = get_token_count((char *)list->data, '|')) > 2) {
1901 array = lives_strsplit((char *)list->data, "|", -1);
1902 if (!strcmp(array[0], prefs->encoder.of_name)) {
1903 if (numtok > 1) {
1904 lives_snprintf(prefs->encoder.of_desc, 128, "%s", array[1]);
1905 }
1906 lives_strfreev(array);
1907 break;
1908 }
1909 lives_strfreev(array);
1910 }
1911 list = list->next;
1912 }
1913 lives_list_free_all(&ofmt_all);
1914 }
1915 }
1916 }
1917
1919 if (!(*prefs->def_vid_load_dir)) {
1920#ifdef USE_GLIB
1921#if GLIB_CHECK_VERSION(2, 14, 0)
1922 lives_snprintf(prefs->def_vid_load_dir, PATH_MAX, "%s", g_get_user_special_dir(G_USER_DIRECTORY_VIDEOS));
1923#else
1924 lives_snprintf(prefs->def_vid_load_dir, PATH_MAX, "%s", capable->home_dir);
1925#endif
1926#endif
1928 }
1929 lives_snprintf(mainw->vid_load_dir, PATH_MAX, "%s", prefs->def_vid_load_dir);
1931
1933 if (!(*prefs->def_vid_save_dir)) {
1934#ifdef USE_GLIB
1935#if GLIB_CHECK_VERSION(2, 14, 0)
1936 lives_snprintf(prefs->def_vid_save_dir, PATH_MAX, "%s", g_get_user_special_dir(G_USER_DIRECTORY_VIDEOS));
1937#else
1938 lives_snprintf(prefs->def_vid_save_dir, PATH_MAX, "%s", capable->home_dir);
1939#endif
1940#endif
1942 }
1943 lives_snprintf(mainw->vid_save_dir, PATH_MAX, "%s", prefs->def_vid_save_dir);
1945
1946 lives_snprintf(mainw->vid_dl_dir, PATH_MAX, "%s", mainw->vid_save_dir);
1947
1949 if (!(*prefs->def_audio_dir)) {
1950#ifdef USE_GLIB
1951#if GLIB_CHECK_VERSION(2, 14, 0)
1952 lives_snprintf(prefs->def_audio_dir, PATH_MAX, "%s", g_get_user_special_dir(G_USER_DIRECTORY_MUSIC));
1953#else
1954 lives_snprintf(prefs->def_audio_dir, PATH_MAX, "%s", capable->home_dir);
1955#endif
1956#endif
1958 }
1959 lives_snprintf(mainw->audio_dir, PATH_MAX, "%s", prefs->def_audio_dir);
1961
1963 if (!(*prefs->def_image_dir)) {
1964#ifdef USE_GLIB
1965#if GLIB_CHECK_VERSION(2, 14, 0)
1966 lives_snprintf(prefs->def_image_dir, PATH_MAX, "%s", g_get_user_special_dir(G_USER_DIRECTORY_PICTURES));
1967#else
1968 lives_snprintf(prefs->def_image_dir, PATH_MAX, "%s", capable->home_dir);
1969#endif
1970#endif
1972 }
1973 lives_snprintf(mainw->image_dir, PATH_MAX, "%s", prefs->def_image_dir);
1975
1977 if (!(*prefs->def_proj_dir)) {
1978 lives_snprintf(prefs->def_proj_dir, PATH_MAX, "%s", capable->home_dir);
1980 }
1981 lives_snprintf(mainw->proj_load_dir, PATH_MAX, "%s", prefs->def_proj_dir);
1983 lives_snprintf(mainw->proj_save_dir, PATH_MAX, "%s", mainw->proj_load_dir);
1984
1986
1989
1994 }
1995
1997
1998 // conserve disk space ?
2001
2002 // need better control of audio channels first
2004
2005 // should we always use the last directory ?
2006 // TODO - add to GUI
2009
2011
2012 prefs->fxdefsfile = NULL;
2013 prefs->fxsizesfile = NULL;
2014
2015 if (!needs_workdir && initial_startup_phase == 0) {
2017 }
2018
2019 // anything that d_prints messages should go here:
2020 do_start_messages();
2021
2022 needs_free = FALSE;
2024 if (!*prefs->weed_plugin_path) {
2025 weed_plugin_path = getenv("WEED_PLUGIN_PATH");
2026 if (!weed_plugin_path) {
2027 weed_plugin_path = lives_build_path(prefs->lib_dir, PLUGIN_EXEC_DIR,
2029 needs_free = TRUE;
2030 }
2031 lives_snprintf(prefs->weed_plugin_path, PATH_MAX, "%s", weed_plugin_path);
2032 if (needs_free) lives_free(weed_plugin_path);
2034 }
2035 lives_setenv("WEED_PLUGIN_PATH", prefs->weed_plugin_path);
2036
2037#ifdef HAVE_FREI0R
2038 needs_free = FALSE;
2040 if (!*prefs->frei0r_path) {
2041 frei0r_path = getenv("FREI0R_PATH");
2042 if (!frei0r_path) {
2043 frei0r_path =
2044 lives_strdup_printf("/usr/lib/frei0r-1:/usr/local/lib/frei0r-1:%s/frei0r-1",
2045 capable->home_dir);
2046 needs_free = TRUE;
2047 }
2048 lives_snprintf(prefs->frei0r_path, PATH_MAX, "%s", frei0r_path);
2049 if (needs_free) lives_free(frei0r_path);
2051 }
2052 lives_setenv("FREI0R_PATH", prefs->frei0r_path);
2053#endif
2054
2055#if HAVE_LADSPA
2056 needs_free = FALSE;
2058 if (!*prefs->ladspa_path) {
2059 ladspa_path = getenv("LADSPA_PATH");
2060 if (!ladspa_path) {
2061 ladspa_path = lives_build_path(prefs->lib_dir, "ladspa", NULL);
2062 needs_free = TRUE;
2063 }
2064 lives_snprintf(prefs->ladspa_path, PATH_MAX, "%s", ladspa_path);
2065 if (needs_free) lives_free(ladspa_path);
2067 }
2068 lives_setenv("LADSPA_PATH", prefs->ladspa_path);
2069#endif
2070
2071#if HAVE_LIBVISUAL
2072 needs_free = FALSE;
2074 if (!*prefs->libvis_path) {
2075 libvis_path = getenv("VISUAL_PLUGIN_PATH");
2076 if (!libvis_path) {
2077 libvis_path = "";
2078 }
2079 lives_snprintf(prefs->libvis_path, PATH_MAX, "%s", libvis_path);
2081 }
2082 lives_setenv("VISUAL_PLUGIN_PATH", prefs->libvis_path);
2083#endif
2084
2085 splash_msg(_("Loading realtime effect plugins..."), SPLASH_LEVEL_LOAD_RTE);
2086 weed_load_all();
2087
2088 // replace any multi choice effects with their delegates
2090
2094
2096
2097#ifdef ENABLE_JACK
2098 lives_snprintf(prefs->jack_aserver, PATH_MAX, "%s/.jackdrc", capable->home_dir);
2099 lives_snprintf(prefs->jack_tserver, PATH_MAX, "%s/.jackdrc", capable->home_dir);
2100#endif
2101
2102 array = lives_strsplit(DEF_AUTOTRANS, "|", 3);
2103 mainw->def_trans_idx = weed_filter_highest_version(array[0], array[1], array[2], NULL);
2104 if (mainw->def_trans_idx == - 1) {
2105 msg = lives_strdup_printf(_("System default transition (%s from package %s by %s) not found."),
2106 array[1], array[0], array[2]);
2107 LIVES_WARN(msg);
2108 lives_free(msg);
2109 }
2110 lives_strfreev(array);
2111
2113 if (!strcmp(buff, "none")) prefs->atrans_fx = -1;
2114 else {
2115 if (!lives_utf8_strcasecmp(buff, DEF_AUTOTRANS) || get_token_count(buff, '|') < 3)
2117 else {
2118 array = lives_strsplit(buff, "|", 3);
2119 prefs->atrans_fx = weed_filter_highest_version(array[0], array[1], array[2], NULL);
2120 if (prefs->atrans_fx == - 1) {
2121 msg = lives_strdup_printf(_("User default transition (%s from package %s by %s) not found."),
2122 array[1], array[0], array[2]);
2123 LIVES_WARN(msg);
2124 lives_free(msg);
2125 }
2126 lives_strfreev(array);
2127 }
2128 }
2129
2130 mainw->recovery_file = lives_strdup_printf("%s/recovery.%d.%d.%d", prefs->workdir, lives_getuid(),
2132
2133 if (capable->has_jackd) naudp++;
2134 if (capable->has_pulse_audio) naudp++;
2135 if (capable->has_sox_play) naudp++;
2136
2137 if (naudp > 1) {
2138 if (prefs->startup_phase > 0 && prefs->startup_phase <= 4) {
2139 splash_end();
2141 lives_exit(0);
2142 }
2146
2147 prefs->startup_phase = 4;
2149 }
2150
2151 // audio startup
2152#ifdef ENABLE_JACK
2156 // start jack transport polling
2157 if (prefs->jack_opts & JACK_OPTS_START_ASERVER) splash_msg(_("Starting jack audio server..."),
2159 else {
2160 if (prefs->jack_opts & JACK_OPTS_START_TSERVER) splash_msg(_("Starting jack transport server..."),
2162 else splash_msg(_("Connecting to jack server..."), SPLASH_LEVEL_LOAD_APLAYER);
2163 }
2164 if (!lives_jack_init()) {
2167 else do_jack_noopen_warn3();
2168 if (prefs->startup_phase == 4) {
2170 }
2171 future_prefs->jack_opts = 0; // jack is causing hassle, get rid of it
2173 lives_exit(0);
2174 }
2175 }
2176
2178 jack_audio_init();
2179 jack_audio_read_init();
2180 mainw->jackd = jack_get_driver(0, TRUE);
2181 if (mainw->jackd) {
2182 if (!jack_create_client_writer(mainw->jackd)) mainw->jackd = NULL;
2183
2184 if (!mainw->jackd && prefs->startup_phase == 0) {
2185#ifdef HAVE_PULSE_AUDIO
2186 char *otherbit = lives_strdup("\"lives -aplayer pulse\".");
2187#else
2188 char *otherbit = lives_strdup("\"lives -aplayer sox\".");
2189#endif
2190 char *tmp;
2191
2192 char *msg = lives_strdup_printf(
2193 _("\n\nManual start of jackd required. Please make sure jackd is running, \n"
2194 "or else change the value of <jack_opts> in %s to 16\nand restart LiVES.\n\n"
2195 "Alternatively, try to start lives with either \"lives -jackopts 16\", or "),
2196 (tmp = lives_filename_to_utf8(prefs->configfile, -1, NULL, NULL, NULL)));
2197 fprintf(stderr, "%s%s\n\n", msg, otherbit);
2198 lives_free(msg);
2199 lives_free(tmp);
2200 lives_free(otherbit);
2201 }
2202
2203 if (!mainw->jackd) {
2205 if (prefs->startup_phase == 4) {
2207 } else do_jack_noopen_warn4();
2208 lives_exit(0);
2209 }
2210
2211 mainw->jackd->whentostop = &mainw->whentostop;
2212 mainw->jackd->cancelled = &mainw->cancelled;
2213 mainw->jackd->in_use = FALSE;
2214 mainw->jackd->play_when_stopped = (prefs->jack_opts & JACK_OPTS_NOPLAY_WHEN_PAUSED)
2215 ? FALSE : TRUE;
2216
2217 jack_write_driver_activate(mainw->jackd);
2218
2219 if (prefs->perm_audio_reader) {
2220 // create reader connection now, if permanent
2221 jack_rec_audio_to_clip(-1, -1, RECA_EXTERNAL);
2222 // *INDENT-OFF*
2223 }}}
2224 // *INDENT-ON*
2225#endif
2226 }
2227
2228#ifdef HAVE_PULSE_AUDIO
2230 splash_msg(_("Starting pulseaudio server..."), SPLASH_LEVEL_LOAD_APLAYER);
2231
2232 if (!mainw->foreign) {
2233 if (prefs->pa_restart && !prefs->vj_mode) {
2234 char *com = lives_strdup_printf("%s -k %s", EXEC_PULSEAUDIO, prefs->pa_start_opts);
2235 lives_system(com, TRUE);
2236 lives_free(com);
2237 }
2238 }
2239
2240 if (!lives_pulse_init(prefs->startup_phase)) {
2241 if (prefs->startup_phase == 4) {
2242 lives_exit(0);
2243 }
2244 } else {
2245 pulse_audio_init();
2246 pulse_audio_read_init();
2247 mainw->pulsed = pulse_get_driver(TRUE);
2248 mainw->pulsed->whentostop = &mainw->whentostop;
2249 mainw->pulsed->cancelled = &mainw->cancelled;
2250 mainw->pulsed->in_use = FALSE;
2251
2252 pulse_driver_activate(mainw->pulsed);
2253
2254 if (prefs->perm_audio_reader) {
2255 // create reader connection now, if permanent
2256 pulse_rec_audio_to_clip(-1, -1, RECA_EXTERNAL);
2257 // *INDENT-OFF*
2258 }}}
2259 // *INDENT-ON*
2260#endif
2261 }
2262
2263 if (prefs->startup_phase != 0) {
2264 splash_end();
2266 prefs->startup_phase = 5;
2268
2270 prefs->startup_phase = 6;
2271
2272 if (prefs->show_disk_quota && !prefs->vj_mode) {
2275
2277 if (capable->ds_used >= 0) {
2278 ran_ds_dlg = TRUE;
2280 } else {
2284 }
2285 } else {
2287 }
2288
2289 set_int_pref(PREF_STARTUP_PHASE, 100); // tell backend to delete this
2290 prefs->startup_phase = 100;
2291
2292 /* if (prefs->show_splash) { */
2293 /* splash_init(); */
2294 /* } */
2295 }
2296
2297 if (strcmp(future_prefs->theme, prefs->theme)) {
2298 // we set the theme here in case it got reset to 'none'
2300 lives_snprintf(future_prefs->theme, 64, "%s", prefs->theme);
2301 }
2302
2304} // end of lives_init
2305
2306
2307static void show_detected_or_not(boolean cap, const char *pname) {
2308 if (cap) d_print(_("%s...detected... "), pname);
2309 else d_print(_("%s...NOT DETECTED... "), pname);
2310}
2311
2312#define SHOWDETx(cap, exec) show_detected_or_not(capable->has_##cap, exec)
2313#define SHOWDET(cap) SHOWDETx(cap, QUOTEME(cap))
2314// SHOWDET(, EXEC_);
2315
2316static void do_start_messages(void) {
2317 int w, h;
2318 char *tmp, *endian, *fname, *phase = NULL;
2319
2320 if (prefs->vj_mode) {
2321 d_print(_("Starting in VJ MODE: Skipping most startup checks\n"));
2322#ifndef IS_MINGW
2323 SHOWDET(wmctrl);
2324 SHOWDET(xdotool);
2325 SHOWDET(xwininfo);
2326#endif
2327 d_print("\n\n");
2328 return;
2329 }
2330
2331 d_print(_("\nMachine details:\n"));
2332
2334 d_print(_("OS is %s %s, running on %s\n"),
2335 capable->os_name ? capable->os_name : _("unknown"),
2337 capable->os_hardware ? capable->os_hardware : "????");
2338
2339 d_print(_("CPU type is %s "), capable->cpu_name);
2340 d_print(P_("(%d core, ", "(%d cores, ", capable->ncpus), capable->ncpus);
2341
2342 if (capable->byte_order == LIVES_LITTLE_ENDIAN) endian = (_("little endian"));
2343 else endian = (_("big endian"));
2344 d_print(_("%d bits, %s)\n"), capable->cpu_bits, endian);
2345 lives_free(endian);
2346
2347 d_print(_("Machine name is '%s'\n"), capable->mach_name);
2348
2349 d_print(_("Number of monitors detected: %d: "), capable->nmonitors);
2350
2351 d_print(_("GUI screen size is %d X %d (usable: %d X %d); %d dpi.\nWidget scaling has been set to %.3f.\n"),
2356
2357 if (get_screen_usable_size(&w, &h)) {
2358 d_print(_("Actual usable size appears to be %d X %d\n"), w, h);
2359 }
2360
2361 get_wm_caps();
2362
2363 d_print(_("Window manager reports as \"%s\" (%s)"),
2364 capable->wm_name ? capable->wm_name : _("UNKNOWN - please patch me !"),
2365 capable->wm_caps.wm_name ? capable->wm_caps.wm_name : "unknown");
2366
2367 if (capable->wm_type && *capable->wm_type)
2368 d_print(_(", running on %s"), capable->wm_type);
2369
2370 d_print(_("; compositing is %s.\n"), capable->wm_caps.is_composited ? _("supported") : _("not supported"));
2371
2373
2375 else tmp = lives_strdup("");
2376
2377 d_print(_("Distro is %s %s %s\n"), capable->distro_name ? capable->distro_name : "?????",
2378 capable->distro_ver ? capable->distro_ver : "?????", tmp);
2379 lives_free(tmp);
2380
2381 d_print("%s", _("GUI type is: "));
2382
2383#ifdef GUI_GTK
2384#if GTK_CHECK_VERSION(3, 0, 0)
2385 d_print(_("GTK+ version %d.%d.%d (compiled with %d.%d.%d)"),
2386 gtk_get_major_version(), gtk_get_minor_version(),
2387 gtk_get_micro_version(),
2388 GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
2389 GTK_MICRO_VERSION
2390 );
2391#else
2392 d_print(_("GTK+ (compiled with %d.%d.%d)"),
2393 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
2394#endif
2395#endif
2396
2397#ifdef LIVES_PAINTER_IS_CAIRO
2398 d_print(_(", with cairo support\n"));
2399#else
2400 d_print(_("\n"));
2401#endif
2402
2403 if (*capable->gui_theme_name) tmp = lives_strdup(capable->gui_theme_name);
2404 else tmp = lives_strdup_printf("lives-%s-dynamic", prefs->theme);
2405
2406 d_print("GUI theme set to %s, icon theme set to %s\n", tmp,
2408
2409 lives_free(tmp);
2410
2411
2412#ifndef RT_AUDIO
2413 d_print(_("WARNING - this version of LiVES was compiled without either\njack or pulseaudio support.\n"
2414 "Many audio features will be unavailable.\n"));
2415# else
2416#ifdef ENABLE_JACK
2417 d_print(_("Compiled with jack support, good !\n"));
2418#endif
2419#ifdef HAVE_PULSE_AUDIO
2420 d_print(_("Compiled with pulseaudio support, wonderful !\n"));
2421#endif
2422#endif
2423
2424 if (ign_opts.ign_configfile) {
2425 tmp = (_("set via -configfile commandline option"));
2426 } else {
2427 tmp = (_("default value"));
2428 }
2429 d_print(_("\nConfig file is %s (%s)\n"), prefs->configfile, tmp);
2430 lives_free(tmp);
2431
2434 if (capable->mountpoint && *capable->mountpoint) tmp = lives_strdup_printf(_(", contained in volume %s"), capable->mountpoint);
2435 else tmp = lives_strdup("");
2436
2437 d_print(_("\nWorking directory is %s%s\n"), prefs->workdir, tmp);
2438 lives_free(tmp);
2439
2441 d_print(_("(Set by -workdir commandline option)\n"));
2442 } else {
2443 if (initial_startup_phase != -1) {
2444 if (!strcmp(mainw->version_hash, mainw->old_vhash)) {
2445 lives_free(old_vhash);
2446 old_vhash = lives_strdup(LiVES_VERSION);
2447 }
2448 d_print(_("(Retrieved from %s, version %s)\n"), prefs->configfile, old_vhash);
2449 } else {
2450 d_print(_("(Set by user during setup phase)\n"));
2451 }
2452 }
2453
2454 if (initial_startup_phase == 0) {
2455 if (!*mainw->old_vhash || !strcmp(mainw->old_vhash, "0")) {
2456 phase = (_("STARTUP ERROR OCCURRED - FORCED REINSTALL"));
2457 } else {
2458 if (atoi(mainw->old_vhash) < atoi(mainw->version_hash)) {
2459 phase = lives_strdup_printf(_("upgrade from version %s. Welcome !"), mainw->old_vhash);
2460 } else if (atoi(mainw->old_vhash) > atoi(mainw->version_hash)) {
2461 phase = lives_strdup_printf(_("downgrade from version %s !"), mainw->old_vhash);
2462 }
2463 }
2464 } else if (initial_startup_phase == -1) {
2465 if (!strcmp(mainw->old_vhash, "0")) {
2466 phase = (_("REINSTALL AFTER FAILED RECOVERY"));
2467 fname = lives_strdup_printf("%s.damaged", prefs->configfile);
2468 if (lives_file_test(fname, LIVES_FILE_TEST_EXISTS)) {
2469 tmp = lives_strdup_printf(_("%s; check %s for possible errors before re-running LiVES"), phase, fname);
2470 lives_free(phase);
2471 phase = tmp;
2472 }
2473 lives_free(fname);
2474 d_print("\n");
2475 } else {
2476 phase = (_("fresh install. Welcome !"));
2477 }
2478 } else {
2479 phase = lives_strdup_printf(_("continue with installation"), initial_startup_phase);
2480 }
2481 if (!phase) phase = (_("normal startup"));
2482 d_print(_("Initial startup phase was %d: (%s)\n"), initial_startup_phase, phase);
2483 lives_free(phase);
2484 lives_free(old_vhash);
2485
2486 if (initial_startup_phase == 0) {
2487 fname = lives_strdup_printf("%s.recovery.tried.succeeded", prefs->configfile);
2488 if (lives_file_test(fname, LIVES_FILE_TEST_EXISTS)) {
2489 phase = lives_strdup_printf(_("%s WAS POSSIBLY RECOVERED FROM %s.recovery\n"), prefs->configfile, prefs->configfile);
2490 d_print("%s", phase);
2491 lives_free(phase);
2492 }
2493 lives_free(fname);
2494 }
2495
2496
2497 d_print(_("\nChecking RECOMMENDED dependencies: "));
2498
2499 SHOWDET(mplayer);
2500 if (!capable->has_mplayer) {
2501 SHOWDET(mplayer2);
2502 if (!capable->has_mplayer2) {
2503 SHOWDET(mpv);
2504 }
2505 }
2506 //SHOWDET(file);
2507 SHOWDET(identify);
2508 if (!capable->has_jackd)
2509 SHOWDETx(pulse_audio, EXEC_PULSEAUDIO);
2510 SHOWDETx(sox_sox, EXEC_SOX);
2511 SHOWDET(convert);
2512 SHOWDET(composite);
2513 SHOWDET(ffprobe);
2514 SHOWDET(gzip);
2515 SHOWDET(md5sum);
2518 SHOWDETx(youtube_dlc, EXEC_YOUTUBE_DLC);
2519 } else SHOWDETx(youtube_dl, EXEC_YOUTUBE_DL);
2520
2521 d_print(_("\n\nChecking OPTIONAL dependencies: "));
2522 SHOWDET(jackd);
2523 SHOWDET(python);
2524 SHOWDET(xwininfo);
2525 SHOWDETx(cdda2wav, "cdda2wav/icedax");
2526 SHOWDET(dvgrab);
2527 SHOWDET(gdb);
2528 SHOWDETx(gconftool_2, EXEC_GCONFTOOL_2);
2529 SHOWDETx(xdg_screensaver, EXEC_XDG_SCREENSAVER);
2530
2531 d_print("\n\n");
2532}
2533#undef SHOWDETx
2534#undef SHOWDET
2535
2536static void set_toolkit_theme(int prefer) {
2537 char *lname, *ic_dir;
2538 // LiVESList *list;
2539 char *tmp;
2540
2541 lives_widget_object_get(gtk_settings_get_default(), "gtk-double-click-time", &capable->dclick_time);
2543
2544 lives_widget_object_get(gtk_settings_get_default(), "gtk-double-click-distance", &capable->dclick_dist);
2546
2547 lives_widget_object_get(gtk_settings_get_default(), "gtk-font-name", &tmp);
2548
2551 lives_free(tmp);
2552
2553 lives_widget_object_get(gtk_settings_get_default(), "gtk-alternative-button-order", &widget_opts.alt_button_order);
2554
2555 lives_widget_object_get(gtk_settings_get_default(), "gtk-icon-theme-name", &capable->icon_theme_name);
2556 lives_widget_object_get(gtk_settings_get_default(), "gtk-theme-name", &capable->gui_theme_name);
2557
2558 if (prefer & LIVES_THEME_DARK) {
2559 lives_widget_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", TRUE);
2560 }
2561
2562 if (prefer & USE_LIVES_THEMEING) {
2563 lives_widget_object_set(gtk_settings_get_default(), "gtk-theme-name", "");
2564
2565 lname = lives_strdup("-lives-hybrid");
2567
2568 lname = lives_strdup("-lives-hybrid-dynamic");
2570 }
2571
2572 capable->extra_icon_path = lives_build_path(prefs->config_datadir, STOCK_ICONS_DIR, NULL);
2573
2574 widget_opts.icon_theme = gtk_icon_theme_new();
2575
2576 gtk_icon_theme_set_custom_theme((LiVESIconTheme *)widget_opts.icon_theme, capable->icon_theme_name);
2577 gtk_icon_theme_prepend_search_path((LiVESIconTheme *)widget_opts.icon_theme, capable->extra_icon_path);
2578
2579 ic_dir = lives_build_path(prefs->prefix_dir, ICON_DIR, NULL);
2580 gtk_icon_theme_prepend_search_path((LiVESIconTheme *)widget_opts.icon_theme, ic_dir);
2581 lives_free(ic_dir);
2582
2583 capable->all_icons = gtk_icon_theme_list_icons((LiVESIconTheme *)widget_opts.icon_theme, NULL);
2584 if (0) {
2585 LiVESList *list = capable->all_icons;
2586 for (; list; list = list->next) if (!strncmp((char *)list->data, "gtk-", 4)) g_print("icon: %s\n", (char *)list->data);
2587 }
2588
2590}
2591
2592
2593#ifndef VALGRIND_ON
2594static void pick_custom_colours(void) {
2595 double lmin, lmax;
2596 uint8_t ncr, ncg, ncb;
2597 if (!(palette->style & STYLE_LIGHT)) {
2598 lmin = .05; lmax = .4;
2599 } else {
2600 lmin = .6; lmax = .8;
2601 }
2602 ncr = palette->menu_and_bars.red * 255.;
2603 ncg = palette->menu_and_bars.green * 255.;
2604 ncb = palette->menu_and_bars.blue * 255.;
2606 if (pick_nice_colour(palette->normal_back.red * 255., palette->normal_back.green * 255.,
2607 palette->normal_back.blue * 255., &ncr, &ncg, &ncb, 1.5, .25, .75)) {
2608 // nice1 - used for outlines
2609 palette->nice1.red = LIVES_WIDGET_COLOR_SCALE_255(ncr);
2610 palette->nice1.green = LIVES_WIDGET_COLOR_SCALE_255(ncg);
2611 palette->nice1.blue = LIVES_WIDGET_COLOR_SCALE_255(ncb);
2612 palette->nice1.alpha = 1.;
2613
2614 ncr = palette->menu_and_bars.red * 255.;
2615 ncg = palette->menu_and_bars.green * 255.;
2616 ncb = palette->menu_and_bars.blue * 255.;
2617
2618 if (pick_nice_colour(palette->nice1.red * 255., palette->nice1.green * 255.,
2619 palette->nice1.blue * 255., &ncr, &ncg, &ncb, 1., lmin, lmax)) {
2620 // nice2 - alt for menu_and_bars
2621 // insensitive colour ?
2622 palette->nice2.red = LIVES_WIDGET_COLOR_SCALE_255(ncr);
2623 palette->nice2.green = LIVES_WIDGET_COLOR_SCALE_255(ncg);
2624 palette->nice2.blue = LIVES_WIDGET_COLOR_SCALE_255(ncb);
2625 palette->nice2.alpha = 1.;
2627
2628 if (!(palette->style & STYLE_LIGHT)) {
2629 lmin = .6; lmax = .8;
2630 } else {
2631 lmin = .2; lmax = .4;
2632 }
2633 pick_nice_colour(palette->normal_fore.red * 255., palette->normal_fore.green * 255.,
2634 palette->normal_fore.blue * 255., &ncr, &ncg, &ncb, 1., lmin, lmax);
2635 // nice3 - alt for menu_and_bars_fore
2636 palette->nice3.red = LIVES_WIDGET_COLOR_SCALE_255(ncr);
2637 palette->nice3.green = LIVES_WIDGET_COLOR_SCALE_255(ncg);
2638 palette->nice3.blue = LIVES_WIDGET_COLOR_SCALE_255(ncb);
2639 palette->nice3.alpha = 1.;
2640 }
2641 }
2643 char *colref, *tmp;
2644 colref = gdk_rgba_to_string(&palette->nice1);
2645 set_css_value_direct(NULL, LIVES_WIDGET_STATE_PRELIGHT, "combobox window menu menuitem", "border-color", colref);
2646
2647 tmp = lives_strdup_printf("0 -3px %s inset", colref);
2648 set_css_value_direct(NULL, LIVES_WIDGET_STATE_CHECKED, "notebook header tabs *", "box-shadow", tmp);
2649 set_css_value_direct(NULL, LIVES_WIDGET_STATE_PRELIGHT, "menuitem", "box-shadow", tmp);
2650 set_css_value_direct(NULL, LIVES_WIDGET_STATE_PRELIGHT, "menu menuitem", "box-shadow", "none");
2651 lives_free(tmp);
2652
2653 set_css_value_direct(NULL, LIVES_WIDGET_STATE_ACTIVE, "scrollbar slider", "background-color", colref);
2654 tmp = lives_strdup_printf("0 0 0 4px %s inset", colref);
2655 set_css_value_direct(NULL, LIVES_WIDGET_STATE_PRELIGHT, "combobox window menu menuitem", "box-shadow", tmp);
2656 lives_free(tmp);
2657 lives_free(colref);
2658 }
2659}
2660#endif
2661
2662
2663boolean set_palette_colours(boolean force_reload) {
2664 // force_reload should only be set when the theme changes in prefs.
2665 lives_colRGBA64_t lcol;
2666 LiVESList *cache_backup;
2667
2668 char *themedir, *themefile, *othemefile, *fname, *tmp;
2669 char *pstyle, *colref;
2670
2671 boolean is_OK = TRUE;
2672 boolean cached = FALSE;
2673
2674 lcol.alpha = 65535;
2675
2676 // set configurable colours and theme colours for the app
2677 lcol.red = lcol.green = lcol.blue = 0;
2679
2680 lcol.red = lcol.green = lcol.blue = 65535;
2682
2683 // salmon
2684 lcol.red = 63750;
2685 lcol.green = 32767;
2686 lcol.blue = 29070;
2688
2689 // SeaGreen3
2690 lcol.red = 17219;
2691 lcol.green = 52685;
2692 lcol.blue = 32896;
2694
2695 // dark red
2696 lcol.red = 30723;
2697 lcol.green = 0;
2698 lcol.blue = 0;
2700
2701 // darkorange4
2702 lcol.red = 35723;
2703 lcol.green = 17733;
2704 lcol.blue = 0;
2706
2709
2711
2712 // defaults
2715
2716 palette->audcol.blue = palette->audcol.red = 16384;
2717 palette->audcol.green = palette->audcol.alpha = 65535;
2718
2719 palette->vidcol.red = 0;
2720 palette->vidcol.green = 16384;
2721 palette->vidcol.blue = palette->vidcol.alpha = 65535;
2722
2723 palette->fxcol.red = palette->fxcol.alpha = 65535;
2725
2728
2730 palette->mt_timeline_reg.alpha = 65535;
2731
2733
2735 palette->ce_unsel.alpha = 65535;
2736
2738
2741
2742 lcol.red = 0;
2743
2744 // if theme is not "none" and we dont find stuff in prefs then we must reload
2745 if (!lives_ascii_strcasecmp(future_prefs->theme, LIVES_THEME_NONE)) {
2746 set_toolkit_theme(0);
2747 return TRUE;
2748 } else if (!get_colour_pref(THEME_DETAIL_STYLE, &lcol)) {
2749 force_reload = TRUE;
2750 } else {
2751 // pull our colours from normal prefs
2752 palette->style = lcol.red;
2753 if (!(palette->style & STYLE_LIGHT)) {
2755 if (mainw->multitrack && mainw->multitrack->sep_image)
2756 lives_widget_set_opacity(mainw->multitrack->sep_image, 0.8);
2759 } else {
2760 set_toolkit_theme(USE_LIVES_THEMEING | LIVES_THEME_COMPACT);
2763 if (mainw->multitrack && mainw->multitrack->sep_image)
2764 lives_widget_set_opacity(mainw->multitrack->sep_image, 0.4);
2765 }
2768
2771
2774
2777
2780
2783
2786
2787 // extended colours
2788
2791
2794
2798
2802
2804
2807 }
2808
2809 if (force_reload) {
2810 // check if theme is custom:
2811 themedir = lives_build_path(prefs->config_datadir, PLUGIN_THEMES, prefs->theme, NULL);
2812 if (!lives_file_test(themedir, LIVES_FILE_TEST_IS_DIR)) {
2813 lives_free(themedir);
2814 // if not custom, check if builtin
2815 themedir = lives_build_path(prefs->prefix_dir, THEME_DIR, prefs->theme, NULL);
2816 if (!lives_file_test(themedir, LIVES_FILE_TEST_IS_DIR)) {
2817 if (!mainw->is_ready) {
2818 lives_free(themedir);
2819 set_toolkit_theme(0);
2820 return FALSE;
2821 }
2822 is_OK = FALSE;
2823 }
2824 }
2825
2827 tmp = lives_build_filename(themedir, fname, NULL);
2828 lives_free(fname);
2829 if (lives_file_test(tmp, LIVES_FILE_TEST_EXISTS)) {
2830 lives_snprintf(mainw->sepimg_path, PATH_MAX, "%s", tmp);
2831 lives_free(tmp);
2832 } else {
2834 lives_free(tmp);
2835 tmp = lives_build_filename(themedir, fname, NULL);
2836 lives_free(fname);
2837 lives_snprintf(mainw->sepimg_path, PATH_MAX, "%s", tmp);
2838 lives_free(tmp);
2839 }
2840
2842 tmp = lives_build_filename(themedir, fname, NULL);
2843 lives_free(fname);
2844 if (lives_file_test(tmp, LIVES_FILE_TEST_EXISTS)) {
2845 lives_snprintf(mainw->frameblank_path, PATH_MAX, "%s", tmp);
2846 lives_free(tmp);
2847 } else {
2849 tmp = lives_build_filename(themedir, fname, NULL);
2850 lives_free(fname);
2851 lives_snprintf(mainw->frameblank_path, PATH_MAX, "%s", tmp);
2852 lives_free(tmp);
2853 }
2854
2855 // load from file
2856 themefile = lives_build_filename(themedir, THEME_HEADER, NULL);
2857#ifdef GUI_GTK
2858#if !GTK_CHECK_VERSION(3, 0, 0)
2859 lives_free(themefile);
2860 themefile = lives_build_filename(themedir, THEME_HEADER_2, NULL);
2861#endif
2862#endif
2863
2864 if (!lives_file_test(themefile, LIVES_FILE_TEST_EXISTS)) {
2865 lives_free(themefile);
2866 themefile = lives_build_filename(themedir, THEME_HEADER_2, NULL);
2867#ifdef GUI_GTK
2868#if !GTK_CHECK_VERSION(3, 0, 0)
2869 lives_free(themefile);
2870 themefile = lives_build_filename(themedir, THEME_HEADER, NULL);
2871#endif
2872#endif
2873 if (!lives_file_test(themefile, LIVES_FILE_TEST_EXISTS)) {
2874 is_OK = FALSE;
2875 }
2876 }
2877
2878 lives_free(themedir);
2879
2880 // cache the themefile
2881 othemefile = themefile;
2882 cache_backup = mainw->gen_cache;
2883 if (!(mainw->gen_cache = cache_file_contents(themefile))) themefile = NULL;
2884 else cached = TRUE;
2885
2887
2888 if (!is_OK || !(pstyle = get_val_from_cached_list(THEME_DETAIL_STYLE, 8, mainw->gen_cache))) {
2889 if (pstyle) lives_free(pstyle);
2890 is_OK = FALSE;
2891 set_toolkit_theme(0);
2892 } else {
2893 palette->style = atoi(pstyle);
2894 lives_free(pstyle);
2895 if (!(palette->style & STYLE_LIGHT)) {
2898 if (mainw->multitrack && mainw->multitrack->sep_image)
2899 lives_widget_set_opacity(mainw->multitrack->sep_image, 0.8);
2901 } else {
2903 if (mainw->multitrack && mainw->multitrack->sep_image)
2904 lives_widget_set_opacity(mainw->multitrack->sep_image, 0.4);
2905 set_toolkit_theme(USE_LIVES_THEMEING | LIVES_THEME_COMPACT);
2907 }
2908 }
2909
2910 if (!is_OK || !get_theme_colour_pref(THEME_DETAIL_NORMAL_FORE, &lcol)) {
2911 is_OK = FALSE;
2913
2914 if (!is_OK || !get_theme_colour_pref(THEME_DETAIL_NORMAL_BACK, &lcol)) {
2915 is_OK = FALSE;
2917
2918 if (!is_OK || !get_theme_colour_pref(THEME_DETAIL_ALT_FORE, &lcol)) {
2919 is_OK = FALSE;
2921
2922 if (!is_OK || !get_theme_colour_pref(THEME_DETAIL_ALT_BACK, &lcol)) {
2923 is_OK = FALSE;
2925
2926 if (!is_OK || !get_theme_colour_pref(THEME_DETAIL_INFO_TEXT, &lcol)) {
2927 is_OK = FALSE;
2929
2930 if (!is_OK || !get_theme_colour_pref(THEME_DETAIL_INFO_BASE, &lcol)) {
2931 is_OK = FALSE;
2933
2934 if (!is_OK) {
2935 if (cached) {
2937 mainw->gen_cache = cache_backup;
2938 themefile = othemefile;
2939 }
2940 if (mainw->is_ready) do_bad_theme_error(themefile);
2941 lives_free(themefile);
2942 return FALSE;
2943 }
2944
2945 // get optional elements
2948 }
2949
2952 }
2953
2957
2961
2963
2966
2967 if (cached) {
2969 mainw->gen_cache = cache_backup;
2970 themefile = othemefile;
2971 }
2972
2973 lives_free(themefile);
2974
2975 // set details in prefs
2976 set_palette_prefs(force_reload);
2977 }
2978
2979#ifndef VALGRIND_ON
2981 // still experimenting...some values may need tweaking
2982 // suggested uses for each colour in the process of being defined
2983 // TODO - run a bg thread until we create GUI
2984 if (!prefs->vj_mode) {
2986 lives_proc_thread_create(LIVES_THRDATTR_NONE, (lives_funcptr_t)pick_custom_colours, 0, "");
2987 }
2988#endif
2990
2991 set_css_value_direct(NULL, LIVES_WIDGET_STATE_PRELIGHT, "toolbutton *", "background-image", "none");
2992
2993 colref = gdk_rgba_to_string(&palette->normal_back);
2994 set_css_value_direct(NULL, LIVES_WIDGET_STATE_NORMAL, "combobox window menu", "background-color", colref);
2995 lives_free(colref);
2996 colref = gdk_rgba_to_string(&palette->normal_fore);
2997 set_css_value_direct(NULL, LIVES_WIDGET_STATE_NORMAL, "combobox window menu", "color", colref);
2998 lives_free(colref);
2999
3000 colref = gdk_rgba_to_string(&palette->menu_and_bars);
3001 set_css_value_direct(NULL, LIVES_WIDGET_STATE_NORMAL, "scrollbar", "background-color", colref);
3002 set_css_value_direct(NULL, LIVES_WIDGET_STATE_PRELIGHT, "combobox window menu menuitem", "background-color", colref);
3003 lives_free(colref);
3004 colref = gdk_rgba_to_string(&palette->menu_and_bars_fore);
3005 set_css_value_direct(NULL, LIVES_WIDGET_STATE_PRELIGHT, "combobox window menu menuitem", "color", colref);
3006 lives_free(colref);
3007
3008 set_css_value_direct(NULL, LIVES_WIDGET_STATE_NORMAL, "combobox window menu menuitem", "border-width", "2px");
3009
3010 tmp = lives_strdup_printf("%dpx", ((widget_opts.css_min_height * 3 + 3) >> 2) << 1);
3011 set_css_value_direct(NULL, LIVES_WIDGET_STATE_NORMAL, "combobox window menu menuitem", "min-height", tmp);
3012 lives_free(tmp);
3013 colref = gdk_rgba_to_string(&palette->menu_and_bars_fore);
3014 set_css_value_direct(NULL, LIVES_WIDGET_STATE_NORMAL, "scrollbar", "color", colref);
3015 lives_free(colref);
3016
3017 //set_css_value_direct(NULL, LIVES_WIDGET_STATE_INSENSITIVE, "spinbutton button", "opacity", "0.5");
3018
3019 return TRUE;
3020}
3021
3022
3024 // get capabilities of backend system
3025 char **array;
3026 char *msg, *tmp;
3027
3028 char buffer[PATH_MAX * 4];
3029 char command[PATH_MAX * 4];
3030 char dir[PATH_MAX];
3031 int numtok;
3032 size_t xs;
3033
3034#ifdef IS_DARWIN
3035 processor_info_array_t processorInfo;
3036 mach_msg_type_number_t numProcessorInfo;
3037 natural_t numProcessors = 0U;
3038 kern_return_t kerr;
3039#endif
3040
3041 buffer[0] = '\0';
3042 command[0] = '\0';
3043
3045
3046 // this is _compile time_ bits, not runtime bits
3047 capable->cpu_bits = (sizeof(void *)) * 8;
3048
3050
3052
3055
3062
3063 capable->wm_name = NULL;
3064 capable->wm_type = NULL;
3065
3067 capable->xstdout = STDOUT_FILENO;
3068
3069 lives_snprintf(capable->backend_path, PATH_MAX, "%s", (tmp = lives_find_program_in_path(BACKEND_NAME)));
3070 lives_free(tmp);
3071 if (!*capable->backend_path) return capable;
3073
3074retry_configfile:
3075
3076 if (!mainw->has_session_workdir) {
3077 lives_snprintf(prefs->backend, PATH_MAX * 4, "%s -s \"%s\" -CONFIGFILE=\"%s\" --", EXEC_PERL, capable->backend_path,
3078 prefs->configfile);
3079 lives_snprintf(prefs->backend_sync, PATH_MAX * 4, "%s", prefs->backend);
3080 } else {
3081 // if the user passed a -workdir option, we will use that, and the backend won't attempt to find an existing value
3082 lives_snprintf(prefs->backend, PATH_MAX * 4, "%s -s \"%s\" -WORKDIR=\"%s\" -CONFIGFILE=\"%s\" --", EXEC_PERL,
3084 lives_snprintf(prefs->backend_sync, PATH_MAX * 4, "%s", prefs->backend);
3085 }
3086
3087 if (!newconfigfile) {
3089 lives_snprintf(command, PATH_MAX * 4, "%s version", prefs->backend_sync);
3090
3091 lives_popen(command, TRUE, buffer, PATH_MAX * 4);
3092
3093 if (THREADVAR(com_failed)) {
3094 return capable;
3095 }
3096
3097 xs = lives_strlen(buffer);
3098 if (xs < 5) return capable;
3099
3100 lives_chomp(buffer);
3101 numtok = get_token_count(buffer, ' ') ;
3102 if (numtok < 2) return capable;
3103
3104 array = lives_strsplit(buffer, " ", numtok);
3105 if (strcmp(array[0], "smogrify")) {
3106 lives_strfreev(array);
3107 return capable;
3108 }
3109
3112
3113 if (strcmp(array[1], LiVES_VERSION)) {
3114 msg = lives_strdup_printf("Version mismatch: smogrify = %s, LiVES = %s\n", array[1], LiVES_VERSION);
3115 LIVES_ERROR(msg);
3116 lives_free(msg);
3117 lives_strfreev(array);
3118 return capable;
3119 }
3120
3121 lives_strfreev(array);
3123 }
3124
3125 if (!newconfigfile)
3126 lives_snprintf(command, PATH_MAX * 4, "%s report -", prefs->backend_sync);
3127 else
3128 lives_snprintf(command, PATH_MAX * 4, "%s report", prefs->backend_sync);
3129
3130 // check_settings:
3131
3133 lives_popen(command, TRUE, buffer, PATH_MAX * 4);
3134 if (THREADVAR(com_failed) || lives_strlen(buffer) < 6) return capable;
3136
3137 numtok = get_token_count(buffer, '|');
3138 if (numtok < 2) {
3140 return capable;
3141 }
3142
3143 array = lives_strsplit(buffer, "|", numtok);
3144
3145 if (!newconfigfile) {
3146 if (!strcmp(array[0], "smogrify::error")) {
3147 LIVES_ERROR(buffer);
3148 if (!strcmp(array[1], "config_get")) {
3149 lives_strfreev(array);
3151 return capable;
3152 }
3153 if (!strcmp(array[1], "config_set_new")) {
3154 lives_strfreev(array);
3156 return capable;
3157 }
3158 if (!strcmp(array[1], "config_set_rec")) {
3159 lives_strfreev(array);
3161 return capable;
3162 }
3163 if (!strcmp(array[1], "config_set")) {
3164 lives_strfreev(array);
3166 return capable;
3167 }
3168 // other unspecified error
3169 mainw->error = TRUE;
3170 lives_snprintf(mainw->msg, MAINW_MSG_SIZE, "%s", buff);
3171 return capable;
3172 }
3173 }
3174
3175 // the startup phase
3176 // this is 0 for normal operation
3177 // -1 for a fresh install
3178 // after this the value goes to 1....n
3179 // then finally gets set to 100, which instructs the backend to remove this preference, and return 0
3180 initial_startup_phase = prefs->startup_phase = atoi(array[2]);
3181
3182 if (!newconfigfile) {
3183 if (initial_startup_phase == -1 && !ign_opts.ign_configfile) {
3187 char *oldconfig = lives_build_filename(capable->home_dir, LIVES_DEF_CONFIG_FILE_OLD, NULL);
3188 if (lives_file_test(oldconfig, LIVES_FILE_TEST_EXISTS)) {
3189 lives_strfreev(array);
3190 newconfigfile = lives_strdup(prefs->configfile);
3191 lives_snprintf(prefs->configfile, PATH_MAX, "%s", oldconfig);
3192 lives_free(oldconfig);
3193 goto retry_configfile;
3194 }
3195 lives_free(oldconfig);
3196 }
3197 }
3198
3199 // hash of last version used,
3200 // or 0 if rcfile existed, but we couldn't extract a version
3201 if (numtok > 3) {
3202 mainw->old_vhash = lives_strdup(array[3]);
3203 }
3204
3205 if (!mainw->old_vhash) {
3206 old_vhash = lives_strdup("NULL");
3207 } else if (!*mainw->old_vhash) {
3208 old_vhash = lives_strdup("not present");
3209 } else if (!strcmp(mainw->old_vhash, "0")) {
3210 old_vhash = lives_strdup("unrecoverable");
3211 } else {
3212 old_vhash = lives_strdup(mainw->old_vhash);
3213
3214 if (newconfigfile && *newconfigfile) {
3218 migrate_config(old_vhash, newconfigfile);
3219 }
3220 }
3221
3222 if (newconfigfile && *newconfigfile) {
3223 lives_strfreev(array);
3224 lives_snprintf(prefs->configfile, PATH_MAX, "%s", newconfigfile);
3225 lives_free(newconfigfile);
3226 newconfigfile = lives_strdup("");
3227 lives_free(old_vhash);
3229 goto retry_configfile;
3230 }
3231
3232 lives_snprintf(dir, PATH_MAX, "%s", array[1]);
3233
3234 if (!mainw->has_session_workdir) {
3235 size_t dirlen = lives_strlen(dir);
3236 boolean dir_valid = TRUE;
3237
3238 if (dirlen && strncmp(dir, "(null)", 6)) {
3239 if (!mainw->old_vhash || !*mainw->old_vhash || !strcmp(mainw->old_vhash, "0")) {
3240 msg = lives_strdup_printf("The backend found a workdir (%s), but claimed old version was %s !", dir, old_vhash);
3241 LIVES_WARN(msg);
3242 lives_free(msg);
3243 }
3244
3245 if (dirlen < PATH_MAX - MAX_SET_NAME_LEN * 2) {
3246 ensure_isdir(dir);
3247
3248 if (dirlen >= PATH_MAX - MAX_SET_NAME_LEN * 2) {
3249 dir_toolong_error(dir, (tmp = (_("working directory"))), PATH_MAX - MAX_SET_NAME_LEN * 2, TRUE);
3250 lives_free(tmp);
3251 dir_valid = FALSE;
3252 }
3253
3254 if (!lives_make_writeable_dir(dir)) {
3256 dir_valid = FALSE;
3257 }
3258 }
3259
3260 if (dir_valid) {
3261 lives_snprintf(prefs->workdir, PATH_MAX, "%s", dir);
3262 lives_snprintf(prefs->backend, PATH_MAX * 4, "%s -s \"%s\" -WORKDIR=\"%s\" -CONFIGFILE=\"%s\" --", EXEC_PERL,
3264 lives_snprintf(prefs->backend_sync, PATH_MAX * 4, "%s", prefs->backend);
3265
3267
3268 // for backwards compatibility only
3270 } else {
3271 needs_workdir = TRUE;
3272 prefs->startup_phase = -1;
3273 }
3274 } else {
3275 if (prefs->startup_phase != -1) {
3276 msg = lives_strdup_printf("The backend found no workdir, but set startup_phase to %d !\n%s",
3278 LIVES_ERROR(msg);
3279 lives_free(msg);
3280 }
3281 needs_workdir = TRUE;
3282 prefs->startup_phase = -1;
3283 }
3284
3285 if (*mainw->old_vhash && strcmp(mainw->old_vhash, "0")) {
3286 if (atoi(mainw->old_vhash) < atoi(mainw->version_hash)) {
3287 if (prefs->startup_phase == 0) {
3288 msg = get_upd_msg();
3289 lives_snprintf(capable->startup_msg, 1024, "%s", msg);
3290 lives_free(msg);
3291 if (numtok > 4 && *array[4]) {
3292 lives_strappend(capable->startup_msg, 1024, array[4]);
3293 // *INDENT-OFF*
3294 }}}}}
3295 // *INDENT-ON*
3296
3297 if ((prefs->startup_phase == 1 || prefs->startup_phase == -1)) {
3298 needs_workdir = TRUE;
3299 }
3300
3301 lives_strfreev(array);
3302
3304
3309
3312 }
3315
3318 }
3319
3322
3324 capable->python_version = get_version_hash(EXEC_PYTHON " -V 2>&1", " ", 1);
3325 }
3326
3330
3333 }
3334
3336 if (capable->ncpus == 0) capable->ncpus = 1;
3337
3338 return capable;
3339}
3340
3341
3342void print_opthelp(void) {
3343 char *tmp;
3344 print_notice();
3345
3346 lives_printerr(_("\nStartup syntax is: %s [OPTS] [filename [start_time] [frames]]\n"), capable->myname);
3347 fprintf(stderr, "%s", _("Where: filename is the name of a media file or backup file to import\n"));
3348 fprintf(stderr, "%s", _("start_time : filename start time in seconds\n"));
3349 fprintf(stderr, "%s", _("frames : maximum number of frames to open\n"));
3350 fprintf(stderr, "%s", "\n");
3351 fprintf(stderr, "%s", _("OPTS can be:\n"));
3352 fprintf(stderr, "%s", _("-help | --help \t\t\t: print this help text on stderr and exit\n"));
3353 fprintf(stderr, "%s", _("-version | --version\t\t: print the LiVES version on stderr and exit\n"));
3354 fprintf(stderr, "%s", _("-workdir <workdir>\t\t: specify the working directory for the session, "
3355 "overriding any value set in preferences\n"));
3356 fprintf(stderr, "%s", _("\t\t\t\t\t(disables any disk quota checking)"));
3357 fprintf(stderr, "%s", _("-configfile <path_to_file>\t: override the default configuration file for the session\n"));
3358 tmp = lives_build_filename(capable->home_dir, LIVES_DEF_CONFIG_DIR, "lives", LIVES_DEF_CONFIG_FILE, NULL);
3359 fprintf(stderr, _("\t\t\t\t\t(default is %s)\n"), tmp);
3360 lives_free(tmp);
3361
3362 tmp = lives_build_path(capable->home_dir, LOCAL_HOME_DIR, LIVES_DEF_CONFIG_DATADIR, NULL);
3363 fprintf(stderr, "%s", _("-configdatadir <dir>\t\t: override the default configuration data directory for the session\n"));
3364 fprintf(stderr, _("\t\t\t\t\t(default is %s\n"), tmp);
3365 lives_free(tmp);
3366
3367 fprintf(stderr, "%s", _("-dscrit <bytes>\t\t\t: temporarily sets the free disk space critical level for workdir to <bytes>\n"));
3368 fprintf(stderr, "%s", _("\t\t\t\t\t(intended to allow correction of erroneous values within the app; "
3369 "<= 0 disables checks)\n"));
3370 fprintf(stderr, "%s", _("-set <setname>\t\t\t: autoload clip set <setname>\n"));
3371 fprintf(stderr, "%s", _("-noset\t\t\t\t: do not reload any clip set on startup (overrides -set)\n"));
3372 fprintf(stderr, "%s", _("-layout <layout_name>\t\t: autoload multitrack layout <layout_name> (if successful, "
3373 "overrides -startup-ce)\n"));
3374 fprintf(stderr, "%s", _("-nolayout\t\t\t: do not reload any multitrack layout on startup (overrides -layout)\n"));
3375 fprintf(stderr, "%s", _("-norecover\t\t\t: force non-loading of crash recovery files (overrides -recover / -autorecover)\n"));
3376 fprintf(stderr, "%s",
3377 _("-recover | -autorecover\t\t: force reloading of any crash recovery files (may override -noset and -nolayout)\n"));
3378 fprintf(stderr, "%s", _("-nogui\t\t\t\t: do not show the gui (still shows the play window when active)\n"));
3379 fprintf(stderr, "%s", _("-nosplash\t\t\t: do not show the splash window\n"));
3380 fprintf(stderr, "%s",
3381 _("-noplaywin\t\t\t: do not show the play window (still shows the internal player; intended for remote streaming)\n"));
3382 fprintf(stderr, "%s",
3383 _("-noninteractive\t\t\t: disable menu interactivity (intended for scripting applications, e.g liblives)\n"));
3384 fprintf(stderr, "%s", _("-startup-ce\t\t\t: start in clip editor mode (overrides -startup-mt)\n"));
3385 fprintf(stderr, "%s", _("-startup-mt\t\t\t: start in multitrack mode\n"));
3386 fprintf(stderr, "%s", _("-vjmode\t\t\t\t: start in VJ mode (implicitly sets -startup-ce -autorecover "
3387 "-nolayout -asource external)\n"));
3388 fprintf(stderr, "%s",
3389 _("-fxmodesmax <n>\t\t\t: allow <n> modes per effect key (overrides any value set in preferences; minimum is 1)\n"));
3390#ifdef ENABLE_OSC
3391 fprintf(stderr, _("-oscstart <port>\t\t: start OSC listener on UDP port <port> (default is %d)\n"), DEF_OSC_LISTEN_PORT);
3392 fprintf(stderr, "%s",
3393 _("-nooscstart\t\t\t: do not start the OSC listener (the default, unless set in preferences)\n"));
3394#endif
3395 fprintf(stderr, "%s",
3396 _("-asource <source>\t\t: set the initial audio source (<source> can be 'internal' or 'external')\n"));
3397 fprintf(stderr, _("\t\t\t\t\t(only valid for %s and %s players)\n"), AUDIO_PLAYER_JACK, AUDIO_PLAYER_PULSE_AUDIO);
3398 fprintf(stderr, "%s", _("-aplayer <ap>\t\t\t: start with the selected audio player (<ap> can be: "));
3399#ifdef HAVE_PULSE_AUDIO
3400 fprintf(stderr, "'%s'", AUDIO_PLAYER_PULSE);
3401#endif
3402#ifdef ENABLE_JACK
3403#ifdef HAVE_PULSE_AUDIO
3404 fprintf(stderr, ", "); // comma after pulse
3405#endif
3406 fprintf(stderr, "'%s'", AUDIO_PLAYER_JACK);
3407 if (capable->has_sox_play) lives_printerr(", '%s'", AUDIO_PLAYER_SOX); // comma after jack
3408 fprintf(stderr, " or '%s')\n", AUDIO_PLAYER_NONE);
3409 fprintf(stderr, "%s",
3410 _("-jackopts <opts>\t\t: opts is a bitmap of jackd startup / playback options (default is 16, "
3411 "unless set in Preferences)\n"
3412 "\t\t\t\t\t 1 = LiVES is a jack transport slave, \n"
3413 "\t\t\t\t\t 2 = LiVES is a jack transport master, \n"
3414 "\t\t\t\t\t 4 = start/stop jack transport server on LiVES playback start / stop\n"
3415 "\t\t\t\t\t\t(must be transport master), \n"
3416 "\t\t\t\t\t 8 = pause jack transport when video paused\n"
3417 "\t\t\t\t\t\t(must be transport master),\n"
3418 "\t\t\t\t\t16 = start/stop jack audio server on LiVES startup / shutdown\n"
3419 "\t\t\t\t\t\t(only if audio player is jack)) \n"));
3420#else // no jack
3421 if (capable->has_sox_play) {
3422#ifdef HAVE_PULSE_AUDIO
3423 fprintf(stderr, ", "); // comma after pulse
3424#endif
3425 fprintf(stderr, _("'%s' or "), AUDIO_PLAYER_SOX);
3426 }
3427#ifdef HAVE_PULSE_AUDIO
3428 else fprintf(stderr, "%s", _(" or ")); // no sox, 'or' after pulse
3429#endif
3430 fprintf(stderr, "'%s')\n", AUDIO_PLAYER_NONE);
3431#endif
3432 fprintf(stderr, "%s", _("-devicemap <mapname>\t\t: autoload devicemap <mapname> (for MIDI / joystick control)\n"));
3433 fprintf(stderr, "%s", _("-vppdefaults <file>\t\t: load defaults for video playback plugin from <file>\n"
3434 "\t\t\t\t\t(Note: only affects the plugin settings, not the plugin type)\n"));
3435#ifdef HAVE_YUV4MPEG
3436 fprintf(stderr, "%s", _("-yuvin <fifo>\t\t\t: autoplay yuv4mpeg from stream <fifo> on startup\n"));
3437 fprintf(stderr, "%s", _("\t\t\t\t\t(only valid in clip edit startup mode)\n"));
3438#endif
3439 fprintf(stderr, "%s", _("-debug\t\t\t\t: try to debug crashes (requires 'gdb' to be installed)\n"));
3440 fprintf(stderr, "%s", "\n");
3441}
3442
3444#ifdef HAVE_YUV4MPEG
3445static boolean open_yuv4m_startup(livespointer data) {
3446 on_open_yuv4m_activate(NULL, data);
3447 return FALSE;
3448}
3449#endif
3450
3451
3453
3454boolean render_choice_idle(livespointer data) {
3455 static boolean norecurse = FALSE;
3456 boolean rec_recovered = FALSE;
3457 boolean is_recovery = LIVES_POINTER_TO_INT(data);
3458 if (norecurse) return FALSE;
3459 if (mainw->noswitch) return TRUE;
3460 norecurse = TRUE;
3461 if (!is_recovery || mt_load_recovery_layout(NULL)) {
3462 if (mainw->event_list) {
3463 if (mainw->multitrack) {
3465 weed_plant_t *backup_elist = mainw->event_list;
3467 mainw->event_list = backup_elist;
3468 }
3469
3470 deal_with_render_choice(is_recovery);
3471 if (is_recovery && mainw->multitrack) rec_recovered = TRUE;
3472 }
3473 }
3474 if (is_recovery) mainw->recording_recovered = rec_recovered;
3475 norecurse = FALSE;
3476 return FALSE;
3477}
3478
3479
3480boolean lazy_startup_checks(void *data) {
3481 static boolean checked_trash = FALSE;
3482 static boolean mwshown = FALSE;
3483 static boolean dqshown = FALSE;
3484 static boolean tlshown = FALSE;
3485 static boolean extra_caps = FALSE;
3486 static boolean is_first = TRUE;
3487
3488 if (LIVES_IS_PLAYING) {
3489 dqshown = mwshown = tlshown = TRUE;
3490 return FALSE;
3491 }
3492
3493 if (is_first) {
3496 is_first = FALSE;
3497 return TRUE;
3498 }
3499
3500 if (!tlshown) {
3501 //g_print("val is $d\n", check_snap("youtube-dl"));
3503 tlshown = TRUE;
3504 return TRUE;
3505 }
3506
3507 if (prefs->vj_mode) {
3508 resize(1.);
3509 if (prefs->open_maximised) {
3510 int bx, by;
3512 if (by > MENU_HIDE_LIM)
3515 }
3516 return FALSE;
3517 }
3518
3519 if (mainw->dsu_widget) return TRUE;
3520
3521 if (!checked_trash) {
3522 if (prefs->autoclean) {
3523 char *com = lives_strdup_printf("%s empty_trash . general %s", prefs->backend, TRASH_NAME);
3524 lives_system(com, FALSE);
3525 lives_free(com);
3526 }
3527 checked_trash = TRUE;
3528 }
3529 if (!dqshown) {
3530 boolean do_show_quota = prefs->show_disk_quota;
3531 if (ran_ds_dlg) do_show_quota = FALSE;
3532 dqshown = TRUE;
3537 capable->ds_free = dsval;
3538 if (capable->ds_used < 0)
3543 } else {
3544 if (capable->ds_used < 0) {
3546 }
3547 }
3548 }
3555 }
3556 do_show_quota = TRUE;
3557 }
3558 }
3559 if (do_show_quota) {
3561 return TRUE;
3562 }
3563 }
3564
3565 if (!mwshown) {
3566 mwshown = TRUE;
3568 }
3569
3570 if (!extra_caps) {
3571 extra_caps = TRUE;
3573 }
3574
3575 if (mainw->ldg_menuitem) {
3576 if (!RFX_LOADED) return TRUE;
3578 mainw->ldg_menuitem = NULL;
3580 if (LIVES_IS_SENSITIZED) sensitize(); // call fn again to sens. new menu entries
3581 }
3582
3583 mainw->lazy = 0;
3584 return FALSE;
3585}
3586
3587
3588boolean resize_message_area(livespointer data) {
3589 // workaround because the window manager will resize the window asynchronously
3590 static boolean isfirst = TRUE;
3591 int bx, by;
3592
3593 if (data) isfirst = TRUE;
3594
3597 mainw->idlemax = 0;
3598 return FALSE;
3599 }
3600
3602
3604
3605 if (mainw->idlemax == DEF_IDLE_MAX / 2 && prefs->open_maximised && (by > 0 || bx > 0)) {
3606 if (by > MENU_HIDE_LIM)
3610 return TRUE;
3611 }
3612
3614
3615 if (mainw->idlemax > 0 && mainw->assumed_height != -1 &&
3618
3619 mainw->idlemax = 0;
3621 msg_area_scroll(LIVES_ADJUSTMENT(mainw->msg_adj), mainw->msg_area);
3622 //#if !GTK_CHECK_VERSION(3, 0, 0)
3624 //#endif
3625 if (isfirst) {
3629 }
3630 if (!CURRENT_CLIP_IS_VALID) {
3631 d_print("");
3632 }
3635 isfirst = FALSE;
3636 }
3637 resize(1.);
3639 return FALSE;
3640}
3641
3643static boolean got_files = FALSE;
3644static boolean lives_startup2(livespointer data);
3645static boolean lives_startup(livespointer data) {
3646 // this is run in an idlefunc
3647
3648 char *tmp, *tmp2, *msg;
3649
3650 // check the working directory
3651 if (needs_workdir) {
3652 // get initial workdir
3653 if (!do_workdir_query()) {
3654 lives_exit(0);
3655 }
3656 prefs->startup_phase = 2;
3658 }
3659 if (prefs->startup_phase > 0 && prefs->startup_phase < 3) {
3660 if (!do_startup_tests(FALSE)) {
3661 lives_exit(0);
3662 }
3663 prefs->startup_phase = 3;
3665
3666 // we can show this now
3668 }
3669
3670 if (newconfigfile || prefs->startup_phase == 3) {
3673 }
3674
3676
3677 if (*buff && strcmp(buff, "(null)") && strcmp(buff, "none")) {
3679 } else if (prefs->startup_phase == 3) {
3681 if (mainw->vpp) {
3682 lives_snprintf(future_prefs->vpp_name, 64, "%s", mainw->vpp->name);
3684 }
3685 }
3686
3687 if (!ign_opts.ign_aplayer) {
3689 if (!strcmp(buff, AUDIO_PLAYER_NONE)) {
3691 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_NONE);
3692 } else if (!strcmp(buff, AUDIO_PLAYER_SOX)) {
3694 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_SOX);
3695 } else if (!strcmp(buff, AUDIO_PLAYER_JACK)) {
3697 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_JACK);
3698 } else if (!strcmp(buff, AUDIO_PLAYER_PULSE) || !strcmp(buff, AUDIO_PLAYER_PULSE_AUDIO)) {
3700 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_PULSE);
3701 }
3702 } else {
3704 }
3705
3706#ifdef HAVE_PULSE_AUDIO
3707 if ((prefs->startup_phase == 1 || prefs->startup_phase == -1) && capable->has_pulse_audio) {
3708 if (prefs->pa_restart) {
3709 char *com = lives_strdup_printf("%s -k %s", EXEC_PULSEAUDIO, prefs->pa_start_opts);
3710 lives_system(com, TRUE);
3711 lives_free(com);
3712 }
3714 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_PULSE);
3716 } else {
3717#endif
3718#ifdef ENABLE_JACK
3719 if ((prefs->startup_phase == 1 || prefs->startup_phase == -1) && capable->has_jackd && prefs->audio_player == -1) {
3721 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_JACK);
3723 }
3724#endif
3725#ifdef HAVE_PULSE_AUDIO
3726 }
3727#endif
3728
3729 if (!ign_opts.ign_asource) {
3730 if (prefs->vj_mode)
3732 else
3734 }
3735
3740 }
3741
3743
3744 splash_msg(_("Starting GUI..."), SPLASH_LEVEL_BEGIN);
3746
3747 create_LiVES();
3748
3750 int bx, by;
3752 if (by > MENU_HIDE_LIM)
3755 }
3756
3757 // needed to avoid priv->pulse2 > priv->pulse1 gtk error
3759
3762
3764
3765 if (theme_error && !mainw->foreign) {
3766 // non-fatal errors
3767 msg = lives_strdup_printf(
3768 _("\n\nThe theme you requested (%s) could not be located.\n"
3769 "Please make sure you have the themes installed in\n%s/%s.\n"
3770 "(Maybe you need to change the value of <prefix_dir> in your %s file)\n"
3771 "or you may be missing a custom theme.\n"), future_prefs->theme,
3772 (tmp = lives_filename_to_utf8(prefs->prefix_dir, -1, NULL, NULL, NULL)), THEME_DIR,
3773 (tmp2 = lives_filename_to_utf8(prefs->configfile, -1, NULL, NULL, NULL)));
3774 lives_free(tmp2);
3775 lives_free(tmp);
3777 lives_free(msg);
3778 lives_snprintf(prefs->theme, 64, LIVES_THEME_NONE);
3779 upgrade_error = TRUE;
3780 }
3781
3782 lives_init(&ign_opts);
3783
3784 // non-fatal errors
3785
3786 if (!mainw->foreign) {
3787 if (*capable->startup_msg) {
3788 if (info_only) startup_message_info(capable->startup_msg);
3790 } else {
3791 if (!prefs->vj_mode) {
3795 _("\nLiVES was unable to locate 'mplayer','mplayer2' or 'mpv'. "
3796 "You may wish to install one of these to use LiVES more fully.\n"),
3798 }
3799 if (!capable->has_convert) {
3801 _("\nLiVES was unable to locate 'convert'. "
3802 "You should install convert and image-magick "
3803 "if you want to use rendered effects.\n"),
3805 }
3806 if (!capable->has_composite) {
3808 _("\nLiVES was unable to locate 'composite'. "
3809 "You should install composite and image-magick "
3810 "if you want to use the merge function.\n"),
3812 }
3813 if (!capable->has_sox_sox) {
3815 _("\nLiVES was unable to locate 'sox'. Some audio features may not work. "
3816 "You should install 'sox'.\n"),
3818 }
3820 msg = lives_strdup_printf(
3821 _("\nLiVES was unable to find any encoder plugins.\n"
3822 "Please check that you have them installed correctly in\n%s%s%s/\n"
3823 "You will not be able to 'Save' without them.\n"
3824 "You may need to change the value of <lib_dir> in %s\n"),
3826 (tmp = lives_filename_to_utf8(prefs->configfile, -1, NULL, NULL, NULL)));
3827 lives_free(tmp);
3829 lives_free(msg);
3830 upgrade_error = TRUE;
3831 }
3832
3833 if (mainw->next_ds_warn_level > 0) {
3835 uint64_t curr_ds_warn = mainw->next_ds_warn_level;
3840 msg = lives_strdup_printf("\n%s\n", tmp);
3841 lives_free(tmp);
3843 lives_free(msg);
3844 // *INDENT-OFF*
3845 }}}}
3846 // *INDENT-ON*
3847 splash_msg(_("Loading rendered effect plugins..."), SPLASH_LEVEL_LOAD_RFX);
3848 // must call this at least to set up rendered_fx[0]
3849 } else {
3850 // capture mode
3851 mainw->foreign_key = atoi(zargv[2]);
3852
3853#if GTK_CHECK_VERSION(3, 0, 0) || defined GUI_QT
3854 mainw->foreign_id = (Window)atoi(zargv[3]);
3855#else
3856 mainw->foreign_id = (GdkNativeWindow)atoi(zargv[3]);
3857#endif
3858
3859 mainw->foreign_width = atoi(zargv[4]);
3860 mainw->foreign_height = atoi(zargv[5]);
3861 lives_snprintf(prefs->image_ext, 16, "%s", zargv[6]);
3862 lives_snprintf(prefs->image_type, 16, "%s", image_ext_to_lives_image_type(prefs->image_ext));
3863 mainw->foreign_bpp = atoi(zargv[7]);
3864 mainw->rec_vid_frames = atoi(zargv[8]);
3865 mainw->rec_fps = strtod(zargv[9], NULL);
3866 mainw->rec_arate = atoi(zargv[10]);
3867 mainw->rec_asamps = atoi(zargv[11]);
3868 mainw->rec_achans = atoi(zargv[12]);
3869 mainw->rec_signed_endian = atoi(zargv[13]);
3870
3871 if (zargc > 14) {
3872 mainw->foreign_visual = lives_strdup(zargv[14]);
3873 if (!strcmp(mainw->foreign_visual, "(null)")) {
3875 mainw->foreign_visual = NULL;
3876 }
3877 }
3878
3879#ifdef ENABLE_JACK
3881 lives_jack_init();
3882 jack_audio_read_init();
3883 }
3884#endif
3885#ifdef HAVE_PULSE_AUDIO
3887 lives_pulse_init(0);
3888 pulse_audio_read_init();
3889 }
3890#endif
3891
3894 mainw->go_away = FALSE;
3895 on_capture2_activate(); // exits
3896 }
3897
3898 //#define NOTTY
3899#ifdef NOTTY
3900 if (!mainw->foreign) {
3901 capable->xstdout = dup(STDOUT_FILENO);
3902 close(STDOUT_FILENO);
3903 }
3904#endif
3905
3907
3909
3910 if (prefs->startup_phase == 100) {
3911 if (upgrade_error) {
3913 }
3914 prefs->startup_phase = 0;
3915 }
3916
3917 // splash_end() will start up multitrack if in STARTUP_MT mode
3918 if (*start_file && strcmp(start_file, "-")) {
3919 splash_end();
3920 deduce_file(start_file, start, end);
3921 got_files = TRUE;
3922 } else {
3923 set_main_title(NULL, 0);
3924 splash_end();
3925 }
3926
3927 if (prefs->startup_phase == 0) show_lives();
3928 mainw->is_ready = TRUE;
3929
3930 if (!strcmp(buff, AUDIO_PLAYER_SOX)) {
3932 }
3933 if (!strcmp(buff, AUDIO_PLAYER_NONE)) {
3934 // still experimental
3936 }
3937
3938 lives_idle_add_simple(lives_startup2, NULL);
3939 return FALSE;
3940}
3941
3942
3943static boolean lives_startup2(livespointer data) {
3944 char *ustr;
3945 boolean layout_recovered = FALSE;
3946
3947 if (prefs->crash_recovery && !no_recover) got_files = check_for_recovery_files(auto_recover);
3948
3949 if (!mainw->foreign && !got_files && prefs->ar_clipset) {
3950 d_print(lives_strdup_printf(_("Autoloading set %s..."), prefs->ar_clipset_name));
3954 }
3956 }
3957
3958#ifdef ENABLE_OSC
3959 if (prefs->osc_start) prefs->osc_udp_started = lives_osc_init(prefs->osc_udp_port);
3960#endif
3961
3963 if (!prefs->vj_mode) layout_recovered = do_layout_recover_dialog();
3965 }
3966
3967 if (!mainw->recording_recovered) {
3968 if (mainw->ascrap_file != -1) {
3969 if (!layout_recovered || !mainw->multitrack || !used_in_current_layout(mainw->multitrack, mainw->ascrap_file)) {
3970 close_ascrap_file(FALSE); // ignore but leave file on disk for recovery purposes
3971 }
3972 }
3973 if (mainw->scrap_file != -1) {
3974 if (!layout_recovered || mainw->multitrack || !used_in_current_layout(mainw->multitrack, mainw->scrap_file)) {
3975 close_scrap_file(FALSE); // ignore but leave file on disk for recovery purposes
3976 }
3977 }
3978 } else {
3980 }
3981
3982#ifdef HAVE_YUV4MPEG
3983 if (*prefs->yuvin) lives_idle_add_simple(open_yuv4m_startup, NULL);
3984#endif
3985
3987 if (mainw->current_file > -1 && !mainw->multitrack) {
3989 }
3990
3991 if (!palette || !(palette->style & STYLE_LIGHT)) {
3993 } else {
3995 }
3997
3998 if (*devmap) on_devicemap_load_activate(NULL, devmap);
3999
4000 if (capable->username)
4001 ustr = lives_strdup_printf(", %s", capable->username);
4002 else
4003 ustr = lives_strdup("");
4004
4005 d_print(_("\nWelcome to LiVES version %s%s !\n"), LiVES_VERSION, ustr);
4006 lives_free(ustr);
4007
4009 d_print("");
4010
4011 if (!mainw->multitrack) {
4012 if (mainw->current_file == -1) {
4013 resize(1.);
4014 if (prefs->show_msg_area) {
4015 // the message area must fit exactly to the screen size, so we update it in an idle function
4016 // due to the fact that the window manager may resize the window asynchronously
4017 if (mainw->idlemax == 0)
4018 lives_idle_add_simple(resize_message_area, NULL);
4020 }
4021 }
4022 } else {
4023 lives_idle_add_simple(mt_idle_show_current_frame, (livespointer)mainw->multitrack);
4024 if (mainw->multitrack->idlefunc == 0) {
4026 }
4027 }
4028
4029 mainw->go_away = FALSE;
4030 if (!mainw->multitrack) sensitize();
4031
4032 if (prefs->vj_mode) {
4033 char *wid = lives_strdup_printf("0x%08lx",
4034 (uint64_t)LIVES_XWINDOW_XID(lives_widget_get_xwindow(LIVES_MAIN_WINDOW_WIDGET)));
4035 if (wid) activate_x11_window(wid);
4036 }
4038 lives_idle_add_simple(render_choice_idle, LIVES_INT_TO_POINTER(TRUE));
4039 }
4040
4042
4043 if (!mainw->multitrack)
4045 else
4047
4048 if (!prefs->vj_mode && !prefs->startup_phase) {
4051 }
4052
4053 mainw->lazy = lives_idle_add_simple(lazy_startup_checks, NULL);
4054
4055 // timer to poll for external commands: MIDI, joystick, jack transport, osc, etc.
4056 mainw->kb_timer = lives_timer_add_simple(EXT_TRIGGER_INTERVAL, &ext_triggers_poll, NULL);
4057
4059
4060 if (newconfigfile) {
4062 lives_free(newconfigfile);
4063 }
4064
4065 if (!mainw->mute) {
4067 }
4070
4072
4073 return FALSE;
4074} // end lives_startup2()
4075
4076
4078 sigset_t smask;
4079 struct sigaction sact;
4080
4081 sigemptyset(&smask);
4082
4083#define USE_GLIB_SIGHANDLER
4084#ifdef USE_GLIB_SIGHANDLER
4085 g_unix_signal_add(LIVES_SIGINT, glib_sighandler, LIVES_INT_TO_POINTER(LIVES_SIGINT));
4086 g_unix_signal_add(LIVES_SIGTERM, glib_sighandler, LIVES_INT_TO_POINTER(LIVES_SIGTERM));
4087#else
4088 sigaddset(&smask, LIVES_SIGINT);
4089 sigaddset(&smask, LIVES_SIGTERM);
4090#endif
4091
4092 sigaddset(&smask, LIVES_SIGSEGV);
4093 sigaddset(&smask, LIVES_SIGABRT);
4094
4095 sact.sa_handler = sigfunc;
4096 sact.sa_flags = 0;
4097 sact.sa_mask = smask;
4098
4099 sigaction(LIVES_SIGINT, &sact, NULL);
4100 sigaction(LIVES_SIGTERM, &sact, NULL);
4101 sigaction(LIVES_SIGSEGV, &sact, NULL);
4102 sigaction(LIVES_SIGABRT, &sact, NULL);
4103
4104 if (mainw) {
4105 if (sigfunc == defer_sigint) mainw->signals_deferred = TRUE;
4107 }
4108}
4109
4110
4111int real_main(int argc, char *argv[], pthread_t *gtk_thread, ulong id) {
4112 weed_error_t werr;
4113 ssize_t mynsize;
4114 char cdir[PATH_MAX];
4115 boolean toolong = FALSE;
4116 char *tmp, *dir, *msg;
4117 pthread_mutexattr_t mattr;
4118#ifndef IS_LIBLIVES
4119 weed_plant_t *test_plant;
4120#endif
4121
4122 mainw = NULL;
4123 prefs = NULL;
4124 capable = NULL;
4125
4127
4128 lives_memset(&ign_opts, 0, sizeof(ign_opts));
4129
4130#ifdef ENABLE_OIL
4131 oil_init();
4132#endif
4133
4134 init_memfuncs();
4135
4136#ifdef IS_LIBLIVES
4137#ifdef GUI_GTK
4138 if (gtk_thread) {
4139 pthread_create(gtk_thread, NULL, gtk_thread_wrapper, NULL);
4140 }
4141#endif
4142#endif
4143
4144 capable = (capability *)lives_calloc(1, sizeof(capability));
4145 capable->cacheline_size = sizeof(void *) * 8;
4146
4147 // _runtime_ byte order, needed for lives_strlen and other things
4148 if (IS_BIG_ENDIAN)
4149 capable->byte_order = LIVES_BIG_ENDIAN;
4150 else
4151 capable->byte_order = LIVES_LITTLE_ENDIAN;
4152
4153 capable->main_thread = pthread_self();
4154
4155 zargc = argc;
4156 zargv = argv;
4157
4158 //setlocale(LC_ALL, "");
4159
4160 // force decimal point to be a "."
4161 putenv("LC_NUMERIC=C");
4162 setlocale(LC_NUMERIC, "C");
4163
4164#ifdef ENABLE_NLS
4165 textdomain(GETTEXT_PACKAGE);
4166 bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
4167#ifdef UTF8_CHARSET
4168 bind_textdomain_codeset(GETTEXT_PACKAGE, nl_langinfo(CODESET));
4169#endif
4170#endif
4171
4172#ifdef GDK_WINDOWING_X11
4173 XInitThreads();
4174#endif
4175
4176#ifdef GUI_GTK
4177#if GTK_CHECK_VERSION(4, 0, 0)
4178 gtk_init();
4179#else
4180 gtk_init(&argc, &argv);
4181#endif
4182#endif
4183
4184 g_log_set_default_handler(lives_log_handler, NULL);
4185
4186 //gtk_window_set_interactive_debugging(TRUE);
4187#ifndef LIVES_NO_DEBUG
4188 g_printerr("FULL DEBUGGING IS ON !!\n");
4189#endif
4190
4191#ifndef IS_LIBLIVES
4192 // start up the Weed system
4193 weed_abi_version = weed_get_abi_version();
4194 if (weed_abi_version > WEED_ABI_VERSION) weed_abi_version = WEED_ABI_VERSION;
4195 //werr = weed_init(weed_abi_version, WEED_INIT_DEBUGMODE);
4196 werr = weed_init(weed_abi_version, 0);
4197 if (werr != WEED_SUCCESS) {
4198 lives_notify(LIVES_OSC_NOTIFY_QUIT, "Failed to init Weed");
4199 LIVES_FATAL("Failed to init Weed");
4200 _exit(1);
4201 }
4202#ifndef USE_STD_MEMFUNCS
4203 weed_utils_set_custom_memfuncs(lives_malloc, lives_calloc, lives_memcpy, NULL, lives_free);
4204#endif
4205#endif
4206
4207 // backup the core functions so we can override them
4208 _weed_plant_new = weed_plant_new;
4209 _weed_plant_free = weed_plant_free;
4210 _weed_leaf_set = weed_leaf_set;
4211 _weed_leaf_get = weed_leaf_get;
4212 _weed_leaf_delete = weed_leaf_delete;
4213 _weed_plant_list_leaves = weed_plant_list_leaves;
4214 _weed_leaf_num_elements = weed_leaf_num_elements;
4215 _weed_leaf_element_size = weed_leaf_element_size;
4216 _weed_leaf_seed_type = weed_leaf_seed_type;
4217 _weed_leaf_get_flags = weed_leaf_get_flags;
4218 _weed_leaf_set_flags = weed_leaf_set_flags;
4219
4220 mainw = (mainwindow *)(lives_calloc(1, sizeof(mainwindow)));
4221 init_random();
4222
4223#ifdef ENABLE_DIAGNOSTICS
4224 run_weed_startup_tests();
4225 check_random();
4228#endif
4229
4230 // allow us to set immutable values (plugins can't)
4231 weed_leaf_set = weed_leaf_set_host;
4232
4233 // allow us to delete undeletable leaves (plugins can't)
4234 weed_leaf_delete = weed_leaf_delete_host;
4235
4236 // allow us to set immutable values (plugins can't)
4237 //weed_leaf_get = weed_leaf_get_monitor;
4238
4239 // allow us to free undeletable plants (plugins cant')
4240 weed_plant_free = weed_plant_free_host;
4241 // weed_plant_new = weed_plant_new_host;
4242
4244
4246 test_plant = weed_plant_new(0);
4247 if (weed_leaf_set_private_data(test_plant, WEED_LEAF_TYPE, NULL) == WEED_ERROR_CONCURRENCY)
4249 else weed_threadsafe = FALSE;
4250 weed_plant_free(test_plant);
4251
4253
4254 /* TRANSLATORS: localised name may be used here */
4255 lives_set_application_name(_("LiVES"));
4256 widget_opts.title_prefix = lives_strdup_printf("%s-%s: - ", lives_get_application_name(), LiVES_VERSION);
4257
4258 // init prefs
4259 prefs = (_prefs *)lives_calloc(1, sizeof(_prefs));
4261 prefs->workdir[0] = '\0';
4262 future_prefs->workdir[0] = '\0';
4263 prefs->config_datadir[0] = '\0';
4264 prefs->configfile[0] = '\0';
4265
4266 prefs->show_gui = TRUE;
4272
4273 lives_snprintf(prefs->cmd_log, PATH_MAX, LIVES_DEVNULL);
4274
4275#ifdef HAVE_YUV4MPEG
4276 prefs->yuvin[0] = '\0';
4277#endif
4278
4279 mainw->version_hash = lives_strdup_printf("%d", verhash(LiVES_VERSION));
4280 mainw->mgeom = NULL;
4281 mainw->msg[0] = '\0';
4282 mainw->error = FALSE;
4284 mainw->multitrack = NULL;
4285 mainw->splash_window = NULL;
4287 mainw->memok = TRUE;
4288 mainw->go_away = TRUE;
4292 mainw->LiVES = NULL;
4294 mainw->clutch = TRUE;
4295 mainw->mbar_res = 0;
4298
4299 pthread_mutexattr_init(&mattr);
4300 pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
4301
4303 mainw->old_vhash = NULL;
4304
4306
4307 // mainw->foreign is set if we are grabbing an external window
4308 mainw->foreign = FALSE;
4309
4310 mainw->debug = FALSE;
4311
4313
4315
4316 devmap[0] = '\0';
4317 capable->mountpoint = NULL;
4318 capable->startup_msg[0] = '\0';
4327
4328 // this is the version we should pass into mkdir
4329 capable->umask = umask(0);
4330 umask(capable->umask);
4331 capable->umask = (0777 & ~capable->umask);
4332
4333#ifdef GUI_GTK
4334 lives_snprintf(capable->home_dir, PATH_MAX, "%s", g_get_home_dir());
4335#else
4336 tmp = getenv("HOME");
4337 lives_snprintf(capable->home_dir, PATH_MAX, "%s", tmp);
4338 lives_free(tmp);
4339#endif
4340
4342 get_location("touch", capable->touch_cmd, PATH_MAX); // needed for make_writeable_dir()
4343 get_location("rm", capable->rm_cmd, PATH_MAX); // ditto
4344 get_location("rmdir", capable->rmdir_cmd, PATH_MAX); // ditto
4345 get_location("sed", capable->sed_cmd, PATH_MAX); // nice to know
4346 get_location("grep", capable->grep_cmd, PATH_MAX); // ditto
4347 get_location("wc", capable->wc_cmd, PATH_MAX); // ditto
4348
4349 // get opts first
4350 if (argc > 1) {
4351 if (!strcmp(argv[1], "-capture")) {
4352 // special mode for grabbing external window
4353 mainw->foreign = TRUE;
4355 ign_opts.ign_asource = TRUE;
4356 } else if (!strcmp(argv[1], "-help") || !strcmp(argv[1], "--help")) {
4357 char string[256];
4358 get_location(EXEC_PLAY, string, 256);
4359 if (*string) capable->has_sox_play = TRUE;
4360
4361 capable->myname_full = lives_find_program_in_path(argv[0]);
4362
4363 if ((mynsize = lives_readlink(capable->myname_full, cdir, PATH_MAX)) != -1) {
4364 lives_memset(cdir + mynsize, 0, 1);
4366 capable->myname_full = lives_strdup(cdir);
4367 }
4368
4369 lives_snprintf(cdir, PATH_MAX, "%s", capable->myname_full);
4370 get_basename(cdir);
4371 capable->myname = lives_strdup(cdir);
4372
4373 print_opthelp();
4374 exit(0);
4375 } else if (!strcmp(argv[1], "-version") || !strcmp(argv[1], "--version")) {
4376 print_notice();
4377 exit(0);
4378 } else {
4379 struct option longopts[] = {
4380 {"aplayer", 1, 0, 0},
4381 {"asource", 1, 0, 0},
4382 {"workdir", 1, 0, 0},
4383 {"configfile", 1, 0, 0},
4384 {"configdatadir", 1, 0, 0},
4385 {"dscrit", 1, 0, 0},
4386 {"set", 1, 0, 0},
4387 {"noset", 0, 0, 0},
4388#ifdef ENABLE_OSC
4389 {"devicemap", 1, 0, 0},
4390#endif
4391 {"vppdefaults", 1, 0, 0},
4392 {"recover", 0, 0, 0},
4393 {"autorecover", 0, 0, 0},
4394 {"norecover", 0, 0, 0},
4395 {"nogui", 0, 0, 0},
4396 {"nosplash", 0, 0, 0},
4397 {"noplaywin", 0, 0, 0},
4398 {"noninteractive", 0, 0, 0},
4399 {"startup-ce", 0, 0, 0},
4400 {"startup-mt", 0, 0, 0},
4401 {"vjmode", 0, 0, 0},
4402 {"fxmodesmax", 1, 0, 0},
4403 {"yuvin", 1, 0, 0},
4404 {"debug", 0, 0, 0},
4405#ifdef ENABLE_OSC
4406 {"oscstart", 1, 0, 0},
4407 {"nooscstart", 0, 0, 0},
4408#endif
4409#ifdef ENABLE_JACK
4410 {"jackopts", 1, 0, 0},
4411#endif
4412 // deprecated
4413 {"nothreaddialog", 0, 0, 0},
4414 {"bigendbug", 1, 0, 0},
4415 {"tmpdir", 1, 0, 0},
4416 {0, 0, 0, 0}
4417 };
4418
4419 int option_index = 0;
4420 const char *charopt;
4421 int c;
4422 int count = 0;
4423
4424 while (1) {
4425 count++;
4426 c = getopt_long_only(argc, argv, "", longopts, &option_index);
4427 if (c == -1) break; // end of options
4428 charopt = longopts[option_index].name;
4429 if (c == '?') {
4430 msg = lives_strdup_printf(_("Invalid option %s on commandline\n"), argv[count]);
4431 LIVES_FATAL(msg);
4432 }
4433 if (!strcmp(charopt, "workdir") || !strcmp(charopt, "tmpdir")) {
4434 if (!*optarg) {
4435 do_abortblank_error(charopt);
4436 continue;
4437 }
4438 if (optarg[0] == '-') {
4439 do_abortblank_error(charopt);
4440 optind--;
4441 continue;
4442 }
4443 if (lives_strlen(optarg) > PATH_MAX - MAX_SET_NAME_LEN * 2) {
4444 toolong = TRUE;
4445 } else {
4446 ensure_isdir(optarg);
4447 if (lives_strlen(optarg) > PATH_MAX - MAX_SET_NAME_LEN * 2) {
4448 toolong = TRUE;
4449 }
4450 }
4451 if (toolong) {
4452 dir_toolong_error(optarg, (tmp = (_("working directory"))), PATH_MAX - MAX_SET_NAME_LEN * 2, TRUE);
4453 lives_free(tmp);
4455 break;
4456 }
4457
4459 lives_snprintf(prefs->workdir, PATH_MAX, "%s", optarg);
4460
4462 // abort if we cannot write to the specified workdir
4464 break;
4465 }
4466 continue;
4467 }
4468
4469 if (!strcmp(charopt, "configdatadir")) {
4470 if (!*optarg) {
4471 do_abortblank_error(charopt);
4472 continue;
4473 }
4474 if (optarg[0] == '-') {
4475 do_abortblank_error(charopt);
4476 optind--;
4477 continue;
4478 }
4479 if (lives_strlen(optarg) > PATH_MAX - 64) {
4480 toolong = TRUE;
4481 } else {
4482 ensure_isdir(optarg);
4483 if (lives_strlen(optarg) > PATH_MAX - 64) {
4484 toolong = TRUE;
4485 }
4486 }
4487 if (toolong) {
4489 dir_toolong_error(optarg, _("config data directory"), PATH_MAX - 64, FALSE);
4490 }
4491
4492 lives_snprintf(prefs->config_datadir, PATH_MAX, "%s", optarg);
4493 ign_opts.ign_config_datadir = TRUE;
4494 continue;
4495 }
4496
4497 if (!strcmp(charopt, "configfile")) {
4498 if (!*optarg) {
4499 do_abortblank_error(charopt);
4500 continue;
4501 }
4502 if (optarg[0] == '-') {
4503 do_abortblank_error(charopt);
4504 optind--;
4505 continue;
4506 }
4507 if (lives_strlen(optarg) > PATH_MAX - 64) {
4508 toolong = TRUE;
4509 }
4510 if (toolong) {
4512 filename_toolong_error(optarg, _("configuration file"), PATH_MAX, FALSE);
4513 }
4514
4515 lives_snprintf(prefs->configfile, PATH_MAX, "%s", optarg);
4516 ign_opts.ign_configfile = TRUE;
4517 continue;
4518 }
4519
4520 if (!strcmp(charopt, "norecover")) {
4521 // auto no-recovery
4522 no_recover = TRUE;
4523 continue;
4524 }
4525
4526 if (!strcmp(charopt, "recover") || !strcmp(charopt, "autorecover")) {
4527 // auto recovery
4528 auto_recover = TRUE;
4529 continue;
4530 }
4531
4532 if (!strcmp(charopt, "debug")) {
4533 // debug crashes
4534 mainw->debug = TRUE;
4535 continue;
4536 }
4537
4538 if (!strcmp(charopt, "yuvin")) {
4539#ifdef HAVE_YUV4MPEG
4540 char *dir;
4541 if (!*optarg) {
4542 continue;
4543 }
4544 if (optarg[0] == '-') {
4545 optind--;
4546 continue;
4547 }
4548 lives_snprintf(prefs->yuvin, PATH_MAX, "%s", optarg);
4550 ign_opts.ign_stmode = TRUE;
4551 dir = get_dir(prefs->yuvin);
4552 get_basename(prefs->yuvin);
4553 lives_snprintf(prefs->yuvin, PATH_MAX, "%s", (tmp = lives_build_filename(dir, prefs->yuvin, NULL)));
4554 lives_free(tmp);
4555 lives_free(dir);
4556#else
4557 msg = (_("Must have mjpegtools installed for -yuvin to work"));
4558 do_abort_ok_dialog(msg);
4559 lives_free(msg);
4560#endif
4561 continue;
4562 }
4563
4564 if (!strcmp(charopt, "dscrit") && optarg) {
4565 // force clipset loading
4566 if (!*optarg) {
4567 do_abortblank_error(charopt);
4568 continue;
4569 }
4570 if (optarg[0] == '-') {
4571 do_abortblank_error(charopt);
4572 optind--;
4573 continue;
4574 }
4575 prefs->ds_crit_level = atoll(optarg);
4576 ign_opts.ign_dscrit = TRUE;
4577 continue;
4578 }
4579
4580 if (!strcmp(charopt, "noset")) {
4581 // override clipset loading
4584 ign_opts.ign_clipset = TRUE;
4585 continue;
4586 }
4587
4588 if (!strcmp(charopt, "set") && optarg) {
4589 // force clipset loading
4590 if (!*optarg) {
4591 do_abortblank_error(charopt);
4592 continue;
4593 }
4594 if (optarg[0] == '-') {
4595 do_abortblank_error(charopt);
4596 optind--;
4597 continue;
4598 }
4599 if (!is_legal_set_name(optarg, TRUE, TRUE)) {
4600 msg = (_("Abort and retry or continue ?"));
4601 do_abort_ok_dialog(msg);
4602 lives_free(msg);
4603 }
4604 lives_snprintf(prefs->ar_clipset_name, 128, "%s", optarg);
4606 ign_opts.ign_clipset = TRUE;
4607 continue;
4608 }
4609
4610 if (!strcmp(charopt, "nolayout")) {
4611 // override layout loading
4614 ign_opts.ign_layout = TRUE;
4615 continue;
4616 }
4617
4618 if (!strcmp(charopt, "layout") && optarg) {
4619 // force layout loading
4620 if (!*optarg) {
4621 do_optarg_blank_err(charopt);
4622 continue;
4623 }
4624 if (optarg[0] == '-') {
4625 do_optarg_blank_err(charopt);
4626 optind--;
4627 continue;
4628 }
4629 lives_snprintf(prefs->ar_layout_name, PATH_MAX, "%s", optarg);
4630 prefs->ar_layout = TRUE;
4631 ign_opts.ign_layout = TRUE;
4632 continue;
4633 }
4634
4635#ifdef ENABLE_OSC
4636 if (!strcmp(charopt, "devicemap") && optarg) {
4637 // force devicemap loading
4638 char *devmap2;
4639 if (!*optarg) {
4640 do_optarg_blank_err(charopt);
4641 continue;
4642 }
4643 if (optarg[0] == '-') {
4644 do_optarg_blank_err(charopt);
4645 optind--;
4646 continue;
4647 }
4648 lives_snprintf(devmap, PATH_MAX, "%s", optarg);
4649 devmap2 = lives_strdup(devmap);
4650 get_basename(devmap);
4651 if (!strcmp(devmap, devmap2)) {
4652 dir = lives_build_filename(prefs->config_datadir, LIVES_DEVICEMAP_DIR, NULL);
4653 } else dir = get_dir(devmap);
4654 lives_snprintf(devmap, PATH_MAX, "%s", (tmp = lives_build_filename(dir, devmap, NULL)));
4655 lives_free(tmp);
4656 lives_free(dir);
4657 lives_free(devmap2);
4658 continue;
4659 }
4660#endif
4661
4662 if (!strcmp(charopt, "vppdefaults") && optarg) {
4663 // load alternate vpp file
4664 if (!*optarg) {
4665 do_optarg_blank_err(charopt);
4666 continue;
4667 }
4668 if (optarg[0] == '-') {
4669 do_optarg_blank_err(charopt);
4670 optind--;
4671 continue;
4672 }
4673 lives_snprintf(mainw->vpp_defs_file, PATH_MAX, "%s", optarg);
4674 ign_opts.ign_vppdefs = TRUE;
4675 dir = get_dir(mainw->vpp_defs_file);
4677 lives_snprintf(mainw->vpp_defs_file, PATH_MAX, "%s", (tmp = lives_build_filename(dir, mainw->vpp_defs_file, NULL)));
4678 lives_free(tmp);
4679 lives_free(dir);
4680 continue;
4681 }
4682
4683 if (!strcmp(charopt, "aplayer")) {
4684 boolean apl_valid = FALSE;
4685 if (!*optarg) {
4686 do_optarg_blank_err(charopt);
4687 continue;
4688 }
4689 if (optarg[0] == '-') {
4690 do_optarg_blank_err(charopt);
4691 optind--;
4692 continue;
4693 }
4694 lives_snprintf(buff, 256, "%s", optarg);
4695 // override aplayer default
4696 if (!strcmp(buff, AUDIO_PLAYER_SOX)) {
4698 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_SOX);
4699 apl_valid = TRUE;
4700 }
4701
4702 if (!strcmp(buff, AUDIO_PLAYER_NONE)) {
4703 // still experimental
4705 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_NONE);
4706 apl_valid = TRUE;
4707 }
4708
4709 if (!strcmp(buff, AUDIO_PLAYER_JACK)) {
4710#ifdef ENABLE_JACK
4712 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_JACK);
4713 apl_valid = TRUE;
4714#endif
4715 }
4716
4717 if (!strcmp(buff, AUDIO_PLAYER_PULSE) || !strcmp(buff, AUDIO_PLAYER_PULSE_AUDIO)) {
4718#ifdef HAVE_PULSE_AUDIO
4720 lives_snprintf(prefs->aplayer, 512, "%s", AUDIO_PLAYER_PULSE);
4721 apl_valid = TRUE;
4722#endif
4723 }
4724 if (apl_valid) ign_opts.ign_aplayer = TRUE;
4725 else {
4726 msg = lives_strdup_printf(_("Invalid audio player %s"), buff);
4727 LIVES_ERROR(msg);
4728 lives_free(msg);
4729 }
4730 continue;
4731 }
4732
4733 if (!strcmp(charopt, "asource")) {
4734 if (!*optarg) {
4735 do_optarg_blank_err(charopt);
4736 continue;
4737 }
4738 if (optarg[0] == '-') {
4739 do_optarg_blank_err(charopt);
4740 optind--;
4741 continue;
4742 }
4743 lives_snprintf(buff, 256, "%s", optarg);
4744 // override audio source
4745 if (!strcmp(buff, _("external")) || !strcmp(buff, "external")) { // handle translated and original strings
4747 ign_opts.ign_asource = TRUE;
4748 } else if (strcmp(buff, _("internal")) && strcmp(buff, "internal")) { // handle translated and original strings
4749 fprintf(stderr, _("Invalid audio source %s\n"), buff);
4750 } else {
4752 ign_opts.ign_asource = TRUE;
4753 }
4754 continue;
4755 }
4756
4757 if (!strcmp(charopt, "nogui")) {
4758 // force headless mode
4759 prefs->show_gui = FALSE;
4760 continue;
4761 }
4762
4763 if (!strcmp(charopt, "nosplash")) {
4764 // do not show splash
4766 continue;
4767 }
4768
4769 if (!strcmp(charopt, "noplaywin")) {
4770 // do not show the play window
4772 continue;
4773 }
4774
4775 if (!strcmp(charopt, "noninteractive")) {
4776 // disable menu/toolbar interactivity
4778 continue;
4779 }
4780
4781 if (!strcmp(charopt, "nothreaddialog")) {
4782 continue;
4783 }
4784
4785 if (!strcmp(charopt, "fxmodesmax") && optarg) {
4786 if (!*optarg) {
4787 do_optarg_blank_err(charopt);
4788 continue;
4789 }
4790 if (optarg[0] == '-') {
4791 do_optarg_blank_err(charopt);
4792 optind--;
4793 continue;
4794 }
4795 // set number of fx modes
4796 prefs->max_modes_per_key = atoi(optarg);
4798 continue;
4799 }
4800
4801 if (!strcmp(charopt, "bigendbug")) {
4802 // only for backwards comptaibility
4803 if (optarg) {
4804 // set bigendbug
4805 prefs->bigendbug = atoi(optarg);
4806 } else prefs->bigendbug = 1;
4807 continue;
4808 }
4809#ifdef ENABLE_OSC
4810
4811 if (!strcmp(charopt, "oscstart") && optarg) {
4812 if (!*optarg) {
4813 do_optarg_blank_err(charopt);
4814 continue;
4815 }
4816 if (optarg[0] == '-') {
4817 do_optarg_blank_err(charopt);
4818 optind--;
4819 continue;
4820 }
4821 // force OSC start
4822 prefs->osc_udp_port = atoi(optarg);
4823 prefs->osc_start = TRUE;
4824 ign_opts.ign_osc = TRUE;
4825 continue;
4826 }
4827
4828 if (!strcmp(charopt, "nooscstart")) {
4829 // force no OSC start
4831 ign_opts.ign_osc = TRUE;
4832 continue;
4833 }
4834#endif
4835
4836#ifdef ENABLE_JACK
4837 if (!strcmp(charopt, "jackopts") && optarg) {
4838 if (!*optarg) {
4839 do_optarg_blank_err(charopt);
4840 continue;
4841 }
4842 if (optarg[0] == '-') {
4843 do_optarg_blank_err(charopt);
4844 optind--;
4845 continue;
4846 }
4847 // override jackopts in config file
4848 ign_opts.ign_jackopts = TRUE;
4849 future_prefs->jack_opts = prefs->jack_opts = atoi(optarg);
4850 continue;
4851 }
4852#endif
4853 if (!strcmp(charopt, "startup-ce")) {
4854 // force start in clip editor mode
4855 if (!ign_opts.ign_stmode) {
4857 ign_opts.ign_stmode = TRUE;
4858 }
4859 continue;
4860 }
4861
4862 if (!strcmp(charopt, "startup-mt")) {
4863 // force start in multitrack mode
4864 if (!ign_opts.ign_stmode) {
4866 ign_opts.ign_stmode = TRUE;
4867 }
4868 continue;
4869 }
4870
4871 if (!strcmp(charopt, "vjmode")) {
4872 // force start in multitrack mode
4873 prefs->vj_mode = TRUE;
4874 ign_opts.ign_vjmode = TRUE;
4875 continue;
4876 }
4877 }
4878
4879 if (optind < argc) {
4880 // remaining opts are filename [start_time] [end_frame]
4881 char *dir;
4882 lives_snprintf(start_file, PATH_MAX, "%s", argv[optind++]); // filename
4883 if (optind < argc) start = lives_strtod(argv[optind++], NULL); // start time (seconds)
4884 if (optind < argc) end = atoi(argv[optind++]); // number of frames
4885
4886 if (lives_strrstr(start_file, "://") == NULL) {
4887 // prepend current directory if needed (unless file contains :// - eg. dvd:// or http://)
4888 dir = get_dir(start_file);
4889 get_basename(start_file);
4890 lives_snprintf(start_file, PATH_MAX, "%s", (tmp = lives_build_filename(dir, start_file, NULL)));
4891 lives_free(tmp);
4892 lives_free(dir);
4893 // *INDENT-OFF*
4894 }}}}
4895 // *INDENT-ON*
4896
4897 if (!ign_opts.ign_configfile) {
4898 tmp = lives_build_filename(capable->home_dir, LIVES_DEF_CONFIG_DIR, "lives", LIVES_DEF_CONFIG_FILE, NULL);
4899 lives_snprintf(prefs->configfile, PATH_MAX, "%s", tmp);
4900 lives_free(tmp);
4901 }
4902
4903 if (!ign_opts.ign_config_datadir) {
4904 tmp = lives_build_path(capable->home_dir, LOCAL_HOME_DIR, LIVES_DEF_CONFIG_DATADIR, NULL);
4905 lives_snprintf(prefs->config_datadir, PATH_MAX, "%s", tmp);
4906 lives_free(tmp);
4907 }
4908
4909 // get capabilities and if OK set some initial prefs
4910 theme_error = pre_init();
4911
4912 lives_memset(start_file, 0, 1);
4913
4914 mainw->libthread = gtk_thread;
4915
4916 // what's my name ?
4917 capable->myname_full = lives_find_program_in_path(argv[0]);
4918
4919 if ((mynsize = lives_readlink(capable->myname_full, cdir, PATH_MAX)) != -1) {
4920 // no. i mean, what's my real name ?
4921 lives_memset(cdir + mynsize, 0, 1);
4923 capable->myname_full = lives_strdup(cdir);
4924 }
4925
4926 // what's my short name (without the path) ?
4927 lives_snprintf(cdir, PATH_MAX, "%s", capable->myname_full);
4928 get_basename(cdir);
4929 capable->myname = lives_strdup(cdir);
4930
4931 // format is:
4932 // lives [opts] [filename [start_time] [frames]]
4933
4934 // need to do this here, before lives_startup but afer setting ign_opts
4935 mainw->new_vpp = NULL;
4936 mainw->vpp = NULL;
4938 future_prefs->vpp_argv = NULL;
4939
4940 if (!ign_opts.ign_vppdefs) {
4941 tmp = lives_build_filename(prefs->config_datadir, VPP_DEFS_FILE, NULL);
4942 lives_snprintf(mainw->vpp_defs_file, PATH_MAX, "%s", tmp);
4943 lives_free(tmp);
4944 }
4945
4946 lives_idle_add_simple(lives_startup, NULL);
4947
4948#ifdef GUI_GTK
4949 if (!gtk_thread) {
4950 gtk_main();
4951 }
4952#endif
4953
4954#ifdef GUI_QT
4955 return qapp->exec();
4956#endif
4957
4958 return 0;
4959}
4960
4961
4962void startup_message_fatal(char *msg) {
4963 if (mainw) {
4965
4966 lives_freep((void **)&mainw->old_vhash);
4967 lives_freep((void **)&old_vhash);
4968 }
4969
4970 do_error_dialog(msg);
4971
4972 LIVES_FATAL(msg);
4973 // needs notify_socket and prefs->omc_events, so seems unlikely it will do anything, but anyway...
4975 lives_free(msg);
4976 _exit(1);
4977}
4978
4979
4982 else do_error_dialog(msg);
4983 return TRUE;
4984}
4985
4986
4987boolean startup_message_info(const char *msg) {
4989 do_info_dialog(msg);
4991 return TRUE;
4992}
4993
4994
4995boolean startup_message_nonfatal_dismissable(const char *msg, uint64_t warning_mask) {
4997 do_error_dialog_with_check(msg, warning_mask);
4999 return TRUE;
5000}
5001
5002
5004
5005void set_main_title(const char *file, int untitled) {
5006 char *title, *tmp, *tmp2;
5007 char short_file[256];
5008
5009 if (file && CURRENT_CLIP_IS_VALID) {
5010 if (untitled) {
5011 title = lives_strdup_printf((tmp = _("<%s> %dx%d : %d frames %d bpp %.3f fps")), (tmp2 = get_untitled_name(untitled)),
5012 cfile->hsize, cfile->vsize, cfile->frames, cfile->bpp, cfile->fps);
5013 } else {
5014 lives_snprintf(short_file, 256, "%s", file);
5015 if (cfile->restoring || (cfile->opening && cfile->frames == 123456789)) {
5016 title = lives_strdup_printf((tmp = _("<%s> %dx%d : ??? frames ??? bpp %.3f fps")),
5017 (tmp2 = lives_path_get_basename(file)), cfile->hsize, cfile->vsize, cfile->fps);
5018 } else {
5019 title = lives_strdup_printf((tmp = _("<%s> %dx%d : %d frames %d bpp %.3f fps")),
5020 cfile->clip_type != CLIP_TYPE_VIDEODEV ? (tmp2 = lives_path_get_basename(file))
5021 : (tmp2 = lives_strdup(file)), cfile->hsize, cfile->vsize, cfile->frames, cfile->bpp, cfile->fps);
5022 }
5023 }
5024 lives_free(tmp); lives_free(tmp2);
5025 } else {
5026 title = (_("<No File>"));
5027 }
5028
5030 lives_free(title);
5031
5033}
5034
5035
5036void sensitize_rfx(void) {
5037 if (!mainw->foreign) {
5038 if (mainw->rendered_fx) {
5043 if (mainw->rendered_fx[0].menuitem && LIVES_IS_WIDGET(mainw->rendered_fx[0].menuitem)) {
5046 (cfile->achans > 0 && prefs->audio_src == AUDIO_SRC_INT
5048 || mainw->agen_key != 0)) {
5051 // *INDENT-OFF*
5052 }}
5053 // *INDENT-ON*
5054
5057 }
5058
5059 if (mainw->has_custom_gens) {
5061 }
5062
5063 if (mainw->has_custom_tools) {
5065 }
5066
5069 }
5070
5071 if (mainw->resize_menuitem) {
5073 }
5074 }
5075}
5076
5077
5078void sensitize(void) {
5079 // sensitize main window controls
5080 // READY MODE
5081 int i;
5082
5083 if (LIVES_IS_PLAYING || mainw->is_processing || mainw->go_away) return;
5084
5085 if (mainw->multitrack) {
5087 return;
5088 }
5089
5092
5096#ifdef HAVE_WEBM
5098#else
5100#endif
5106#ifdef LIBAV_TRANSCODE
5108#endif
5109 if (!prefs->vj_mode) {
5113 }
5117
5118 if (!prefs->vj_mode) {
5126 }
5132 cfile->real_pointer_time > 0.);
5135 if (mainw->preview_box) {
5139 cfile->real_pointer_time > 0.);
5142 }
5143
5148 if (!prefs->vj_mode)
5153
5154 if (!prefs->vj_mode) {
5157 }
5158
5162 }
5163
5164 if (!prefs->vj_mode) {
5165 if (RFX_LOADED) {
5166 sensitize_rfx();
5167 }
5168 }
5170 if (!prefs->vj_mode) {
5185 cfile->real_pointer_time > 0.));
5193 }
5207 if (!prefs->vj_mode)
5210 if (!prefs->vj_mode)
5216#ifdef HAVE_YUV4MPEG
5218#endif
5219
5221 && CURRENT_CLIP_IS_VALID && (cfile->insert_start > 0));
5223 && CURRENT_CLIP_IS_VALID && (cfile->undo_start > 0));
5225
5234 cfile->frame_index != NULL);
5240 //lives_widget_set_sensitive(mainw->open_lives2lives, TRUE);
5241 if (!prefs->vj_mode)
5245
5247
5248 if (!CURRENT_CLIP_IS_CLIPBOARD && CURRENT_CLIP_IS_VALID && (cfile->start == 1 || cfile->end == cfile->frames) &&
5249 !(cfile->start == 1 &&
5250 cfile->end == cfile->frames)) {
5252 } else {
5254 }
5255
5258 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->spinbutton_end), 1, cfile->frames);
5259 lives_spin_button_set_value(LIVES_SPIN_BUTTON(mainw->spinbutton_end), cfile->end);
5261
5263 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->spinbutton_start), 1, cfile->frames);
5264 lives_spin_button_set_value(LIVES_SPIN_BUTTON(mainw->spinbutton_start), cfile->start);
5266
5270 }
5271
5273 // unblock spinbutton in play window
5275 }
5276 }
5277
5278 // clips menu
5279 for (i = 1; i < MAX_FILES; i++) {
5280 if (mainw->files[i]) {
5281 if (mainw->files[i]->menuentry) {
5283 // *INDENT-OFF*
5284 }}}
5285 // *INDENT-ON*
5286 if (prefs->vj_mode) {
5287#ifdef LIBAV_TRANSCODE
5289#endif
5298 }
5299}
5300
5301
5302void desensitize(void) {
5303 // desensitize the main window when we are playing/processing a clip
5304 int i;
5305
5306 if (mainw->multitrack) {
5308 return;
5309 }
5310
5313
5314 //lives_widget_set_sensitive (mainw->open, mainw->playing_file>-1);
5318#ifdef HAVE_WEBM
5320#else
5322#endif
5324#ifdef HAVE_YUV4MPEG
5326#endif
5327
5330
5338#ifdef LIBAV_TRANSCODE
5340#endif
5351 if (!prefs->pause_during_pb) {
5353 }
5355 if (!prefs->vj_mode) {
5356 if (RFX_LOADED) {
5357 if (!mainw->foreign) {
5361 mainw->rendered_fx[i].min_frames >= 0)
5363 }
5364 }
5365 }
5366
5367 if (mainw->resize_menuitem) {
5369 }
5370
5371 if (!prefs->vj_mode)
5374 }
5375
5376
5377 if (mainw->has_custom_gens) {
5379 }
5380
5381 if (mainw->has_custom_tools) {
5383 }
5384
5385 if (!mainw->foreign)
5388 }
5389
5427
5430
5431 if (mainw->current_file >= 0 && (!LIVES_IS_PLAYING || mainw->foreign)) {
5432 // if (!cfile->opening||mainw->dvgrab_preview||mainw->preview||cfile->opening_only_audio) {
5433 // disable the 'clips' menu entries
5434 for (i = 1; i < MAX_FILES; i++) {
5435 if (mainw->files[i]) {
5436 if (mainw->files[i]->menuentry) {
5437 if (i != mainw->current_file) {
5439 // *INDENT-OFF*
5440 }}}}}
5441 // *INDENT-ON*
5442}
5443
5444
5446 // switch on/off a few extra widgets in the processing dialog
5447
5448 int current_file;
5449
5450 if (mainw->multitrack) return;
5451
5454
5456 && (cfile->menuentry || cfile->opening) && !mainw->preview) {
5457 // an effect etc,
5460
5462 mainw->loop = lives_check_menu_item_get_active(LIVES_CHECK_MENU_ITEM(mainw->loop_video));
5463 }
5465 mainw->mute = lives_check_menu_item_get_active(LIVES_CHECK_MENU_ITEM(mainw->mute_audio));
5466 }
5467 }
5468 if (!CURRENT_CLIP_IS_CLIPBOARD && CURRENT_CLIP_IS_VALID && !cfile->menuentry) {
5470 if (cfile->opening || cfile->restoring) {
5471 // loading, restoring etc
5474 if (!cfile->opening_only_audio) {
5476 }
5477 }
5478 }
5479
5480 current_file = mainw->current_file;
5481 if (CURRENT_CLIP_IS_VALID && cfile->cb_src != -1) mainw->current_file = cfile->cb_src;
5482
5484 // stop the start and end from being changed
5485 // better to clamp the range than make insensitive, this way we stop
5486 // other widgets (like the video bar) updating it
5488 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->spinbutton_end), cfile->end, cfile->end);
5489 lives_spin_button_set_value(LIVES_SPIN_BUTTON(mainw->spinbutton_end), cfile->end);
5492 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->spinbutton_start), cfile->start, cfile->start);
5493 lives_spin_button_set_value(LIVES_SPIN_BUTTON(mainw->spinbutton_start), cfile->start);
5495 }
5496
5497 mainw->current_file = current_file;
5498
5500 // block spinbutton in play window
5502 }
5503
5515
5521 }
5522}
5523
5524
5525void set_drawing_area_from_pixbuf(LiVESWidget * widget, LiVESPixbuf * pixbuf,
5526 lives_painter_surface_t *surface) {
5527 LiVESXWindow *xwin;
5528 lives_rect_t update_rect;
5529 lives_painter_t *cr;
5530 int cx, cy;
5531 int rwidth, rheight, width, height, owidth, oheight;
5532
5533 if (!surface || !widget) return;
5534
5535 xwin = lives_widget_get_xwindow(widget);
5536 if (!LIVES_IS_XWINDOW(xwin)) return;
5537
5539
5540 if (!cr) return;
5541
5542 rwidth = lives_widget_get_allocation_width(widget);
5543 rheight = lives_widget_get_allocation_height(widget);
5544
5545 if (!rwidth || !rheight) return;
5546
5547 rwidth = (rwidth >> 1) << 1;
5548 rheight = (rheight >> 1) << 1;
5549
5550 if (pixbuf) {
5551 owidth = width = lives_pixbuf_get_width(pixbuf);
5552 oheight = height = lives_pixbuf_get_height(pixbuf);
5553
5554 cx = (rwidth - width) >> 1;
5555 if (cx < 0) cx = 0;
5556 cy = (rheight - height) >> 1;
5557 if (cy < 0) cy = 0;
5558
5559 if (widget == mainw->start_image || widget == mainw->end_image
5560 || (mainw->multitrack && widget == mainw->play_image)
5561 || (widget == mainw->play_window && !mainw->fs)) {
5562 int xrwidth, xrheight;
5563 LiVESWidget *p = lives_widget_get_parent(widget);
5564
5566
5569 lives_painter_render_background(p, cr, 0., 0., xrwidth, xrheight);
5570
5571 if (mainw->multitrack) {
5572 rwidth = xrwidth;
5573 rheight = xrheight;
5574 }
5575
5576 if (!mainw->multitrack && (prefs->ce_maxspect || prefs->letterbox)) {
5577 calc_maxspect(rwidth, rheight, &width, &height);
5578
5579 width = (width >> 1) << 1;
5580 height = (height >> 1) << 1;
5581
5582 if (width > owidth && height > oheight) {
5583 width = owidth;
5584 height = oheight;
5585 }
5586 }
5587
5588 if (mainw->multitrack) {
5589 cx = (rwidth - width) >> 1;
5590 if (cx < 0) cx = 0;
5591 cy = (rheight - height) >> 1;
5592 if (cy < 0) cy = 0;
5593 }
5594 }
5595
5596 lives_widget_set_opacity(widget, 1.);
5597
5598 if ((!mainw->multitrack || widget != mainw->play_image) && widget != mainw->preview_image) {
5599 if (!LIVES_IS_PLAYING && mainw->multitrack && widget == mainw->play_image) clear_widget_bg(widget, surface);
5600 if (prefs->funky_widgets) {
5602 if (widget == mainw->start_image || widget == mainw->end_image || widget == mainw->play_image) {
5603 lives_painter_move_to(cr, 0, 0);
5604 lives_painter_line_to(cr, rwidth, 0);
5605 lives_painter_move_to(cr, 0, rheight);
5606 lives_painter_line_to(cr, rwidth, rheight);
5607 } else lives_painter_rectangle(cr, cx - 1, cy - 1, width + 2, height + 2);
5608 // frame
5610 cx += 2;
5611 cy += 4;
5612 }
5613 }
5614
5616 lives_painter_set_source_pixbuf(cr, pixbuf, cx, cy);
5617 lives_painter_rectangle(cr, cx, cy, rwidth - cx * 2, rheight + 2 - cy * 2);
5618 } else {
5619 lives_widget_set_opacity(widget, 0.);
5620 clear_widget_bg(widget, surface);
5621 }
5624
5625 if (widget == mainw->play_window && rheight > mainw->pheight) rheight = mainw->pheight;
5626
5627 update_rect.x = update_rect.y = 0;
5628 update_rect.width = rwidth;
5629 update_rect.height = rheight;
5630
5631 if (!LIVES_IS_XWINDOW(xwin)) return;
5633}
5634
5635
5636void showclipimgs(void) {
5638 load_end_image(cfile->end);
5639 load_start_image(cfile->start);
5640 } else {
5641 load_end_image(0);
5643 }
5647}
5648
5649
5650void load_start_image(int frame) {
5651 LiVESPixbuf *start_pixbuf = NULL;
5652 LiVESPixbuf *orig_pixbuf = NULL;
5653 weed_layer_t *layer = NULL;
5654 weed_timecode_t tc;
5655 LiVESInterpType interp;
5656 char *xmd5sum = NULL;
5657 char *fname = NULL;
5658 boolean expose = FALSE;
5659 boolean cache_it = TRUE;
5660 int rwidth, rheight, width, height;
5661 int tries = 2;
5662 frames_t xpf;
5663
5664 if (!prefs->show_gui) return;
5665 if (mainw->multitrack) return;
5666
5668 capable->nmonitors == 1) &&
5669 (!mainw->ext_playback ||
5670 (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY))))) return;
5671 if (frame < 0) {
5672 frame = -frame;
5673 expose = TRUE;
5674 }
5675
5677
5678 if (!CURRENT_CLIP_IS_NORMAL || frame < 1 || frame > cfile->frames) {
5679 int bx, by, hsize, vsize;
5680 int scr_width = GUI_SCREEN_WIDTH;
5681 int scr_height = GUI_SCREEN_HEIGHT;
5682 int vspace = get_vspace();
5684 if (by > MENU_HIDE_LIM)
5686 hsize = (scr_width - (H_RESIZE_ADJUST * 3 + bx)) / 3;
5687 vsize = scr_height - (CE_TIMELINE_VSPACE * 1.01 / sqrt(widget_opts.scale) + vspace + by
5688 + (prefs->show_msg_area ? mainw->mbar_res : 0)
5691 hsize /= 2;
5692 vsize /= 2;
5693 }
5697
5700 }
5701
5702 if (CURRENT_CLIP_IS_VALID && (cfile->clip_type == CLIP_TYPE_YUV4MPEG || cfile->clip_type == CLIP_TYPE_VIDEODEV)) {
5703 if (!mainw->camframe) {
5704 LiVESError *error = NULL;
5706 char *tmp = lives_build_filename(prefs->prefix_dir, THEME_DIR, LIVES_THEME_CAMERA, fname, NULL);
5709 lives_free(tmp); lives_free(fname);
5710 }
5712 return;
5713 }
5714
5715 if (!CURRENT_CLIP_IS_NORMAL || mainw->current_file == mainw->scrap_file || frame < 1 || frame > cfile->frames) {
5716 if (mainw->imframe) {
5718 } else {
5720 }
5721 if (!palette || !(palette->style & STYLE_LIGHT)) {
5723 } else {
5725 }
5726 return;
5727 }
5728
5729 xpf = ABS(get_indexed_frame(mainw->current_file, frame));
5730
5731check_stcache:
5732 if (mainw->st_fcache) {
5735 if (is_virtual_frame(mainw->current_file, frame)) layer = mainw->st_fcache;
5736 else {
5737 if (cfile->clip_type == CLIP_TYPE_DISK && capable->has_md5sum) {
5738 char *md5sum = weed_get_string_value(mainw->st_fcache, WEED_LEAF_MD5SUM, NULL);
5739 if (md5sum) {
5740 if (!fname) fname = make_image_file_name(cfile, frame, get_image_ext_for_type(cfile->img_type));
5741 if (!xmd5sum) xmd5sum = get_md5sum(fname);
5742 if (!lives_strcmp(md5sum, xmd5sum)) layer = mainw->st_fcache;
5743 lives_free(md5sum);
5744 // *INDENT-OFF*
5745 }}}}}
5746 // *INDENT-ON*
5747
5748 if (!layer) {
5749 if (mainw->st_fcache) {
5752 mainw->st_fcache = NULL;
5753 }
5754 if (tries--) {
5755 if (tries == 1) mainw->st_fcache = mainw->pr_fcache;
5756 else mainw->st_fcache = mainw->en_fcache;
5757 goto check_stcache;
5758 }
5759 }
5760 lives_freep((void **)&fname);
5761
5762 tc = ((frame - 1.)) / cfile->fps * TICKS_PER_SECOND;
5763
5764 if (!prefs->ce_maxspect && !prefs->letterbox) {
5765 // if we are not playing, and it would be slow to seek to the frame, convert it to an image
5766 if (!LIVES_IS_PLAYING && !layer && cfile->clip_type == CLIP_TYPE_FILE && is_virtual_frame(mainw->current_file, frame) &&
5767 cfile->ext_src) {
5768 lives_clip_data_t *cdata = ((lives_decoder_t *)cfile->ext_src)->cdata;
5769 if (cdata && (expose || !(cdata->seek_flag & LIVES_SEEK_FAST))) {
5770 virtual_to_images(mainw->current_file, frame, frame, FALSE, &start_pixbuf);
5771 cache_it = FALSE;
5772 }
5773 }
5774
5775 if (!layer && !start_pixbuf) {
5777 if (pull_frame_at_size(layer, get_image_ext_for_type(cfile->img_type), tc, cfile->hsize, cfile->vsize,
5778 WEED_PALETTE_RGB24)) {
5779 check_layer_ready(layer);
5781 if (!resize_layer(layer, cfile->hsize, cfile->vsize, interp, WEED_PALETTE_RGB24, 0) ||
5782 !convert_layer_palette(layer, WEED_PALETTE_RGB24, 0)) {
5783 if (xmd5sum) lives_free(xmd5sum);
5784 return;
5785 }
5786 }
5787 }
5788
5789 if (!start_pixbuf) start_pixbuf = layer_to_pixbuf(layer, TRUE, TRUE);
5790
5791 if (LIVES_IS_PIXBUF(start_pixbuf)) {
5793 if (!cache_it || weed_layer_get_pixel_data_packed(layer) || !(pixbuf_to_layer(layer, start_pixbuf)))
5794 lives_widget_object_unref(start_pixbuf);
5795 } else cache_it = FALSE;
5796
5797 if (!cache_it) {
5798 if (layer) weed_layer_free(layer);
5799 mainw->st_fcache = NULL;
5800 } else {
5801 if (!mainw->st_fcache) {
5802 mainw->st_fcache = layer;
5803 if (!is_virtual_frame(mainw->current_file, frame)) {
5804 if (cfile->clip_type == CLIP_TYPE_DISK && capable->has_md5sum) {
5805 if (!xmd5sum) {
5806 char *fname = make_image_file_name(cfile, frame, get_image_ext_for_type(cfile->img_type));
5807 xmd5sum = get_md5sum(fname);
5808 lives_free(fname);
5809 }
5810 weed_set_string_value(layer, WEED_LEAF_MD5SUM, xmd5sum);
5811 // *INDENT-OFF*
5812 }}
5813 lives_layer_set_frame(layer, xpf);
5815 }}
5816 // *INDENT-ON*
5817 if (xmd5sum) lives_free(xmd5sum);
5818 return;
5819 }
5820
5821 do {
5822 width = cfile->hsize;
5823 height = cfile->vsize;
5824
5825 // TODO *** - if width*height==0, show broken frame image
5826
5829
5830 calc_maxspect(rwidth, rheight, &width, &height);
5831 width = (width >> 2) << 2;
5832 height = (height >> 2) << 2;
5833
5834 // if we are not playing, and it would be slow to seek to the frame, convert it to an image
5835 if (!LIVES_IS_PLAYING && !layer && cfile->clip_type == CLIP_TYPE_FILE && is_virtual_frame(mainw->current_file, frame) &&
5836 cfile->ext_src) {
5837 lives_clip_data_t *cdata = ((lives_decoder_t *)cfile->ext_src)->cdata;
5838 if (cdata && (expose || !(cdata->seek_flag & LIVES_SEEK_FAST))) {
5839 // TODO: make background thread
5840 virtual_to_images(mainw->current_file, frame, frame, FALSE, &start_pixbuf);
5841 cache_it = FALSE;
5842 }
5843 }
5844
5845 if (!layer && !start_pixbuf) {
5847 if (pull_frame_at_size(layer, get_image_ext_for_type(cfile->img_type), tc, width, height, WEED_PALETTE_RGB24)) {
5848 check_layer_ready(layer);
5850 if (!resize_layer(layer, width, height, interp, WEED_PALETTE_RGB24, 0) ||
5851 !convert_layer_palette(layer, WEED_PALETTE_RGB24, 0)) {
5852 weed_layer_free(layer);
5853 if (xmd5sum) lives_free(xmd5sum);
5854 return;
5855 }
5856 }
5857 }
5858
5859 if (!start_pixbuf || lives_pixbuf_get_width(start_pixbuf) != width || lives_pixbuf_get_height(start_pixbuf) != height) {
5860 if (!orig_pixbuf) {
5861 if (layer) orig_pixbuf = layer_to_pixbuf(layer, TRUE, TRUE);
5862 else orig_pixbuf = start_pixbuf;
5863 }
5864 if (start_pixbuf != orig_pixbuf && LIVES_IS_PIXBUF(start_pixbuf)) {
5865 start_pixbuf = NULL;
5866 }
5867 if (LIVES_IS_PIXBUF(orig_pixbuf)) {
5868 if (lives_pixbuf_get_width(orig_pixbuf) == width && lives_pixbuf_get_height(orig_pixbuf) == height)
5869 start_pixbuf = orig_pixbuf;
5870 else {
5871 start_pixbuf = lives_pixbuf_scale_simple(orig_pixbuf, width, height, LIVES_INTERP_BEST);
5872 }
5873 }
5874 }
5875
5876 if (LIVES_IS_PIXBUF(start_pixbuf)) {
5878 }
5879
5880#if !GTK_CHECK_VERSION(3, 0, 0)
5885#else
5886 }
5887 while (FALSE);
5888#endif
5889 if (start_pixbuf != orig_pixbuf && LIVES_IS_PIXBUF(start_pixbuf)) {
5890 lives_widget_object_unref(start_pixbuf);
5891 }
5892
5893 if (LIVES_IS_PIXBUF(orig_pixbuf)) {
5894 if (!cache_it || weed_layer_get_pixel_data_packed(layer) || !(pixbuf_to_layer(layer, orig_pixbuf)))
5895 lives_widget_object_unref(orig_pixbuf);
5896 } else cache_it = FALSE;
5897
5898 if (!cache_it) {
5899 weed_layer_free(layer);
5900 mainw->st_fcache = NULL;
5901 } else {
5902 if (!mainw->st_fcache) {
5903 mainw->st_fcache = layer;
5904 if (!is_virtual_frame(mainw->current_file, frame)) {
5905 if (cfile->clip_type == CLIP_TYPE_DISK && capable->has_md5sum) {
5906 if (!xmd5sum) {
5907 char *fname = make_image_file_name(cfile, frame, get_image_ext_for_type(cfile->img_type));
5908 xmd5sum = get_md5sum(fname);
5909 lives_free(fname);
5910 }
5911 weed_set_string_value(layer, WEED_LEAF_MD5SUM, xmd5sum);
5912 // *INDENT-OFF*
5913 }}
5914 lives_layer_set_frame(layer, xpf);
5916 }}
5917// *INDENT-ON*
5918 if (xmd5sum) lives_free(xmd5sum);
5919}
5920
5921
5922void load_end_image(int frame) {
5923 LiVESPixbuf *end_pixbuf = NULL;
5924 LiVESPixbuf *orig_pixbuf = NULL;
5925 weed_layer_t *layer = NULL;
5926 weed_timecode_t tc;
5927 LiVESInterpType interp;
5928 char *xmd5sum = NULL;
5929 char *fname = NULL;
5930 boolean expose = FALSE;
5931 boolean cache_it = TRUE;
5932 int rwidth, rheight, width, height;
5933 int tries = 2;
5934 frames_t xpf;
5935
5936 if (!prefs->show_gui) return;
5937 if (mainw->multitrack) return;
5938
5940 capable->nmonitors == 1) &&
5941 (!mainw->ext_playback ||
5942 (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY))))) return;
5943 if (frame < 0) {
5944 frame = -frame;
5945 expose = TRUE;
5946 }
5947
5949
5950 if (!CURRENT_CLIP_IS_NORMAL || frame < 1 || frame > cfile->frames) {
5951 int bx, by, hsize, vsize;
5952 int scr_width = GUI_SCREEN_WIDTH;
5953 int scr_height = GUI_SCREEN_HEIGHT;
5954 int vspace = get_vspace();
5956 if (by > MENU_HIDE_LIM)
5958 hsize = (scr_width - (H_RESIZE_ADJUST * 3 + bx)) / 3;
5959 vsize = scr_height - (CE_TIMELINE_VSPACE * 1.01 / sqrt(widget_opts.scale) + vspace + by
5960 + (prefs->show_msg_area ? mainw->mbar_res : 0)
5963 hsize /= 2;
5964 vsize /= 2;
5965 }
5969
5972 }
5973
5974 if (CURRENT_CLIP_IS_VALID && (cfile->clip_type == CLIP_TYPE_YUV4MPEG || cfile->clip_type == CLIP_TYPE_VIDEODEV)) {
5975 if (!mainw->camframe) {
5976 LiVESError *error = NULL;
5978 char *tmp = lives_build_filename(prefs->prefix_dir, THEME_DIR, LIVES_THEME_CAMERA, fname, NULL);
5981 lives_free(tmp); lives_free(fname);
5982 }
5983
5985 return;
5986 }
5987
5988 if (!CURRENT_CLIP_IS_NORMAL || mainw->current_file == mainw->scrap_file || frame < 1 || frame > cfile->frames) {
5989 if (mainw->imframe) {
5991 } else {
5993 }
5994 if (!palette || !(palette->style & STYLE_LIGHT)) {
5996 } else {
5998 }
5999 return;
6000 }
6001
6002 xpf = ABS(get_indexed_frame(mainw->current_file, frame));
6003check_encache:
6004 if (mainw->en_fcache) {
6007 if (is_virtual_frame(mainw->current_file, frame)) layer = mainw->en_fcache;
6008 else {
6009 if (cfile->clip_type == CLIP_TYPE_DISK && capable->has_md5sum) {
6010 char *md5sum = weed_get_string_value(mainw->en_fcache, WEED_LEAF_MD5SUM, NULL);
6011 if (md5sum) {
6012 if (!fname) fname = make_image_file_name(cfile, frame, get_image_ext_for_type(cfile->img_type));
6013 if (!xmd5sum) xmd5sum = get_md5sum(fname);
6014 if (!lives_strcmp(md5sum, xmd5sum)) layer = mainw->en_fcache;
6015 lives_free(md5sum);
6016 // *INDENT-OFF*
6017 }}}}}
6018 // *INDENT-ON*
6019
6020 if (!layer) {
6021 if (mainw->en_fcache) {
6024 mainw->en_fcache = NULL;
6025 }
6026 if (tries--) {
6027 if (tries == 1) mainw->en_fcache = mainw->pr_fcache;
6028 else mainw->en_fcache = mainw->st_fcache;
6029 goto check_encache;
6030 }
6031 }
6032
6033 lives_freep((void **)&fname);
6034
6035 tc = (frame - 1.) / cfile->fps * TICKS_PER_SECOND;
6036
6037 if (!prefs->ce_maxspect && !prefs->letterbox) {
6038 // if we are not playing, and it would be slow to seek to the frame, convert it to an image
6039 if (!LIVES_IS_PLAYING && !layer && cfile->clip_type == CLIP_TYPE_FILE && is_virtual_frame(mainw->current_file, frame) &&
6040 cfile->ext_src) {
6041 lives_clip_data_t *cdata = ((lives_decoder_t *)cfile->ext_src)->cdata;
6042 if (cdata && (expose || !(cdata->seek_flag & LIVES_SEEK_FAST))) {
6043 virtual_to_images(mainw->current_file, frame, frame, FALSE, &end_pixbuf);
6044 cache_it = FALSE;
6045 }
6046 }
6047
6048 if (!layer && !end_pixbuf) {
6050 if (pull_frame_at_size(layer, get_image_ext_for_type(cfile->img_type), tc, cfile->hsize, cfile->vsize,
6051 WEED_PALETTE_RGB24)) {
6052 check_layer_ready(layer);
6054 if (!resize_layer(layer, cfile->hsize, cfile->vsize, interp, WEED_PALETTE_RGB24, 0) ||
6055 !convert_layer_palette(layer, WEED_PALETTE_RGB24, 0)) {
6056 if (xmd5sum) lives_free(xmd5sum);
6057 return;
6058 }
6059 }
6060 }
6061
6062 if (!end_pixbuf) end_pixbuf = layer_to_pixbuf(layer, TRUE, TRUE);
6063
6064 if (LIVES_IS_PIXBUF(end_pixbuf)) {
6066 if (!cache_it || weed_layer_get_pixel_data_packed(layer) || !(pixbuf_to_layer(layer, end_pixbuf)))
6067 lives_widget_object_unref(end_pixbuf);
6068 } else cache_it = FALSE;
6069
6070 if (!cache_it) {
6071 if (layer) weed_layer_free(layer);
6072 mainw->en_fcache = NULL;
6073 } else {
6074 if (!mainw->en_fcache) {
6075 mainw->en_fcache = layer;
6076 if (!is_virtual_frame(mainw->current_file, frame)) {
6077 if (cfile->clip_type == CLIP_TYPE_DISK && capable->has_md5sum) {
6078 if (!xmd5sum) {
6079 char *fname = make_image_file_name(cfile, frame, get_image_ext_for_type(cfile->img_type));
6080 xmd5sum = get_md5sum(fname);
6081 lives_free(fname);
6082 }
6083 weed_set_string_value(layer, WEED_LEAF_MD5SUM, xmd5sum);
6084 // *INDENT-OFF*
6085 }}
6086 lives_layer_set_frame(layer, xpf);
6088 }}
6089 // *INDENT-ON*
6090 return;
6091 }
6092
6093 do {
6094 width = cfile->hsize;
6095 height = cfile->vsize;
6096
6099
6100 calc_maxspect(rwidth, rheight, &width, &height);
6101 width = (width >> 2) << 2;
6102 height = (height >> 2) << 2;
6103
6104 // if we are not playing, and it would be slow to seek to the frame, convert it to an image
6105 if (!LIVES_IS_PLAYING && !layer && cfile->clip_type == CLIP_TYPE_FILE && is_virtual_frame(mainw->current_file, frame) &&
6106 cfile->ext_src) {
6107 lives_clip_data_t *cdata = ((lives_decoder_t *)cfile->ext_src)->cdata;
6108 if (cdata && (expose || !(cdata->seek_flag & LIVES_SEEK_FAST))) {
6109 virtual_to_images(mainw->current_file, frame, frame, FALSE, &end_pixbuf);
6110 cache_it = FALSE;
6111 }
6112 }
6113
6114 if (!layer && !end_pixbuf) {
6116 if (pull_frame_at_size(layer, get_image_ext_for_type(cfile->img_type), tc, width, height, WEED_PALETTE_RGB24)) {
6117 check_layer_ready(layer);
6119 if (!resize_layer(layer, width, height, interp, WEED_PALETTE_RGB24, 0) ||
6120 !convert_layer_palette(layer, WEED_PALETTE_RGB24, 0)) {
6121 weed_layer_free(layer);
6122 if (xmd5sum) lives_free(xmd5sum);
6123 return;
6124 }
6125 }
6126 }
6127
6128 if (!end_pixbuf || lives_pixbuf_get_width(end_pixbuf) != width || lives_pixbuf_get_height(end_pixbuf) != height) {
6129 if (!orig_pixbuf) {
6130 if (layer) orig_pixbuf = layer_to_pixbuf(layer, TRUE, TRUE);
6131 else orig_pixbuf = end_pixbuf;
6132 }
6133 if (end_pixbuf != orig_pixbuf && LIVES_IS_PIXBUF(end_pixbuf)) {
6134 lives_widget_object_unref(end_pixbuf);
6135 end_pixbuf = NULL;
6136 }
6137 if (LIVES_IS_PIXBUF(orig_pixbuf)) {
6138 if (lives_pixbuf_get_width(orig_pixbuf) == width && lives_pixbuf_get_height(orig_pixbuf) == height)
6139 end_pixbuf = orig_pixbuf;
6140 else {
6141 end_pixbuf = lives_pixbuf_scale_simple(orig_pixbuf, width, height, LIVES_INTERP_BEST);
6142 }
6143 }
6144 }
6145
6146 if (LIVES_IS_PIXBUF(end_pixbuf)) {
6148 }
6149
6150#if !GTK_CHECK_VERSION(3, 0, 0)
6153 } while (rwidth != lives_widget_get_allocation_width(mainw->end_image) ||
6155#if 0
6156 {
6157#endif
6158#else
6159 } while (FALSE);
6160#endif
6161
6162 if (end_pixbuf != orig_pixbuf && LIVES_IS_PIXBUF(end_pixbuf)) {
6163 lives_widget_object_unref(end_pixbuf);
6164 }
6165
6166 if (LIVES_IS_PIXBUF(orig_pixbuf)) {
6167 if (!cache_it || weed_layer_get_pixel_data_packed(layer) || !(pixbuf_to_layer(layer, orig_pixbuf)))
6168 lives_widget_object_unref(orig_pixbuf);
6169 } else cache_it = FALSE;
6170
6171 if (!cache_it) {
6172 weed_layer_free(layer);
6173 mainw->en_fcache = NULL;
6174 } else {
6175 if (!mainw->en_fcache) {
6176 mainw->en_fcache = layer;
6177 if (!is_virtual_frame(mainw->current_file, frame)) {
6178 if (cfile->clip_type == CLIP_TYPE_DISK && capable->has_md5sum) {
6179 if (!xmd5sum) {
6180 char *fname = make_image_file_name(cfile, frame, get_image_ext_for_type(cfile->img_type));
6181 xmd5sum = get_md5sum(fname);
6182 lives_free(fname);
6183 }
6184 weed_set_string_value(layer, WEED_LEAF_MD5SUM, xmd5sum);
6185 // *INDENT-OFF*
6186 }}
6187 lives_layer_set_frame(layer, xpf);
6189 }}
6190 // *INDENT-ON*
6191 if (xmd5sum) lives_free(xmd5sum);
6192 }
6193#if 0
6194}
6195#endif
6196
6197#ifndef IS_LIBLIVES
6198int main(int argc, char *argv[]) {
6199 // call any hooks here
6200 return real_main(argc, argv, NULL, 0l);
6201}
6202#endif
6203
6204
6205void load_preview_image(boolean update_always) {
6206 // this is for the sepwin preview
6207 // update_always==TRUE = update widgets from mainw->preview_frame
6208 LiVESPixbuf *pixbuf = NULL;
6209 weed_layer_t *layer = NULL;
6210 boolean cache_it = TRUE;
6211 char *xmd5sum = NULL;
6212 char *fname = NULL;
6213 frames_t xpf = -1;
6214 int tries = 2;
6215 int preview_frame;
6216 int width, height;
6217
6218 if (!prefs->show_gui) return;
6219 if (LIVES_IS_PLAYING) return;
6220
6222
6223 if (CURRENT_CLIP_IS_VALID && (cfile->clip_type == CLIP_TYPE_YUV4MPEG || cfile->clip_type == CLIP_TYPE_VIDEODEV)) {
6224 if (!mainw->camframe) {
6225 LiVESError *error = NULL;
6227 char *tmp = lives_build_filename(prefs->prefix_dir, THEME_DIR, LIVES_THEME_CAMERA, fname, NULL);
6230 lives_free(tmp); lives_free(fname);
6231 fname = NULL;
6232 }
6233 pixbuf = lives_pixbuf_scale_simple(mainw->camframe, mainw->pwidth, mainw->pheight, LIVES_INTERP_BEST);
6235 if (pixbuf) lives_widget_object_unref(pixbuf);
6236 mainw->preview_frame = 1;
6238 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->preview_spinbutton), 1, 1);
6242 return;
6243 }
6244
6246 mainw->preview_frame = 0;
6248 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->preview_spinbutton), 0, 0);
6251 if (mainw->imframe) {
6256 if (!palette || !(palette->style & STYLE_LIGHT)) {
6258 } else {
6260 }
6261 return;
6262 }
6263
6264 if (!update_always) {
6265 // set current frame from spins, set range
6266 // set mainw->preview_frame to 0 before calling to force an update (e.g after a clip switch)
6267 switch (mainw->prv_link) {
6268 case PRV_END:
6269 preview_frame = cfile->end;
6270 break;
6271 case PRV_PTR:
6272 preview_frame = calc_frame_from_time(mainw->current_file, cfile->pointer_time);
6273 break;
6274 case PRV_START:
6275 preview_frame = cfile->start;
6276 break;
6277 default:
6278 preview_frame = mainw->preview_frame > 0 ? mainw->preview_frame : 1;
6279 if (preview_frame > cfile->frames) preview_frame = cfile->frames;
6280 break;
6281 }
6282
6284 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->preview_spinbutton), 1, cfile->frames);
6285 lives_spin_button_set_value(LIVES_SPIN_BUTTON(mainw->preview_spinbutton), preview_frame);
6287
6288 mainw->preview_frame = preview_frame;
6289 }
6290
6291 if (mainw->preview_frame < 1 || mainw->preview_frame > cfile->frames) {
6292 pixbuf = lives_pixbuf_scale_simple(mainw->imframe, cfile->hsize, cfile->vsize, LIVES_INTERP_BEST);
6293 if (!palette || !(palette->style & STYLE_LIGHT)) {
6295 } else {
6297 }
6298 } else {
6299 weed_timecode_t tc;
6301check_prcache:
6302 if (mainw->pr_fcache) {
6306 else {
6307 if (cfile->clip_type == CLIP_TYPE_DISK && capable->has_md5sum) {
6308 char *md5sum = weed_get_string_value(mainw->pr_fcache, WEED_LEAF_MD5SUM, NULL);
6309 if (md5sum) {
6310 if (!fname) fname = make_image_file_name(cfile, mainw->preview_frame, get_image_ext_for_type(cfile->img_type));
6311 if (!xmd5sum) xmd5sum = get_md5sum(fname);
6312 if (!lives_strcmp(md5sum, xmd5sum)) layer = mainw->pr_fcache;
6313 lives_free(md5sum);
6314 // *INDENT-OFF*
6315 }}}}}
6316 // *INDENT-ON*
6317 if (!layer) {
6318 if (mainw->pr_fcache) {
6321 mainw->pr_fcache = NULL;
6322 }
6323 if (tries--) {
6324 if (tries == 1) mainw->pr_fcache = mainw->st_fcache;
6325 else mainw->pr_fcache = mainw->en_fcache;
6326 goto check_prcache;
6327 }
6328 }
6329 lives_freep((void **)&fname);
6330
6331 // if we are not playing, and it would be slow to seek to the frame, convert it to an image
6332 if (!LIVES_IS_PLAYING && !layer && cfile->clip_type == CLIP_TYPE_FILE &&
6334 cfile->ext_src) {
6335 lives_clip_data_t *cdata = ((lives_decoder_t *)cfile->ext_src)->cdata;
6336 if (cdata && !(cdata->seek_flag & LIVES_SEEK_FAST)) {
6338 cache_it = FALSE;
6339 }
6340 }
6341
6342 width = cfile->hsize;
6343 height = cfile->vsize;
6344 if (prefs->ce_maxspect && !prefs->letterbox) {
6345 width = mainw->pwidth;
6346 height = mainw->pheight;
6347 }
6348 if (prefs->letterbox) {
6349 calc_maxspect(mainw->pwidth, mainw->pheight, &width, &height);
6350 }
6351
6352 if (!layer && !pixbuf) {
6354 tc = ((mainw->preview_frame - 1.)) / cfile->fps * TICKS_PER_SECOND;
6355 if (pull_frame_at_size(layer, get_image_ext_for_type(cfile->img_type), tc, width, height,
6356 WEED_PALETTE_RGB24)) {
6357 LiVESInterpType interp = get_interp_value(prefs->pb_quality, TRUE);
6358 check_layer_ready(layer);
6359 if (!resize_layer(layer, width, height, interp, WEED_PALETTE_RGB24, 0) ||
6360 !convert_layer_palette(layer, WEED_PALETTE_RGB24, 0)) {
6361 weed_layer_free(layer);
6362 if (xmd5sum) lives_free(xmd5sum);
6363 return;
6364 }
6365 }
6366 }
6367
6368 if (!pixbuf || lives_pixbuf_get_width(pixbuf) != mainw->pwidth
6369 || lives_pixbuf_get_height(pixbuf) != mainw->pheight) {
6370 if (!pixbuf) {
6371 if (layer) pixbuf = layer_to_pixbuf(layer, TRUE, TRUE);
6372 }
6373 }
6374
6375 if (LIVES_IS_PIXBUF(pixbuf)) {
6376 LiVESPixbuf *pr_pixbuf = NULL;
6377 if (lives_pixbuf_get_width(pixbuf) == width && lives_pixbuf_get_height(pixbuf) == height)
6378 pr_pixbuf = pixbuf;
6379 else {
6380 pr_pixbuf = lives_pixbuf_scale_simple(pixbuf, width, height, LIVES_INTERP_BEST);
6381 }
6382 if (LIVES_IS_PIXBUF(pr_pixbuf)) {
6385 if (pr_pixbuf != pixbuf) lives_widget_object_unref(pr_pixbuf);
6386 if (!layer || !cache_it || weed_layer_get_pixel_data_packed(layer) || !(pixbuf_to_layer(layer, pixbuf)))
6388 } else cache_it = FALSE;
6389 } else cache_it = FALSE;
6390 }
6391
6392 if (!cache_it) {
6393 weed_layer_free(layer);
6394 mainw->pr_fcache = NULL;
6395 } else {
6396 if (!mainw->pr_fcache) {
6397 mainw->pr_fcache = layer;
6399 if (cfile->clip_type == CLIP_TYPE_DISK && capable->has_md5sum) {
6400 if (!xmd5sum) {
6402 get_image_ext_for_type(cfile->img_type));
6403 xmd5sum = get_md5sum(fname);
6404 lives_free(fname);
6405 }
6406 weed_set_string_value(layer, WEED_LEAF_MD5SUM, xmd5sum);
6407 // *INDENT-OFF*
6408 }}
6409 lives_layer_set_frame(layer, xpf);
6411 }}
6412 // *INDENT-ON*
6413
6414 if (update_always) {
6415 // set spins from current frame
6416 switch (mainw->prv_link) {
6417 case PRV_PTR:
6418 //cf. hrule_reset
6419 cfile->pointer_time = lives_ce_update_timeline(mainw->preview_frame, 0.);
6420 if (cfile->frames > 0) cfile->frameno = calc_frame_from_time(mainw->current_file,
6421 cfile->pointer_time);
6422 if (cfile->pointer_time > 0.) {
6426 if (mainw->preview_box) {
6428 }
6429 }
6430 mainw->ptrtime = cfile->pointer_time;
6432 break;
6433
6434 case PRV_START:
6437 }
6439 if (cfile->start != mainw->preview_frame) {
6441 lives_spin_button_update(LIVES_SPIN_BUTTON(mainw->spinbutton_start));
6443 }
6444 break;
6445
6446 case PRV_END:
6449 }
6451 if (cfile->end != mainw->preview_frame) {
6453 lives_spin_button_update(LIVES_SPIN_BUTTON(mainw->spinbutton_end));
6455 }
6456 break;
6457
6458 default:
6462 if (mainw->preview_box) {
6464 }
6465 break;
6466 }
6467 }
6468 if (xmd5sum) lives_free(xmd5sum);
6469}
6470
6471
6472#ifndef NO_PROG_LOAD
6473
6474#ifdef GUI_GTK
6475static void pbsize_set(GdkPixbufLoader * pbload, int xxwidth, int xxheight, livespointer ptr) {
6476 if (xxwidth * xxheight > 0) gdk_pixbuf_loader_set_size(pbload, xxwidth, xxheight);
6477}
6478#endif
6479
6480#endif
6481
6482
6483#ifdef USE_LIBPNG
6484#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
6485static png_uint_32 png_flags;
6486#endif
6487static int png_flagstate = 0;
6488
6489static void png_init(png_structp png_ptr) {
6490 png_uint_32 mask = 0;
6491#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
6492#ifdef PNG_SELECT_READ
6493 int selection = PNG_SELECT_READ;// | PNG_SELECT_WRITE;
6494 int mmxsupport = png_mmx_support(); // -1 = not compiled, 0 = not on machine, 1 = OK
6495 mask = png_get_asm_flagmask(selection);
6496
6497 if (mmxsupport < 1) {
6498 int compilerID;
6499 mask &= ~(png_get_mmx_flagmask(selection, &compilerID));
6500 /* if (prefs->show_dev_opts) { */
6501 /* g_printerr(" without MMX features (%d)\n", mmxsupport); */
6502 /* } */
6503 } else {
6504 /* if (prefs->show_dev_opts) { */
6505 /* g_printerr(" with MMX features\n"); */
6506 /* } */
6507 }
6508#endif
6509#endif
6510
6511#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \
6512 && defined(PNG_THREAD_UNSAFE_OK)
6513 /* Disable thread-unsafe features of pnggccrd */
6514 if (png_access_version() >= 10200) {
6515 mask &= ~(PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
6516 | PNG_ASM_FLAG_MMX_READ_FILTER_SUB
6517 | PNG_ASM_FLAG_MMX_READ_FILTER_AVG
6518 | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH);
6519
6520 if (prefs->show_dev_opts) {
6521 g_printerr("Thread unsafe features of libpng disabled.\n");
6522 }
6523 }
6524#endif
6525
6526 if (prefs->show_dev_opts && mask != 0) {
6527 uint64_t xmask = (uint64_t)mask;
6528 g_printerr("enabling png opts %lu\n", xmask);
6529 }
6530
6531 if (!mask) png_flagstate = -1;
6532 else {
6533#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
6534 png_flags = png_get_asm_flags(png_ptr);
6535 png_flags |= mask;
6536 png_flagstate = 1;
6537#endif
6538 }
6539}
6540
6541#define PNG_BIO
6542#ifdef PNG_BIO
6543static void png_read_func(png_structp png_ptr, png_bytep data, png_size_t length) {
6544 int fd = LIVES_POINTER_TO_INT(png_get_io_ptr(png_ptr));
6545 //lives_file_buffer_t *fbuff = find_in_file_buffers(fd);
6546 if (lives_read_buffered(fd, data, length, TRUE) < length) {
6547 png_error(png_ptr, "read_fn error");
6548 }
6549}
6550#endif
6551
6552typedef struct {
6553 weed_layer_t *layer;
6554 int width, height;
6555 LiVESInterpType interp;
6556 int pal, clamp;
6557} resl_priv_data;
6558
6559
6560#ifdef USE_RESTHREAD
6561static void res_thrdfunc(void *arg) {
6562 resl_priv_data *priv = (resl_priv_data *)arg;
6563 resize_layer(priv->layer, priv->width, priv->height, priv->interp, priv->pal, priv->clamp);
6564 weed_set_voidptr_value(priv->layer, WEED_LEAF_RESIZE_THREAD, NULL);
6565 lives_free(priv);
6566}
6567
6568
6569static void reslayer_thread(weed_layer_t *layer, int twidth, int theight, LiVESInterpType interp,
6570 int tpalette, int clamp, double file_gamma) {
6571 resl_priv_data *priv = (resl_priv_data *)lives_malloc(sizeof(resl_priv_data));
6572 lives_proc_thread_t resthread;
6573 weed_set_double_value(layer, "file_gamma", file_gamma);
6574 priv->layer = layer;
6575 priv->width = twidth;
6576 priv->height = theight;
6577 priv->interp = interp;
6578 priv->pal = tpalette;
6579 priv->clamp = clamp;
6580 resthread = lives_proc_thread_create(LIVES_THRDATTR_NO_GUI, (lives_funcptr_t)res_thrdfunc, -1, "v", priv);
6581 weed_set_voidptr_value(layer, WEED_LEAF_RESIZE_THREAD, resthread);
6582}
6583#endif
6584
6585
6586boolean layer_from_png(int fd, weed_layer_t *layer, int twidth, int theight, int tpalette, boolean prog) {
6587 png_structp png_ptr;
6588 png_infop info_ptr;
6589 double file_gamma;
6590 int gval;
6591#ifndef PNG_BIO
6592 FILE *fp = fdopen(fd, "rb");
6593 size_t bsize = fread(ibuff, 1, 8, fp);
6594 boolean is_png = TRUE;
6595 unsigned char ibuff[8];
6596#endif
6597
6598 unsigned char **row_ptrs;
6599 unsigned char *ptr;
6600
6601 boolean is16bit = FALSE;
6602
6603 png_uint_32 xwidth, xheight;
6604
6605 int width, height;
6606 int color_type, bit_depth;
6607 int rowstride;
6608 int flags, privflags;
6609
6610 png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL, NULL, NULL);
6611
6612 if (!png_ptr) {
6613#ifndef PNG_BIO
6614 fclose(fp);
6615#endif
6616 return FALSE;
6617 }
6618
6619#if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
6620 if (!png_flagstate) png_init(png_ptr);
6621#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
6622 if (png_flagstate == 1) png_set_asm_flags(png_ptr, png_flags);
6623#endif
6624#endif
6625
6626 info_ptr = png_create_info_struct(png_ptr);
6627
6628 if (!info_ptr) {
6629 png_destroy_read_struct(&png_ptr, NULL, NULL);
6630#ifndef PNG_BIO
6631 fclose(fp);
6632#endif
6633 return FALSE;
6634 }
6635
6636 if (setjmp(png_jmpbuf(png_ptr))) {
6637 // libpng will longjump to here on error
6638#ifdef USE_RESTHREAD
6639 weed_set_int_value(layer, WEED_LEAF_PROGSCAN, 0);
6640#endif
6641 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
6642#ifndef PNG_BIO
6643 fclose(fp);
6644#endif
6645 return FALSE;
6646 }
6647
6648#ifdef PNG_BIO
6649 png_set_read_fn(png_ptr, LIVES_INT_TO_POINTER(fd), png_read_func);
6650#ifndef VALGRIND_ON
6651 png_set_sig_bytes(png_ptr, 8);
6652#else
6653 png_set_sig_bytes(png_ptr, 0);
6654#endif
6655#else
6656 png_init_io(png_ptr, fp);
6657 png_set_sig_bytes(png_ptr, bsize);
6658#endif
6659
6660 // read header info
6661 png_read_info(png_ptr, info_ptr);
6662 png_get_IHDR(png_ptr, info_ptr, &xwidth, &xheight,
6663 NULL, NULL, NULL,
6664 NULL, NULL);
6665 if (xwidth > 0 && xheight > 0) {
6666 weed_set_int_value(layer, WEED_LEAF_WIDTH, xwidth);
6667 weed_set_int_value(layer, WEED_LEAF_HEIGHT, xheight);
6668
6669 privflags = weed_get_int_value(layer, WEED_LEAF_HOST_FLAGS, NULL);
6670 weed_set_int_value(layer, WEED_LEAF_HOST_FLAGS, privflags | LIVES_LAYER_HAS_SIZE_NOW);
6671 if (privflags == LIVES_LAYER_GET_SIZE_ONLY
6672 || (privflags == LIVES_LAYER_LOAD_IF_NEEDS_RESIZE
6673 && (int)xwidth == twidth && (int)xheight == theight)) {
6674 png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
6675#ifndef PNG_BIO
6676 fclose(fp);
6677#endif
6678 return TRUE;
6679 }
6680 }
6681
6682 flags = weed_layer_get_flags(layer);
6683
6684#if PNG_LIBPNG_VER >= 10504
6685 if (prefs->alpha_post) {
6687 png_set_alpha_mode(png_ptr, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
6688 } else {
6689 flags |= WEED_LAYER_ALPHA_PREMULT;
6690 png_set_alpha_mode(png_ptr, PNG_ALPHA_PREMULTIPLIED, PNG_DEFAULT_sRGB);
6691 }
6692#endif
6693
6694 weed_set_int_value(layer, WEED_LEAF_FLAGS, flags);
6695
6696 color_type = png_get_color_type(png_ptr, info_ptr);
6697 bit_depth = png_get_bit_depth(png_ptr, info_ptr);
6698 gval = png_get_gAMA(png_ptr, info_ptr, &file_gamma);
6699
6700 if (!gval) {
6701 // b > a, brighter
6702 //png_set_gamma(png_ptr, 1.0, .45455); /// default, seemingly
6703 //png_set_gamma(png_ptr, 1. / .45455, 1.0); /// too bright
6704 png_set_gamma(png_ptr, 1.0, 1.0);
6705 }
6706
6707 if (gval == PNG_INFO_gAMA) {
6708 weed_set_int_value(layer, WEED_LEAF_GAMMA_TYPE, WEED_GAMMA_LINEAR);
6709 }
6710
6711 // want to convert everything (greyscale, RGB, RGBA64 etc.) to RGBA32 (or RGB24)
6712 if (color_type == PNG_COLOR_TYPE_PALETTE)
6713 png_set_palette_to_rgb(png_ptr);
6714
6715 if (png_get_valid(png_ptr, info_ptr,
6716 PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
6717
6718 if (color_type == PNG_COLOR_TYPE_GRAY &&
6719 bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
6720
6721 if (color_type == PNG_COLOR_TYPE_GRAY ||
6722 color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
6723 png_set_gray_to_rgb(png_ptr);
6724
6725 if (bit_depth == 16) {
6726 // if tpalette is YUV, then recreate the pixel_data with double the width
6727 // and mark as 16bpc, then >> 8 when doing the conversion
6728#ifdef xUSE_16BIT_PCONV
6730 if (weed_palette_is_yuv(tpalette)) {
6731 width *= 2;
6732 is16bit = TRUE;
6733 } else {
6734#endif
6735#if PNG_LIBPNG_VER >= 10504
6736 png_set_scale_16(png_ptr);
6737#else
6738 png_set_strip_16(png_ptr);
6739#endif
6740#ifdef xUSE_16BIT_PCONV
6741 }
6742#endif
6743 }
6744
6745 if (tpalette != WEED_PALETTE_END) {
6746 if (weed_palette_has_alpha(tpalette)) {
6747 // if target has alpha, add a channel
6748 if (color_type != PNG_COLOR_TYPE_RGB_ALPHA &&
6749 color_type != PNG_COLOR_TYPE_GRAY_ALPHA) {
6750 if (tpalette == WEED_PALETTE_ARGB32)
6751 png_set_add_alpha(png_ptr, 255, PNG_FILLER_BEFORE);
6752 else
6753 png_set_add_alpha(png_ptr, 255, PNG_FILLER_AFTER);
6754 color_type = PNG_COLOR_TYPE_RGB_ALPHA;
6755 } else {
6756 if (tpalette == WEED_PALETTE_ARGB32) {
6757 png_set_swap_alpha(png_ptr);
6758 }
6759 }
6760 } else {
6761 // else remove it
6762 if (color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
6763 color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
6764 png_set_strip_alpha(png_ptr);
6765 color_type = PNG_COLOR_TYPE_RGB;
6766 }
6767 }
6768 if (tpalette == WEED_PALETTE_BGR24 || tpalette == WEED_PALETTE_BGRA32) {
6769 png_set_bgr(png_ptr);
6770 }
6771 }
6772
6773 // unnecessary for read_image or if we set npass
6774 //png_set_interlace_handling(png_ptr);
6775
6776 // read updated info with the new palette
6777 png_read_update_info(png_ptr, info_ptr);
6778
6779 width = png_get_image_width(png_ptr, info_ptr);
6780 height = png_get_image_height(png_ptr, info_ptr);
6781
6782 weed_set_int_value(layer, WEED_LEAF_WIDTH, width);
6783 weed_set_int_value(layer, WEED_LEAF_HEIGHT, height);
6784
6785 if (weed_palette_is_rgb(tpalette)) {
6786 weed_layer_set_palette(layer, tpalette);
6787 } else {
6788 if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
6789 weed_layer_set_palette(layer, WEED_PALETTE_RGBA32);
6790 } else {
6791 weed_layer_set_palette(layer, WEED_PALETTE_RGB24);
6792 }
6793 }
6794
6796
6797 if (!create_empty_pixel_data(layer, FALSE, TRUE)) {
6799#ifndef PNG_BIO
6800 fclose(fp);
6801#endif
6802 return FALSE;
6803 }
6804
6805 // TODO: rowstride must be at least png_get_rowbytes(png_ptr, info_ptr)
6806
6807 rowstride = weed_layer_get_rowstride(layer);
6809
6810 // libpng needs pointers to each row
6811 row_ptrs = (unsigned char **)lives_malloc(height * sizeof(unsigned char *));
6812 for (int j = 0; j < height; j++) {
6813 row_ptrs[j] = ptr;
6814 ptr += rowstride;
6815 }
6816
6817#ifdef USE_RESTHREAD
6818 if (weed_threadsafe && twidth * theight != 0 && (twidth != width || theight != height) &&
6819 !png_get_interlace_type(png_ptr, info_ptr)) {
6820 weed_set_int_value(layer, WEED_LEAF_PROGSCAN, 1);
6821 reslayer_thread(layer, twidth, theight, get_interp_value(prefs->pb_quality, TRUE),
6822 tpalette, weed_layer_get_yuv_clamping(layer),
6823 gval == PNG_INFO_gAMA ? file_gamma : 1.);
6824 for (int j = 0; j < height; j++) {
6825 png_read_row(png_ptr, row_ptrs[j], NULL);
6826 weed_set_int_value(layer, WEED_LEAF_PROGSCAN, j + 1);
6827 }
6828 weed_set_int_value(layer, WEED_LEAF_PROGSCAN, -1);
6829 } else
6830#endif
6831 png_read_image(png_ptr, row_ptrs);
6832
6833 //png_read_end(png_ptr, NULL);
6834
6835 // end read
6836
6837 lives_free(row_ptrs);
6838
6839 png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
6840
6845
6846 if (gval == PNG_INFO_gAMA) {
6849 weed_layer_set_gamma(layer, WEED_GAMMA_LINEAR);
6850 } else weed_layer_set_gamma(layer, WEED_GAMMA_SRGB);
6851
6852 if (is16bit) {
6853#ifdef USE_RESTHREAD
6854 lives_proc_thread_t resthread;
6855#endif
6856 int clamping, sampling, subspace;
6857 weed_layer_get_palette_yuv(layer, &clamping, &sampling, &subspace);
6858 weed_set_int_value(layer, WEED_LEAF_PIXEL_BITS, 16);
6859 if (weed_palette_has_alpha(tpalette)) tpalette = WEED_PALETTE_YUVA4444P;
6860 else {
6861 if (tpalette != WEED_PALETTE_YUV420P) tpalette = WEED_PALETTE_YUV444P;
6862 }
6863#ifdef USE_RESTHREAD
6864 if ((resthread = weed_get_voidptr_value(layer, WEED_LEAF_RESIZE_THREAD, NULL))) {
6865 lives_proc_thread_join(resthread);
6866 weed_set_voidptr_value(layer, WEED_LEAF_RESIZE_THREAD, NULL);
6867 }
6868#endif
6869 // convert RGBA -> YUVA4444P or RGB -> 444P or 420
6870 // 16 bit conversion
6871 convert_layer_palette_full(layer, tpalette, clamping, sampling, subspace, WEED_GAMMA_UNKNOWN);
6872 }
6873#ifndef PNG_BIO
6874 fclose(fp);
6875#endif
6876 return TRUE;
6877}
6878
6879
6880// unused
6881boolean save_to_png(FILE * fp, weed_layer_t *layer, int comp) {
6882 // comp is 0 (none) - 9 (full)
6883 png_structp png_ptr;
6884 png_infop info_ptr;
6885
6886 unsigned char *ptr;
6887
6888 int width, height, palette;
6889#if PNG_LIBPNG_VER >= 10504
6890 int flags = 0;
6891#endif
6892 int rowstride;
6893
6894 register int i;
6895
6896 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL, NULL, NULL);
6897
6898 if (!png_ptr) {
6899 fclose(fp);
6900 return FALSE;
6901 }
6902
6903 info_ptr = png_create_info_struct(png_ptr);
6904
6905 if (!info_ptr) {
6906 png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
6907 fclose(fp);
6908 return FALSE;
6909 }
6910
6911 if (setjmp(png_jmpbuf(png_ptr))) {
6912 // libpng will longjump to here on error
6913 if (info_ptr) png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
6914 png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
6915 return FALSE;
6916 }
6917
6918 png_init_io(png_ptr, fp);
6919
6920 width = weed_layer_get_width(layer);
6921 height = weed_layer_get_height(layer);
6922 rowstride = weed_layer_get_rowstride(layer);
6924
6925 if (width <= 0 || height <= 0 || rowstride <= 0) {
6926 LIVES_WARN("Cannot make png with 0 width or height");
6927 return FALSE;
6928 }
6929
6930 switch (palette) {
6931 case WEED_PALETTE_RGB24:
6932 case WEED_PALETTE_BGR24:
6933 png_set_IHDR(png_ptr, info_ptr, width, height,
6934 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
6935 PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
6936 break;
6937 case WEED_PALETTE_RGBA32:
6938 case WEED_PALETTE_BGRA32:
6939 png_set_IHDR(png_ptr, info_ptr, width, height,
6940 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
6941 PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
6942 break;
6943 default:
6944 LIVES_ERROR("Bad png palette !\n");
6945 break;
6946 }
6947
6948 png_set_compression_level(png_ptr, comp);
6949
6950 //png_set_write_status_fn(png_ptr, png_row_callback);
6951
6952#if PNG_LIBPNG_VER >= 10504
6953 flags = weed_layer_get_flags(layer);
6954 if (flags & WEED_LAYER_ALPHA_PREMULT) {
6955 png_set_alpha_mode(png_ptr, PNG_ALPHA_PREMULTIPLIED, PNG_DEFAULT_sRGB);
6956 } else {
6957 png_set_alpha_mode(png_ptr, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
6958 }
6959#endif
6960
6961 if (weed_layer_get_gamma(layer) == WEED_GAMMA_LINEAR)
6962 png_set_gAMA(png_ptr, info_ptr, 1.0);
6963 else
6964 png_set_gAMA(png_ptr, info_ptr, 0.45455);
6965
6966 png_write_info(png_ptr, info_ptr);
6967
6968 ptr = (unsigned char *)weed_layer_get_pixel_data_packed(layer);
6969
6970 // Write image data
6971 for (i = 0 ; i < height ; i++) {
6972 png_write_row(png_ptr, ptr);
6973 ptr += rowstride;
6974 }
6975
6976 // end write
6977 png_write_end(png_ptr, (png_infop)NULL);
6978
6979 if (info_ptr) png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
6980 png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
6981
6982 fflush(fp);
6983
6984 return TRUE;
6985}
6986#endif
6987
6988
6989boolean weed_layer_create_from_file_progressive(weed_layer_t *layer, const char *fname, int width,
6990 int height, int tpalette, const char *img_ext) {
6991 LiVESPixbuf *pixbuf = NULL;
6992 LiVESError *gerror = NULL;
6993 boolean ret = TRUE;
6994#ifndef VALGRIND_ON
6995 boolean is_png = FALSE;
6996#endif
6997 int fd = -1;
6998
6999#ifndef NO_PROG_LOAD
7000#ifdef GUI_GTK
7001 GdkPixbufLoader *pbload;
7002#endif
7003 uint8_t ibuff[IMG_BUFF_SIZE];
7004 size_t bsize;
7005
7006#ifndef VALGRIND_ON
7007 if (!strcmp(img_ext, LIVES_FILE_EXT_PNG)) is_png = TRUE;
7008#endif
7009
7010#ifdef PNG_BIO
7011 fd = lives_open_buffered_rdonly(fname);
7012 if (fd < 0) break_me(fname);
7013 if (fd < 0) return FALSE;
7014#ifndef VALGRIND_ON
7015 if (is_png) lives_buffered_rdonly_slurp(fd, 8);
7016 else
7018#endif
7019#else
7020 fd = lives_open2(fname, O_RDONLY);
7021#endif
7022 if (fd < 0) return FALSE;
7023#ifndef PNG_BIO
7024#ifdef HAVE_POSIX_FADVISE
7025 posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
7026#endif
7027#endif
7028
7029 xxwidth = width;
7030 xxheight = height;
7031
7032 if (!strcmp(img_ext, LIVES_FILE_EXT_PNG)) {
7033#ifdef USE_LIBPNG
7034 tpalette = weed_layer_get_palette(layer);
7035 ret = layer_from_png(fd, layer, width, height, tpalette, TRUE);
7036 goto fndone;
7037#endif
7038
7039#ifdef GUI_GTK
7040 pbload = gdk_pixbuf_loader_new_with_type(LIVES_IMAGE_TYPE_PNG, &gerror);
7041#endif
7042 }
7043#ifdef GUI_GTK
7044 else if (!strcmp(img_ext, LIVES_FILE_EXT_JPG)) pbload = gdk_pixbuf_loader_new_with_type(LIVES_IMAGE_TYPE_JPEG, &gerror);
7045 else pbload = gdk_pixbuf_loader_new();
7046
7047 lives_signal_connect(LIVES_WIDGET_OBJECT(pbload), LIVES_WIDGET_SIZE_PREPARED_SIGNAL,
7048 LIVES_GUI_CALLBACK(pbsize_set), NULL);
7049
7050 while (1) {
7051#ifndef PNG_BIO
7052 if ((bsize = read(fd, ibuff, IMG_BUFF_SIZE)) <= 0) break;
7053#else
7054 if ((bsize = lives_read_buffered(fd, ibuff, IMG_BUFF_SIZE, TRUE)) <= 0) break;
7055#endif
7056 if (!gdk_pixbuf_loader_write(pbload, ibuff, bsize, &gerror)) {
7057 ret = FALSE;
7058 goto fndone;
7059 }
7060 }
7061
7062 if (!gdk_pixbuf_loader_close(pbload, &gerror)) {
7063 ret = FALSE;
7064 goto fndone;
7065 }
7066 pixbuf = gdk_pixbuf_loader_get_pixbuf(pbload);
7068 if (pbload) lives_widget_object_unref(pbload);
7069
7070#endif
7071
7072# else //PROG_LOAD
7073
7074#ifdef USE_LIBPNG
7075 {
7076#ifdef PNG_BIO
7077 fd = lives_open_buffered_rdonly(fname);
7078#else
7079 fd = lives_open2(fname, O_RDONLY);
7080#endif
7081
7082 if (fd < 0) return FALSE;
7083
7084#ifndef PNG_BIO
7085#ifdef HAVE_POSIX_FADVISE
7086 posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
7087#endif
7088#endif
7089 tpalette = weed_layer_get_palette(layer);
7090 ret = layer_from_png(fd, layer, width, height, tpalette, FALSE);
7091 goto fndone;
7092 }
7093#endif
7094
7095 pixbuf = lives_pixbuf_new_from_file_at_scale(fname, width > 0 ? width : -1, height > 0 ? height : -1, FALSE, gerror);
7096#endif
7097
7098 if (gerror) {
7099 LIVES_ERROR(gerror->message);
7100 lives_error_free(gerror);
7101 pixbuf = NULL;
7102 }
7103
7104 if (!pixbuf) {
7105 ret = FALSE;
7106 goto fndone;
7107 }
7108
7109 if (lives_pixbuf_get_has_alpha(pixbuf)) {
7110 /* unfortunately gdk pixbuf loader does not preserve the original alpha channel, instead it adds its own.
7111 We need to hence reset it back to opaque */
7113 weed_layer_set_palette(layer, WEED_PALETTE_RGBA32);
7114 } else weed_layer_set_palette(layer, WEED_PALETTE_RGB24);
7115
7116 if (!pixbuf_to_layer(layer, pixbuf)) {
7118 }
7119
7120fndone:
7121#ifdef PNG_BIO
7122 if (fd >= 0) {
7124 }
7125#else
7126 if (fd >= 0) close(fd);
7127#endif
7128
7129 return ret;
7130}
7131
7132
7133static weed_plant_t *render_subs_from_file(lives_clip_t *sfile, double xtime, weed_layer_t *layer) {
7134 // render subtitles from whatever (.srt or .sub) file
7135 // uses default values for colours, fonts, size, etc.
7136
7137 // TODO - allow prefs settings for colours, fonts, size, alpha (use plugin for this)
7138
7139 //char *sfont=mainw->font_list[prefs->sub_font];
7140 const char *sfont = "Sans";
7141 lives_colRGBA64_t col_white, col_black_a;
7142
7143 int error, size;
7144
7145 xtime -= (double)sfile->subt->offset / sfile->fps;
7146
7147 // round to 2 dp
7148 xtime = (double)((int)(xtime * 100. + .5)) / 100.;
7149
7150 if (xtime < 0.) return layer;
7151
7152 get_subt_text(sfile, xtime);
7153
7154 if (!sfile->subt->text) return layer;
7155
7156 size = weed_get_int_value(layer, WEED_LEAF_WIDTH, &error) / 32;
7157
7158 col_white = lives_rgba_col_new(65535, 65535, 65535, 65535);
7159 col_black_a = lives_rgba_col_new(0, 0, 0, SUB_OPACITY);
7160
7162 // make it look nicer by dimming relative to luma
7163 gamma_convert_layer(WEED_GAMMA_LINEAR, layer);
7164 }
7165
7166 layer = render_text_to_layer(layer, sfile->subt->text, sfont, size,
7167 LIVES_TEXT_MODE_FOREGROUND_AND_BACKGROUND, &col_white, &col_black_a, TRUE, TRUE, 0.);
7168 return layer;
7169}
7170
7171
7172boolean pull_frame_at_size(weed_layer_t *layer, const char *image_ext, weed_timecode_t tc, int width, int height,
7173 int target_palette) {
7174 // pull a frame from an external source into a layer
7175 // the WEED_LEAF_CLIP and WEED_LEAF_FRAME leaves must be set in layer
7176 // tc is used instead of WEED_LEAF_FRAME for some sources (e.g. generator plugins)
7177 // image_ext is used if the source is an image file (eg. "jpg" or "png")
7178 // width and height are hints only, the caller should resize if necessary
7179 // target_palette is also a hint
7180
7181 // if we pull from a decoder plugin, then we may also deinterlace
7182 weed_plant_t *vlayer;
7183 lives_clip_t *sfile = NULL;
7184 int clip = lives_layer_get_clip(layer);
7185 frames_t frame = lives_layer_get_frame(layer);
7186 int clip_type;
7187
7188 boolean is_thread = FALSE;
7189
7190 // the default unless overridden
7191 weed_layer_set_gamma(layer, WEED_GAMMA_SRGB);
7192
7193 if (weed_plant_has_leaf(layer, WEED_LEAF_HOST_PTHREAD)) is_thread = TRUE;
7194
7196 weed_leaf_delete(layer, WEED_LEAF_NATURAL_SIZE);
7197
7198 mainw->osc_block = TRUE; // block OSC until we are done
7199
7200 if (clip < 0 && frame == 0) clip_type = CLIP_TYPE_DISK;
7201 else {
7202 sfile = mainw->files[clip];
7203 if (!sfile) {
7205 return FALSE;
7206 }
7207 clip_type = sfile->clip_type;
7208 }
7209
7210 switch (clip_type) {
7213 create_blank_layer(layer, image_ext, width, height, target_palette);
7214 return TRUE;
7215 case CLIP_TYPE_DISK:
7216 case CLIP_TYPE_FILE:
7217 // frame number can be 0 during rendering
7218 if (frame == 0) {
7220 create_blank_layer(layer, image_ext, width, height, target_palette);
7221 return TRUE;
7222 } else if (clip == mainw->scrap_file) {
7223 boolean res = load_from_scrap_file(layer, frame);
7224 if (!res) {
7225 create_blank_layer(layer, image_ext, width, height, target_palette);
7226 return FALSE;
7227 }
7228 weed_leaf_delete(layer, WEED_LEAF_HOST_PIXBUF_SRC);
7229 weed_leaf_delete(layer, WEED_LEAF_HOST_SURFACE_SRC);
7230 // clip width and height may vary dynamically
7231 if (LIVES_IS_PLAYING) {
7232 sfile->hsize = weed_layer_get_width(layer);
7233 sfile->vsize = weed_layer_get_height(layer);
7234 }
7235 // realign
7236 copy_pixel_data(layer, NULL, THREADVAR(rowstride_alignment));
7238 return TRUE;
7239 } else {
7240 if (sfile->clip_type == CLIP_TYPE_FILE && sfile->frame_index && frame > 0 &&
7241 frame <= sfile->frames && is_virtual_frame(clip, frame)) {
7242 // pull frame from video clip
7244#ifdef USE_REC_RS
7245 int nplanes;
7246#endif
7247 void **pixel_data;
7248 boolean res = TRUE;
7249 int *rowstrides;
7250 lives_decoder_t *dplug = NULL;
7252 if (weed_plant_has_leaf(layer, WEED_LEAF_HOST_DECODER)) {
7253 dplug = (lives_decoder_t *)weed_get_voidptr_value(layer, WEED_LEAF_HOST_DECODER, NULL);
7254 } else {
7256 if (weed_plant_has_leaf(layer, "alt_src")) {
7257 int srcnum = weed_get_int_value(layer, "alt_src", NULL);
7258 dplug = sfile->alt_srcs[srcnum];
7259 }
7260 if (!dplug) dplug = (lives_decoder_t *)sfile->ext_src;
7261 }
7262 if (!dplug || !dplug->cdata) {
7263 create_blank_layer(layer, image_ext, width, height, target_palette);
7264 return FALSE;
7265 }
7266 if (target_palette != dplug->cdata->current_palette) {
7267 if (dplug->decoder->set_palette) {
7268 int opal = dplug->cdata->current_palette;
7269 int pal = best_palette_match(dplug->cdata->palettes, -1, target_palette);
7270 if (pal != opal) {
7271 dplug->cdata->current_palette = pal;
7272 if (!(*dplug->decoder->set_palette)(dplug->cdata)) {
7273 dplug->cdata->current_palette = opal;
7274 (*dplug->decoder->set_palette)(dplug->cdata);
7275 } else if (dplug->cdata->rec_rowstrides) {
7277 dplug->cdata->rec_rowstrides = NULL;
7278 // *INDENT-OFF*
7279 }}}}
7280 // *INDENT-ON*
7281
7282 // TODO *** - check for auto-border : we might use width,height instead of frame_width,frame_height,
7283 // and handle this in the plugin
7284
7285 if (!prefs->auto_nobord) {
7287 height = dplug->cdata->frame_height;
7288 } else {
7290 height = dplug->cdata->height;
7291 }
7292
7293 weed_layer_set_size(layer, width, height);
7294
7297 dplug->cdata->YUV_clamping,
7298 dplug->cdata->YUV_sampling,
7299 dplug->cdata->YUV_subspace);
7300 else weed_layer_set_palette(layer, dplug->cdata->current_palette);
7301
7302#ifdef USE_REC_RS
7304 if (!dplug->cdata->rec_rowstrides) {
7305 dplug->cdata->rec_rowstrides = lives_calloc(nplanes, sizint);
7306 } else {
7307 if (dplug->cdata->rec_rowstrides[0]) {
7308 weed_layer_set_rowstrides(layer, dplug->cdata->rec_rowstrides, nplanes);
7309 weed_leaf_set_flagbits(layer, WEED_LEAF_ROWSTRIDES, LIVES_FLAG_MAINTAIN_VALUE);
7310 lives_memset(dplug->cdata->rec_rowstrides, 0, nplanes * sizint);
7311 }
7312 }
7313#endif
7314 if (create_empty_pixel_data(layer, TRUE, TRUE)) {
7315#ifdef USE_REC_RS
7316 weed_leaf_clear_flagbits(layer, WEED_LEAF_ROWSTRIDES, LIVES_FLAG_MAINTAIN_VALUE);
7317#endif
7318 pixel_data = weed_layer_get_pixel_data(layer, NULL);
7319 } else {
7320#ifdef USE_REC_RS
7321 weed_leaf_clear_flagbits(layer, WEED_LEAF_ROWSTRIDES, LIVES_FLAG_MAINTAIN_VALUE);
7322#endif
7323 create_blank_layer(layer, image_ext, width, height, target_palette);
7324 return FALSE;
7325 }
7326
7327 if (!pixel_data || !pixel_data[0]) {
7328 char *msg = lives_strdup_printf("NULL pixel data for layer size %d X %d, palette %s\n", width, height,
7330 dplug->cdata->YUV_clamping, dplug->cdata->YUV_subspace));
7331 LIVES_WARN(msg);
7332 lives_free(msg);
7333 create_blank_layer(layer, image_ext, width, height, target_palette);
7334 return FALSE;
7335 }
7336
7337 rowstrides = weed_layer_get_rowstrides(layer, NULL);
7338
7339 //static int last = -1;
7340 // try to pull frame from decoder plugin
7341 //if (sfile->frame_index[frame - 1] == last) break_me();
7342 //last = sfile->frame_index[frame - 1];
7343 if (!(*dplug->decoder->get_frame)(dplug->cdata, (int64_t)(sfile->frame_index[frame - 1]),
7344 rowstrides, sfile->vsize, pixel_data)) {
7345
7346#ifdef USE_REC_RS
7347 if (dplug->cdata->rec_rowstrides) lives_memset(dplug->cdata->rec_rowstrides, 0, nplanes * sizint);
7348#endif
7349 if (prefs->show_dev_opts) g_print("Error loading frame %d (index value %d)\n", frame,
7350 sfile->frame_index[frame - 1]);
7351 // if get_frame fails, return a black frame
7352 if (!is_thread) {
7354 if (!create_empty_pixel_data(layer, TRUE, TRUE)) {
7355 create_blank_layer(layer, image_ext, width, height, target_palette);
7356 return FALSE;
7357 }
7358 }
7359 res = FALSE;
7360 }
7361
7362 lives_free(pixel_data);
7363 lives_free(rowstrides);
7364 if (res) {
7366 if (dplug->cdata->frame_gamma != WEED_GAMMA_UNKNOWN) {
7367 weed_layer_set_gamma(layer, dplug->cdata->frame_gamma);
7368 } else if (dplug->cdata->YUV_subspace == WEED_YUV_SUBSPACE_BT709) {
7369 weed_layer_set_gamma(layer, WEED_GAMMA_BT709);
7370 }
7371 }
7372
7373 // get_frame may now update YUV_clamping, YUV_sampling, YUV_subspace
7376 dplug->cdata->YUV_clamping,
7377 dplug->cdata->YUV_sampling,
7378 dplug->cdata->YUV_subspace);
7380 if (weed_get_int_value(layer, WEED_LEAF_GAMMA_TYPE, NULL) == WEED_GAMMA_BT709) {
7381 weed_set_int_value(layer, WEED_LEAF_YUV_SUBSPACE, WEED_YUV_SUBSPACE_BT709);
7382 }
7383 if (weed_get_int_value(layer, WEED_LEAF_YUV_SUBSPACE, NULL) == WEED_YUV_SUBSPACE_BT709) {
7384 weed_set_int_value(layer, WEED_LEAF_GAMMA_TYPE, WEED_GAMMA_BT709);
7385 }
7386 }
7387 }
7388 // deinterlace
7389 if (sfile->deinterlace || (prefs->auto_deint && dplug->cdata->interlace != LIVES_INTERLACE_NONE)) {
7390 if (!is_thread) {
7391 deinterlace_frame(layer, tc);
7392 } else weed_set_boolean_value(layer, WEED_LEAF_HOST_DEINTERLACE, WEED_TRUE);
7393 }
7394 }
7396 return res;
7397 } else {
7398 // pull frame from decoded images
7399 boolean ret;
7400 char *fname = make_image_file_name(sfile, frame, image_ext);
7401#ifdef USE_RESTHREAD
7402 lives_proc_thread_t resthread;
7403#endif
7404 if (!*image_ext) image_ext = get_image_ext_for_type(sfile->img_type);
7405 ret = weed_layer_create_from_file_progressive(layer, fname, width, height, target_palette, image_ext);
7406
7407#ifdef USE_RESTHREAD
7408 if ((resthread = weed_get_voidptr_value(layer, WEED_LEAF_RESIZE_THREAD, NULL))) {
7409 lives_proc_thread_join(resthread);
7410 weed_set_voidptr_value(layer, WEED_LEAF_RESIZE_THREAD, NULL);
7411 }
7412#endif
7413
7414 lives_free(fname);
7416 if (!ret) {
7417 break_me("bad frame load from file");
7418 create_blank_layer(layer, image_ext, width, height, target_palette);
7419 return FALSE;
7420 }
7421 }
7422 }
7423 break;
7424
7425 // handle other types of sources
7426
7427#ifdef HAVE_YUV4MPEG
7428 case CLIP_TYPE_YUV4MPEG:
7429 weed_layer_set_from_yuv4m(layer, sfile);
7430 if (sfile->deinterlace) {
7431 if (!is_thread) {
7432 deinterlace_frame(layer, tc);
7433 } else weed_set_boolean_value(layer, WEED_LEAF_HOST_DEINTERLACE, WEED_TRUE);
7434 }
7436 return TRUE;
7437#endif
7438#ifdef HAVE_UNICAP
7439 case CLIP_TYPE_VIDEODEV:
7440 weed_layer_set_from_lvdev(layer, sfile, 4. / cfile->pb_fps);
7441 if (sfile->deinterlace) {
7442 if (!is_thread) {
7443 deinterlace_frame(layer, tc);
7444 } else weed_set_boolean_value(layer, WEED_LEAF_HOST_DEINTERLACE, WEED_TRUE);
7445 }
7447 return TRUE;
7448#endif
7452 return TRUE;
7453 case CLIP_TYPE_GENERATOR: {
7454 // special handling for clips where host controls size
7455 // Note: vlayer is actually the out channel of the generator, so we should
7456 // never free it !
7457 weed_plant_t *inst = (weed_plant_t *)sfile->ext_src;
7458 if (inst) {
7459 int key = weed_get_int_value(inst, WEED_LEAF_HOST_KEY, NULL);
7460 while (filter_mutex_trylock(key)) {
7461 sched_yield();
7462 lives_usleep(prefs->sleep_time);
7463 }
7464 vlayer = weed_layer_create_from_generator(inst, tc, clip);
7465 weed_layer_copy(layer, vlayer); // layer is non-NULL, so copy by reference
7468 } else {
7470 create_blank_layer(layer, image_ext, width, height, target_palette);
7471 }
7473 }
7474 return TRUE;
7475 default:
7477 create_blank_layer(layer, image_ext, width, height, target_palette);
7478 return FALSE;
7479 }
7481
7482 if (!is_thread) {
7483 // render subtitles from file
7484 if (prefs->show_subtitles && sfile->subt && sfile->subt->tfile > 0) {
7485 double xtime = (double)(frame - 1) / sfile->fps;
7486 layer = render_subs_from_file(sfile, xtime, layer);
7487 }
7488 }
7489
7490 return TRUE;
7491}
7492
7493
7500LIVES_GLOBAL_INLINE boolean pull_frame(weed_layer_t *layer, const char *image_ext, weed_timecode_t tc) {
7501 return pull_frame_at_size(layer, image_ext, tc, 0, 0, WEED_PALETTE_END);
7502}
7503
7504
7529 int clip;
7530 boolean ready = TRUE;
7531 lives_clip_t *sfile;
7532 lives_thread_t *thrd;
7533#ifdef USE_RESTHREAD
7534 lives_proc_thread_t resthread;
7535#endif
7536 if (!layer) return FALSE;
7537
7538 thrd = (lives_thread_t *)weed_get_voidptr_value(layer, WEED_LEAF_HOST_PTHREAD, NULL);
7539 if (thrd) {
7540 ready = FALSE;
7541 lives_thread_join(*thrd, NULL);
7542 weed_leaf_delete(layer, WEED_LEAF_HOST_PTHREAD);
7543 lives_free(thrd);
7544 }
7545
7546#ifdef USE_RESTHREAD
7547 if ((resthread = weed_get_voidptr_value(layer, WEED_LEAF_RESIZE_THREAD, NULL))) {
7548 ready = FALSE;
7549 lives_proc_thread_join(resthread);
7550 weed_set_voidptr_value(layer, WEED_LEAF_RESIZE_THREAD, NULL);
7551 }
7552#endif
7553
7554 if (ready) return TRUE;
7555
7556 if (weed_get_boolean_value(layer, WEED_LEAF_HOST_DEINTERLACE, NULL) == WEED_TRUE) {
7557 weed_timecode_t tc = weed_get_int64_value(layer, WEED_LEAF_HOST_TC, NULL);
7558 deinterlace_frame(layer, tc);
7559 weed_set_boolean_value(layer, WEED_LEAF_HOST_DEINTERLACE, WEED_FALSE);
7560 }
7561
7562 if (weed_plant_has_leaf(layer, WEED_LEAF_CLIP)) {
7563 // TODO: we should render subs before display, to avoid the text size changing
7564 clip = weed_get_int_value(layer, WEED_LEAF_CLIP, NULL);
7565 if (IS_VALID_CLIP(clip)) {
7566 sfile = mainw->files[clip];
7567 // render subtitles from file
7568 if (sfile->subt && sfile->subt->tfile >= 0 && prefs->show_subtitles) {
7569 frames_t frame = weed_get_int_value(layer, WEED_LEAF_FRAME, NULL);
7570 double xtime = (double)(frame - 1) / sfile->fps;
7571 layer = render_subs_from_file(sfile, xtime, layer);
7572 // *INDENT-OFF*
7573 }}}
7574 // *INDENT-ON*
7575
7576 return TRUE;
7577}
7578
7579
7580typedef struct {
7581 weed_layer_t *layer;
7582 weed_timecode_t tc;
7583 const char *img_ext;
7584 int width, height;
7585} pft_priv_data;
7586
7587
7588static void *pft_thread(void *in) {
7589 pft_priv_data *data = (pft_priv_data *)in;
7590 weed_layer_t *layer = data->layer;
7591 weed_timecode_t tc = data->tc;
7592 const char *img_ext = data->img_ext;
7593 int width = data->width, height = data->height;
7594 lives_free(in);
7596 //and prepare it in this thread
7597 if (mainw->blend_file != -1 && mainw->blend_palette != WEED_PALETTE_END
7599 && weed_get_int_value(layer, WEED_LEAF_CLIP, NULL) == mainw->blend_file) {
7600 int tgamma = WEED_GAMMA_UNKNOWN;
7601 short interp = get_interp_value(prefs->pb_quality, TRUE);
7603 if (is_layer_ready(layer)) {
7606 }
7607 if (mainw->blend_palette != WEED_PALETTE_END) {
7609 tgamma = mainw->blend_gamma;
7610 }
7611 if (mainw->blend_palette != WEED_PALETTE_END) {
7612 if (is_layer_ready(layer) && weed_layer_get_width(layer) == mainw->blend_width
7615 mainw->blend_subspace, tgamma);
7616 }
7617 }
7618 if (tgamma != WEED_GAMMA_UNKNOWN && is_layer_ready(layer)
7623 } else {
7624 pull_frame_at_size(layer, img_ext, tc, width, height, WEED_PALETTE_END);
7625 }
7626 weed_set_boolean_value(layer, WEED_LEAF_THREAD_PROCESSING, WEED_FALSE);
7627 return NULL;
7628}
7629
7630
7631void pull_frame_threaded(weed_layer_t *layer, const char *img_ext, weed_timecode_t tc, int width, int height) {
7632 // pull a frame from an external source into a layer
7633 // the WEED_LEAF_CLIP and WEED_LEAF_FRAME leaves must be set in layer
7634
7635 // done in a threaded fashion
7636 // call check_layer_ready() to block until the frame thread is completed
7637#ifdef NO_FRAME_THREAD
7638 pull_frame(layer, img_ext, tc);
7639 return;
7640#else
7641 //#define MULT_SRC_TEST
7642#ifdef MULT_SRC_TEST
7643 if (layer == mainw->frame_layer_preload) {
7644 int clip = mainw->pred_clip;
7645 if (IS_VALID_CLIP(clip)) {
7646 lives_clip_t *sfile = mainw->files[clip];
7647 if (sfile->clip_type == CLIP_TYPE_FILE) {
7648 if (!sfile->alt_srcs) {
7649 sfile->alt_srcs = lives_calloc(1, sizeof(void *));
7650 sfile->alt_srcs[0] = clone_decoder(clip);
7651 if (sfile->alt_srcs[0]) {
7652 weed_set_int_value(layer, "alt_src", 0);
7653 sfile->alt_src_types = lives_calloc(1, sizint);
7655 // *INDENT-OFF*
7656 }}}}}
7657#endif
7658 // *INDENT-ON*
7659 weed_set_boolean_value(layer, WEED_LEAF_THREAD_PROCESSING, WEED_TRUE);
7660 if (1) {
7662 pft_priv_data *in = (pft_priv_data *)lives_calloc(1, sizeof(pft_priv_data));
7663 lives_thread_t *frame_thread = (lives_thread_t *)lives_calloc(1, sizeof(lives_thread_t));
7664 weed_set_int64_value(layer, WEED_LEAF_HOST_TC, tc);
7665 weed_set_boolean_value(layer, WEED_LEAF_HOST_DEINTERLACE, WEED_FALSE);
7666 weed_set_voidptr_value(layer, WEED_LEAF_HOST_PTHREAD, (void *)frame_thread);
7667 in->img_ext = img_ext;
7668 in->layer = layer;
7669 in->width = width;
7670 in->height = height;
7671 in->tc = tc;
7672 lives_thread_create(frame_thread, attr, pft_thread, (void *)in);
7673 }
7674#endif
7675// *INDENT-ON*
7676}
7677
7678LiVESPixbuf *pull_lives_pixbuf_at_size(int clip, int frame, const char *image_ext, weed_timecode_t tc,
7679 int width, int height, LiVESInterpType interp, boolean fordisp) {
7680 // return a correctly sized (Gdk)Pixbuf (RGB24 for jpeg, RGB24 / RGBA32 for png) for the given clip and frame
7681 // tc is used instead of WEED_LEAF_FRAME for some sources (e.g. generator plugins)
7682 // image_ext is used if the source is an image file (eg. "jpg" or "png")
7683 // pixbuf will be sized to width x height pixels using interp
7684
7685 LiVESPixbuf *pixbuf = NULL;
7686 weed_layer_t *layer = lives_layer_new_for_frame(clip, frame);
7687 int palette;
7688
7689#ifndef ALLOW_PNG24
7690 if (!strcmp(image_ext, LIVES_FILE_EXT_PNG)) palette = WEED_PALETTE_RGBA32;
7691 else palette = WEED_PALETTE_RGB24;
7692#else
7693 if (strcmp(image_ext, LIVES_FILE_EXT_PNG)) palette = WEED_PALETTE_RGB24;
7694 else palette = WEED_PALETTE_END;
7695#endif
7696
7697 if (pull_frame_at_size(layer, image_ext, tc, width, height, palette)) {
7698 check_layer_ready(layer);
7699 pixbuf = layer_to_pixbuf(layer, TRUE, fordisp);
7700 }
7701 weed_layer_free(layer);
7702 if (pixbuf && ((width != 0 && lives_pixbuf_get_width(pixbuf) != width)
7703 || (height != 0 && lives_pixbuf_get_height(pixbuf) != height))) {
7704 LiVESPixbuf *pixbuf2;
7705 // TODO - could use resize plugin here
7706 pixbuf2 = lives_pixbuf_scale_simple(pixbuf, width, height, interp);
7707 if (pixbuf) lives_widget_object_unref(pixbuf);
7708 pixbuf = pixbuf2;
7709 }
7710
7711 return pixbuf;
7712}
7713
7714
7715LIVES_GLOBAL_INLINE LiVESPixbuf *pull_lives_pixbuf(int clip, int frame, const char *image_ext, weed_timecode_t tc) {
7716 return pull_lives_pixbuf_at_size(clip, frame, image_ext, tc, 0, 0, LIVES_INTERP_NORMAL, FALSE);
7717}
7718
7719
7720void get_player_size(int *opwidth, int *opheight) {
7721 // calc output size for display
7722 int rwidth, rheight;
7723
7725 if (mainw->ext_playback) {
7726 // playback plugin (therefore fullscreen / separate window)
7729 // plugin can resize, max is the screen size
7730 get_play_screen_size(opwidth, opheight);
7731 } else {
7732 // ext plugin can't resize, use its fixed size
7733 *opwidth = mainw->vpp->fwidth;
7734 *opheight = mainw->vpp->fheight;
7735 }
7736 } else {
7737 // remote display
7738 if (!(mainw->vpp->capabilities & VPP_CAN_RESIZE)) {
7739 // cant resize, we use the width it gave us if it can't resize
7740 *opwidth = mainw->vpp->fwidth;
7741 *opheight = mainw->vpp->fheight;
7742 } else {
7743 // else the clip size
7744 *opwidth = cfile->hsize;
7745 *opheight = cfile->vsize;
7746 }
7747 }
7748 goto align;
7749 }
7750
7751 if (mainw->play_window) {
7752 // playback in separate window
7753 // use values set in resize_play_window
7754 *opwidth = mainw->pwidth;
7755 *opheight = mainw->pheight;
7757 rwidth = *opwidth;
7758 rheight = *opheight;
7759 *opwidth = cfile->hsize;
7760 *opheight = cfile->vsize;
7761 calc_maxspect(rwidth, rheight, opwidth, opheight);
7762 }
7763 goto align;
7764 }
7765
7767 // multitrack: we ignore double size, and fullscreen unless playing in the separate window
7768 if (mainw->multitrack) {
7769 // frame max sizes for multitrack
7770 /* *opwidth = mainw->files[mainw->multitrack->render_file]->hsize; */
7771 /* *opheight = mainw->files[mainw->multitrack->render_file]->vsize; */
7772 /* if (!mainw->multitrack->is_rendering) { */
7773 /* calc_maxspect(mainw->multitrack->play_width, mainw->multitrack->play_height, opwidth, opheight); */
7774 /* } */
7775 *opwidth = mainw->multitrack->play_width;
7776 *opheight = mainw->multitrack->play_height;
7777 goto align;
7778 }
7779
7781 // clip edit mode
7782 if (mainw->is_rendering && !mainw->preview) {
7783 *opwidth = cfile->hsize;
7784 *opheight = cfile->vsize;
7785 goto align;
7786 }
7787
7788 if (!mainw->fs) {
7789 // embedded player
7790 rwidth = lives_widget_get_allocation_width(mainw->play_image);// - H_RESIZE_ADJUST;
7791 rheight = lives_widget_get_allocation_height(mainw->play_image);// - V_RESIZE_ADJUST;
7792
7793 if (0 && prefs->letterbox) {
7794 *opwidth = cfile->hsize;
7795 *opheight = cfile->vsize;
7796 calc_maxspect(rwidth, rheight, opwidth, opheight);
7797 } else {
7798 *opwidth = rwidth;
7799 *opheight = rheight;
7800 }
7801 } else {
7802 // try to get exact inner size of the main window
7803 lives_window_get_inner_size(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), opwidth, opheight);
7804 //*opheight -= 2; // necessary, or screen expands too much (!?)
7806 }
7807
7808align:
7809 *opwidth = (*opwidth >> 2) << 2;
7810 *opheight = (*opheight >> 2) << 2;
7811 mainw->pwidth = *opwidth;
7812 mainw->pheight = *opheight;
7813}
7814
7815
7817 int i;
7818 for (i = 0; i < MAX_TRACKS; i++) {
7819 mainw->track_decoders[i] = NULL;
7821 }
7822 for (i = 0; i < MAX_FILES; i++) mainw->ext_src_used[i] = FALSE;
7823}
7824
7825
7827 for (int i = 0; i < MAX_TRACKS; i++) {
7828 if (mainw->track_decoders[i] &&
7831 }
7832}
7833
7834
7835static boolean check_for_overlay_text(weed_layer_t *layer) {
7838 if (!timeout) {
7839 lives_freep((void **)&mainw->urgency_msg);
7840 return FALSE;
7841 }
7843 return TRUE;
7844 }
7845
7847 if (mainw->lockstats) {
7848 lives_freep((void **)&mainw->overlay_msg);
7849 show_sync_callback(NULL, NULL, 0, 0, LIVES_INT_TO_POINTER(1));
7850 if (mainw->overlay_msg) {
7853 weed_plant_t *event = get_last_frame_event(mainw->event_list);
7854 if (event) weed_set_string_value(event, WEED_LEAF_OVERLAY_TEXT, mainw->overlay_msg);
7855 }
7856 }
7857 return TRUE;
7858 } else {
7859 if (!mainw->preview_rendering) {
7861 if (timeout == 0) {
7862 lives_freep((void **)&mainw->overlay_msg);
7863 return FALSE;
7864 }
7865 }
7868 return TRUE;
7869 }
7870 }
7871 return FALSE;
7872}
7873
7874
7875static void do_cleanup(weed_layer_t *layer, int success) {
7877 lives_clip_t *sfile = NULL;
7878 int clip = -1;
7879 double fps = DEF_FPS;
7880 frames_t frame = 0;
7881
7882 if (layer) {
7883 clip = lives_layer_get_clip(layer);
7884 frame = lives_layer_get_frame(layer);
7885 if (IS_VALID_CLIP(clip)) {
7886 sfile = mainw->files[clip];
7887 fps = sfile->pb_fps;
7888 }
7889 }
7890
7891 if (success) {
7892 char *tmp;
7893 // format is now msg|timecode|fgclip|fgframe|fgfps|
7895 (tmp = lives_strdup_printf("%.8f|%d|%d|%.3f|", (double)mainw->currticks / TICKS_PER_SECOND_DBL,
7896 clip, frame, fps)));
7897 lives_free(tmp);
7898 }
7899
7900 if (layer) {
7901 check_layer_ready(layer);
7903 if (layer == mainw->frame_layer) mainw->frame_layer = NULL;
7904 weed_layer_free(layer);
7905 }
7906}
7907
7908
7909//static weed_plant_t *cleaner = NULL;
7910
7911/* void wait_for_cleaner(void) { */
7912/* if (cleaner) { */
7913/* lives_nanosleep_until_nonzero(weed_get_boolean_value(cleaner, WEED_LEAF_DONE, NULL)); */
7914/* weed_plant_free(cleaner); */
7915/* cleaner = NULL; */
7916/* } */
7917/* } */
7918
7919#define USEC_WAIT_FOR_SYNC 500000
7920
7921static boolean avsync_check(void) {
7922 register int count = USEC_WAIT_FOR_SYNC / 10, rc = 0;
7923 struct timespec ts;
7924
7925#ifdef VALGRIND_ON
7926 count *= 10;
7927#endif
7928
7933 return TRUE;
7934 }
7935
7936 if (!mainw->video_seek_ready) {
7937#ifdef ENABLE_JACK
7940 if (LIVES_UNLIKELY(mainw->event_list && LIVES_IS_PLAYING && !mainw->record
7941 && !mainw->record_paused && mainw->jackd->is_paused)) {
7944 return TRUE;
7945 }
7946 }
7947#endif
7948#ifdef HAVE_PULSE_AUDIO
7951 if (LIVES_UNLIKELY(mainw->event_list && LIVES_IS_PLAYING && !mainw->record
7952 && !mainw->record_paused && mainw->pulsed->is_paused)) {
7955 return TRUE;
7956 }
7957 }
7958#endif
7959 }
7960
7961 clock_gettime(CLOCK_REALTIME, &ts);
7962 pthread_mutex_lock(&mainw->avseek_mutex);
7964 while (!mainw->audio_seek_ready && --count) {
7965 ts.tv_nsec += 10000; // def. 10 usec (* 50000 = 0.5 sec)
7966 if (ts.tv_nsec >= ONE_BILLION) {
7967 ts.tv_sec++;
7968 ts.tv_nsec -= ONE_BILLION;
7969 }
7970 sched_yield();
7971 rc = pthread_cond_timedwait(&mainw->avseek_cond, &mainw->avseek_mutex, &ts);
7973 }
7974 if (!mainw->audio_seek_ready && rc == ETIMEDOUT) {
7975 pthread_mutex_unlock(&mainw->avseek_mutex);
7977 return FALSE;
7978 }
7979 pthread_mutex_unlock(&mainw->avseek_mutex);
7980 return TRUE;
7981}
7982
7983
7984void load_frame_image(int frame) {
7985 // this is where we do the actual load/record of a playback frame
7986 // it is called every 1/fps from do_progress_dialog() via process_one() in dialogs.c
7987
7988 // for the multitrack window we set mainw->frame_image; this is used to display the
7989 // preview image
7990
7991 // NOTE: we should be careful if load_frame_image() is called from anywhere inside load_frame_image()
7992 // e.g. by calling g_main_context_iteration() --> user presses sepwin button --> load_frame_image() is called
7993 // this is because mainw->frame_layer is global and gets freed() before exit from load_frame_image()
7994
7995 void **pd_array, **retdata = NULL;
7996 LiVESPixbuf *pixbuf = NULL;
7997
7998 char *framecount = NULL, *tmp;
7999 char *fname_next = NULL, *info_file = NULL;
8000 const char *img_ext = NULL;
8001
8002 LiVESInterpType interp;
8003 double scrap_file_size = -1;
8004
8005 ticks_t audio_timed_out = 1;
8006
8007 boolean was_preview = FALSE;
8008 boolean rec_after_pb = FALSE;
8009 boolean success = FALSE;
8010 boolean size_ok = TRUE;
8011 boolean player_v2 = FALSE;
8012
8013 int retval;
8014 int layer_palette, cpal;
8015
8016 static int old_pwidth = 0, old_pheight = 0;
8017 int opwidth = 0, opheight = 0;
8018 int pwidth, pheight;
8019 int lb_width = 0, lb_height = 0;
8020 int bad_frame_count = 0;
8021 int fg_file = mainw->current_file;
8022 int tgamma = WEED_GAMMA_UNKNOWN;
8023 boolean was_letterboxed = FALSE;
8024
8025#if defined ENABLE_JACK || defined HAVE_PULSE_AUDIO
8026 lives_alarm_t alarm_handle;
8027#endif
8028
8029#define BFC_LIMIT 1000
8030 if (LIVES_UNLIKELY(cfile->frames == 0 && !mainw->foreign && !mainw->is_rendering)) {
8031 if (mainw->record && !mainw->record_paused) {
8032 // add blank frame
8033 weed_plant_t *event = get_last_event(mainw->event_list);
8035 mainw->orignsecs),
8036 &event);
8037 if (!mainw->event_list) mainw->event_list = event_list;
8038 if (mainw->rec_aclip != -1 && (prefs->rec_opts & REC_AUDIO) && !mainw->record_starting) {
8039 // we are recording, and the audio clip changed; add audio
8040 if (mainw->rec_aclip == mainw->ascrap_file) {
8044 mainw->rec_avel = 1.;
8045 }
8046 if (!mainw->mute) {
8048 mainw->rec_aclip = -1;
8049 }
8050 }
8051 }
8052 if (!mainw->fs && !mainw->faded) get_play_times();
8053
8054 return;
8055 }
8056
8057 if (!mainw->foreign) {
8058 mainw->actual_frame = frame;
8059 if (!mainw->preview_rendering && (!((was_preview = mainw->preview) || mainw->is_rendering))) {
8061
8062 // normal play
8063
8064 if (LIVES_UNLIKELY(mainw->nervous) && clip_can_reverse(mainw->playing_file)) {
8065 // nervous mode
8066 if ((mainw->actual_frame += (-10 + (int)(21.*rand() / (RAND_MAX + 1.0)))) > cfile->frames ||
8067 mainw->actual_frame < 1) mainw->actual_frame = frame;
8069 }
8070
8072 framecount = lives_strdup_printf("%9d", mainw->actual_frame);
8073 } else {
8074 framecount = lives_strdup_printf("%9d / %d", mainw->actual_frame, cfile->frames);
8075 }
8076
8078
8079 // record performance
8081 ticks_t actual_ticks;
8082 int fg_frame = mainw->record_frame;
8084 ? mainw->blend_file : -1;
8085 int bg_frame = bg_file > 0 && bg_file != mainw->current_file ? mainw->files[bg_file]->frameno : 0;
8086 int numframes;
8087 int *clips;
8088 int64_t *frames;
8089 weed_plant_t *event_list;
8090
8091 // should we record the output from the playback plugin ?
8094 rec_after_pb = TRUE;
8095 }
8096
8097 if (rec_after_pb || !CURRENT_CLIP_IS_NORMAL ||
8098 (prefs->rec_opts & REC_EFFECTS && bg_file != -1 && !IS_NORMAL_CLIP(bg_file))) {
8099 // TODO - handle non-opening of scrap_file
8100 if (mainw->scrap_file == -1) open_scrap_file();
8101 fg_file = mainw->scrap_file;
8102 fg_frame = mainw->files[mainw->scrap_file]->frames + 1;
8103 scrap_file_size = mainw->files[mainw->scrap_file]->f_size;
8104 bg_file = -1;
8105 bg_frame = 0;
8106 }
8107
8108 //actual_ticks = mainw->clock_ticks;//mainw->currticks;
8109 actual_ticks = mainw->startticks;
8110
8111 if (mainw->record_starting) {
8112 if (!mainw->event_list) {
8113 mainw->event_list = lives_event_list_new(NULL, NULL);
8114 }
8115
8116 // mark record start
8118
8119 if (prefs->rec_opts & REC_EFFECTS) {
8120 // add init events and pchanges for all active fx
8121 add_filter_init_events(mainw->event_list, actual_ticks);
8122 }
8123
8124#ifdef ENABLE_JACK
8127 // get current seek postion
8128 alarm_handle = lives_alarm_set(LIVES_SHORT_TIMEOUT);
8129
8130 while ((audio_timed_out = lives_alarm_check(alarm_handle)) > 0 && jack_get_msgq(mainw->jackd) != NULL) {
8131 // wait for audio player message queue clearing
8132 sched_yield();
8133 lives_usleep(prefs->sleep_time);
8134 }
8135 lives_alarm_clear(alarm_handle);
8136 if (audio_timed_out == 0) {
8138 goto lfi_done;
8139 }
8140 jack_get_rec_avals(mainw->jackd);
8141 }
8142#endif
8143#ifdef HAVE_PULSE_AUDIO
8146 // get current seek postion
8147 alarm_handle = lives_alarm_set(LIVES_SHORT_TIMEOUT);
8148 while ((audio_timed_out = lives_alarm_check(alarm_handle)) > 0 && pulse_get_msgq(mainw->pulsed) != NULL) {
8149 // wait for audio player message queue clearing
8150 sched_yield();
8151 lives_usleep(prefs->sleep_time);
8152 }
8153 lives_alarm_clear(alarm_handle);
8154 pulse_get_rec_avals(mainw->pulsed);
8155 }
8156#endif
8158 if (audio_timed_out == 0) {
8160 goto lfi_done;
8161 }
8162 mainw->record = TRUE;
8164 }
8165
8166 numframes = (bg_file == -1) ? 1 : 2;
8167 clips = (int *)lives_malloc(numframes * sizint);
8168 frames = (int64_t *)lives_malloc(numframes * 8);
8169
8170 clips[0] = fg_file;
8171 frames[0] = (int64_t)fg_frame;
8172 if (numframes == 2) {
8173 clips[1] = bg_file;
8174 frames[1] = (int64_t)bg_frame;
8175 }
8176 if (framecount) lives_free(framecount);
8177 pthread_mutex_lock(&mainw->event_list_mutex);
8178
8180 if ((event_list = append_frame_event(mainw->event_list, actual_ticks, numframes, clips, frames)) != NULL) {
8181 if (!mainw->event_list) mainw->event_list = event_list;
8182
8183 // TODO ***: do we need to perform more checks here ???
8184 if (scrap_file_size != -1 || (mainw->rec_aclip != -1 && (prefs->rec_opts & REC_AUDIO))) {
8185 weed_plant_t *event = get_last_frame_event(mainw->event_list);
8186
8187 if (scrap_file_size != -1) weed_set_int64_value(event, WEED_LEAF_HOST_SCRAP_FILE_OFFSET, scrap_file_size);
8188
8189 if (mainw->rec_aclip != -1) {
8190 if (mainw->rec_aclip == mainw->ascrap_file) {
8194 mainw->rec_avel = 1.;
8195
8196 }
8197 if (!mainw->mute) {
8198 weed_event_t *xevent = get_prev_frame_event(event);
8199 if (!xevent) xevent = event;
8201 }
8202 mainw->rec_aclip = -1;
8203 }
8204 }
8205 pthread_mutex_unlock(&mainw->event_list_mutex);
8206
8207 /* TRANSLATORS: rec(ord) */
8208 framecount = lives_strdup_printf((tmp = _("rec %9d / %d")), mainw->actual_frame,
8209 cfile->frames > mainw->actual_frame ? cfile->frames : mainw->actual_frame);
8210 } else {
8211 pthread_mutex_unlock(&mainw->event_list_mutex);
8212 /* TRANSLATORS: out of memory (rec(ord)) */
8213 framecount = lives_strdup_printf((tmp = _("!rec %9d / %d")), mainw->actual_frame, cfile->frames);
8214 }
8215 lives_free(tmp);
8216 lives_free(clips);
8217 lives_free(frames);
8218 } else {
8219 if (mainw->toy_type != LIVES_TOY_NONE) {
8221 int current_file = mainw->current_file;
8222 if (mainw->toy_go_wild) {
8223 int i, other_file;
8224 for (i = 0; i < 11; i++) {
8225 other_file = (1 + (int)((double)(mainw->clips_available) * rand() / (RAND_MAX + 1.0)));
8226 other_file = LIVES_POINTER_TO_INT(lives_list_nth_data(mainw->cliplist, other_file));
8227 if (mainw->files[other_file]) {
8228 // steal a frame from another clip
8229 mainw->current_file = other_file;
8230 }
8231 }
8232 }
8233 load_end_image(1 + (int)((double)cfile->frames * rand() / (RAND_MAX + 1.0)));
8234 load_start_image(1 + (int)((double)cfile->frames * rand() / (RAND_MAX + 1.0)));
8235 mainw->current_file = current_file;
8236 }
8237 }
8238 }
8239
8240 if ((!mainw->fs || (prefs->play_monitor != widget_opts.monitor && capable->nmonitors > 1) ||
8242 && !prefs->hide_framebar) {
8243 lives_entry_set_text(LIVES_ENTRY(mainw->framecounter), framecount);
8244 //lives_widget_queue_draw(mainw->framecounter);
8245 }
8246 lives_freep((void **)&framecount);
8247 }
8248
8249 if (was_preview) {
8250 // preview
8251 if (mainw->proc_ptr && mainw->proc_ptr->frames_done > 0 &&
8252 frame >= (mainw->proc_ptr->frames_done - cfile->progress_start + cfile->start)) {
8253 if (cfile->opening) {
8254 mainw->proc_ptr->frames_done = cfile->opening_frames = get_frame_count(mainw->current_file, cfile->opening_frames);
8255 }
8256 }
8257 if (mainw->proc_ptr && mainw->proc_ptr->frames_done > 0 &&
8258 frame >= (mainw->proc_ptr->frames_done - cfile->progress_start + cfile->start)) {
8260 goto lfi_done;
8261 }
8262
8263 // play preview
8264 if (cfile->opening || (cfile->next_event && !mainw->proc_ptr)) {
8265 fname_next = make_image_file_name(cfile, frame + 1, get_image_ext_for_type(cfile->img_type));
8266 if (!mainw->fs && !prefs->hide_framebar && !mainw->is_rendering) {
8267 lives_freep((void **)&framecount);
8268 if (CURRENT_CLIP_HAS_VIDEO && cfile->frames != 123456789) {
8269 framecount = lives_strdup_printf("%9d / %d", frame, cfile->frames);
8270 } else {
8271 framecount = lives_strdup_printf("%9d", frame);
8272 }
8273 lives_entry_set_text(LIVES_ENTRY(mainw->framecounter), framecount);
8275 lives_freep((void **)&framecount);
8276 }
8277 if (mainw->toy_type != LIVES_TOY_NONE) {
8278 // TODO - move into toys.c
8280 if (cfile->opening_only_audio) {
8281 load_end_image(1 + (int)((double)cfile->frames * rand() / (RAND_MAX + 1.0)));
8282 load_start_image(1 + (int)((double)cfile->frames * rand() / (RAND_MAX + 1.0)));
8283 } else {
8284 load_end_image(1 + (int)((double)frame * rand() / (RAND_MAX + 1.0)));
8285 load_start_image(1 + (int)((double)frame * rand() / (RAND_MAX + 1.0)));
8286 }
8287 }
8288 }
8289 } else {
8291 fname_next = make_image_file_name(cfile, frame + 1, get_image_ext_for_type(cfile->img_type));
8292 } else {
8293 if (!mainw->keep_pre) {
8294 img_ext = LIVES_FILE_EXT_MGK;
8295 } else {
8296 img_ext = LIVES_FILE_EXT_PRE;
8297 }
8298 fname_next = make_image_file_name(cfile, frame + 1, img_ext);
8299 }
8300 }
8301 mainw->actual_frame = frame;
8302
8303 // maybe the performance finished and we weren't looping
8304 if ((mainw->actual_frame < 1 || mainw->actual_frame > cfile->frames) &&
8306 goto lfi_done;
8307 return;
8308 }
8309 }
8310
8311 // limit max frame size unless we are saving to disk or rendering
8312 // frame_layer will in any case be equal to or smaller than this depending on maximum source frame size
8313
8316 get_player_size(&opwidth, &opheight);
8317 }
8318
8320 // load a frame from disk buffer
8321
8322 if (mainw->preview && !mainw->frame_layer && (!mainw->event_list || cfile->opening)) {
8323 info_file = lives_build_filename(prefs->workdir, cfile->handle, LIVES_STATUS_FILE_NAME, NULL);
8324 }
8325
8326 do {
8327 //wait_for_cleaner();
8328 if (mainw->frame_layer) {
8329 // free the old mainw->frame_layer
8330 check_layer_ready(mainw->frame_layer); // ensure all threads are complete
8332 mainw->frame_layer = NULL;
8333 }
8334
8335 if (mainw->is_rendering && !(mainw->proc_ptr && mainw->preview)) {
8336 // here if we are rendering from multitrack, previewing a recording, or applying realtime effects to a selection
8337 weed_timecode_t tc = mainw->cevent_tc;
8338 if (mainw->scrap_file != -1 && mainw->clip_index[0] == mainw->scrap_file && mainw->num_tracks == 1) {
8339 // do not apply fx, just pull frame
8341 pull_frame_threaded(mainw->frame_layer, NULL, (weed_timecode_t)mainw->currticks, 0, 0);
8342 /* if (!pull_frame(mainw->frame_layer, get_image_ext_for_type(cfile->img_type), tc)) { */
8343 /* weed_plant_free(mainw->frame_layer); */
8344 /* mainw->frame_layer = NULL; */
8345 /* if (mainw->preview_rendering) { */
8346 /* mainw->cancelled = CANCEL_NO_MORE_PREVIEW; */
8347 /* goto lfi_done; */
8348 /* } */
8349 /* } */
8350 } else {
8351 int oclip, nclip;
8352 register int i;
8353 weed_plant_t **layers = (weed_plant_t **)lives_calloc((mainw->num_tracks + 1), sizeof(weed_plant_t *));
8354 // get list of active tracks from mainw->filter map
8356 for (i = 0; i < mainw->num_tracks; i++) {
8357 oclip = mainw->old_active_track_list[i];
8358 mainw->ext_src_used[oclip] = FALSE;
8359 if (oclip > 0 && oclip == (nclip = mainw->active_track_list[i])) {
8360 // check if ext_src survives old->new
8361 if (mainw->track_decoders[i] == mainw->files[oclip]->ext_src) mainw->ext_src_used[oclip] = TRUE;
8362 }
8363 }
8364
8365 for (i = 0; i < mainw->num_tracks; i++) {
8367 weed_set_int_value(layers[i], WEED_LEAF_CURRENT_PALETTE, (mainw->clip_index[i] == -1 ||
8369 IMG_TYPE_JPEG) ? WEED_PALETTE_RGB24 : WEED_PALETTE_RGBA32);
8370 if ((oclip = mainw->old_active_track_list[i]) != (nclip = mainw->active_track_list[i])) {
8371 // now using threading, we want to start pulling all pixel_data for all active layers here
8372 // however, we may have more than one copy of the same clip -
8373 // in this case we want to create clones of the decoder plugin
8374 // this is to prevent constant seeking between different frames in the clip
8375 if (oclip > 0) {
8376 if (mainw->files[oclip]->clip_type == CLIP_TYPE_FILE) {
8377 if (mainw->track_decoders[i] != (lives_decoder_t *)mainw->files[oclip]->ext_src) {
8378 // remove the clone for oclip
8380 }
8381 mainw->track_decoders[i] = NULL;
8382 }
8383 }
8384
8385 if (nclip > 0) {
8386 if (mainw->files[nclip]->clip_type == CLIP_TYPE_FILE) {
8387 if (!mainw->ext_src_used[nclip]) {
8389 mainw->ext_src_used[nclip] = TRUE;
8390 } else {
8391 // add new clone for nclip
8392 mainw->track_decoders[i] = clone_decoder(nclip);
8393 // *INDENT-OFF*
8394 }}}}
8395 // *INDENT-ON*
8396
8398
8399 if (nclip > 0) {
8400 img_ext = get_image_ext_for_type(mainw->files[nclip]->img_type);
8401 // set alt src in layer
8402 weed_set_voidptr_value(layers[i], WEED_LEAF_HOST_DECODER, (void *)mainw->track_decoders[i]);
8403 pull_frame_threaded(layers[i], img_ext, (weed_timecode_t)mainw->currticks, 0, 0);
8404 } else {
8405 weed_layer_pixel_data_free(layers[i]);
8406 }
8407 }
8408 layers[i] = NULL;
8409
8410 mainw->frame_layer = weed_apply_effects(layers, mainw->filter_map, tc, opwidth, opheight, mainw->pchains);
8411
8412 for (i = 0; layers[i]; i++) {
8413 if (layers[i] != mainw->frame_layer) {
8414 check_layer_ready(layers[i]);
8415 weed_layer_free(layers[i]);
8416 }
8417 }
8418 lives_free(layers);
8419
8421 // this happens if we are calling from multitrack, or apply rte. We get our mainw->frame_layer and exit.
8422 // DO NOT goto lfi_done, as that will free mainw->frame_layer.
8423 lives_freep((void **)&framecount);
8424 lives_freep((void **)&info_file);
8425 return;
8426 }
8427 }
8428 } else {
8430 g_printerr("pull_frame @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8431 // normal playback in the clip editor, or applying a non-realtime effect
8432 if (cfile->clip_type != CLIP_TYPE_DISK
8433 || !mainw->preview || lives_file_test(fname_next, LIVES_FILE_TEST_EXISTS)) {
8435 if (!img_ext) img_ext = get_image_ext_for_type(cfile->img_type);
8436 if (mainw->preview && !mainw->frame_layer
8437 && (!mainw->event_list || cfile->opening)) {
8438 if (!pull_frame_at_size(mainw->frame_layer, img_ext, (weed_timecode_t)mainw->currticks,
8439 cfile->hsize, cfile->vsize, WEED_PALETTE_END)) {
8440 if (mainw->frame_layer) {
8442 mainw->frame_layer = NULL;
8443 }
8444
8445 if (cfile->clip_type == CLIP_TYPE_DISK &&
8446 cfile->opening && cfile->img_type == IMG_TYPE_PNG
8447 && sget_file_size(fname_next) <= 0) {
8448 if (++bad_frame_count > BFC_LIMIT) {
8450 bad_frame_count = 0;
8451 } else lives_usleep(prefs->sleep_time);
8452 }
8453 }
8454 } else {
8455 boolean got_preload = FALSE;
8458 frames_t delta = (labs(mainw->pred_frame) - mainw->actual_frame) * sig(cfile->pb_fps);
8459 /* g_print("THANKS for %p,! %d %ld should be %d, right -- %d",
8460 // mainw->frame_layer_preload, mainw->pred_clip, */
8461 /* mainw->pred_frame, mainw->actual_frame, delta); */
8462 if (delta <= 0 || (mainw->pred_frame < 0 && delta > 0)) {
8465 //g_print("YAH !\n");
8466 got_preload = TRUE;
8467 if (mainw->pred_frame < 0) {
8470 } else {
8473 }
8474 }
8475 }
8476 if (prefs->show_dev_opts) {
8477 if (delta < 0) g_printerr("cached frame TOO LATE, got %ld, wanted %d !!!\n",
8479 }
8480 //if (delta > 0) g_print(" waiting...\n");
8481 }
8482 if (!got_preload) {
8483 pull_frame_threaded(mainw->frame_layer, img_ext, (weed_timecode_t)mainw->currticks, 0, 0);
8484 //pull_frame(mainw->frame_layer, img_ext, (weed_timecode_t)mainw->currticks);
8485 }
8486 if ((mainw->rte != 0 || (mainw->is_rendering && !mainw->event_list))
8489 get_blend_layer((weed_timecode_t)mainw->currticks);
8490 }
8491 }
8492 }
8493
8495 g_printerr("pull_frame done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8496 if ((!cfile->next_event && mainw->is_rendering && !mainw->switch_during_pb &&
8497 (!mainw->multitrack || (!mainw->multitrack->is_rendering && !mainw->is_generating))) ||
8498 ((!mainw->multitrack || (mainw->multitrack && mainw->multitrack->is_rendering)) &&
8499 mainw->preview && !mainw->frame_layer)) {
8500 // preview ended
8501 if (!cfile->opening) mainw->cancelled = CANCEL_NO_MORE_PREVIEW;
8502 if (mainw->cancelled) {
8503 lives_free(fname_next);
8504 lives_freep((void **)&info_file);
8505 goto lfi_done;
8506 }
8507 // ???
8509 }
8510
8511 img_ext = NULL;
8512
8514 // here we are rendering to an effect or timeline, need to keep mainw->frame_layer and return
8515 lives_freep((void **)&framecount);
8516 lives_freep((void **)&info_file);
8518 return;
8519 }
8520
8521 if (!mainw->frame_layer && (!mainw->preview || (mainw->multitrack && !cfile->opening))) {
8522 lives_freep((void **)&info_file);
8523 goto lfi_done;
8524 }
8525
8526 if (mainw->preview && !mainw->frame_layer && (!mainw->event_list || cfile->opening)) {
8527 FILE *fp;
8528 // non-realtime effect preview
8529 // check effect to see if it finished yet
8530 if ((fp = fopen(info_file, "r"))) {
8532 do {
8533 retval = 0;
8535 if (THREADVAR(read_failed) && THREADVAR(read_failed) == fileno(fp) + 1) {
8536 THREADVAR(read_failed) = 0;
8537 retval = do_read_failed_error_s_with_retry(info_file, NULL);
8538 }
8539 } while (retval == LIVES_RESPONSE_RETRY);
8540 fclose(fp);
8541 if (!lives_strncmp(mainw->msg, "completed", 9) || !strncmp(mainw->msg, "error", 5)) {
8542 // effect completed whilst we were busy playing a preview
8545 if (cfile->opening && !cfile->is_loaded) {
8546 if (mainw->toy_type == LIVES_TOY_TV) {
8547 on_toy_activate(NULL, LIVES_INT_TO_POINTER(LIVES_TOY_NONE));
8548 }
8549 }
8550 mainw->preview = FALSE;
8551 } else {
8552 lives_usleep(prefs->sleep_time);
8553 }
8554 } else {
8555 lives_usleep(prefs->sleep_time);
8556 }
8557
8558 // or we reached the end of the preview
8559 if ((!cfile->opening && frame >= (mainw->proc_ptr->frames_done - cfile->progress_start + cfile->start)) ||
8560 (cfile->opening && (mainw->toy_type == LIVES_TOY_TV || !mainw->preview || mainw->effects_paused))) {
8561 if (mainw->toy_type == LIVES_TOY_TV) {
8562 // force a loop (set mainw->cancelled to CANCEL_KEEP_LOOPING to play selection again)
8565 lives_free(fname_next);
8566 // end of playback, so this is no longer needed
8567 lives_freep((void **)&info_file);
8568 goto lfi_done;
8569 } else if (mainw->preview || cfile->opening) lives_widget_context_update();
8570 }
8571 }
8572 } while (!mainw->frame_layer && mainw->cancelled == CANCEL_NONE && cfile->clip_type == CLIP_TYPE_DISK);
8573
8574 lives_freep((void **)&info_file);
8575
8576 if (LIVES_UNLIKELY((!mainw->frame_layer) || mainw->cancelled > 0)) {
8577 // NULL frame or user cancelled
8578 if (mainw->frame_layer) {
8581 mainw->frame_layer = NULL;
8582 }
8583 goto lfi_done;
8584 }
8585
8586 if (was_preview) {
8587 lives_free(fname_next);
8588 }
8589
8590 // OK. Here is the deal now. We have a layer from the current file, current frame.
8591 // (or at least we sent out a thread to fetch it).
8592 // We will pass this into the effects, and we will get back a layer.
8593 // The palette of the effected layer could be any Weed palette.
8594 // We will pass the layer to all playback plugins.
8595 // Finally we may want to end up with a GkdPixbuf (unless the playback plugin is VPP_DISPLAY_LOCAL
8596 // and we are in full screen mode).
8597
8599 && mainw->pwidth > 0 && mainw->pheight > 0
8600 && !(mainw->is_rendering && !(mainw->proc_ptr && mainw->preview))
8601 && !cfile->opening && !mainw->resizing && CURRENT_CLIP_IS_NORMAL
8604 // if we are pulling the frame from an image and playing back normally, check the size is what it should be
8605 // this used to cause problems with some effects, but that may no longer be the case with the layers model
8609 if ((wl != cfile->hsize && wl != mainw->pwidth)
8610 || (hl != cfile->vsize && hl != mainw->pheight)) {
8611 break_me("bad frame size");
8613 size_ok = FALSE;
8614 }
8615 }
8616
8617 if (size_ok) {
8618 // if frame size is OK we apply real time effects
8619 if ((mainw->rte != 0 || (mainw->is_rendering && !mainw->event_list))
8622 g_printerr("rte start @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8623 mainw->frame_layer = on_rte_apply(mainw->frame_layer, lb_width, lb_height, (weed_timecode_t)mainw->currticks);
8624 }
8625 }
8626
8628 g_printerr("rte done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8629
8631
8632 // save to scrap_file now if we have to
8633 if (mainw->record && !mainw->record_paused && mainw->scrap_file != -1 && fg_file == mainw->scrap_file) {
8634 if (!rec_after_pb) {
8637 }
8638 get_player_size(&opwidth, &opheight);
8639 }
8640
8642 && ((((!prefs->letterbox && !mainw->multitrack) || (mainw->multitrack && !prefs->letterbox_mt)))
8644 // here we are outputing video through a video playback plugin which can resize: thus we just send whatever we have
8645 // we need only to convert the palette to whatever was agreed with the plugin when we called set_palette()
8646 // in plugins.c
8647 //
8648 // if we want letterboxing we do this ourselves, later in the code
8649
8650 weed_plant_t *frame_layer = NULL;
8651 weed_plant_t *return_layer = NULL;
8652 int lwidth, lheight;
8653 int ovpppalette = mainw->vpp->palette;
8654
8656 if (mainw->vpp->play_frame) player_v2 = TRUE;
8657
8658 //g_print("clr1 start @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8661 //g_print("clr1 done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8662
8663 layer_palette = weed_layer_get_palette(mainw->frame_layer);
8664 if (!weed_palette_is_valid(layer_palette)) {
8665 goto lfi_done;
8666 }
8667
8669 && mainw->vpp->palette != layer_palette) vpp_try_match_palette(mainw->vpp, mainw->frame_layer);
8670
8672 ((weed_palette_is_rgb(layer_palette) &&
8674 (weed_palette_is_lower_quality(mainw->vpp->palette, layer_palette)))) {
8675 // mainw->frame_layer is RGB and so is our screen, but plugin is YUV
8676 // so copy layer and convert, retaining original
8677 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8678 frame_layer = weed_layer_copy(NULL, mainw->frame_layer);
8679 } else frame_layer = mainw->frame_layer;
8680
8682 if (!check_for_overlay_text(frame_layer)) {
8683 if (mainw->multitrack && mainw->multitrack->opts.overlay_timecode) {
8684 frame_layer = render_text_overlay(frame_layer, mainw->multitrack->timestring);
8685 }
8686 }
8687 }
8688
8689 if (prefs->apply_gamma) {
8690 // gamma correction
8693 tgamma = WEED_GAMMA_LINEAR;
8694 else {
8695 tgamma = WEED_GAMMA_SRGB;
8696 }
8697 }
8698 }
8699
8700 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8702 mainw->vpp->YUV_sampling, mainw->vpp->YUV_subspace, tgamma)) {
8703 goto lfi_done;
8704 }
8706 g_print("cl palette done %d to %d @ %f\n", weed_layer_get_palette(frame_layer), mainw->vpp->palette,
8708
8709 if (!player_v2) {
8710 // vid plugin expects compacted rowstrides (i.e. no padding/alignment after pixel row)
8711 if (!compact_rowstrides(frame_layer)) {
8712 goto lfi_done;
8713 }
8714 }
8716 g_print("comp rs done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8718
8719 if (rec_after_pb) {
8720 // record output from playback plugin
8721
8723 int retheight = mainw->pheight;
8724
8725 return_layer = weed_layer_create(retwidth, retheight, NULL, ovpppalette);
8726
8727 if (weed_palette_is_yuv(ovpppalette)) {
8728 weed_set_int_value(return_layer, WEED_LEAF_YUV_CLAMPING, mainw->vpp->YUV_clamping);
8729 weed_set_int_value(return_layer, WEED_LEAF_YUV_SUBSPACE, mainw->vpp->YUV_subspace);
8730 weed_set_int_value(return_layer, WEED_LEAF_YUV_SAMPLING, mainw->vpp->YUV_sampling);
8731 }
8732
8733 // vid plugin expects compacted rowstrides (i.e. no padding/alignment after pixel row)
8734 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8735 if (create_empty_pixel_data(return_layer, FALSE, TRUE))
8736 retdata = weed_layer_get_pixel_data(return_layer, NULL);
8737 else return_layer = NULL;
8738 }
8739
8740 // chain any data to the playback plugin
8741 if (!(mainw->preview || mainw->is_rendering)) {
8742 // chain any data pipelines
8743 if (mainw->pconx) {
8745 }
8747 }
8748
8749 if (prefs->apply_gamma) {
8750 // gamma correction
8751 gamma_convert_layer(tgamma, frame_layer);
8752 }
8754 g_print("gamma conv done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8755
8756 if (return_layer) weed_leaf_dup(return_layer, frame_layer, WEED_LEAF_GAMMA_TYPE);
8757 pd_array = weed_layer_get_pixel_data(frame_layer, NULL);
8758 lb_width = lwidth = weed_layer_get_width_pixels(frame_layer);
8759 lb_height = lheight = weed_layer_get_height(frame_layer);
8760 pwidth = mainw->pwidth;
8761 pheight = mainw->pheight;
8762 if (player_v2) {
8764 // pretend it cant resize, just to get the offsets
8765 get_letterbox_sizes(&pwidth, &pheight, &lb_width, &lb_height, FALSE);
8766 weed_set_double_value(frame_layer, "x_range", (double)lb_width / (double)pwidth);
8767 weed_set_double_value(frame_layer, "y_range", (double)lb_height / (double)pheight);
8768 } else {
8769 weed_set_double_value(frame_layer, "x_range", 1.0);
8770 weed_set_double_value(frame_layer, "y_range", 1.0);
8771 }
8772 }
8773
8774 if (!avsync_check()) goto lfi_done;
8775
8776 lwidth = weed_layer_get_width(frame_layer);
8777 if (tgamma == WEED_GAMMA_SRGB && prefs->use_screen_gamma) {
8778 // TODO - do conversion before letterboxing
8780 }
8781 if ((player_v2 && !(*mainw->vpp->play_frame)(frame_layer, mainw->currticks - mainw->stream_ticks, return_layer))
8782 || (!player_v2 && !(*mainw->vpp->render_frame)(lwidth, weed_layer_get_height(frame_layer),
8783 mainw->currticks - mainw->stream_ticks, pd_array, retdata, mainw->vpp->play_params))) {
8784 //vid_playback_plugin_exit();
8785 if (return_layer) {
8786 weed_layer_free(return_layer);
8787 lives_free(retdata);
8788 return_layer = NULL;
8789 }
8790 } else success = TRUE;
8792 g_printerr("rend fr done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8793 lives_free(pd_array);
8794 if (frame_layer != mainw->frame_layer) {
8795 weed_layer_free(frame_layer);
8796 }
8797
8798 if (return_layer) {
8799 int width = MIN(weed_layer_get_width(mainw->frame_layer)
8801 weed_layer_get_width(return_layer)
8803 int height = MIN(weed_layer_get_height(mainw->frame_layer), weed_layer_get_height(return_layer));
8804 if (!resize_layer(return_layer, width, height, LIVES_INTERP_FAST, WEED_PALETTE_END, 0)) {
8805 if (tgamma == WEED_GAMMA_SRGB && prefs->use_screen_gamma) {
8807 gamma_convert_layer(WEED_GAMMA_SRGB, return_layer);
8808 }
8809 save_to_scrap_file(return_layer);
8810 }
8811 weed_layer_free(return_layer);
8812 lives_free(retdata);
8813 return_layer = NULL;
8814 }
8815
8816 if (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY) goto lfi_done;
8817 }
8818
8821 g_printerr("ext start @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8822
8826 // here we are either: playing through an external video playback plugin which cannot resize
8827 // - we must resize to whatever width and height we set when we called init_screen() in the plugin
8828 // i.e. mainw->vpp->fwidth, mainw->vpp fheight
8829
8830 // both dimensions are in RGB(A) pixels, so we must adjust here and send the correct
8831 // macropixel size in the plugin's render_frame() (in case of exotic palettes)
8832
8833 // - this is also used if we are letterboxing with an external plugin
8834
8835 weed_plant_t *frame_layer = NULL;
8836 weed_plant_t *return_layer = NULL;
8837 int ovpppalette = mainw->vpp->palette;
8838 boolean needs_lb = FALSE;
8839
8841 if (mainw->vpp->play_frame) player_v2 = TRUE;
8842
8846 g_printerr("clr2 @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8847
8848 layer_palette = weed_layer_get_palette(mainw->frame_layer);
8849 if (!weed_palette_is_valid(layer_palette)) goto lfi_done;
8850
8852 && mainw->vpp->palette != layer_palette) vpp_try_match_palette(mainw->vpp, mainw->frame_layer);
8854
8858 }
8859
8861 ((mainw->vpp->fwidth < mainw->pwidth || mainw->vpp->fheight < mainw->pheight))) {
8862 // mainw->frame_layer will be downsized for the plugin but upsized for screen
8863 // so copy layer and convert, retaining original
8864 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8865 frame_layer = weed_layer_copy(NULL, mainw->frame_layer);
8866 } else frame_layer = mainw->frame_layer;
8867
8868 if (frame_layer == mainw->frame_layer && !(mainw->vpp->capabilities & VPP_LOCAL_DISPLAY) &&
8869 ((weed_palette_is_rgb(layer_palette) &&
8871 (weed_palette_is_lower_quality(mainw->vpp->palette, layer_palette)))) {
8872 // mainw->frame_layer is RGB and so is our screen, but plugin is YUV
8873 // so copy layer and convert, retaining original
8874 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8875 frame_layer = weed_layer_copy(NULL, mainw->frame_layer);
8876 }
8878 g_printerr("copied @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8879
8880 pwidth = mainw->vpp->fwidth;
8881 pheight = mainw->vpp->fheight;
8882
8887 get_letterbox_sizes(&pwidth, &pheight, &lb_width, &lb_height, (mainw->vpp->capabilities & VPP_CAN_RESIZE) != 0);
8888 if (pwidth != lb_width || pheight != lb_height) {
8889 needs_lb = TRUE;
8891 if (frame_layer == mainw->frame_layer) {
8892 if (layer_palette != mainw->vpp->palette && (pwidth > lb_width || pheight > lb_height)) {
8893 frame_layer = weed_layer_copy(NULL, mainw->frame_layer);
8894 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8896 mainw->vpp->YUV_sampling, mainw->vpp->YUV_subspace, tgamma)) {
8897 goto lfi_done;
8898 }
8899 } else {
8901 weed_layer_copy(frame_layer, mainw->frame_layer);
8902 }
8903 }
8904 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8905 if (!letterbox_layer(frame_layer, pwidth, pheight, lb_width, lb_height, interp,
8906 mainw->vpp->palette, mainw->vpp->YUV_clamping)) goto lfi_done;
8907 was_letterboxed = TRUE;
8908 // *INDENT-OFF*
8909 } else {
8910 weed_set_double_value(frame_layer, "x_range", (double)lb_width / (double)pwidth);
8911 weed_set_double_value(frame_layer, "y_range", (double)lb_height / (double)pheight);
8912 }
8913 }
8914 }
8915 // *INDENT-ON*
8916
8918 g_printerr("lbb @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8919 layer_palette = weed_layer_get_palette(frame_layer);
8920
8921 if (((weed_layer_get_width_pixels(frame_layer) ^ pwidth) >> 2) ||
8922 ((weed_layer_get_height(frame_layer) ^ pheight) >> 1)) {
8923 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8924 if (!needs_lb || was_letterboxed) {
8925 lb_width = pwidth;
8926 lb_height = pheight;
8927 }
8928 if (!resize_layer(frame_layer, lb_width, lb_height, interp,
8929 mainw->vpp->palette, mainw->vpp->YUV_clamping)) goto lfi_done;
8930 }
8932 g_printerr("resize done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8933
8934 // resize_layer can change palette
8935
8936 if (frame_layer == mainw->frame_layer && !(mainw->vpp->capabilities & VPP_LOCAL_DISPLAY) &&
8937 ((weed_palette_is_rgb(layer_palette) &&
8939 (weed_palette_is_lower_quality(mainw->vpp->palette, layer_palette)))) {
8940 // mainw->frame_layer is RGB and so is our screen, but plugin is YUV
8941 // so copy layer and convert, retaining original
8942 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8943 frame_layer = weed_layer_copy(NULL, mainw->frame_layer);
8944 }
8945
8946 layer_palette = weed_layer_get_palette(frame_layer);
8947
8948 pwidth = weed_layer_get_width(frame_layer) * weed_palette_get_pixels_per_macropixel(layer_palette);
8949 pheight = weed_layer_get_height(frame_layer);
8950
8952 if (!check_for_overlay_text(frame_layer)) {
8953 if (mainw->multitrack && mainw->multitrack->opts.overlay_timecode) {
8954 frame_layer = render_text_overlay(frame_layer, mainw->multitrack->timestring);
8955 }
8956 }
8957 }
8958
8959 if (prefs->apply_gamma) {
8960 // gamma correction
8963 tgamma = WEED_GAMMA_LINEAR;
8964 else {
8965 tgamma = WEED_GAMMA_SRGB;
8966 }
8967 }
8968 }
8969 //g_print("clp start %d %d %d %d @\n", weed_layer_get_palette(frame_layer),
8970 //mainw->vpp->palette, weed_layer_get_gamma(frame_layer), tgamma);
8971 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8973 mainw->vpp->YUV_sampling, mainw->vpp->YUV_subspace, tgamma)) {
8974 goto lfi_done;
8975 }
8976
8978 g_printerr("clp done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8979
8981
8982 if (!player_v2) {
8983 // vid plugin expects compacted rowstrides (i.e. no padding/alignment after pixel row)
8984 if (!compact_rowstrides(frame_layer)) goto lfi_done;
8986 g_printerr("c rows done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
8987 }
8988 if (rec_after_pb) {
8989 // record output from playback plugin
8990 int retwidth = mainw->vpp->fwidth;
8991 int retheight = mainw->vpp->fheight;
8992
8993 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1;
8994 return_layer = weed_layer_create(retwidth, retheight, NULL, ovpppalette);
8995
9000 }
9001
9002 if (!player_v2) THREADVAR(rowstride_alignment_hint) = -1 ;
9003 if (create_empty_pixel_data(return_layer, FALSE, TRUE)) {
9004 retdata = weed_layer_get_pixel_data(return_layer, NULL);
9005 } else return_layer = NULL;
9006 }
9007
9008 // chain any data to the playback plugin
9009 if (!(mainw->preview || mainw->is_rendering)) {
9010 // chain any data pipelines
9011 if (mainw->pconx) {
9012 pconx_chain_data(-2, 0, FALSE);
9013 }
9014 if (mainw->cconx) cconx_chain_data(-2, 0);
9015 }
9016
9017 if (tgamma != WEED_GAMMA_UNKNOWN) {
9018 if (!was_letterboxed) {
9019 gamma_convert_layer(tgamma, frame_layer);
9020 } else {
9021 gamma_convert_sub_layer(tgamma, 1.0, frame_layer, (pwidth - lb_width) / 2, (pheight - lb_height) / 2,
9022 lb_width, lb_height, TRUE);
9023 }
9024 }
9025
9026 if (return_layer) weed_layer_set_gamma(return_layer, weed_layer_get_gamma(frame_layer));
9027
9028 if (!avsync_check()) goto lfi_done;
9029
9030 pd_array = weed_layer_get_pixel_data(frame_layer, NULL);
9031
9032 if (player_v2) {
9033 weed_set_double_value(frame_layer, "x_range", 1.0);
9034 weed_set_double_value(frame_layer, "y_range", 1.0);
9035 }
9036
9037 if (tgamma == WEED_GAMMA_SRGB && prefs->use_screen_gamma) {
9038 // TODO - do conversion before letterboxing
9040 }
9041
9042 if ((player_v2 && !(*mainw->vpp->play_frame)(frame_layer,
9043 mainw->currticks - mainw->stream_ticks, return_layer))
9044 || (!player_v2 && !(*mainw->vpp->render_frame)(weed_layer_get_width(frame_layer),
9045 weed_layer_get_height(frame_layer),
9046 mainw->currticks - mainw->stream_ticks, pd_array, retdata,
9047 mainw->vpp->play_params))) {
9048 //vid_playback_plugin_exit();
9049 if (return_layer) {
9050 weed_layer_free(return_layer);
9051 lives_free(retdata);
9052 return_layer = NULL;
9053 }
9054 goto lfi_done;
9055 } else success = TRUE;
9056 lives_free(pd_array);
9058 g_printerr("rend done @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9059
9060 if (return_layer) {
9061 int width = MIN(weed_layer_get_width(mainw->frame_layer)
9063 weed_layer_get_width(return_layer)
9065 int height = MIN(weed_layer_get_height(mainw->frame_layer), weed_layer_get_height(return_layer));
9066 if (resize_layer(return_layer, width, height, LIVES_INTERP_FAST, WEED_PALETTE_END, 0)) {
9067 if (tgamma == WEED_GAMMA_SRGB && prefs->use_screen_gamma) {
9068 // TODO - save w. screen_gamma
9069 gamma_convert_layer(WEED_GAMMA_SRGB, frame_layer);
9070 }
9071 save_to_scrap_file(return_layer);
9072 }
9073 weed_layer_free(return_layer);
9074 lives_free(retdata);
9075 return_layer = NULL;
9076 }
9077
9078 if (frame_layer != mainw->frame_layer) {
9079 weed_layer_free(frame_layer);
9080 }
9081
9082 // frame display was handled by a playback plugin, skip the rest
9083 if (mainw->vpp->capabilities & VPP_LOCAL_DISPLAY) goto lfi_done;
9084 }
9085
9087 // local display - either we are playing with no playback plugin, or else the playback plugin has no
9088 // local display of its own
9090 g_printerr("clr @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9091 check_layer_ready(mainw->frame_layer); // wait for all threads to complete
9094 g_printerr("clr end @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9095 if (weed_layer_get_width(mainw->frame_layer) == 0) return;
9096 if ((mainw->sep_win && !prefs->show_playwin) || (!mainw->sep_win && !prefs->show_gui)) {
9097 // no display to output, skip the rest
9098 success = TRUE;
9099 goto lfi_done;
9100 }
9101
9102 if (mainw->ext_playback && !player_v2) THREADVAR(rowstride_alignment_hint) = -1 ;
9103 layer_palette = weed_layer_get_palette(mainw->frame_layer);
9104 if (!weed_palette_is_valid(layer_palette) || !CURRENT_CLIP_IS_VALID) goto lfi_done;
9105
9106 if (cfile->img_type == IMG_TYPE_JPEG || !weed_palette_has_alpha(layer_palette)) cpal = WEED_PALETTE_RGB24;
9107 else {
9108 cpal = WEED_PALETTE_RGBA32;
9109 }
9110 if (mainw->fs && !mainw->ext_playback && (!mainw->multitrack || mainw->sep_win)) {
9111 // set again, in case vpp was turned off because of preview conditions
9113 }
9114
9116
9117 pwidth = opwidth;
9118 pheight = opheight;
9119
9121 g_printerr("res start @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9122
9125
9126 if ((lb_width != pwidth || lb_height != pheight)
9127 || weed_get_boolean_value(mainw->frame_layer, "letterboxed", NULL) == WEED_FALSE) {
9130 get_letterbox_sizes(&pwidth, &pheight, &lb_width, &lb_height, FALSE);
9131 if (!letterbox_layer(mainw->frame_layer, pwidth, pheight, lb_width, lb_height, interp, cpal, 0)) goto lfi_done;
9132 was_letterboxed = TRUE;
9133 weed_set_boolean_value(mainw->frame_layer, "letterboxed", WEED_TRUE);
9134 lb_width = pwidth;
9135 lb_height = pheight;
9136 }
9137 }
9138
9139 if (lb_width != pwidth || lb_height != pheight ||
9140 weed_get_boolean_value(mainw->frame_layer, "letterboxed", NULL) == WEED_FALSE) {
9143 if (!resize_layer(mainw->frame_layer, pwidth, pheight, interp, cpal, 0)) goto lfi_done;
9144 }
9145 }
9147 g_printerr("res end @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9148
9149 if (!convert_layer_palette_full(mainw->frame_layer, cpal, 0, 0, 0, WEED_GAMMA_SRGB)) goto lfi_done;
9150
9152 g_printerr("clp end @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9153 if (LIVES_IS_PLAYING) {
9154 if (!check_for_overlay_text(mainw->frame_layer)) {
9155 if (mainw->multitrack && mainw->multitrack->opts.overlay_timecode) {
9157 }
9158 }
9159 }
9160
9161 /* if (1 || !was_letterboxed) { */
9162 /* if (!prefs->gamma_srgb) */
9163 /* gamma_convert_layer(WEED_GAMMA_MONITOR, mainw->frame_layer); */
9164 /* else */
9165 /* gamma_convert_layer(WEED_GAMMA_SRGB, mainw->frame_layer); */
9166 /* } else { */
9167 /* if (!prefs->gamma_srgb) */
9168 /* gamma_convert_sub_layer(WEED_GAMMA_MONITOR, mainw->frame_layer, (pwidth - lb_width) / 2, (pheight - lb_height / 2), */
9169 /* lb_width, lb_height); */
9170 /* else */
9171 /* gamma_convert_sub_layer(WEED_GAMMA_SRGB, mainw->frame_layer, (pwidth - lb_width) / 2, (pheight - lb_height / 2), */
9172 /* lb_width, lb_height); */
9173 /* } */
9174
9176 g_printerr("l2p start @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9177
9179
9181 g_printerr("l2p @ %f\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9182
9183 if (!avsync_check()) goto lfi_done;
9184
9185 // internal player, double size or fullscreen, or multitrack
9186
9187 if (mainw->play_window && LIVES_IS_XWINDOW(lives_widget_get_xwindow(mainw->play_window))) {
9190 } else {
9193 if (pwidth < old_pwidth || pheight < old_pheight)
9195 old_pwidth = pwidth;
9196 old_pheight = pheight;
9199 }
9200
9201 if (pixbuf) lives_widget_object_unref(pixbuf);
9202 success = TRUE;
9204 g_print("paint @ %f\n\n", lives_get_current_ticks() / TICKS_PER_SECOND_DBL);
9205 goto lfi_done;
9206 }
9207
9208 // record external window
9209 if (mainw->record_foreign) {
9210 char fname[PATH_MAX];
9211 int xwidth, xheight;
9212 LiVESError *gerror = NULL;
9214
9215 if (!cr) return;
9216
9217 if (mainw->rec_vid_frames == -1) {
9218 lives_entry_set_text(LIVES_ENTRY(mainw->framecounter), (tmp = lives_strdup_printf("%9d", frame)));
9220 } else {
9221 if (frame > mainw->rec_vid_frames) {
9224 return;
9225 }
9226
9227 lives_entry_set_text(LIVES_ENTRY(mainw->framecounter), (tmp = lives_strdup_printf("%9d / %9d",
9228 frame, mainw->rec_vid_frames)));
9230 lives_free(tmp);
9231 }
9232
9233#ifdef GUI_GTK
9234#if GTK_CHECK_VERSION(3, 0, 0)
9235 xwidth = gdk_window_get_width(mainw->foreign_window);
9236 xheight = gdk_window_get_height(mainw->foreign_window);
9237 if ((pixbuf = gdk_pixbuf_get_from_window(mainw->foreign_window, 0, 0, xwidth, xheight))) {
9238#else
9239 gdk_window_get_size(mainw->foreign_window, &xwidth, &xheight);
9240 if ((pixbuf = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE(mainw->foreign_window),
9241 mainw->foreign_cmap, 0, 0, 0, 0, xwidth, xheight))) {
9242#endif
9243#endif
9244 tmp = make_image_file_name(cfile, frame, get_image_ext_for_type(cfile->img_type));
9245 lives_snprintf(fname, PATH_MAX, "%s", tmp);
9246 lives_free(tmp);
9247
9248 do {
9249 // TODO ***: add a timeout here
9250 if (gerror) lives_error_free(gerror);
9251 lives_pixbuf_save(pixbuf, fname, cfile->img_type, 100, cfile->hsize, cfile->vsize, &gerror);
9252 } while (gerror);
9253
9254 lives_painter_set_source_pixbuf(cr, pixbuf, 0, 0);
9257
9258 if (pixbuf) lives_widget_object_unref(pixbuf);
9259 cfile->frames = frame;
9260 } else {
9262 do_error_dialog(_("LiVES was unable to capture this image\n\n"));
9265 }
9266 if (frame > mainw->rec_vid_frames && mainw->rec_vid_frames > -1)
9268 lives_freep((void **)&framecount);
9269 return;
9270 }
9271
9272lfi_done:
9273 // here is where we free the mainw->frame_layer (the output video "frame" we just worked with)
9274 // we also animate the timeline and frame counters
9275 // if success is TRUE we may send an OSC FRAME_SYNCH notification
9276
9277 /* if (cleaner) { */
9278 /* lives_nanosleep_until_nonzero(weed_get_boolean_value(cleaner, WEED_LEAF_DONE, NULL)); */
9279 /* weed_plant_free(cleaner); */
9280 /* cleaner = NULL; */
9281 /* } */
9282
9283 do_cleanup(mainw->frame_layer, success);
9284 mainw->frame_layer = NULL;
9285 THREADVAR(rowstride_alignment_hint) = 0;
9286 lives_freep((void **)&framecount);
9287 if (success) {
9288 if (!mainw->multitrack &&
9290 && prefs->play_monitor != 0 && capable->nmonitors > 1))
9292 double ptrtime = ((double)mainw->actual_frame - 1.) / cfile->fps;
9293 mainw->ptrtime = ptrtime;
9295 }
9297 }
9298}
9299
9300
9304boolean lives_pixbuf_save(LiVESPixbuf * pixbuf, char *fname, lives_img_type_t imgtype, int quality, int width, int height,
9305 LiVESError **gerrorptr) {
9306 ticks_t timeout;
9307 lives_alarm_t alarm_handle;
9308 boolean retval = TRUE;
9309 int fd;
9310
9311 // CALLER should check for errors
9312 // fname should be in local charset
9313
9314 if (!LIVES_IS_PIXBUF(pixbuf)) {
9316 const char *img_ext = get_image_ext_for_type(imgtype);
9317 weed_layer_t *layer = create_blank_layer(NULL, img_ext, width, height, WEED_PALETTE_END);
9318 pixbuf = layer_to_pixbuf(layer, TRUE, FALSE);
9319 weed_layer_free(layer);
9320 retval = FALSE;
9321 }
9322
9323 fd = lives_open3(fname, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
9325 while (flock(fd, LOCK_EX) && (timeout = lives_alarm_check(alarm_handle)) > 0) {
9326 lives_nanosleep(1000);
9327 }
9328 lives_alarm_clear(alarm_handle);
9329 if (timeout == 0) return FALSE;
9330
9331 if (imgtype == IMG_TYPE_JPEG) {
9332 char *qstr = lives_strdup_printf("%d", quality);
9333#ifdef GUI_GTK
9334 gdk_pixbuf_save(pixbuf, fname, LIVES_IMAGE_TYPE_JPEG, gerrorptr, "quality", qstr, NULL);
9335#endif
9336#ifdef GUI_QT
9337 qt_jpeg_save(pixbuf, fname, gerrorptr, quality);
9338#endif
9339 lives_free(qstr);
9340 } else if (imgtype == IMG_TYPE_PNG) {
9341 char *cstr = lives_strdup_printf("%d", (int)((100. - (double)quality + 5.) / 10.));
9342 if (LIVES_IS_PIXBUF(pixbuf)) {
9343#ifdef GUI_GTK
9344 gdk_pixbuf_save(pixbuf, fname, LIVES_IMAGE_TYPE_PNG, gerrorptr, "compression", cstr, NULL);
9345#endif
9346#ifdef GUI_QT
9347 qt_png_save(pixbuf, fname, gerrorptr, (int)((100. - (double)quality + 5.) / 10.));
9348#endif
9349 } else retval = FALSE;
9350 lives_free(cstr);
9351 } else {
9352 //gdk_pixbuf_save_to_callback(...);
9353 }
9354
9355 close(fd);
9356 if (*gerrorptr) return FALSE;
9357 return retval;
9358}
9359
9366 savethread_priv_t *saveargs = (savethread_priv_t *)args;
9367 lives_pixbuf_save(saveargs->pixbuf, saveargs->fname, saveargs->img_type, saveargs->compression, saveargs->width,
9368 saveargs->height, &saveargs->error);
9369 return saveargs;
9370}
9371
9372
9373void close_current_file(int file_to_switch_to) {
9374 // close the current file, and free the file struct and all sub storage
9375 LiVESList *list_index;
9376 char *com;
9377 boolean need_new_blend_file = FALSE;
9378 int index = -1;
9379 int old_file = mainw->current_file;
9380
9381 //update the bar text
9383 int i;
9384 if (cfile->clip_type == CLIP_TYPE_TEMP) {
9385 close_temp_handle(file_to_switch_to);
9386 return;
9387 }
9388 if (cfile->clip_type != CLIP_TYPE_GENERATOR && mainw->current_file != mainw->scrap_file &&
9390 (!mainw->multitrack || mainw->current_file != mainw->multitrack->render_file)) {
9391 d_print(_("Closed clip %s\n"), cfile->file_name);
9393 }
9394
9395 cfile->hsize = mainw->def_width;
9396 cfile->vsize = mainw->def_height;
9397
9398 if (cfile->laudio_drawable) {
9399 if (mainw->laudio_drawable == cfile->laudio_drawable
9401 if (!mainw->multitrack) {
9402 if (cairo_surface_get_reference_count(cfile->laudio_drawable))
9403 lives_painter_surface_destroy(cfile->laudio_drawable);
9404 }
9405 cfile->laudio_drawable = NULL;
9406 }
9407 if (cfile->raudio_drawable) {
9408 if (mainw->raudio_drawable == cfile->raudio_drawable
9410 if (!mainw->multitrack) {
9411 if (cairo_surface_get_reference_count(cfile->raudio_drawable))
9412 lives_painter_surface_destroy(cfile->raudio_drawable);
9413 }
9414 cfile->raudio_drawable = NULL;
9415 }
9416 if (mainw->drawsrc == mainw->current_file) mainw->drawsrc = -1;
9417
9418 if (mainw->st_fcache) {
9419 if (mainw->en_fcache == mainw->st_fcache) mainw->en_fcache = NULL;
9420 if (mainw->pr_fcache == mainw->st_fcache) mainw->pr_fcache = NULL;
9422 mainw->st_fcache = NULL;
9423 }
9424 if (mainw->en_fcache) {
9425 if (mainw->pr_fcache == mainw->en_fcache) mainw->pr_fcache = NULL;
9427 mainw->en_fcache = NULL;
9428 }
9429 if (mainw->pr_fcache) {
9431 mainw->pr_fcache = NULL;
9432 }
9433
9434 for (i = 0; i < FN_KEYS - 1; i++) {
9435 if (mainw->clipstore[i][0] == mainw->current_file) mainw->clipstore[i][0] = -1;
9436 }
9437
9438 // this must all be done last...
9439 if (cfile->menuentry) {
9440 // c.f. on_prevclip_activate
9441 list_index = lives_list_find(mainw->cliplist, LIVES_INT_TO_POINTER(mainw->current_file));
9442 do {
9443 if (!(list_index = lives_list_previous(list_index))) list_index = lives_list_last(mainw->cliplist);
9444 index = LIVES_POINTER_TO_INT(lives_list_nth_data(list_index, 0));
9445 } while ((mainw->files[index] || mainw->files[index]->opening || mainw->files[index]->restoring ||
9446 (index == mainw->scrap_file && index > -1) || (index == mainw->ascrap_file && index > -1)
9447 || (mainw->files[index]->frames == 0 &&
9448 LIVES_IS_PLAYING)) &&
9449 index != mainw->current_file);
9450 if (index == mainw->current_file) index = -1;
9452 }
9453
9454 if (CURRENT_CLIP_IS_NORMAL && cfile->ext_src) {
9455 if (cfile->ext_src_type == LIVES_EXT_SRC_DECODER) {
9457 }
9458 }
9460 lives_freep((void **)&cfile->frame_index);
9461 lives_freep((void **)&cfile->frame_index_back);
9462
9463 if (cfile->clip_type != CLIP_TYPE_GENERATOR && !mainw->close_keep_frames) {
9464 char *clipd = lives_build_path(prefs->workdir, cfile->handle, NULL);
9465 if (lives_file_test(clipd, LIVES_FILE_TEST_EXISTS)) {
9466 // as a safety feature we create a special file which allows the back end to delete the directory
9467 char *permitname = lives_build_filename(clipd, TEMPFILE_MARKER "." LIVES_FILE_EXT_TMP, NULL);
9468 lives_touch(permitname);
9469 lives_free(permitname);
9470
9471 com = lives_strdup_printf("%s close \"%s\"", prefs->backend_sync, cfile->handle);
9472 lives_system(com, TRUE);
9473 lives_free(com);
9474 }
9475 lives_free(clipd);
9476 if (cfile->event_list_back) event_list_free(cfile->event_list_back);
9477 if (cfile->event_list) event_list_free(cfile->event_list);
9478
9479 lives_list_free_all(&cfile->layout_map);
9480 }
9481
9482 if (cfile->subt) subtitles_free(cfile);
9483
9484 if (cfile->clip_type == CLIP_TYPE_YUV4MPEG) {
9485#ifdef HAVE_YUV4MPEG
9487 lives_free(cfile->ext_src);
9488#endif
9489 }
9490
9491 if (cfile->clip_type == CLIP_TYPE_VIDEODEV) {
9492#ifdef HAVE_UNICAP
9493 lives_vdev_free((lives_vdev_t *)cfile->ext_src);
9494 lives_free(cfile->ext_src);
9495#endif
9496 }
9497
9498 if (cfile->audio_waveform) {
9499 for (i = 0; i < cfile->achans; i++) lives_freep((void **)&cfile->audio_waveform[i]);
9500 lives_freep((void **)&cfile->audio_waveform);
9501 lives_free(cfile->aw_sizes);
9502 }
9503
9504 lives_freep((void **)&cfile);
9505
9506 if (mainw->multitrack && mainw->current_file != mainw->multitrack->render_file) {
9508 }
9509
9512
9513 if (!mainw->only_close) {
9514 if (IS_VALID_CLIP(file_to_switch_to) && file_to_switch_to > 0) {
9515 if (!mainw->multitrack) {
9516 if (!LIVES_IS_PLAYING) {
9517 mainw->current_file = file_to_switch_to;
9518 switch_clip(1, file_to_switch_to, TRUE);
9519 d_print("");
9520 } else {
9521 if (file_to_switch_to != mainw->playing_file) mainw->new_clip = file_to_switch_to;
9522 }
9523 } else if (old_file != mainw->multitrack->render_file) {
9525 }
9526 return;
9527 }
9528 }
9529 // file we were asked to switch to is invalid, thus we must find one
9530
9532 need_new_blend_file = TRUE;
9533 // set blend_file to -1. This in case the file is a generator - we need to distinguish between the cases where
9534 // the generator is the blend file and we switch because it was deinited, and when we switch fg <-> bg
9535 // in the former case the generator is killed off, in the latter it survives
9536 mainw->blend_file = -1;
9537 }
9538
9539 mainw->preview_frame = 0;
9540
9541 if (!mainw->only_close) {
9542 // find another clip to switch to
9543 if (index > -1) {
9544 if (!mainw->multitrack) {
9545 if (!LIVES_IS_PLAYING) {
9546 switch_clip(1, index, TRUE);
9547 d_print("");
9548 } else mainw->new_clip = index;
9549 if (need_new_blend_file) mainw->blend_file = mainw->current_file;
9550 } else {
9551 mainw->multitrack->clip_selected = -mainw->multitrack->clip_selected;
9553 }
9554 return;
9555 }
9556 if (mainw->clips_available > 0) {
9557 for (i = mainw->current_file - 1; i > 0; i--) {
9558 if (mainw->files[i]) {
9559 if (!mainw->multitrack) {
9560 if (!LIVES_IS_PLAYING) {
9561 switch_clip(1, i, TRUE);
9562 d_print("");
9563 } else mainw->new_clip = index;
9564 if (need_new_blend_file) mainw->blend_file = mainw->current_file;
9565 } else {
9566 mainw->multitrack->clip_selected = -mainw->multitrack->clip_selected;
9568 }
9569 return;
9570 }
9571 }
9572 for (i = 1; i < MAX_FILES; i++) {
9573 if (mainw->files[i]) {
9574 if (!mainw->multitrack) {
9575 if (!LIVES_IS_PLAYING) {
9576 switch_clip(1, i, TRUE);
9577 d_print("");
9578 } else mainw->new_clip = index;
9579 if (need_new_blend_file) mainw->blend_file = mainw->current_file;
9580 } else {
9581 mainw->multitrack->clip_selected = -mainw->multitrack->clip_selected;
9583 }
9584 return;
9585 // *INDENT-OFF*
9586 }}}}}
9587 // *INDENT-ON*
9588
9589 // no other clips
9591 set_main_title(NULL, 0);
9592
9597
9599
9600 // can't use set_undoable, as we don't have a cfile
9606
9607 if (!mainw->is_ready || mainw->recovering_files) return;
9608
9610
9611 if (!mainw->multitrack) {
9612 //resize(1);
9614 //lives_widget_hide(mainw->playframe);
9616 load_end_image(0);
9617 if (prefs->show_msg_area && !mainw->only_close) {
9618 if (mainw->idlemax == 0) {
9619 lives_idle_add_simple(resize_message_area, NULL);
9620 }
9622 }
9623 }
9624
9626
9629
9630 if (!mainw->only_close) {
9632 if (!LIVES_IS_PLAYING) d_print("");
9633
9634 if (mainw->multitrack) {
9635 mainw->multitrack->clip_selected = -mainw->multitrack->clip_selected;
9637 }
9638 }
9641 else sensitize();
9642 }
9643}
9644
9645
9646void switch_to_file(int old_file, int new_file) {
9647 // this function is used for full clip switching (during non-playback or non fs)
9648
9649 // calling this function directly is now deprecated in favour of switch_clip()
9650
9651 int orig_file = mainw->current_file;
9652
9653 // should use close_current_file
9654 if (!IS_VALID_CLIP(new_file)) {
9655 char *msg = lives_strdup_printf("attempt to switch to invalid clip %d", new_file);
9656 LIVES_WARN(msg);
9657 lives_free(msg);
9658 return;
9659 }
9660
9661 if (mainw->multitrack) return;
9662
9663 if (LIVES_IS_PLAYING) {
9664 mainw->new_clip = new_file;
9665 return;
9666 }
9667
9668 mainw->current_file = new_file;
9669
9670 if (old_file != new_file) {
9672 mainw->laudio_drawable = cfile->laudio_drawable;
9673 mainw->raudio_drawable = cfile->raudio_drawable;
9675 }
9676 if (old_file != 0 && new_file != 0) mainw->preview_frame = 0;
9677 if (1) {
9678 // TODO - indicate "opening" in clipmenu
9679
9680 // if (old_file>0&&mainw->files[old_file]!=NULL&&mainw->files[old_file]->menuentry!=NULL&&
9681 // (mainw->files[old_file]->clip_type==CLIP_TYPE_DISK||mainw->files[old_file]->clip_type==CLIP_TYPE_FILE)) {
9682 //char menutext[32768];
9683 //get_menu_text_long(mainw->files[old_file]->menuentry,menutext);
9684
9685 //lives_menu_item_set_text(mainw->files[old_file]->menuentry,menutext,FALSE);
9686 //}
9687 lives_widget_set_sensitive(mainw->select_new, (cfile->insert_start > 0));
9689 if ((cfile->start == 1 || cfile->end == cfile->frames) && !(cfile->start == 1 && cfile->end == cfile->frames)) {
9691 } else {
9693 }
9694 if (IS_VALID_CLIP(old_file) && mainw->files[old_file]->opening) {
9695 // switch while opening - come out of processing dialog
9696 if (mainw->proc_ptr) {
9698 lives_freep((void **)&mainw->proc_ptr);
9699 // *INDENT-OFF*
9700 }}}}
9701 // *INDENT-ON*
9702
9703 if (mainw->play_window && cfile->is_loaded && orig_file != new_file) {
9705
9706 // if the clip is loaded
9707 if (!mainw->preview_box) {
9708 // create the preview box that shows frames...
9710 }
9711 // add it the play window...
9715 }
9716
9721
9722 // and resize it
9725 }
9726
9731 }
9732
9733 if (!CURRENT_CLIP_IS_VALID) return;
9734 //chill_decoder_plugin(mainw->current_file);
9735
9736 if (!CURRENT_CLIP_IS_NORMAL || cfile->opening) {
9738 }
9739
9740 if (cfile->menuentry) {
9742 }
9743
9744 if (!mainw->switch_during_pb && !cfile->opening) sensitize();
9745
9748
9750
9755
9756 if (cfile->achans < 2) {
9758 } else {
9760 }
9761
9762 if (cfile->redoable) {
9765 } else {
9768 }
9769
9770 if (new_file > 0) {
9771 if (cfile->menuentry) {
9772 set_main_title(cfile->name, 0);
9773 } else set_main_title(cfile->file_name, 0);
9774 }
9775
9776 if (cfile->frames == 0) {
9778 }
9779
9780 resize(1);
9781 if (!mainw->go_away) {
9783 }
9784
9785 // if the file was opening, continue...
9786 if (cfile->opening) {
9787 open_file(cfile->file_name);
9788 } else {
9789 showclipimgs();
9791 lives_ce_update_timeline(0, cfile->pointer_time);
9792 mainw->ptrtime = cfile->pointer_time;
9794 }
9795
9796 if (!mainw->multitrack && !mainw->reconfig) {
9797 if (prefs->show_msg_area && !mainw->only_close) {
9798 reset_message_area(); // necessary
9799 if (mainw->idlemax == 0) {
9800 lives_idle_add_simple(resize_message_area, NULL);
9801 }
9803 }
9804 }
9805}
9806
9807
9808boolean switch_audio_clip(int new_file, boolean activate) {
9809 ticks_t timeout;
9810 lives_alarm_t alarm_handle;
9811
9813#ifdef ENABLE_JACK
9814 if (mainw->jackd) {
9815 if (mainw->jackd->playing_file == new_file ||
9817 && mainw->jackd->playing_file != mainw->playing_file)) return FALSE;
9818
9819 if (mainw->scratch == SCRATCH_JUMP) {
9820 mainw->files[new_file]->aseek_pos =
9821 (off_t)((double)mainw->files[new_file]->frameno / mainw->files[new_file]->fps * mainw->files[new_file]->arate)
9822 * mainw->files[new_file]->achans * mainw->files[new_file]->asampsize / 8;
9823 }
9824
9825 if (!activate) mainw->jackd->in_use = FALSE;
9826
9827 alarm_handle = lives_alarm_set(LIVES_DEFAULT_TIMEOUT);
9828 while ((timeout = lives_alarm_check(alarm_handle)) > 0 && jack_get_msgq(mainw->jackd) != NULL) {
9829 // wait for seek
9830 lives_nanosleep(1000);
9831 }
9832 lives_alarm_clear(alarm_handle);
9833 if (timeout == 0) {
9835 return FALSE;
9836 }
9837
9838 if (mainw->jackd->playing_file > 0) {
9839 if (!CLIP_HAS_AUDIO(new_file)) {
9840 jack_get_rec_avals(mainw->jackd);
9841 mainw->rec_avel = 0.;
9842 }
9843 jack_message.command = ASERVER_CMD_FILE_CLOSE;
9844 jack_message.data = NULL;
9845 jack_message.next = NULL;
9846 mainw->jackd->msgq = &jack_message;
9847
9848 alarm_handle = lives_alarm_set(LIVES_DEFAULT_TIMEOUT);
9849 while ((timeout = lives_alarm_check(alarm_handle)) > 0 && jack_get_msgq(mainw->jackd) != NULL) {
9850 // wait for seek
9851 lives_nanosleep(1000);
9852 }
9853 lives_alarm_clear(alarm_handle);
9854 if (timeout == 0) {
9856 return FALSE;
9857 }
9858 }
9859 }
9860 if (!IS_VALID_CLIP(new_file)) {
9861 mainw->jackd->in_use = FALSE;
9862 return FALSE;
9863 }
9864
9865 if (CLIP_HAS_AUDIO(new_file)) {
9866 int asigned = !(mainw->files[new_file]->signed_endian & AFORM_UNSIGNED);
9867 int aendian = !(mainw->files[new_file]->signed_endian & AFORM_BIG_ENDIAN);
9868 mainw->jackd->num_input_channels = mainw->files[new_file]->achans;
9869 mainw->jackd->bytes_per_channel = mainw->files[new_file]->asampsize / 8;
9870 if (activate && (prefs->audio_opts & AUDIO_OPTS_FOLLOW_FPS)) {
9871 if (!mainw->files[new_file]->play_paused)
9872 mainw->jackd->sample_in_rate = mainw->files[new_file]->arate * mainw->files[new_file]->pb_fps /
9873 mainw->files[new_file]->fps;
9874 else mainw->jackd->sample_in_rate = mainw->files[new_file]->arate * mainw->files[new_file]->freeze_fps /
9875 mainw->files[new_file]->fps;
9876 } else mainw->jackd->sample_in_rate = mainw->files[new_file]->arate;
9877 if (mainw->files[new_file]->adirection == LIVES_DIRECTION_REVERSE)
9878 mainw->jackd->sample_in_rate = -abs(mainw->jackd->sample_in_rate);
9879 else
9880 mainw->jackd->sample_in_rate = abs(mainw->jackd->sample_in_rate);
9881 mainw->jackd->usigned = !asigned;
9882 mainw->jackd->seek_end = mainw->files[new_file]->afilesize;
9883
9884 if ((aendian && (capable->byte_order == LIVES_BIG_ENDIAN)) ||
9885 (!aendian && (capable->byte_order == LIVES_LITTLE_ENDIAN)))
9886 mainw->jackd->reverse_endian = TRUE;
9887 else mainw->jackd->reverse_endian = FALSE;
9888
9890 else mainw->jackd->loop = AUDIO_LOOP_FORWARD;
9891
9892 avsync_force();
9893
9894 // tell jack server to open audio file and start playing it
9895
9896 jack_message.command = ASERVER_CMD_FILE_OPEN;
9897
9898 jack_message.data = lives_strdup_printf("%d", new_file);
9899
9900 jack_message2.command = ASERVER_CMD_FILE_SEEK;
9901 jack_message.next = &jack_message2;
9902 jack_message2.data = lives_strdup_printf("%"PRId64, mainw->files[new_file]->aseek_pos);
9903 if (LIVES_IS_PLAYING && !mainw->preview) jack_message2.tc = lives_get_current_ticks();
9904 jack_message2.next = NULL;
9905
9906 mainw->jackd->msgq = &jack_message;
9907 mainw->jackd->in_use = TRUE;
9908
9909 mainw->jackd->is_paused = mainw->files[new_file]->play_paused;
9910 mainw->jackd->is_silent = FALSE;
9911 mainw->rec_aclip = new_file;
9912 mainw->rec_avel = (double)mainw->jackd->sample_in_rate / (double)mainw->files[new_file]->arps;
9913 mainw->rec_aseek = fabs((double)(mainw->files[new_file]->aseek_pos
9914 / (mainw->files[new_file]->achans * mainw->files[new_file]->asampsize / 8))
9915 / (double)mainw->files[new_file]->arps);
9916 } else {
9918 }
9919 /* event = get_last_frame_event(mainw->event_list); */
9920 /* insert_audio_event_at(event, -1, mainw->rec_aclip, mainw->rec_aseek, mainw->rec_avel); */
9921 /* mainw->rec_aclip = -1; */
9922#endif
9923 }
9924
9926#ifdef HAVE_PULSE_AUDIO
9927 if (mainw->pulsed) {
9928 if (mainw->pulsed->playing_file == new_file ||
9930 && mainw->pulsed->playing_file != mainw->playing_file)) return FALSE;
9931
9932 if (mainw->scratch == SCRATCH_JUMP) {
9933 mainw->files[new_file]->aseek_pos =
9934 (off_t)((double)mainw->files[new_file]->frameno / mainw->files[new_file]->fps * mainw->files[new_file]->arate)
9935 * mainw->files[new_file]->achans * mainw->files[new_file]->asampsize / 8;
9936 }
9937
9938 if (!activate) mainw->pulsed->in_use = FALSE;
9939
9940 alarm_handle = lives_alarm_set(LIVES_DEFAULT_TIMEOUT);
9941 while ((timeout = lives_alarm_check(alarm_handle)) > 0 && pulse_get_msgq(mainw->pulsed)) {
9942 // wait for seek
9943 lives_nanosleep(1000);
9944 }
9945 lives_alarm_clear(alarm_handle);
9946 if (timeout == 0) {
9948 return FALSE;
9949 }
9950
9951 if (mainw->pulsed->fd > 0) {
9952 if (!CLIP_HAS_AUDIO(new_file)) {
9953 pulse_get_rec_avals(mainw->pulsed);
9954 mainw->rec_avel = 0.;
9955 }
9956 pulse_message.command = ASERVER_CMD_FILE_CLOSE;
9957 pulse_message.data = NULL;
9958 pulse_message.next = NULL;
9959 mainw->pulsed->msgq = &pulse_message;
9960
9961 alarm_handle = lives_alarm_set(LIVES_DEFAULT_TIMEOUT);
9962 while ((timeout = lives_alarm_check(alarm_handle)) > 0 && pulse_get_msgq(mainw->pulsed) != NULL) {
9963 // wait for seek
9964 lives_nanosleep(1000);
9965 }
9966 lives_alarm_clear(alarm_handle);
9967 if (timeout == 0) {
9969 return FALSE;
9970 }
9971 }
9972
9973 if (!IS_VALID_CLIP(new_file)) {
9974 mainw->pulsed->in_use = FALSE;
9975 return FALSE;
9976 }
9977
9978 mainw->pulsed->in_use = TRUE;
9979
9980 if (CLIP_HAS_AUDIO(new_file)) {
9981 int asigned = !(mainw->files[new_file]->signed_endian & AFORM_UNSIGNED);
9982 int aendian = !(mainw->files[new_file]->signed_endian & AFORM_BIG_ENDIAN);
9983 mainw->pulsed->in_achans = mainw->files[new_file]->achans;
9984 mainw->pulsed->in_asamps = mainw->files[new_file]->asampsize;
9985 if (activate && (prefs->audio_opts & AUDIO_OPTS_FOLLOW_FPS)) {
9986 if (!mainw->files[new_file]->play_paused)
9987 mainw->pulsed->in_arate = mainw->files[new_file]->arate
9988 * mainw->files[new_file]->pb_fps /
9989 mainw->files[new_file]->fps;
9990 else mainw->pulsed->in_arate = mainw->files[new_file]->arate
9991 * mainw->files[new_file]->freeze_fps /
9992 mainw->files[new_file]->fps;
9993 } else mainw->pulsed->in_arate = mainw->files[new_file]->arate;
9994 if (mainw->files[new_file]->adirection == LIVES_DIRECTION_REVERSE)
9995 mainw->pulsed->in_arate = -abs(mainw->pulsed->in_arate);
9996 else
9997 mainw->pulsed->in_arate = abs(mainw->pulsed->in_arate);
9998 mainw->pulsed->usigned = !asigned;
9999 mainw->pulsed->seek_end = mainw->files[new_file]->afilesize;
10000
10001 if ((aendian && (capable->byte_order == LIVES_BIG_ENDIAN)) ||
10002 (!aendian && (capable->byte_order == LIVES_LITTLE_ENDIAN)))
10003 mainw->pulsed->reverse_endian = TRUE;
10004 else mainw->pulsed->reverse_endian = FALSE;
10005
10007 else mainw->pulsed->loop = AUDIO_LOOP_FORWARD;
10008
10009 avsync_force();
10010
10011 // tell pulse server to open audio file and start playing it
10012
10013 pulse_message.command = ASERVER_CMD_FILE_OPEN;
10014 pulse_message.data = lives_strdup_printf("%d", new_file);
10015
10016 pulse_message2.command = ASERVER_CMD_FILE_SEEK;
10017 if (LIVES_IS_PLAYING && !mainw->preview) pulse_message2.tc = lives_get_current_ticks();
10018 pulse_message.next = &pulse_message2;
10019 pulse_message2.data = lives_strdup_printf("%"PRId64, mainw->files[new_file]->aseek_pos);
10020 pulse_message2.next = NULL;
10021 mainw->pulsed->msgq = &pulse_message;
10022 mainw->pulsed->in_use = TRUE;
10023
10024 mainw->pulsed->is_paused = mainw->files[new_file]->play_paused;
10025 mainw->rec_aclip = new_file;
10026 mainw->rec_avel = (double)mainw->pulsed->in_arate / (double)mainw->files[new_file]->arps;
10027 mainw->rec_aseek = fabs((double)(mainw->files[new_file]->aseek_pos
10028 / (mainw->files[new_file]->achans * mainw->files[new_file]->asampsize / 8))
10029 / (double)mainw->files[new_file]->arps);
10030 } else {
10032 }
10033 }
10034#endif
10035 }
10036
10037#if 0
10039 if (!IS_VALID_CLIP(new_file)) {
10040 mainw->nullaudio_playing_file = -1;
10041 return FALSE;
10042 }
10043 if (mainw->nullaudio->playing_file == new_file) return FALSE;
10044 nullaudio_clip_set(new_file);
10045 if (activate && (prefs->audio_opts & AUDIO_OPTS_FOLLOW_FPS)) {
10046 if (!mainw->files[new_file]->play_paused)
10047 nullaudio_arate_set(mainw->files[new_file]->arate * mainw->files[new_file]->pb_fps /
10048 mainw->files[new_file]->fps);
10049 else nullaudio_arate_set(mainw->files[new_file]->arate
10050 * mainw->files[new_file]->freeze_fps /
10051 mainw->files[new_file]->fps);
10052 } else nullaudio_arate_set(mainw->files[new_file]->arate);
10053 nullaudio_seek_set(mainw->files[new_file]->aseek_pos);
10054 if (CLIP_HAS_AUDIO(new_file)) {
10055 nullaudio_get_rec_avals();
10056 } else {
10057 nullaudio_get_rec_avals();
10058 mainw->rec_avel = 0.;
10059 }
10060 }
10061#endif
10062 return TRUE;
10063}
10064
10065
10066void do_quick_switch(int new_file) {
10067 // handle clip switching during playback
10068 // calling this function directly is now deprecated in favour of switch_clip()
10069 boolean osc_block;
10070 int old_file = mainw->current_file;// area = 0;
10071
10072 if (mainw->current_file < 1 || !mainw->files[new_file]) return;
10073
10074 if (mainw->multitrack
10075 || (mainw->record && !mainw->record_paused && !(prefs->rec_opts & REC_CLIPS)) ||
10076 mainw->foreign || (mainw->preview && !mainw->is_rendering)) return;
10077
10078 if (!LIVES_IS_PLAYING) {
10079 switch_to_file(mainw->current_file, new_file);
10080 return;
10081 }
10082
10083 if (mainw->noswitch) {
10084 mainw->new_clip = new_file;
10085 return;
10086 }
10087
10088 mainw->blend_palette = WEED_PALETTE_END;
10089
10091 && !mainw->is_rendering) {
10092 if (cfile->clip_type == CLIP_TYPE_GENERATOR && cfile->ext_src) {
10093 if (new_file != mainw->blend_file) {
10094 // switched from generator to another clip, end the generator
10095 weed_plant_t *inst = (weed_plant_t *)cfile->ext_src;
10098 weed_generator_end(inst);
10099 } else {
10101 }
10102 }
10106 }
10107 }
10108
10109 osc_block = mainw->osc_block;
10110 mainw->osc_block = TRUE;
10111
10112 if (mainw->loop_locked) {
10114 }
10115
10117
10118 // TODO - can these be combined ?
10121
10122 if (CURRENT_CLIP_IS_NORMAL) cfile->last_play_sequence = mainw->play_sequence;
10123
10124 mainw->current_file = new_file;
10125
10127 mainw->laudio_drawable = cfile->laudio_drawable;
10128 mainw->raudio_drawable = cfile->raudio_drawable;
10129
10130 if (!mainw->fs && !mainw->faded) {
10133 }
10134
10135 lives_spin_button_set_value(LIVES_SPIN_BUTTON(mainw->spinbutton_pb_fps), mainw->files[new_file]->pb_fps);
10136 changed_fps_during_pb(LIVES_SPIN_BUTTON(mainw->spinbutton_pb_fps), LIVES_INT_TO_POINTER(1));
10137
10138 // switch audio clip
10141 || prefs->audio_src == AUDIO_SRC_EXT))) {
10142 switch_audio_clip(new_file, TRUE);
10143 }
10144
10145 mainw->deltaticks = 0;
10146
10147 set_main_title(cfile->name, 0);
10148
10150
10152 char *tmp;
10153 tmp = lives_build_filename(prefs->workdir, cfile->handle, LIVES_STATUS_FILE_NAME, NULL);
10154 lives_snprintf(cfile->info_file, PATH_MAX, "%s", tmp);
10155 lives_free(tmp);
10156 }
10157
10159 mainw->play_end = INT_MAX;
10160
10161 // act like we are not playing a selection (but we will try to keep to
10162 // selection bounds)
10164
10165 if (!cfile->frameno && cfile->frames) cfile->frameno = calc_frame_from_time(mainw->current_file, cfile->pointer_time);
10166 cfile->last_frameno = cfile->frameno;
10167
10168 mainw->playing_file = new_file;
10169
10170 cfile->next_event = NULL;
10171
10172#if GTK_CHECK_VERSION(3, 0, 0)
10173 if (LIVES_IS_PLAYING && !mainw->play_window && (!IS_VALID_CLIP(old_file)
10174 || !CURRENT_CLIP_IS_VALID || cfile->hsize != mainw->files[old_file]->hsize
10175 || cfile->vsize != mainw->files[old_file]->vsize)) {
10177 }
10178#endif
10179
10181 if (!mainw->fs && !mainw->faded) {
10183 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->spinbutton_end), 1, cfile->frames);
10184 lives_spin_button_set_value(LIVES_SPIN_BUTTON(mainw->spinbutton_end), cfile->end);
10186
10188 lives_spin_button_set_range(LIVES_SPIN_BUTTON(mainw->spinbutton_start), 1, cfile->frames);
10189 lives_spin_button_set_value(LIVES_SPIN_BUTTON(mainw->spinbutton_start), cfile->start);
10191
10192 if (!mainw->play_window && mainw->double_size) {
10193 //frame_size_update();
10194 resize(2.);
10195 } else resize(1);
10196 }
10197 } else resize(1);
10198
10199 if (!mainw->fs && !mainw->faded) {
10200 showclipimgs();
10201 }
10202
10203 if (new_file == mainw->blend_file) {
10205 mainw->blend_file = old_file;
10206 }
10207
10208 // force loading of a frame from the new clip
10210
10211 mainw->fps_mini_measure = 1.;
10213
10215 lives_window_present(LIVES_WINDOW(mainw->play_window));
10217 }
10218
10219 //mainw->switch_during_pb = FALSE;
10220 mainw->osc_block = osc_block;
10222
10223 if (!mainw->fs && !mainw->faded) {
10226 }
10227}
10228
10229
10230void resize(double scale) {
10231 // resize the frame widgets
10232 // set scale < 0. to _force_ the playback frame to expand (for external capture)
10233 LiVESXWindow *xwin;
10234 double oscale = scale;
10235
10236 int xsize, vspace;
10237 int bx, by;
10238
10239 // height of the separator imeage
10240
10241 // maximum values
10242 int hsize, vsize;
10243 int w, h;
10244 int scr_width = GUI_SCREEN_WIDTH;
10245 int scr_height = GUI_SCREEN_HEIGHT;
10246
10247 if (!prefs->show_gui || mainw->multitrack) return;
10248 vspace = get_vspace();
10249
10251 bx *= 2;
10252
10253 if (prefs->open_maximised && by > MENU_HIDE_LIM)
10255
10258
10259 // resize the main window so it fits the gui monitor
10260 if (prefs->open_maximised)
10262 else if (w > scr_width - bx || h > scr_height - by) {
10263 w = scr_width - bx;
10264 h = scr_height - by - mainw->mbar_res;
10266 lives_window_resize(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), w, h);
10267 }
10268
10269 //if (mainw->play_window) return;
10270
10271 hsize = (scr_width - (H_RESIZE_ADJUST * 3 + bx)) / 3;
10272 vsize = scr_height - (CE_TIMELINE_VSPACE * 1.01 / sqrt(widget_opts.scale) + vspace + by
10273 + (prefs->show_msg_area ? mainw->mbar_res : 0)
10275
10276 if (scale < 0.) {
10277 // foreign capture
10278 scale = -scale;
10279 hsize = (scr_width - H_RESIZE_ADJUST - bx) / scale;
10280 vsize = (scr_height - V_RESIZE_ADJUST - by) / scale;
10281 }
10282
10283 mainw->ce_frame_width = hsize;
10284 mainw->ce_frame_height = vsize;
10285
10286 if (oscale == 2.) {
10287 if (hsize * 2 > scr_width - SCR_WIDTH_SAFETY) {
10288 scale = 1.;
10289 }
10290 }
10291
10292 if (oscale > 0.) {
10293 if (scale > 1.) {
10294 // this is the size for the start and end frames
10295 // they shrink when scale is 2.0
10296 mainw->ce_frame_width = hsize / scale;
10297 mainw->ce_frame_height = vsize / scale + V_RESIZE_ADJUST;
10298
10301 }
10302
10304 if (cfile->clip_type == CLIP_TYPE_YUV4MPEG || cfile->clip_type == CLIP_TYPE_VIDEODEV) {
10305 if (!mainw->camframe) {
10306 LiVESError *error = NULL;
10308 char *tmp = lives_build_filename(prefs->prefix_dir, THEME_DIR, LIVES_THEME_CAMERA, fname, NULL);
10311 lives_free(tmp); lives_free(fname);
10312 }
10313 }
10314 }
10315
10316 // THE SIZES OF THE FRAME CONTAINERS
10321
10324
10325 // use unscaled size in dblsize
10326 if (scale > 1.) {
10327 hsize *= scale;
10328 vsize *= scale;
10329 }
10333
10334 // IMPORTANT (or the entire image will not be shown)
10337 if (LIVES_IS_XWINDOW(xwin)) {
10340 lives_xwindow_create_similar_surface(xwin, LIVES_PAINTER_CONTENT_COLOR,
10341 hsize, vsize);
10343 }
10344 } else {
10345 // capture window size
10346 xsize = (scr_width - hsize * -oscale - H_RESIZE_ADJUST) / 2;
10347 if (xsize > 0) {
10352 mainw->ce_frame_width = xsize / scale;
10354 } else {
10359 }
10360 }
10361
10362 if (!mainw->foreign && mainw->current_file == -1) {
10365 load_end_image(0);
10366 }
10367
10369
10370 if (scale != oscale) {
10372 if (prefs->open_maximised)
10374 else if (w > scr_width - bx || h > scr_height - by) {
10375 w = scr_width - bx;
10376 h = scr_height - by;
10378 lives_window_resize(LIVES_WINDOW(LIVES_MAIN_WINDOW_WIDGET), w, h);
10379 }
10380 }
10381}
boolean resync_audio(double frameno)
resync audio playback to the current video frame
Definition: audio.c:2822
LIVES_GLOBAL_INLINE void avsync_force(void)
Definition: audio.c:2785
LIVES_GLOBAL_INLINE lives_cancel_t handle_audio_timeout(void)
Definition: audio.c:3971
#define DEFAULT_AUDIO_SAMPS
Definition: audio.h:25
#define ASERVER_CMD_FILE_SEEK
Definition: audio.h:59
#define ASERVER_CMD_FILE_CLOSE
Definition: audio.h:58
#define is_realtime_aplayer(ptype)
Definition: audio.h:236
#define DEFAULT_AUDIO_CHANS
Definition: audio.h:24
#define DEFAULT_AUDIO_RATE
defaults for when not specifed
Definition: audio.h:23
@ RECA_EXTERNAL
Definition: audio.h:200
#define ASERVER_CMD_FILE_OPEN
Definition: audio.h:57
@ AUDIO_LOOP_FORWARD
Definition: audio.h:147
@ AUDIO_LOOP_PINGPONG
Definition: audio.h:148
void changed_fps_during_pb(LiVESSpinButton *spinbutton, livespointer user_data)
This is a super important function : almost everything related to velocity direction changes during p...
Definition: callbacks.c:10522
void unlock_loop_lock(void)
Definition: callbacks.c:4966
boolean show_sync_callback(LiVESAccelGroup *group, LiVESWidgetObject *obj, uint32_t keyval, LiVESXModifierType mod, livespointer keybd)
Definition: callbacks.c:11311
boolean reload_set(const char *set_name)
Definition: callbacks.c:5661
void update_sel_menu(void)
Definition: callbacks.c:9666
void switch_clip(int type, int newclip, boolean force)
Definition: callbacks.c:6900
LIVES_GLOBAL_INLINE void lives_notify_int(int msgnumber, int msgint)
Definition: callbacks.c:77
void on_toy_activate(LiVESMenuItem *menuitem, livespointer user_data)
Definition: callbacks.c:9550
void lives_exit(int signum)
Definition: callbacks.c:145
void lives_notify(int msgnumber, const char *msgstring)
Definition: callbacks.c:49
void on_capture2_activate(void)
Definition: callbacks.c:11635
boolean clip_can_reverse(int clipno)
Definition: callbacks.c:4980
void ce_thumbs_highlight_current_clip(void)
Definition: ce_thumbs.c:673
LIVES_GLOBAL_INLINE weed_layer_t * lives_layer_new_for_frame(int clip, frames_t frame)
Definition: colourspace.c:9833
LiVESPixbuf * layer_to_pixbuf(weed_layer_t *layer, boolean realpalette, boolean fordisplay)
LIVES_GLOBAL_INLINE void lives_layer_set_frame(weed_layer_t *layer, frames_t frame)
Definition: colourspace.c:9822
boolean letterbox_layer(weed_layer_t *layer, int nwidth, int nheight, int width, int height, LiVESInterpType interp, int tpal, int tclamp)
LIVES_GLOBAL_INLINE int * weed_layer_get_rowstrides(weed_layer_t *layer, int *nplanes)
boolean copy_pixel_data(weed_layer_t *layer, weed_layer_t *old_layer, size_t alignment)
Definition: colourspace.c:9843
LIVES_GLOBAL_INLINE int lives_layer_get_clip(weed_layer_t *layer)
Definition: colourspace.c:9705
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_free(weed_layer_t *layer)
frees pixel_data for a layer, then the layer itself
void lives_pixbuf_set_opaque(LiVESPixbuf *pixbuf)
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_set_palette_yuv(weed_layer_t *layer, int palette, int clamping, int sampling, int subspace)
Definition: colourspace.c:9812
boolean pixbuf_to_layer(weed_layer_t *layer, LiVESPixbuf *pixbuf)
turn a (Gdk)Pixbuf into a Weed layer
boolean pick_nice_colour(uint8_t r0, uint8_t g0, uint8_t b0, uint8_t *r1, uint8_t *g1, uint8_t *b1, double max, double lmin, double lmax)
Definition: colourspace.c:1142
LIVES_GLOBAL_INLINE int weed_layer_get_height(weed_layer_t *layer)
LIVES_GLOBAL_INLINE int weed_palette_get_nplanes(int pal)
Definition: colourspace.c:1417
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_new(int layer_type)
Definition: colourspace.c:9655
LIVES_GLOBAL_INLINE boolean weed_palette_is_valid(int pal)
Definition: colourspace.c:1374
LIVES_GLOBAL_INLINE boolean gamma_convert_layer(int gamma_type, weed_layer_t *layer)
LIVES_GLOBAL_INLINE uint8_t * weed_layer_get_pixel_data_packed(weed_layer_t *layer)
boolean convert_layer_palette(weed_layer_t *layer, int outpl, int op_clamping)
LIVES_GLOBAL_INLINE boolean weed_palette_is_yuv(int pal)
Definition: colourspace.c:1457
boolean create_empty_pixel_data(weed_layer_t *layer, boolean black_fill, boolean may_contig)
creates pixel data for layer
Definition: colourspace.c:9058
boolean weed_palette_is_lower_quality(int p1, int p2)
Definition: colourspace.c:2143
LIVES_GLOBAL_INLINE int weed_layer_get_flags(weed_layer_t *layer)
Definition: colourspace.c:9699
LIVES_GLOBAL_INLINE boolean weed_palette_has_alpha(int pal)
Definition: colourspace.c:1466
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_set_yuv_sampling(weed_layer_t *layer, int sampling)
Definition: colourspace.c:9798
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_set_size(weed_layer_t *layer, int width, int height)
Definition: colourspace.c:9731
boolean resize_layer(weed_layer_t *layer, int width, int height, LiVESInterpType interp, int opal_hint, int oclamp_hint)
resize a layer
LIVES_GLOBAL_INLINE int weed_layer_get_palette_yuv(weed_layer_t *layer, int *clamping, int *sampling, int *subspace)
LIVES_GLOBAL_INLINE int weed_palette_get_pixels_per_macropixel(int pal)
Definition: colourspace.c:1403
LIVES_GLOBAL_INLINE int weed_layer_get_rowstride(weed_layer_t *layer)
for packed palettes
LIVES_GLOBAL_INLINE void lives_layer_set_clip(weed_layer_t *layer, int clip)
Definition: colourspace.c:9828
LIVES_GLOBAL_INLINE void ** weed_layer_get_pixel_data(weed_layer_t *layer, int *nplanes)
LIVES_GLOBAL_INLINE boolean weed_palette_is_rgb(int pal)
Definition: colourspace.c:1448
weed_layer_t * weed_layer_create(int width, int height, int *rowstrides, int palette)
create a layer, setting the most important properties
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_set_gamma(weed_layer_t *layer, int gamma_type)
Definition: colourspace.c:9784
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_set_rowstrides(weed_layer_t *layer, int *rowstrides, int nplanes)
Definition: colourspace.c:9763
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_set_yuv_clamping(weed_layer_t *layer, int clamping)
Definition: colourspace.c:9791
LIVES_GLOBAL_INLINE frames_t lives_layer_get_frame(weed_layer_t *layer)
Definition: colourspace.c:9711
boolean gamma_convert_sub_layer(int gamma_type, double fileg, weed_layer_t *layer, int x, int y, int width, int height, boolean may_thread)
alter the transfer function of a Weed layer, from current value to gamma_type
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_set_palette(weed_layer_t *layer, int palette)
functions all return the input layer for convenience; no checking for valid values is done if layer i...
Definition: colourspace.c:9777
LIVES_GLOBAL_INLINE int weed_layer_get_width(weed_layer_t *layer)
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_set_yuv_subspace(weed_layer_t *layer, int subspace)
Definition: colourspace.c:9805
int weed_layer_get_gamma(weed_layer_t *layer)
LIVES_GLOBAL_INLINE int weed_layer_get_width_pixels(weed_layer_t *layer)
weed_layer_t * create_blank_layer(weed_layer_t *layer, const char *image_ext, int width, int height, int target_palette)
fills layer with default values.
Definition: colourspace.c:9611
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_nullify_pixel_data(weed_layer_t *layer)
Definition: colourspace.c:9753
boolean compact_rowstrides(weed_layer_t *layer)
void weed_layer_pixel_data_free(weed_layer_t *layer)
free pixel_data from layer
LIVES_GLOBAL_INLINE int weed_layer_get_palette(weed_layer_t *layer)
void init_colour_engine(void)
Definition: colourspace.c:1661
weed_layer_t * weed_layer_copy(weed_layer_t *dlayer, weed_layer_t *slayer)
copy source layer slayer to dest layer dlayer
LIVES_GLOBAL_INLINE int weed_layer_get_yuv_clamping(weed_layer_t *layer)
boolean convert_layer_palette_full(weed_layer_t *layer, int outpl, int oclamping, int osampling, int osubspace, int tgamma)
convert the palette of a layer
#define WEED_LAYER_TYPE_VIDEO
Definition: colourspace.h:221
#define WEED_LEAF_CLIP
Definition: colourspace.h:18
#define LIVES_LAYER_LOAD_IF_NEEDS_RESIZE
private flags
Definition: colourspace.h:259
#define LIVES_LAYER_GET_SIZE_ONLY
Definition: colourspace.h:260
#define WEED_LEAF_PIXEL_BITS
Definition: colourspace.h:23
#define WEED_LEAF_HOST_FLAGS
Definition: colourspace.h:24
#define WEED_LEAF_HOST_PIXBUF_SRC
Definition: colourspace.h:21
#define WEED_GAMMA_MONITOR
Definition: colourspace.h:253
#define DEF_SCREEN_GAMMA
Definition: colourspace.h:28
#define WEED_LEAF_HOST_SURFACE_SRC
Definition: colourspace.h:22
#define WEED_LEAF_RESIZE_THREAD
Definition: colourspace.h:25
#define WEED_LEAF_FRAME
Definition: colourspace.h:19
#define WEED_LAYER_ALPHA_PREMULT
Definition: colourspace.h:256
weed_plant_t weed_layer_t
Definition: colourspace.h:71
#define WEED_LEAF_PROGSCAN
Definition: colourspace.h:26
#define LIVES_LAYER_HAS_SIZE_NOW
Definition: colourspace.h:263
frames_t virtual_to_images(int sfileno, frames_t sframe, frames_t eframe, boolean update_progress, LiVESPixbuf **pbr)
Definition: cvirtual.c:719
boolean is_virtual_frame(int sfileno, frames_t frame)
Definition: cvirtual.c:1063
#define get_indexed_frame(clip, frame)
Definition: cvirtual.h:47
int test_palette_conversions(void)
Definition: diagnostics.c:1072
void check_random(void)
void lives_struct_test(void)
LiVESResponseType do_dir_perm_error(const char *dir_name, boolean allow_cancel)
Definition: dialogs.c:4247
LIVES_GLOBAL_INLINE void do_messages_window(boolean is_startup)
Definition: dialogs.c:3335
LIVES_GLOBAL_INLINE char * get_upd_msg(void)
Definition: dialogs.c:4490
LIVES_GLOBAL_INLINE LiVESResponseType do_info_dialog(const char *text)
Definition: dialogs.c:787
LiVESResponseType do_read_failed_error_s_with_retry(const char *fname, const char *errtext)
Definition: dialogs.c:4122
char * ds_warning_msg(const char *dir, char **mountpoint, uint64_t dsval, uint64_t cwarn, uint64_t nwarn)
Definition: dialogs.c:850
LIVES_GLOBAL_INLINE LiVESResponseType do_abort_ok_dialog(const char *text)
Definition: dialogs.c:720
LIVES_GLOBAL_INLINE boolean do_layout_recover_dialog(void)
Definition: dialogs.c:4698
LIVES_GLOBAL_INLINE void do_optarg_blank_err(const char *what)
Definition: dialogs.c:881
LiVESResponseType do_error_dialog_with_check(const char *text, uint64_t warn_mask_number)
Definition: dialogs.c:800
LIVES_GLOBAL_INLINE void do_bad_theme_error(const char *themefile)
Definition: dialogs.c:4474
LIVES_GLOBAL_INLINE void do_upgrade_error_dialog(void)
Definition: dialogs.c:3358
char * ds_critical_msg(const char *dir, char **mountpoint, uint64_t dsval)
warn about disk space
Definition: dialogs.c:822
LIVES_GLOBAL_INLINE LiVESResponseType do_error_dialog(const char *text)
Definition: dialogs.c:749
void threaded_dialog_spin(double fraction)
Definition: dialogs.c:3823
LIVES_GLOBAL_INLINE void do_abortblank_error(const char *what)
Definition: dialogs.c:873
boolean pconx_chain_data(int key, int mode, boolean is_audio_thread)
boolean cconx_chain_data(int key, int mode)
#define FX_DATA_KEY_PLAYBACK_PLUGIN
Definition: effects-data.h:12
LIVES_GLOBAL_INLINE int filter_mutex_unlock(int key)
Definition: effects-weed.c:108
int best_palette_match(int *palette_list, int num_palettes, int palette)
check palette vs.
Definition: effects-weed.c:868
void weed_load_all(void)
load effects
boolean has_video_filters(boolean analysers_only)
weed_error_t weed_leaf_delete_host(weed_plant_t *plant, const char *key)
int weed_filter_highest_version(const char *pkg, const char *fxname, const char *auth, int *xversion)
void weed_generator_end(weed_plant_t *inst)
int weed_get_idx_for_hashname(const char *hashname, boolean fullname)
fullname includes author and version
LIVES_GLOBAL_INLINE int filter_mutex_trylock(int key)
Definition: effects-weed.c:74
weed_plant_t * weed_layer_create_from_generator(weed_plant_t *inst, weed_timecode_t tc, int clipno)
void rte_swap_fg_bg(void)
weed_plant_t * weed_apply_effects(weed_plant_t **layers, weed_plant_t *filter_map, weed_timecode_t tc, int opwidth, int opheight, void ***pchains)
weed_error_t weed_plant_free_host(weed_plant_t *plant)
weed_error_t weed_leaf_set_host(weed_plant_t *plant, const char *key, uint32_t seed_type, weed_size_t num_elems, void *values)
weed_plant_t * get_weed_filter(int idx)
weed_plant_t * add_filter_init_events(weed_plant_t *event_list, weed_timecode_t tc)
add init events for every effect which is switched on
Definition: effects-weed.c:839
boolean has_audio_filters(lives_af_t af_type)
#define WEED_LEAF_HOST_SCRAP_FILE_OFFSET
Definition: effects-weed.h:88
#define LIVES_FLAG_MAINTAIN_VALUE
soft flag, like immutable / deletable for host
Definition: effects-weed.h:109
#define WEED_LEAF_HOST_KEY
Definition: effects-weed.h:67
void deinterlace_frame(weed_layer_t *layer, weed_timecode_t tc)
Definition: effects.c:920
weed_plant_t * on_rte_apply(weed_layer_t *layer, int opwidth, int opheight, weed_timecode_t tc)
Definition: effects.c:879
void get_blend_layer(weed_timecode_t tc)
Definition: effects.c:861
@ AF_TYPE_ANY
Definition: effects.h:41
void get_active_track_list(int *clip_index, int num_tracks, weed_plant_t *filter_map)
Definition: events.c:3008
weed_plant_t * get_last_frame_event(weed_plant_t *event_list)
Definition: events.c:419
weed_plant_t * append_marker_event(weed_plant_t *event_list, weed_timecode_t tc, int marker_type)
Definition: events.c:1382
weed_plant_t * get_prev_frame_event(weed_plant_t *event)
Definition: events.c:368
void insert_audio_event_at(weed_plant_t *event, int track, int clipnum, double seek, double vel)
Definition: events.c:1243
boolean deal_with_render_choice(boolean add_deinit)
Definition: events.c:5159
LIVES_GLOBAL_INLINE weed_plant_t * get_last_event(weed_plant_t *event_list)
Definition: events.c:124
boolean backup_recording(char **esave_file, char **asave_file)
Definition: events.c:5028
void event_list_free(weed_plant_t *event_list)
Definition: events.c:2313
weed_plant_t * append_frame_event(weed_plant_t *event_list, weed_timecode_t tc, int numframes, int *clips, int64_t *frames)
Definition: events.c:2610
LIVES_GLOBAL_INLINE weed_plant_t * insert_blank_frame_event_at(weed_plant_t *event_list, weed_timecode_t tc, weed_plant_t **shortcut)
Definition: events.c:1472
weed_event_t * lives_event_list_new(weed_event_t *elist, const char *cdate)
lib-ish stuff
Definition: events.c:240
#define EVENT_MARKER_RECORD_START
Definition: events.h:355
render_details * rdet
Definition: events.h:256
weed_plant_t weed_event_t
Definition: events.h:97
#define WEED_LEAF_OVERLAY_TEXT
Definition: events.h:90
@ LIVES_RENDER_ERROR_NONE
Definition: events.h:101
void reset_message_area(void)
Definition: gui.c:4734
void splash_msg(const char *msg, double pct)
Definition: gui.c:4687
void show_lives(void)
Definition: gui.c:3006
LIVES_GLOBAL_INLINE boolean get_play_screen_size(int *opwidth, int *opheight)
Definition: gui.c:3937
void set_interactive(boolean interactive)
Definition: gui.c:3072
void make_preview_box(void)
Definition: gui.c:3515
void play_window_set_title(void)
Definition: gui.c:3722
void create_LiVES(void)
Definition: gui.c:366
void resize_play_window(void)
Definition: gui.c:4349
void get_letterbox_sizes(int *pwidth, int *pheight, int *lb_width, int *lb_height, boolean player_can_upscale)
calculate sizes for letterboxing
Definition: gui.c:4406
void remove_from_clipmenu(void)
Definition: gui.c:4560
LIVES_GLOBAL_INLINE int get_vspace(void)
Definition: gui.c:55
void splash_end(void)
Definition: gui.c:4712
void splash_init(void)
Definition: gui.c:4605
double lives_ce_update_timeline(int frame, double x)
pointer position in timeline
Definition: interface.c:207
boolean msg_area_config(LiVESWidget *widget)
Definition: interface.c:6938
void show_playbar_labels(int clipno)
Definition: interface.c:77
void redraw_timeline(int clipno)
Definition: interface.c:3412
boolean get_screen_usable_size(int *w, int *h)
Definition: interface.c:6853
void run_diskspace_dialog(void)
Definition: interface.c:6445
void msg_area_scroll(LiVESAdjustment *adj, livespointer userdata)
Definition: interface.c:7284
LIVES_GLOBAL_INLINE void msg_area_scroll_to_end(LiVESWidget *widget, LiVESAdjustment *adj)
Definition: interface.c:7277
boolean do_audio_choice_dialog(short startup_phase)
Definition: startup.c:500
boolean ext_triggers_poll(livespointer data)
poll for external playback start
Definition: keyboard.c:67
uint16_t cached_mod
Definition: keyboard.h:11
#define DEF_MIDI_RPT
allowed non-reads between reads (raw MIDI only)
Definition: keyboard.h:83
#define EXT_TRIGGER_INTERVAL
Definition: keyboard.h:74
#define DEF_MIDI_CHECK_RATE
default MIDI checks per keyboard cycle (i.e.
Definition: keyboard.h:80
uint16_t cached_key
Definition: keyboard.h:10
void lives_yuv_stream_stop_read(lives_yuv4m_t *yuv4mpeg)
void weed_layer_set_from_yuv4m(weed_layer_t *layer, lives_clip_t *sfile)
void on_open_yuv4m_activate(LiVESMenuItem *menuitem, livespointer user_data)
error("LSD_RANDFUNC(ptr, size) must be defined")
boolean show_desktop_panel(void)
LIVES_GLOBAL_INLINE int lives_getgid(void)
LIVES_GLOBAL_INLINE boolean lives_strcmp(const char *st1, const char *st2)
returns FALSE if strings match
boolean get_x11_visible(const char *wname)
boolean get_distro_dets(void)
char * get_md5sum(const char *filename)
Definition: machinestate.c:646
weed_plantptr_t lives_proc_thread_t
lives proc_threads API
char * get_mountpoint_for(const char *dir)
lives_thread_data_t * lives_thread_data_create(uint64_t idx)
boolean activate_x11_window(const char *wid)
LIVES_GLOBAL_INLINE int64_t disk_monitor_wait_result(const char *dir, ticks_t timeout)
Definition: machinestate.c:742
lives_proc_thread_t disk_monitor_start(const char *dir)
Definition: machinestate.c:717
boolean init_memfuncs(void)
Definition: machinestate.c:630
LIVES_GLOBAL_INLINE size_t lives_strlen(const char *s)
off_t sget_file_size(const char *name)
Definition: machinestate.c:962
void init_random()
Definition: machinestate.c:92
void lives_threadpool_init(void)
void disk_monitor_forget(void)
Definition: machinestate.c:769
LIVES_GLOBAL_INLINE ticks_t lives_get_current_ticks(void)
Definition: machinestate.c:835
int get_num_cpus(void)
boolean disk_monitor_running(const char *dir)
Definition: machinestate.c:715
LIVES_GLOBAL_INLINE int lives_strappend(const char *string, int len, const char *xnew)
LIVES_GLOBAL_INLINE int lives_getuid(void)
boolean get_machine_dets(void)
int64_t disk_monitor_check_result(const char *dir)
Definition: machinestate.c:726
lives_storage_status_t get_storage_status(const char *dir, uint64_t warn_level, int64_t *dsval, int64_t ds_resvd)
Definition: machinestate.c:693
LIVES_GLOBAL_INLINE pid_t lives_getpid(void)
LIVES_GLOBAL_INLINE void lives_proc_thread_join(lives_proc_thread_t tinfo)
LIVES_GLOBAL_INLINE char * lives_chomp(char *buff)
LIVES_GLOBAL_INLINE boolean lives_strncmp(const char *st1, const char *st2, size_t len)
returns FALSE if strings match
LIVES_GLOBAL_INLINE char * lives_concat(char *st, char *x)
LIVES_GLOBAL_INLINE ticks_t lives_get_relative_ticks(ticks_t origsecs, ticks_t orignsecs)
Definition: machinestate.c:813
int64_t get_cpu_load(int cpun)
percent * 1 million
uint64_t lives_thread_join(lives_thread_t work, void **retval)
boolean get_wm_caps(void)
int check_for_bad_ffmpeg(void)
lives_proc_thread_t lives_proc_thread_create(lives_thread_attr_t attr, lives_funcptr_t func, int return_type, const char *args_fmt,...)
create the specific plant which defines a background task to be run
int lives_thread_create(lives_thread_t *thread, lives_thread_attr_t attr, lives_funcptr_t func, void *arg)
void reget_afilesize(int fileno)
Definition: machinestate.c:972
#define LIVES_THRDATTR_PRIORITY
Definition: machinestate.h:439
#define WEED_LEAF_MD5SUM
Definition: machinestate.h:193
LiVESList lives_thread_t
Definition: machinestate.h:434
#define WEED_LEAF_SIGNAL_DATA
Definition: machinestate.h:422
#define lives_nanosleep(nanosec)
Definition: machinestate.h:307
#define lives_calloc
Definition: machinestate.h:67
@ LIVES_STORAGE_STATUS_CRITICAL
Definition: machinestate.h:185
@ LIVES_STORAGE_STATUS_NORMAL
Definition: machinestate.h:183
@ LIVES_STORAGE_STATUS_WARNING
Definition: machinestate.h:184
@ LIVES_STORAGE_STATUS_UNKNOWN
Definition: machinestate.h:182
@ LIVES_STORAGE_STATUS_OVER_QUOTA
Definition: machinestate.h:187
#define LIVES_THRDATTR_NO_GUI
Definition: machinestate.h:442
#define THREADVAR(var)
Definition: machinestate.h:531
#define lives_free
Definition: machinestate.h:52
#define lives_memset
Definition: machinestate.h:61
uint64_t lives_thread_attr_t
Definition: machinestate.h:435
#define lives_malloc
Definition: machinestate.h:46
#define lives_memcpy
Definition: machinestate.h:55
#define WEED_LEAF_SIGNALLED
Definition: machinestate.h:421
void *(* lives_funcptr_t)(void *)
Definition: machinestate.h:378
#define PRId64
Definition: machinestate.h:169
#define WEED_LEAF_THREAD_PROCESSING
Definition: machinestate.h:414
#define LIVES_THRDATTR_NONE
Definition: machinestate.h:437
void defer_sigint(int signum)
Definition: main.c:282
boolean startup_message_nonfatal_dismissable(const char *msg, uint64_t warning_mask)
Definition: main.c:4995
int main(int argc, char *argv[])
Definition: main.c:6198
boolean startup_message_info(const char *msg)
Definition: main.c:4987
LIVES_GLOBAL_INLINE void free_track_decoders(void)
Definition: main.c:7826
void load_end_image(int frame)
Definition: main.c:5922
LIVES_GLOBAL_INLINE boolean startup_message_nonfatal(const char *msg)
Definition: main.c:4980
void set_drawing_area_from_pixbuf(LiVESWidget *widget, LiVESPixbuf *pixbuf, lives_painter_surface_t *surface)
Definition: main.c:5525
void sensitize(void)
Definition: main.c:5078
void load_start_image(int frame)
Definition: main.c:5650
_palette * palette
interface colour settings
Definition: main.c:101
boolean resize_message_area(livespointer data)
Definition: main.c:3588
LiVESPixbuf * pull_lives_pixbuf_at_size(int clip, int frame, const char *image_ext, weed_timecode_t tc, int width, int height, LiVESInterpType interp, boolean fordisp)
Definition: main.c:7678
void catch_sigint(int signum)
Definition: main.c:296
ssize_t sizdbl
Definition: main.c:102
void procw_desensitize(void)
Definition: main.c:5445
#define SHOWDETx(cap, exec)
Definition: main.c:2312
void set_signal_handlers(SignalHandlerPointer sigfunc)
Definition: main.c:4077
boolean set_palette_colours(boolean force_reload)
Definition: main.c:2663
void load_frame_image(int frame)
Definition: main.c:7984
void showclipimgs(void)
Definition: main.c:5636
void resize(double scale)
Definition: main.c:10230
void load_preview_image(boolean update_always)
Definition: main.c:6205
#define USEC_WAIT_FOR_SYNC
Definition: main.c:7919
void startup_message_fatal(char *msg)
Definition: main.c:4962
void init_track_decoders(void)
Definition: main.c:7816
ssize_t sizint
type sizes
Definition: main.c:102
void sensitize_rfx(void)
Definition: main.c:5036
LIVES_GLOBAL_INLINE boolean pull_frame(weed_layer_t *layer, const char *image_ext, weed_timecode_t tc)
pull a frame from an external source into a layer the WEED_LEAF_CLIP and WEED_LEAF_FRAME leaves must ...
Definition: main.c:7500
void set_main_title(const char *file, int untitled)
Definition: main.c:5005
void break_me(const char *brkstr)
Definition: main.c:159
ssize_t sizshrt
Definition: main.c:102
#define SHOWDET(cap)
Definition: main.c:2313
void * gtk_thread_wrapper(void *data)
Definition: main.c:167
boolean check_layer_ready(weed_layer_t *layer)
block until layer pixel_data is ready.
Definition: main.c:7528
void * lives_pixbuf_save_threaded(void *args)
save frame to pixbuf in a thread.
Definition: main.c:9365
void print_opthelp(void)
Definition: main.c:3342
LIVES_GLOBAL_INLINE LiVESPixbuf * pull_lives_pixbuf(int clip, int frame, const char *image_ext, weed_timecode_t tc)
Definition: main.c:7715
mainwindow * mainw
Definition: main.c:103
void desensitize(void)
Definition: main.c:5302
capability * get_capabilities(void)
Definition: main.c:3023
boolean switch_audio_clip(int new_file, boolean activate)
Definition: main.c:9808
void switch_to_file(int old_file, int new_file)
Definition: main.c:9646
void do_quick_switch(int new_file)
Definition: main.c:10066
boolean render_choice_idle(livespointer data)
Definition: main.c:3454
boolean pull_frame_at_size(weed_layer_t *layer, const char *image_ext, weed_timecode_t tc, int width, int height, int target_palette)
Definition: main.c:7172
void replace_with_delegates(void)
Definition: main.c:1090
void get_monitors(boolean reset)
Definition: main.c:400
LiVESTargetEntry target_table[]
Definition: main.c:141
boolean lives_pixbuf_save(LiVESPixbuf *pixbuf, char *fname, lives_img_type_t imgtype, int quality, int width, int height, LiVESError **gerrorptr)
Save a pixbuf to a file using the specified imgtype and the specified quality/compression value.
Definition: main.c:9304
void pull_frame_threaded(weed_layer_t *layer, const char *img_ext, weed_timecode_t tc, int width, int height)
Definition: main.c:7631
int real_main(int argc, char *argv[], pthread_t *gtk_thread, ulong id)
Definition: main.c:4111
void get_player_size(int *opwidth, int *opheight)
Definition: main.c:7720
boolean lazy_startup_checks(void *data)
Definition: main.c:3480
#define BFC_LIMIT
boolean weed_layer_create_from_file_progressive(weed_layer_t *layer, const char *fname, int width, int height, int tpalette, const char *img_ext)
Definition: main.c:6989
void close_current_file(int file_to_switch_to)
close current file, and try to switch to file_to_switch_to
Definition: main.c:9373
ssize_t lives_read_buffered(int fd, void *buf, ssize_t count, boolean allow_less)
Definition: utils.c:924
#define LIVES_WARN(x)
Definition: main.h:1862
void clear_mainw_msg(void)
Definition: utils.c:1435
int lives_close_buffered(int fd)
Definition: utils.c:716
weed_leaf_get_f _weed_leaf_get
Definition: main.h:365
int frames_t
Definition: main.h:99
boolean load_from_scrap_file(weed_layer_t *layer, int frame)
Definition: saveplay.c:5360
int get_frame_count(int idx, int xsize)
sets mainw->files[idx]->frames with current framecount
Definition: utils.c:3109
void get_basename(char *filename)
Definition: utils.c:3194
ssize_t lives_popen(const char *com, boolean allow_error, char *buff, ssize_t buflen)
Definition: utils.c:194
void do_jack_noopen_warn3(void)
#define CLIP_HAS_AUDIO(clip)
Definition: main.h:817
char * get_untitled_name(int number)
Definition: saveplay.c:3802
void(* SignalHandlerPointer)(int)
Definition: main.h:1464
#define clipboard
Definition: main.h:1835
void lives_list_free_all(LiVESList **)
Definition: utils.c:4873
#define LIVES_EXT_SRC_DECODER
Definition: main.h:1044
void get_play_times(void)
recalculate video / audio lengths and draw the timer bars
Definition: utils.c:3672
size_t get_token_count(const char *string, int delim)
Definition: utils.c:5430
#define is_layer_ready(layer)
Definition: main.h:1485
@ NEVER_STOP
Definition: main.h:693
#define MAX_FILES
max files is actually 1 more than this, since file 0 is the clipboard
Definition: main.h:184
weed_leaf_get_flags_f _weed_leaf_get_flags
Definition: main.h:372
void cached_list_free(LiVESList **list)
Definition: utils.c:4881
int lives_touch(const char *tfile)
Definition: utils.c:4455
#define LIVES_COPYRIGHT_YEARS
Definition: main.h:198
#define LIVES_GLOBAL_INLINE
Definition: main.h:239
#define CURRENT_CLIP_IS_CLIPBOARD
Definition: main.h:848
ticks_t lives_get_current_playback_ticks(ticks_t origsecs, ticks_t origusecs, lives_time_source_t *time_source)
Definition: utils.c:1481
boolean ensure_isdir(char *fname)
Definition: utils.c:3346
@ CANCEL_KILL
normal - kill background processes working on current clip
Definition: main.h:759
#define ANNOY_DISPLAY
Definition: main.h:441
#define ANNOY_FS
Definition: main.h:449
#define BACKEND_NAME
Definition: main.h:1132
#define LIVES_IS_PLAYING
Definition: main.h:840
#define IS_NORMAL_CLIP(clip)
Definition: main.h:833
void close_scrap_file(boolean remove)
Definition: saveplay.c:5583
#define INT_CLAMP(i, min, max)
Definition: main.h:280
int add_messages_to_list(const char *text)
Definition: utils.c:2416
void close_ascrap_file(boolean remove)
Definition: saveplay.c:5612
int lives_utf8_strcasecmp(const char *s1, const char *s2)
Definition: utils.c:5458
boolean lives_make_writeable_dir(const char *newdir)
Definition: utils.c:5721
const char * image_ext_to_lives_image_type(const char *img_ext)
Definition: utils.c:3039
void do_jack_noopen_warn4(void)
ulong deduce_file(const char *filename, double start_time, int end)
Definition: saveplay.c:238
weed_leaf_delete_f _weed_leaf_delete
Definition: main.h:375
#define CURRENT_CLIP_TOTAL_TIME
Definition: main.h:846
int lives_open3(const char *pathname, int flags, mode_t mode)
Definition: utils.c:94
#define CURRENT_CLIP_HAS_AUDIO
Definition: main.h:818
boolean open_scrap_file(void)
Definition: saveplay.c:5230
boolean lives_setenv(const char *name, const char *value)
Definition: utils.c:120
boolean lives_alarm_clear(lives_alarm_t alarm_handle)
Definition: utils.c:1732
#define ulong
Definition: main.h:178
#define LIVES_LOCAL_INLINE
Definition: main.h:246
int lives_system(const char *com, boolean allow_error)
Definition: utils.c:145
void switch_aud_to_none(boolean set_pref)
Definition: utils.c:4001
#define WEED_LEAF_HOST_TC
Definition: main.h:800
#define sig(a)
Definition: main.h:268
boolean weed_threadsafe
Definition: main.h:634
#define AFORM_UNSIGNED
Definition: main.h:786
#define WARN_FILE_SIZE
LiVES will show a warning if this (MBytes) is exceeded on load (can be overridden in prefs)
Definition: main.h:215
int weed_abi_version
Definition: main.h:635
char * lives_fgets(char *s, int size, FILE *stream)
Definition: utils.c:368
int close_temp_handle(int new_clip)
close cfile and switch to new clip (may be -1)
Definition: saveplay.c:3498
const char * get_image_ext_for_type(lives_img_type_t imgtype)
Definition: utils.c:3025
LiVESInterpType get_interp_value(short quality, boolean low_for_mt)
Definition: utils.c:5744
#define FPS_MAX
maximum fps we will allow (double)
Definition: main.h:218
int lives_open_buffered_rdonly(const char *pathname)
Definition: utils.c:636
#define RES_HIDE
Definition: main.h:456
lives_img_type_t lives_image_type_to_img_type(const char *lives_image_type)
Definition: utils.c:3046
#define CURRENT_CLIP_HAS_VIDEO
Definition: main.h:815
void do_jack_noopen_warn(void)
lives_alarm_t lives_alarm_set(ticks_t ticks)
set alarm for now + delta ticks (10 nanosec) param ticks (10 nanoseconds) is the offset when we want ...
Definition: utils.c:1643
char * get_val_from_cached_list(const char *key, size_t maxlen, LiVESList *cache)
Definition: utils.c:4966
void set_sel_label(LiVESWidget *label)
Definition: utils.c:4838
@ LIVES_DIRECTION_REVERSE
Definition: main.h:852
#define IS_VALID_CLIP(clip)
Definition: main.h:808
int verhash(char *version)
Definition: utils.c:4755
void get_location(const char *exe, char *val, int maxlen)
Definition: utils.c:3407
int64_t ticks_t
Definition: main.h:97
LiVESList * cache_file_contents(const char *filename)
Definition: utils.c:4909
#define CURRENT_CLIP_IS_NORMAL
Definition: main.h:838
weed_leaf_seed_type_f _weed_leaf_seed_type
Definition: main.h:371
weed_plant_new_f _weed_plant_new
Definition: main.h:367
#define IMG_BUFF_SIZE
256 * 1024 < chunk size for reading images
Definition: main.h:1062
weed_leaf_set_flags_f _weed_leaf_set_flags
Definition: main.h:374
capability * capable
Definition: main.h:627
weed_leaf_set_f _weed_leaf_set
Definition: main.h:366
#define RESTYPE_ACTION
Definition: main.h:462
weed_plant_free_f _weed_plant_free
Definition: main.h:373
@ UNCHECKED
Definition: main.h:393
@ PRESENT
Definition: main.h:394
#define cfile
Definition: main.h:1833
int save_to_scrap_file(weed_layer_t *layer)
Definition: saveplay.c:5569
int lives_open2(const char *pathname, int flags)
Definition: utils.c:99
@ LIVES_INTERLACE_NONE
Definition: main.h:791
void reset_clipmenu(void)
Definition: utils.c:4290
void d_print(const char *fmt,...)
Definition: utils.c:2542
#define LIVES_ERROR(x)
Definition: main.h:1870
lives_img_type_t
Definition: main.h:774
@ IMG_TYPE_PNG
Definition: main.h:777
@ IMG_TYPE_JPEG
Definition: main.h:776
void do_jack_noopen_warn2(void)
#define WEED_LEAF_HOST_PTHREAD
Definition: main.h:802
boolean check_for_executable(lives_checkstatus_t *cap, const char *exec)
Definition: utils.c:3434
#define PREFIX_DEFAULT
this must match AC_PREFIX_DEFAULT in configure.in TODO - when lives-plugins is a separate package,...
Definition: main.h:189
void lives_buffered_rdonly_slurp(int fd, off_t skip)
Definition: utils.c:671
weed_leaf_num_elements_f _weed_leaf_num_elements
Definition: main.h:369
uint64_t get_version_hash(const char *exe, const char *sep, int piece)
Definition: utils.c:3475
#define AFORM_BIG_ENDIAN
Definition: main.h:787
#define CURRENT_CLIP_IS_VALID
Definition: main.h:809
weed_leaf_element_size_f _weed_leaf_element_size
Definition: main.h:370
ssize_t lives_readlink(const char *path, char *buf, size_t bufsiz)
Definition: utils.c:104
#define PREFIX
if –prefix= was not set, this is set to "NONE"
Definition: main.h:194
boolean switch_aud_to_sox(boolean set_pref)
Definition: utils.c:3944
char * ensure_extension(const char *fname, const char *ext) WARN_UNUSED
Definition: utils.c:3232
void calc_maxspect(int rwidth, int rheight, int *cwidth, int *cheight)
Definition: utils.c:2174
#define WEED_LEAF_HOST_DEINTERLACE
Definition: main.h:799
#define PATH_MAX
Definition: main.h:255
boolean lives_freep(void **ptr)
Definition: utils.c:1411
boolean is_legal_set_name(const char *set_name, boolean allow_dupes, boolean leeway)
Definition: utils.c:2975
@ CLIP_TYPE_VIDEODEV
frames from video device
Definition: main.h:771
@ CLIP_TYPE_LIVES2LIVES
type for LiVES to LiVES streaming
Definition: main.h:770
@ CLIP_TYPE_YUV4MPEG
yuv4mpeg stream
Definition: main.h:769
@ CLIP_TYPE_FILE
unimported video, not or partially broken in frames
Definition: main.h:765
@ CLIP_TYPE_TEMP
temp type, for internal use only
Definition: main.h:768
@ CLIP_TYPE_GENERATOR
frames from generator plugin
Definition: main.h:766
@ CLIP_TYPE_DISK
imported video, broken into frames
Definition: main.h:764
@ CLIP_TYPE_NULL_VIDEO
generates blank video frames
Definition: main.h:767
boolean check_for_recovery_files(boolean auto_recover)
Definition: saveplay.c:6550
void zero_spinbuttons(void)
Definition: utils.c:3807
#define LIVES_FATAL(x)
Definition: main.h:1886
char * get_dir(const char *filename)
Definition: utils.c:3185
#define WEED_LEAF_HOST_DECODER
Definition: main.h:801
char * make_image_file_name(lives_clip_t *clip, frames_t frame, const char *img_ext)
lives_image_type can be a string, lives_img_type_t is an enumeration
Definition: utils.c:3053
ulong open_file(const char *filename)
Definition: saveplay.c:261
ticks_t lives_alarm_check(lives_alarm_t alarm_handle)
Definition: utils.c:1687
@ CANCEL_PREVIEW_FINISHED
effect processing finished during preview
Definition: main.h:710
@ CANCEL_GENERATOR_END
generator was stopped
Definition: main.h:728
@ CANCEL_KEEP_LOOPING
special cancel for TV toy
Definition: main.h:755
@ CANCEL_NONE
no cancel
Definition: main.h:701
@ CANCEL_KEEP
user pressed 'Keep'
Definition: main.h:734
@ CANCEL_NO_MORE_PREVIEW
ran out of preview frames
Definition: main.h:716
@ CANCEL_CAPTURE_ERROR
image could not be captured
Definition: main.h:719
int calc_frame_from_time(int filenum, double time)
nearest frame [1, frames]
Definition: utils.c:1759
weed_plant_list_leaves_f _weed_plant_list_leaves
Definition: main.h:368
#define MAINW_MSG_SIZE
mainw->msg bytesize
Definition: mainwindow.h:702
#define THEME_DETAIL_MT_TLREG
Definition: mainwindow.h:286
#define THEME_DETAIL_SEPWIN_IMAGE
Definition: mainwindow.h:274
#define LIVES_SIGABRT
Definition: mainwindow.h:1859
#define DEF_FRAME_VSIZE_UNSCALED
Definition: mainwindow.h:144
@ LIVES_TOY_NONE
Definition: mainwindow.h:234
@ LIVES_TOY_MAD_FRAMES
Definition: mainwindow.h:235
@ LIVES_TOY_TV
Definition: mainwindow.h:236
#define EXEC_XDOTOOL
Definition: mainwindow.h:427
#define STOCK_ICONS_DIR
Definition: mainwindow.h:613
#define LIVES_THEME_COMPACT
Definition: mainwindow.h:270
#define THEME_DETAIL_FXCOL
Definition: mainwindow.h:285
#define USE_LIVES_THEMEING
Definition: mainwindow.h:268
#define THEME_DETAIL_MT_MARK
Definition: mainwindow.h:287
#define STYLE_PLAIN
no theme (theme 'none')
Definition: mainwindow.h:298
#define THEME_DETAIL_ALT_BACK
Definition: mainwindow.h:279
#define LIVES_IMAGE_TYPE_JPEG
Definition: mainwindow.h:479
#define THEME_DETAIL_INFO_TEXT
Definition: mainwindow.h:280
#define ALL_USED
Definition: mainwindow.h:192
#define LIVES_SHORT_TIMEOUT
Definition: mainwindow.h:42
#define EXEC_DU
Definition: mainwindow.h:408
#define EXEC_JACKD
recommended if (!have_pulseaudio)
Definition: mainwindow.h:417
#define LIVES_SIGINT
Definition: mainwindow.h:1855
#define EXEC_SOX
Definition: mainwindow.h:391
@ MAX_EXT_CNTL
Definition: mainwindow.h:221
#define LIVES_STATUS_FILE_NAME
Definition: mainwindow.h:532
#define EXEC_PULSEAUDIO
Definition: mainwindow.h:392
#define LIVES_SIGTRAP
Definition: mainwindow.h:1857
#define EXEC_WMCTRL
Definition: mainwindow.h:426
#define EXEC_GZIP
Definition: mainwindow.h:407
#define THEME_DETAIL_MT_TCFG
Definition: mainwindow.h:289
#define DEF_SCRATCHFWD_AMOUNT
Definition: mainwindow.h:54
#define LIVES_MAX_ALARMS
Definition: mainwindow.h:1633
#define EXEC_DVGRAB
Definition: mainwindow.h:418
#define DEF_BLENDCHANGE_AMOUNT
adjustment amount for effect parameter via keyboard (TODO: make pref)
Definition: mainwindow.h:57
#define LIVES_SHORTEST_TIMEOUT
Definition: mainwindow.h:41
#define EFFECT_NONE
Definition: mainwindow.h:208
#define TICKS_PER_SECOND
ticks per second - GLOBAL TIMEBASE
Definition: mainwindow.h:36
#define THEME_SEP_IMG_LITERAL
Definition: mainwindow.h:547
#define THEME_DETAIL_ALT_FORE
Definition: mainwindow.h:278
#define THEME_HEADER_2
Definition: mainwindow.h:550
#define EXEC_XDG_SCREENSAVER
Definition: mainwindow.h:424
#define LIVES_IS_INTERACTIVE
Definition: mainwindow.h:1710
#define LIVES_DEF_CONFIG_FILE
in LIVES_DEF_CONFIG_DIR unless overridden
Definition: mainwindow.h:608
#define PLUGIN_EXEC_DIR
Definition: mainwindow.h:599
#define DEF_FRAME_HSIZE_UNSCALED
Definition: mainwindow.h:139
#define SCRATCH_NONE
Definition: mainwindow.h:1027
#define DEF_FPS
Definition: mainwindow.h:47
#define TEMPFILE_MARKER
Definition: mainwindow.h:574
#define LIVES_THEME_DARK
Definition: mainwindow.h:269
#define LIVES_SIGTERM
Definition: mainwindow.h:1862
#define EXEC_GDB
Definition: mainwindow.h:421
#define LIVES_MAIN_WINDOW_WIDGET
Definition: mainwindow.h:188
#define DEF_IDLE_MAX
Definition: mainwindow.h:1740
#define EXEC_IDENTIFY
Definition: mainwindow.h:395
#define TICKS_PER_SECOND_DBL
actually microseconds / 100.
Definition: mainwindow.h:37
#define FX_KEYS_PHYSICAL_EXTRA
Definition: mainwindow.h:199
#define DEF_FPSCHANGE_AMOUNT
rate to change pb fps when faster/slower pressed (TODO: make pref)
Definition: mainwindow.h:50
#define THEME_DETAIL_FRAMEBLANK_IMAGE
Definition: mainwindow.h:275
#define MIN_MSG_AREA_SCRNHEIGHT
Definition: mainwindow.h:136
#define EXEC_FFPROBE
Definition: mainwindow.h:396
#define DEF_DL_BANDWIDTH
Kb / sec.
Definition: mainwindow.h:61
#define THEME_DETAIL_CE_SEL
Definition: mainwindow.h:292
#define LIVES_DEVICEMAP_DIR
Definition: mainwindow.h:615
@ LIVES_STRING_CONSTANT_CUSTOM
Definition: mainwindow.h:376
@ LIVES_STRING_CONSTANT_BUILTIN
Definition: mainwindow.h:375
@ LIVES_STRING_CONSTANT_DISABLED
Definition: mainwindow.h:373
@ LIVES_STRING_CONSTANT_RECOMMENDED
Definition: mainwindow.h:372
@ LIVES_STRING_CONSTANT_TEST
Definition: mainwindow.h:377
@ LIVES_STRING_CONSTANT_NONE
Definition: mainwindow.h:371
@ LIVES_STRING_CONSTANT_CL
"the current layout"
Definition: mainwindow.h:374
@ LIVES_STRING_CONSTANT_ANY
Definition: mainwindow.h:370
#define PRV_START
Definition: mainwindow.h:1313
#define THEME_DETAIL_MT_EVBOX
Definition: mainwindow.h:288
#define EXEC_YOUTUBE_DL
Definition: mainwindow.h:399
#define LIVES_FILE_EXT_PNG
Definition: mainwindow.h:487
#define THEME_DETAIL_AUDCOL
Definition: mainwindow.h:283
#define PRV_END
Definition: mainwindow.h:1314
#define SPLASH_LEVEL_LOAD_APLAYER
Definition: mainwindow.h:1600
#define LIVES_FILE_EXT_TMP
Definition: mainwindow.h:486
#define LIVES_SENSE_STATE_INTERACTIVE
Definition: mainwindow.h:1708
#define DESKTOP_ICON_DIR
Definition: mainwindow.h:601
#define EXEC_MPLAYER2
Definition: mainwindow.h:387
#define PT_LAZY_DSUSED
Definition: mainwindow.h:683
#define MENU_HIDE_LIM
Definition: mainwindow.h:86
#define LIVES_DEF_DCLICK_DIST
default double click dist. (pixels), can be overriden by system settings
Definition: mainwindow.h:214
#define STYLE_LIGHT
Definition: mainwindow.h:304
#define THEME_DETAIL_INFO_BASE
Definition: mainwindow.h:281
#define THEME_DETAIL_MT_TCBG
Definition: mainwindow.h:290
#define EXEC_GCONFTOOL_2
Definition: mainwindow.h:423
#define THEME_FRAME_IMG_LITERAL
Definition: mainwindow.h:548
#define EXEC_YOUTUBE_DLC
Definition: mainwindow.h:400
#define LIVES_FILE_EXT_MGK
Definition: mainwindow.h:489
#define THEME_DIR
Definition: mainwindow.h:595
#define FX_KEYS_MAX_VIRTUAL
must be >= FX_KEYS_PHYSICAL, and <=64 (number of bits in a 64bit int mask) (max number of keys accesi...
Definition: mainwindow.h:203
#define THEME_DETAIL_CE_UNSEL
Definition: mainwindow.h:293
#define EXEC_PLAY
Definition: mainwindow.h:428
#define TRASH_NAME
Definition: mainwindow.h:581
#define EXEC_PERL
Definition: mainwindow.h:385
#define DEF_FRAME_HSIZE
Definition: mainwindow.h:152
#define LIVES_IS_SENSITIZED
Definition: mainwindow.h:1711
#define SCRATCH_JUMP
jump and resync audio
Definition: mainwindow.h:1031
#define MAX_SET_NAME_LEN
sets
Definition: mainwindow.h:748
#define THEME_DETAIL_FRAME_SURROUND
Definition: mainwindow.h:291
#define LIVES_SENSE_STATE_PROC_INSENSITIZED
Definition: mainwindow.h:1706
#define LIVES_FILE_EXT_NEW
Definition: mainwindow.h:491
#define SPLASH_LEVEL_LOAD_RFX
Definition: mainwindow.h:1601
#define GUI_SCREEN_WIDTH
Definition: mainwindow.h:99
#define EXEC_XWININFO
Definition: mainwindow.h:422
#define LIVES_DEF_DCLICK_TIME
default double click time (milliseconds), can be overriden by system settings
Definition: mainwindow.h:213
#define PREVIEW_BOX_HT
height of preview widgets in sepwin
Definition: mainwindow.h:93
#define EXEC_PYTHON
Definition: mainwindow.h:413
#define EXEC_MIDISTOP
shipped
Definition: mainwindow.h:416
#define LIVES_DEF_CONFIG_DATADIR
Definition: mainwindow.h:605
#define MIN_SEPWIN_WIDTH
Definition: mainwindow.h:83
#define THEME_DETAIL_NORMAL_BACK
Definition: mainwindow.h:277
#define DEF_SCRATCHBACK_AMOUNT
forward/back scratch value (TODO: make pref)
Definition: mainwindow.h:53
#define SCREEN_SCALE_DEF_WIDTH
Definition: mainwindow.h:107
#define STYLE_1
turn on theming if set
Definition: mainwindow.h:299
#define RFX_TOOL_MENU_POSN
where do we add the builtin tools in the tools menu
Definition: mainwindow.h:699
_fx_dialog * fx_dialog[2]
Definition: mainwindow.h:1851
#define ICON_DIR
Definition: mainwindow.h:600
#define THEME_DETAIL_NORMAL_FORE
Definition: mainwindow.h:276
#define LIVES_IMAGE_TYPE_PNG
Definition: mainwindow.h:480
#define LIVES_DEF_CONFIG_FILE_OLD
pre 3.2.0
Definition: mainwindow.h:610
#define PT_LAZY_RFX
Definition: mainwindow.h:682
#define LIVES_DEF_CONFIG_DIR
in $HOME : used once to set configfile, and then discarded
Definition: mainwindow.h:607
#define EXEC_MPV
Definition: mainwindow.h:388
#define LIVES_FILE_EXT_JPG
Definition: mainwindow.h:488
#define THEME_DETAIL_STYLE
Definition: mainwindow.h:273
#define LIVES_FILE_EXT_PRE
Definition: mainwindow.h:490
#define EXEC_CDDA2WAV
Definition: mainwindow.h:419
#define EXEC_MIDISTART
shipped
Definition: mainwindow.h:415
#define LIVES_SIGSEGV
Definition: mainwindow.h:1860
#define EXEC_MD5SUM
Definition: mainwindow.h:405
#define SCR_WIDTH_SAFETY
sepwin/screen size safety margins in pixels
Definition: mainwindow.h:89
#define LIVES_THEME_CAMERA
Definition: mainwindow.h:553
#define EXEC_MPLAYER
Definition: mainwindow.h:386
#define SCREEN_AREA_BACKGROUND
Definition: mainwindow.h:1681
#define LIVES_SENSE_STATE_INSENSITIZED
Definition: mainwindow.h:1705
#define SPLASH_LEVEL_BEGIN
Definition: mainwindow.h:1597
#define LIVES_DEFAULT_TIMEOUT
Definition: mainwindow.h:43
#define SPLASH_LEVEL_LOAD_RTE
Definition: mainwindow.h:1599
#define SEL_MOVE_AUTO
Definition: mainwindow.h:890
#define LIVES_SENSE_STATE_SENSITIZED
Definition: mainwindow.h:1707
#define PRV_PTR
Definition: mainwindow.h:1315
#define LIVES_THEME_NONE
Definition: mainwindow.h:552
#define LOCAL_HOME_DIR
Definition: mainwindow.h:604
#define THEME_DETAIL_VIDCOL
Definition: mainwindow.h:284
#define SCREEN_AREA_USER_DEFINED1
Definition: mainwindow.h:1682
#define LIVES_URGENCY_ALARM
Definition: mainwindow.h:1636
#define H_RESIZE_ADJUST
Definition: mainwindow.h:66
#define LIVES_DEVNULL
Definition: mainwindow.h:592
#define V_RESIZE_ADJUST
Definition: mainwindow.h:67
#define EXEC_FFMPEG
Definition: mainwindow.h:397
#define ONE_BILLION
Definition: mainwindow.h:25
#define FX_KEYS_MAX
the rest of the keys are accessible through the multitrack renderer (must, be > FX_KEYS_MAX_VIRTUAL)
Definition: mainwindow.h:206
#define LIVES_AUTHOR_EMAIL
Definition: mainwindow.h:523
int lives_alarm_t
Definition: mainwindow.h:696
#define SCREEN_AREA_FOREGROUND
Definition: mainwindow.h:1680
#define EXEC_CONVERT
Definition: mainwindow.h:393
#define LIVES_BUG_URL
Definition: mainwindow.h:525
#define EXEC_ICEDAX
Definition: mainwindow.h:420
#define FN_KEYS
number of function keys
Definition: mainwindow.h:195
#define CE_TIMELINE_VSPACE
Definition: mainwindow.h:71
#define GUI_SCREEN_HEIGHT
Definition: mainwindow.h:100
#define THEME_HEADER
Definition: mainwindow.h:549
#define EXEC_COMPOSITE
Definition: mainwindow.h:394
void mt_clip_select(lives_mt *mt, boolean scroll)
Definition: multitrack.c:3024
uint32_t mt_idle_add(lives_mt *mt)
Definition: multitrack.c:901
void mt_desensitise(lives_mt *mt)
Definition: multitrack.c:16979
void mt_delete_clips(lives_mt *mt, int file)
Definition: multitrack.c:10800
void mt_sensitise(lives_mt *mt)
Definition: multitrack.c:17052
boolean used_in_current_layout(lives_mt *mt, int file)
Definition: multitrack.c:9180
boolean multitrack_delete(lives_mt *mt, boolean save_layout)
Definition: multitrack.c:9204
boolean mt_idle_show_current_frame(livespointer data)
Definition: multitrack.c:11015
void free_thumb_cache(int fnum, frames_t fromframe)
Definition: multitrack.c:1148
void animate_multitrack(lives_mt *mt)
Definition: multitrack.c:14223
boolean mt_load_recovery_layout(lives_mt *mt)
Definition: multitrack.c:941
#define MAX_TRACKS
Definition: multitrack.h:1044
#define DEF_AUTOTRANS
Definition: multitrack.h:59
#define DEF_MT_DISP_TRACKS
Definition: multitrack.h:1041
void on_devicemap_load_activate(LiVESMenuItem *, livespointer)
#define OMC_DEV_FORCE_RAW_MIDI
Definition: omc-learn.h:12
const char * get_midi_filename(void)
boolean has_devicemap(int has_this_macro)
#define MIDI_OMNI
Definition: omc-learn.h:28
#define OMC_DEV_MIDI_DUMMY
Definition: omc-learn.h:13
#define LIVES_OSC_NOTIFY_MODE_CHANGED
mode changed to clip editor or to multitrack
Definition: osc_notify.h:56
#define LIVES_OSC_NOTIFY_QUIT
sent when app quits
Definition: osc_notify.h:44
#define LIVES_OSC_NOTIFY_CLIP_CLOSED
sent after a clip is closed
Definition: osc_notify.h:47
#define LIVES_OSC_NOTIFY_FRAME_SYNCH
sent when a frame is displayed
Definition: osc_notify.h:33
weed_plant_t * render_text_to_layer(weed_layer_t *layer, const char *text, const char *fontname, double size, lives_text_mode_t mode, lives_colRGBA64_t *fg_col, lives_colRGBA64_t *bg_col, boolean center, boolean rising, double top)
Definition: pangotext.c:570
void subtitles_free(lives_clip_t *sfile)
Definition: pangotext.c:976
boolean get_subt_text(lives_clip_t *sfile, double xtime)
Definition: pangotext.c:930
char ** get_font_list(void)
Definition: pangotext.c:416
boolean lives_parse_font_string(const char *string, char **font, int *size, char **stretch, char **style, char **weight)
Definition: pangotext.c:1182
LIVES_GLOBAL_INLINE weed_plant_t * render_text_overlay(weed_layer_t *layer, const char *text)
Definition: pangotext.c:543
@ LIVES_TEXT_MODE_FOREGROUND_AND_BACKGROUND
Definition: pangotext.h:51
#define SUB_OPACITY
Definition: pangotext.h:13
LIVES_GLOBAL_INLINE void on_render_fx_pre_activate(LiVESMenuItem *menuitem, lives_rfx_t *rfx)
Definition: paramwindow.c:656
LiVESList * get_plugin_list(const char *plugin_type, boolean allow_nonex, const char *plugdir, const char *filter_ext)
Definition: plugins.c:115
_vid_playback_plugin * open_vid_playback_plugin(const char *name, boolean in_use)
Definition: plugins.c:1099
int64_t get_best_audio(_vid_playback_plugin *vpp)
Definition: plugins.c:1441
void close_decoder_plugin(lives_decoder_t *dplug)
Definition: plugins.c:2361
LIVES_GLOBAL_INLINE LiVESList * plugin_request_by_line(const char *plugin_type, const char *plugin_name, const char *request)
Definition: plugins.c:59
boolean vpp_try_match_palette(_vid_playback_plugin *vpp, weed_layer_t *layer)
Definition: plugins.c:1066
void close_clip_decoder(int clipno)
Definition: plugins.c:2382
lives_decoder_t * clone_decoder(int fileno)
Definition: plugins.c:2181
lives_rfx_t * weed_to_rfx(weed_plant_t *plant, boolean show_reinits)
Definition: plugins.c:3564
LIVES_GLOBAL_INLINE LiVESList * plugin_request(const char *plugin_type, const char *plugin_name, const char *request)
Definition: plugins.c:54
#define FX_CANDIDATE_RESIZER
Definition: plugins.h:695
#define VPP_LINEAR_GAMMA
Definition: plugins.h:70
#define FFMPEG_ENCODER_NAME
Definition: plugins.h:219
#define VPP_CAN_CHANGE_PALETTE
Definition: plugins.h:73
#define DEFAULT_VPP
Definition: plugins.h:209
#define HI_THEORA_FORMAT
Definition: plugins.h:224
#define PLUGIN_ENCODERS
Definition: plugins.h:98
#define VPP_CAN_LETTERBOX
Definition: plugins.h:72
@ RFX_STATUS_ANY
indicates free choice of statuses
Definition: plugins.h:615
#define PLUGIN_WEED_FX_BUILTIN
Definition: plugins.h:111
#define HI_H_MKV_FORMAT
Definition: plugins.h:226
#define HI_MPEG_FORMAT
Definition: plugins.h:225
#define VPP_LOCAL_DISPLAY
Definition: plugins.h:69
#define LIVES_SEEK_FAST
good
Definition: plugins.h:312
#define VPP_DEFS_FILE
Definition: plugins.h:121
#define HI_H_AVI_FORMAT
Definition: plugins.h:227
#define VPP_CAN_RETURN
Definition: plugins.h:68
#define MULTI_ENCODER3_NAME
Definition: plugins.h:222
#define PLUGIN_THEMES
smogrify handles the directory differently for themes
Definition: plugins.h:106
#define VPP_CAN_RESIZE
type sepcific caps
Definition: plugins.h:67
#define AUDIO_CODEC_UNKNOWN
Definition: plugins.h:253
#define FX_CANDIDATE_DEINTERLACE
Definition: plugins.h:696
#define MULTI_ENCODER_NAME
Definition: plugins.h:221
#define MAX_FX_CANDIDATE_TYPES
Definition: plugins.h:698
#define RFX_PROPS_MAY_RESIZE
is a tool
Definition: plugins.h:635
LIVES_GLOBAL_INLINE boolean get_boolean_prefd(const char *key, boolean defval)
Definition: preferences.c:154
int set_boolean_pref(const char *key, boolean value)
Definition: preferences.c:354
LIVES_GLOBAL_INLINE LiVESResponseType get_string_pref(const char *key, char *val, int maxlen)
Definition: preferences.c:92
LiVESList * get_list_pref(const char *key)
Definition: preferences.c:123
LIVES_GLOBAL_INLINE boolean get_boolean_pref(const char *key)
Definition: preferences.c:146
LIVES_GLOBAL_INLINE double get_double_pref(const char *key)
Definition: preferences.c:187
LIVES_GLOBAL_INLINE int64_t get_int64_prefd(const char *key, int64_t defval)
Definition: preferences.c:179
boolean get_colour_pref(const char *key, lives_colRGBA64_t *lcol)
Definition: preferences.c:211
int set_string_pref(const char *key, const char *value)
Definition: preferences.c:290
int set_utf8_pref(const char *key, const char *value)
Definition: preferences.c:306
LIVES_GLOBAL_INLINE boolean has_pref(const char *key)
Definition: preferences.c:203
LIVES_GLOBAL_INLINE double get_double_prefd(const char *key, double defval)
Definition: preferences.c:195
LIVES_GLOBAL_INLINE int get_int_pref(const char *key)
Definition: preferences.c:163
LIVES_GLOBAL_INLINE int get_int_prefd(const char *key, int defval)
Definition: preferences.c:171
LIVES_GLOBAL_INLINE LiVESResponseType get_string_prefd(const char *key, char *val, int maxlen, const char *def)
Definition: preferences.c:98
void set_palette_prefs(boolean save)
Definition: preferences.c:412
int set_string_pref_priority(const char *key, const char *value)
Definition: preferences.c:298
int set_int_pref(const char *key, int value)
Definition: preferences.c:329
boolean get_theme_colour_pref(const char *key, lives_colRGBA64_t *lcol)
Definition: preferences.c:234
LiVESResponseType get_utf8_pref(const char *key, char *val, int maxlen)
Definition: preferences.c:112
#define AUDIO_PLAYER_NONE
Definition: preferences.h:47
#define PREF_VID_LOAD_DIR
Definition: preferences.h:954
#define REC_FPS
Definition: preferences.h:198
#define PREF_FILESEL_MAXIMISED
Definition: preferences.h:1049
#define STARTUP_CE
Definition: preferences.h:338
#define PREF_WORKING_DIR_OLD
Definition: preferences.h:906
#define PREF_RRCRASH
Definition: preferences.h:1081
#define PREF_REC_STOP_GB
Definition: preferences.h:973
#define PREF_DS_WARN_LEVEL
Definition: preferences.h:959
#define AUDIO_PLAYER_PULSE_AUDIO
used for display, alternate pref and alternate startup opt (-aplayer pulseaudio)
Definition: preferences.h:52
#define PREF_PARESTART
Definition: preferences.h:1071
#define PREF_RRAMICRO
Definition: preferences.h:1085
#define DEF_MT_UNDO_SIZE
MB.
Definition: preferences.h:265
#define PREF_LADSPA_PATH
Definition: preferences.h:915
#define PREF_BLEND_AMOUNT
Definition: preferences.h:1094
#define PREF_MAX_DISP_VTRACKS
Definition: preferences.h:983
#define PREF_FORCE_SINGLE_MONITOR
Definition: preferences.h:1031
#define PREF_CLEAR_DISK_OPTS
Definition: preferences.h:981
#define PREF_RRPRESMOOTH
Definition: preferences.h:1083
#define PREF_MT_SHOW_CTX
Definition: preferences.h:1018
#define PREF_SHOW_RECENT_FILES
Definition: preferences.h:1030
#define PREF_USE_SCREEN_GAMMA
Definition: preferences.h:978
#define PREF_SHOW_URGENCY
Definition: preferences.h:1063
#define PREF_MT_DEF_FPS
Definition: preferences.h:1091
#define PREF_SHOW_ASRC
Definition: preferences.h:898
#define PREF_RRQMODE
Definition: preferences.h:1026
#define JACK_OPTS_TRANSPORT_CLIENT
jack can start/stop
Definition: preferences.h:233
_prefs * prefs
Definition: preferences.h:847
#define PREF_PREF_TRASH
prefer trash to delete
Definition: preferences.h:1077
#define DEF_WARNING_MASK
bits 10, 11, 13, 18 and 19 set (off by default)
Definition: preferences.h:84
#define PREF_FPSCHANGE_AMOUNT
Definition: preferences.h:1095
#define PREF_IMAGE_DIR
Definition: preferences.h:948
#define PREF_OSC_PORT
Definition: preferences.h:1005
#define PREF_OMC_MIDI_FNAME
Definition: preferences.h:945
#define PREF_PREFIX_DIR
Definition: preferences.h:907
#define PREF_MASTER_VOLUME
Definition: preferences.h:1099
#define SEPWIN_TYPE_NON_STICKY
Definition: preferences.h:187
#define DEF_MSG_TEXTSIZE
(SOFT LIMIT) max space we can use for all our files (0 means unlimited (up to ds_crtical,...
Definition: preferences.h:385
#define PREF_OUTPUT_TYPE
Definition: preferences.h:929
#define PREF_DS_CRIT_LEVEL
Definition: preferences.h:960
#define PREF_OMC_JS_FNAME
Definition: preferences.h:946
#define PREF_SHOW_SUBS
Definition: preferences.h:1074
#define PREF_MT_BACKAUDIO
Definition: preferences.h:1017
#define PREF_ALLOW_EASING
Definition: preferences.h:1066
#define PREF_CE_MAXSPECT
Definition: preferences.h:1039
#define PREF_PASTARTOPTS
Definition: preferences.h:939
#define PREF_AUDIO_PLAYER
Definition: preferences.h:910
#define PREF_AHOLD_THRESHOLD
Definition: preferences.h:1098
#define PREF_NOFRAMEDROP
Definition: preferences.h:989
#define PREF_AR_CLIPSET
Definition: preferences.h:934
#define PREF_SHOW_DEVOPTS
Definition: preferences.h:1067
#define PREF_AUTO_TRIM_PAD_AUDIO
Definition: preferences.h:1041
#define PREF_CONSERVE_SPACE
Definition: preferences.h:1059
#define AUD_PLAYER_SOX
Definition: preferences.h:42
#define AUDIO_OPTS_FOLLOW_CLIPS
Definition: preferences.h:255
#define PREF_MT_DEF_ASAMPS
Definition: preferences.h:1011
#define PREF_WORKING_DIR
Definition: preferences.h:905
#define PREF_ENCODER_ACODEC
Definition: preferences.h:1000
#define AUDIO_PLAYER_JACK
Definition: preferences.h:49
#define PREF_MT_DEF_ARATE
Definition: preferences.h:1009
#define PREF_PUSH_AUDIO_TO_GENS
Definition: preferences.h:1060
#define PREF_MIDISYNCH
Definition: preferences.h:1052
#define PREF_SHOW_TOOLTIPS
Definition: preferences.h:1062
#define AUDIO_PLAYER_SOX
Definition: preferences.h:48
#define PREF_REC_DESKTOP_AUDIO
Definition: preferences.h:1055
#define PREF_MT_DEF_ACHANS
Definition: preferences.h:1010
#define PREF_ANTIALIAS
Definition: preferences.h:1048
#define PREF_RENDER_PROMPT
Definition: preferences.h:1035
#define PREF_OPEN_MAXIMISED
Definition: preferences.h:1040
#define PREF_STARTUP_INTERFACE
Definition: preferences.h:966
#define PREF_RTE_KEYS_VIRTUAL
Definition: preferences.h:991
#define PREF_BACK_COMPAT
forces backwards compatibility with earlier versions
Definition: preferences.h:1088
#define PREF_PB_QUALITY
Definition: preferences.h:971
#define PREF_INSTANT_OPEN
Definition: preferences.h:1051
#define PREF_RRFSTATE
Definition: preferences.h:1027
#define AUDIO_PLAYER_PULSE
used in pref and for external players (e.g -ao pulse, -aplayer pulse)
Definition: preferences.h:51
#define PREF_RRSUPER
Definition: preferences.h:1082
#define PREF_INSERT_RESAMPLE
Definition: preferences.h:1056
#define PREF_AUTOCLEAN_TRASH
remove unneeded files on shutdown / startup
Definition: preferences.h:1076
#define PREF_GUI_THEME
Definition: preferences.h:926
#define PREF_MT_DEF_HEIGHT
Definition: preferences.h:1008
#define PREF_AR_LAYOUT
Definition: preferences.h:933
#define DEF_MAX_MSGS
Definition: preferences.h:386
#define PREF_RECORD_OPTS
Definition: preferences.h:1002
#define PREF_SCREEN_GAMMA
Definition: preferences.h:979
#define PB_QUALITY_HIGH
Definition: preferences.h:34
#define PREF_DEFAULT_IMAGE_TYPE
Definition: preferences.h:922
#define PREF_MSG_TEXTSIZE
Definition: preferences.h:986
#define PREF_DISK_QUOTA
Definition: preferences.h:961
#define PREF_LOAD_RFX_BUILTIN
Definition: preferences.h:1047
#define PREF_HFBWNP
Definition: preferences.h:899
#define PREF_AUTOLOAD_SUBS
Definition: preferences.h:1075
#define PREF_VIDEO_OPEN_COMMAND
Definition: preferences.h:924
#define STARTUP_MT
Definition: preferences.h:339
#define PREF_MT_DEF_WIDTH
Definition: preferences.h:1007
#define DEF_DS_WARN_LEVEL
Definition: preferences.h:377
#define PREF_SAVE_DIRECTORIES
Definition: preferences.h:1058
#define PREF_WEED_PLUGIN_PATH
Definition: preferences.h:916
#define PREF_OPEN_COMPRESSION_PERCENT
Definition: preferences.h:969
#define SEPWIN_TYPE_STICKY
Definition: preferences.h:188
#define PREF_AUDIO_OPTS
Definition: preferences.h:893
#define PREF_LETTERBOX
Definition: preferences.h:1069
#define PREF_RRQSMOOTH
Definition: preferences.h:1084
#define PREF_SHOW_QUOTA
Definition: preferences.h:1079
#define PREF_STOP_SCREENSAVER
Definition: preferences.h:1032
#define PREF_UNSTABLE_FX
Definition: preferences.h:1065
#define PREF_MT_DEF_SIGNED_ENDIAN
Definition: preferences.h:1012
#define REC_AUDIO
Definition: preferences.h:201
#define PREF_MIDI_RPT
Definition: preferences.h:996
#define PREF_MT_EXIT_RENDER
Definition: preferences.h:1034
#define PREF_MIDI_CHECK_RATE
Definition: preferences.h:995
#define PREF_STREAM_AUDIO_OUT
Definition: preferences.h:1045
#define REC_CLIPS
Definition: preferences.h:200
#define AUD_PLAYER_NONE
Definition: preferences.h:41
#define PREF_SHOW_TOOLBAR
Definition: preferences.h:1038
#define PREF_MOUSE_SCROLL_CLIPS
Definition: preferences.h:1043
#define JACK_OPTS_NOPLAY_WHEN_PAUSED
play audio even when transport paused
Definition: preferences.h:236
#define JACK_OPTS_START_TSERVER
start transport server
Definition: preferences.h:235
#define PREF_OMC_DEV_OPTS
Definition: preferences.h:1004
#define AUDIO_OPTS_FOLLOW_FPS
Definition: preferences.h:256
#define PREF_NFX_THREADS
Definition: preferences.h:975
#define PREF_CONCAT_IMAGES
Definition: preferences.h:1057
#define Q_SMOOTH
Definition: preferences.h:59
#define PREF_AUDIO_SRC
Definition: preferences.h:911
#define PREF_RRRAMICRO
Definition: preferences.h:1086
#define PREF_MT_PERTRACK_AUDIO
Definition: preferences.h:1036
#define PREF_AUTO_DEINTERLACE
Definition: preferences.h:1053
#define JACK_OPTS_TRANSPORT_MASTER
transport master
Definition: preferences.h:234
#define PREF_KEEP_ALL_AUDIO
Definition: preferences.h:1042
#define PREF_CE_THUMB_MODE
Definition: preferences.h:1046
#define AUD_PLAYER_JACK
Definition: preferences.h:43
#define PREF_BTGAMMA
Definition: preferences.h:977
#define PREF_DL_BANDWIDTH_K
Definition: preferences.h:1021
#define PREF_DEF_AUTHOR
Definition: preferences.h:941
#define PB_QUALITY_MED
default
Definition: preferences.h:33
#define PREF_EXTRA_COLOURS
Definition: preferences.h:1073
_prefsw * prefsw
Definition: preferences.h:849
#define PREF_JACK_OPTS
Definition: preferences.h:993
#define DEF_DS_CRIT_LEVEL
Definition: preferences.h:379
#define PREF_MT_ENTER_PROMPT
Definition: preferences.h:1033
#define PB_QUALITY_LOW
Definition: preferences.h:32
#define REC_AFTER_PB
Definition: preferences.h:202
#define WARN_MASK_NO_ENCODERS
Definition: preferences.h:93
#define PREF_MIDI_RCV_CHANNEL
Definition: preferences.h:998
_future_prefs * future_prefs
Definition: preferences.h:848
#define REC_FRAMES
Definition: preferences.h:197
#define AUDIO_SRC_EXT
Definition: preferences.h:206
#define PREF_OSC_START
Definition: preferences.h:1037
#define PREF_LIBVISUAL_PATH
Definition: preferences.h:918
#define PREF_SHOW_OVERLAY_MSGS
Definition: preferences.h:1064
#define PREF_SCBACK_AMOUNT
Definition: preferences.h:1024
#define PREF_SCREEN_SCALE
Definition: preferences.h:938
#define PREF_VID_PLAYBACK_PLUGIN
Definition: preferences.h:920
#define PREF_LETTERBOXMT
Definition: preferences.h:1070
#define PREF_PROJ_DIR
Definition: preferences.h:951
#define WARN_MASK_NO_MPLAYER
Definition: preferences.h:91
#define PREF_MT_UNDO_BUF
Definition: preferences.h:1015
#define PREF_APPLY_GAMMA
Definition: preferences.h:1061
#define PREF_AUTO_CUT_BORDERS
Definition: preferences.h:1054
#define AUDIO_SRC_INT
Definition: preferences.h:205
#define PREF_ACTIVE_AUTOTRANS
Definition: preferences.h:936
#define PREF_DEFAULT_FPS
Definition: preferences.h:1092
#define PREF_MSG_PBDIS
Definition: preferences.h:987
#define PREF_VJMODE
Definition: preferences.h:1068
#define PREF_MSG_START
Definition: preferences.h:1078
#define PREF_FREI0R_PATH
Definition: preferences.h:917
#define PREF_AUDIO_DIR
Definition: preferences.h:949
#define PREF_SCFWD_AMOUNT
Definition: preferences.h:1023
#define PREF_LIVES_WARNING_MASK
Definition: preferences.h:968
#define PREF_LIB_DIR
Definition: preferences.h:908
#define PREF_PBQ_ADAPTIVE
Definition: preferences.h:1072
#define PREF_MAX_MSGS
Definition: preferences.h:985
#define REC_EFFECTS
Definition: preferences.h:199
#define PREF_MONITORS
Definition: preferences.h:913
#define PREF_SHOW_BUTTON_ICONS
Definition: preferences.h:1044
#define PREF_SEPWIN_TYPE
Definition: preferences.h:894
#define AUD_PLAYER_PULSE
Definition: preferences.h:44
#define PREF_DISABLED_DECODERS
Definition: preferences.h:1102
#define PREF_VID_SAVE_DIR
Definition: preferences.h:953
#define DEF_REC_STOP_GB
Definition: preferences.h:347
#define PREF_STARTUP_PHASE
Definition: preferences.h:964
#define PREF_MT_AUTO_BACK
Definition: preferences.h:1014
#define PREF_ENCODER
Definition: preferences.h:928
#define JACK_OPTS_START_ASERVER
start audio server
Definition: preferences.h:237
#define PREF_WARN_FILE_SIZE
Definition: preferences.h:1019
#define PREF_SHOW_PLAYER_STATS
Definition: preferences.h:1050
#define PREF_CDPLAY_DEVICE
Definition: preferences.h:931
_resaudw * resaudw
Definition: resample.h:38
void add_rfx_effects(lives_rfx_status_t status)
add dynamic menu entries
Definition: rfx-builder.c:4172
void add_rfx_effects2(lives_rfx_status_t status)
Definition: rfx-builder.c:4481
#define RFX_LOADED
Definition: rfx-builder.h:56
void load_default_keymap(void)
Definition: rte_window.c:2717
LiVESWidget * rte_window
Definition: rte_window.h:58
#define DEF_FX_KEYMODES
Definition: rte_window.h:13
void cleanup_old_config(void)
Definition: startup.c:58
void filename_toolong_error(const char *fname, const char *ftype, size_t max, boolean can_retry)
Definition: startup.c:291
boolean do_startup_tests(boolean tshoot)
Definition: startup.c:767
void do_startup_interface_query(void)
Definition: startup.c:1276
boolean migrate_config(const char *old_vhash, const char *newconfigfile)
Definition: startup.c:20
boolean do_workdir_query(void)
Definition: startup.c:413
boolean build_init_config(const char *config_datadir, boolean prompt)
Definition: startup.c:83
void dir_toolong_error(const char *dirname, const char *dirtype, size_t max, boolean can_retry)
Definition: startup.c:304
void weed_layer_set_from_lives2lives(weed_layer_t *layer, int clip, lives_vstream_t *lstream)
Definition: stream.c:675
char of_desc[128]
Definition: plugins.h:264
char name[64]
Definition: plugins.h:234
uint32_t capabilities
Definition: plugins.h:255
char of_name[64]
Definition: plugins.h:263
char of_restrict[1024]
Definition: plugins.h:266
uint32_t audio_codec
Definition: plugins.h:235
int of_allowed_acodecs
Definition: plugins.h:265
boolean ar_clipset
Definition: preferences.h:840
volatile float volume
audio volume level (for jack and pulse)
Definition: preferences.h:837
char theme[64]
Definition: preferences.h:800
boolean pref_trash
user prefers trash to delete (future / present swapped)
Definition: preferences.h:843
boolean letterbox_mt
Definition: preferences.h:844
char workdir[PATH_MAX]
Definition: preferences.h:799
boolean vj_mode
Definition: preferences.h:839
uint32_t audio_opts
Definition: preferences.h:830
int startup_interface
Definition: preferences.h:825
uint32_t jack_opts
Definition: preferences.h:827
short sepwin_type
Definition: preferences.h:832
boolean osc_start
Definition: preferences.h:824
char ** vpp_argv
Definition: preferences.h:817
_encoder encoder
Definition: preferences.h:820
short pb_quality
Definition: preferences.h:831
char vpp_name[64]
new video playback plugin
Definition: preferences.h:801
boolean show_recent
Definition: preferences.h:822
uint64_t disk_quota
Definition: preferences.h:818
startup overrides from commandline
Definition: preferences.h:780
boolean ign_vjmode
Definition: preferences.h:789
boolean ign_config_datadir
Definition: preferences.h:792
boolean ign_aplayer
Definition: preferences.h:785
boolean ign_configfile
Definition: preferences.h:791
boolean ign_jackopts
Definition: preferences.h:784
boolean ign_osc
Definition: preferences.h:783
boolean ign_clipset
Definition: preferences.h:781
boolean ign_asource
Definition: preferences.h:786
boolean ign_vppdefs
Definition: preferences.h:788
boolean ign_layout
Definition: preferences.h:782
boolean ign_stmode
Definition: preferences.h:787
boolean ign_dscrit
Definition: preferences.h:790
set in set_palette_colours()
Definition: mainwindow.h:296
lives_colRGBA64_t ce_sel
Definition: mainwindow.h:348
LiVESWidgetColor nice2
Definition: mainwindow.h:336
LiVESWidgetColor mt_timecode_bg
Definition: mainwindow.h:332
LiVESWidgetColor dark_orange
Definition: mainwindow.h:312
LiVESWidgetColor normal_fore
Definition: mainwindow.h:325
LiVESWidgetColor info_base
Definition: mainwindow.h:330
int style
Definition: mainwindow.h:297
LiVESWidgetColor banner_fade_text
Definition: mainwindow.h:320
lives_colRGBA64_t mt_evbox
Definition: mainwindow.h:346
lives_colRGBA64_t mt_timeline_reg
Definition: mainwindow.h:342
LiVESWidgetColor light_red
Definition: mainwindow.h:309
LiVESWidgetColor menu_and_bars
Definition: mainwindow.h:327
lives_colRGBA64_t audcol
Definition: mainwindow.h:339
LiVESWidgetColor info_text
Definition: mainwindow.h:329
LiVESWidgetColor white
Definition: mainwindow.h:306
LiVESWidgetColor normal_back
Definition: mainwindow.h:324
LiVESWidgetColor black
Definition: mainwindow.h:307
lives_colRGBA64_t frame_surround
Definition: mainwindow.h:344
LiVESWidgetColor dark_red
Definition: mainwindow.h:311
lives_colRGBA64_t ce_unsel
Definition: mainwindow.h:349
LiVESWidgetColor light_green
Definition: mainwindow.h:310
lives_colRGBA64_t mt_mark
Definition: mainwindow.h:345
LiVESWidgetColor menu_and_bars_fore
Definition: mainwindow.h:328
LiVESWidgetColor nice3
Definition: mainwindow.h:337
lives_colRGBA64_t fxcol
Definition: mainwindow.h:341
LiVESWidgetColor nice1
Definition: mainwindow.h:335
LiVESWidgetColor fade_colour
Definition: mainwindow.h:318
lives_colRGBA64_t vidcol
Definition: mainwindow.h:340
LiVESWidgetColor mt_timecode_fg
Definition: mainwindow.h:333
boolean ce_thumb_mode
Definition: preferences.h:420
boolean dev_show_dabg
Definition: preferences.h:464
char backend[PATH_MAX *4]
Definition: preferences.h:411
boolean omc_noisy
send success/fail
Definition: preferences.h:212
boolean discard_tv
Definition: preferences.h:194
boolean ce_maxspect
Definition: preferences.h:341
boolean auto_deint
Definition: preferences.h:302
int rr_fstate
Definition: preferences.h:493
int nfx_threads
Definition: preferences.h:356
boolean vj_mode
Definition: preferences.h:459
boolean load_rfx_builtin
Definition: preferences.h:449
boolean save_directories
Definition: preferences.h:195
boolean show_playwin
Definition: preferences.h:292
boolean instant_open
Definition: preferences.h:301
int mt_def_arate
Definition: preferences.h:273
double mt_def_fps
Definition: preferences.h:271
boolean show_asrc
Definition: preferences.h:438
_encoder encoder
from main.h
Definition: preferences.h:38
boolean show_urgency_msgs
Definition: preferences.h:310
int startup_interface
Definition: preferences.h:336
boolean perm_audio_reader
Definition: preferences.h:426
boolean rr_pre_smooth
Definition: preferences.h:491
int mt_auto_back
time diff to backup (-1 == never, 0 == after every change, > 0 == seconds)
Definition: preferences.h:281
boolean show_tooltips
Definition: preferences.h:455
boolean crash_recovery
TRUE==maintain mainw->recovery file.
Definition: preferences.h:259
uint64_t ds_crit_level
diskspace critical level bytes
Definition: preferences.h:380
char omc_js_fname[PATH_MAX]
utf8
Definition: preferences.h:320
volatile uint32_t audio_opts
Definition: preferences.h:254
boolean rec_desktop_audio
Definition: preferences.h:288
boolean hfbwnp
Definition: preferences.h:436
int ocp
open_compression_percent : get/set in prefs
Definition: preferences.h:217
boolean pbq_adaptive
Definition: preferences.h:36
boolean show_recent
Definition: preferences.h:179
char pa_start_opts[255]
Definition: preferences.h:473
boolean rr_super
Definition: preferences.h:490
int audio_src
Definition: preferences.h:204
boolean event_window_show_frame_events
Definition: preferences.h:258
uint64_t disk_quota
Definition: preferences.h:383
boolean interactive
Definition: preferences.h:478
boolean keep_all_audio
Definition: preferences.h:371
int midi_check_rate
deprecated
Definition: preferences.h:315
char * fxsizesfile
Definition: preferences.h:248
boolean osc_start
Definition: preferences.h:294
int play_monitor
Definition: preferences.h:306
uint64_t warning_mask
Definition: preferences.h:80
boolean push_audio_to_gens
Definition: preferences.h:424
boolean safe_symlinks
Definition: preferences.h:327
boolean mt_show_ctx
Definition: preferences.h:277
char aplayer[512]
Definition: preferences.h:54
boolean hide_framebar
Definition: preferences.h:434
boolean auto_trim_audio
Definition: preferences.h:370
boolean show_msgs_on_startup
Definition: preferences.h:484
boolean show_gui
Definition: preferences.h:290
int num_rtaudiobufs
Definition: preferences.h:325
char video_open_command[PATH_MAX *2]
Definition: preferences.h:170
int mt_backaudio
Definition: preferences.h:279
boolean ar_layout
Definition: preferences.h:284
char def_vid_save_dir[PATH_MAX]
Definition: preferences.h:68
boolean no_bandwidth
Definition: preferences.h:208
double default_fps
Definition: preferences.h:173
boolean letterbox_mt
playback with letterbox (multitrack)
Definition: preferences.h:363
float volume
audio volume level (for jack and pulse)
Definition: preferences.h:457
double quota_limit
Definition: preferences.h:486
char jack_tserver[PATH_MAX]
Definition: preferences.h:244
char ar_clipset_name[128]
locale
Definition: preferences.h:285
char cmd_log[PATH_MAX]
Definition: preferences.h:168
char ladspa_path[PATH_MAX]
Definition: preferences.h:415
boolean force_system_clock
Definition: preferences.h:366
char def_image_dir[PATH_MAX]
Definition: preferences.h:70
uint32_t osc_udp_port
Definition: preferences.h:210
boolean back_compat
Definition: preferences.h:471
boolean pause_effect_during_preview
Definition: preferences.h:174
boolean rr_ramicro
Definition: preferences.h:495
char workdir[PATH_MAX]
kept in locale encoding
Definition: preferences.h:61
int rec_opts
Definition: preferences.h:196
boolean autoclean
remove temp files on shutdown / startup
Definition: preferences.h:481
boolean noframedrop
Definition: preferences.h:469
double screen_gamma
Definition: preferences.h:442
char frei0r_path[PATH_MAX]
Definition: preferences.h:414
boolean show_msg_area
Definition: preferences.h:225
boolean mt_exit_render
Definition: preferences.h:275
int max_disp_vtracks
Definition: preferences.h:430
char config_datadir[PATH_MAX]
kept in locale encoding (general config files) (default ~/.local/share/lives)
Definition: preferences.h:64
int mt_def_signed_endian
Definition: preferences.h:273
int scratchfwd_amount
Definition: preferences.h:229
uint32_t clear_disk_opts
Definition: preferences.h:402
int bigendbug
default 0; 1==use old (bad) behaviour on bigendian machines (r/w bigend ints/doubles); 2==bad reads,...
Definition: preferences.h:374
float ahold_threshold
Definition: preferences.h:440
int rr_qmode
Definition: preferences.h:489
boolean letterbox
playback with letterbox
Definition: preferences.h:362
boolean fileselmax
Definition: preferences.h:178
boolean alpha_post
set to TRUE to force use of post alpha internally
Definition: preferences.h:358
int midi_rcv_channel
Definition: preferences.h:334
char def_audio_dir[PATH_MAX]
Definition: preferences.h:69
boolean dev_show_timing
Definition: preferences.h:465
boolean show_player_stats
Definition: preferences.h:190
boolean extra_colours
Definition: preferences.h:479
int midi_rpt
Definition: preferences.h:316
boolean antialias
Definition: preferences.h:219
int dl_bandwidth
Definition: preferences.h:182
boolean mt_enter_prompt
Definition: preferences.h:268
char prefix_dir[PATH_MAX]
Definition: preferences.h:74
boolean enc_letterbox
encode with letterbox
Definition: preferences.h:364
boolean msgs_pbdis
Definition: preferences.h:467
boolean render_overlay
Definition: preferences.h:312
LiVESList * acodec_list
Definition: preferences.h:251
int mt_def_achans
Definition: preferences.h:273
boolean unstable_fx
Definition: preferences.h:361
char cdplay_device[PATH_MAX]
locale encoding
Definition: preferences.h:172
short rte_keys_virtual
Definition: preferences.h:223
char def_author[1024]
TODO - add to prefs windo.
Definition: preferences.h:497
LiVESList * disabled_decoders
Definition: preferences.h:408
boolean normalise_audio
for future use
Definition: preferences.h:299
boolean mt_load_fuzzy
Definition: preferences.h:432
char configfile[PATH_MAX]
kept in locale encoding (config settings) [default ~/.local/config/lives)
Definition: preferences.h:63
boolean show_rdet
show render details (frame size, encoder type) before saving to file
Definition: preferences.h:261
boolean force_single_monitor
Definition: preferences.h:308
double fpschange_amount
Definition: preferences.h:230
boolean ins_resample
Definition: preferences.h:184
boolean force64bit
< force system clock (rather than soundcard) for timing ( better for high framerates )
Definition: preferences.h:368
boolean midisynch
Definition: preferences.h:181
boolean open_decorated
Definition: preferences.h:175
boolean show_subtitles
Definition: preferences.h:192
uint32_t jack_opts
Definition: preferences.h:232
short sepwin_type
Definition: preferences.h:186
int atrans_fx
Definition: preferences.h:353
char lib_dir[PATH_MAX]
Definition: preferences.h:75
int gui_monitor
Definition: preferences.h:305
short q_type
frame quantisation type
Definition: preferences.h:57
boolean show_disk_quota
Definition: preferences.h:485
boolean show_overlay_msgs
Definition: preferences.h:311
boolean stream_audio_out
Definition: preferences.h:360
boolean concat_images
Definition: preferences.h:296
int sleep_time
Definition: preferences.h:176
double screen_scale
Definition: preferences.h:447
char ar_layout_name[PATH_MAX]
locale
Definition: preferences.h:286
boolean omc_events
send other events
Definition: preferences.h:213
boolean allow_easing
Definition: preferences.h:461
boolean show_button_images
Definition: preferences.h:422
boolean move_effects
Definition: preferences.h:263
char weed_plugin_path[PATH_MAX]
Definition: preferences.h:413
int mt_def_asamps
Definition: preferences.h:273
char omc_midi_fname[PATH_MAX]
utf8
Definition: preferences.h:321
boolean mouse_scroll_clips
Definition: preferences.h:323
char libvis_path[PATH_MAX]
Definition: preferences.h:416
double blendchange_amount
Definition: preferences.h:228
char theme[64]
the theme name
Definition: preferences.h:29
char image_type[16]
Definition: preferences.h:77
uint32_t omc_dev_opts
Definition: preferences.h:318
boolean show_splash
Definition: preferences.h:291
int mt_def_width
Definition: preferences.h:270
boolean funky_widgets
Definition: preferences.h:428
int mt_def_height
Definition: preferences.h:270
boolean pref_trash
user prefers trash to delete
Definition: preferences.h:480
boolean pa_restart
Definition: preferences.h:474
boolean present
Definition: preferences.h:418
boolean loop_recording
Definition: preferences.h:193
boolean render_audio
Definition: preferences.h:298
boolean show_dev_opts
Definition: preferences.h:463
boolean mt_pertrack_audio
Definition: preferences.h:278
boolean apply_gamma
Definition: preferences.h:451
double fps_tolerance
Definition: preferences.h:221
int warn_file_size
Definition: preferences.h:180
boolean ar_clipset
auto-reload
Definition: preferences.h:284
boolean btgamma
allows clips to be stored with bt709 gamma - CAUTION not backwards compatible, untested
Definition: preferences.h:453
boolean rr_qsmooth
Definition: preferences.h:492
boolean show_desktop_panel
Definition: preferences.h:483
boolean conserve_space
Definition: preferences.h:183
double rec_stop_gb
Definition: preferences.h:348
char * fxdefsfile
Definition: preferences.h:247
boolean stop_screensaver
Definition: preferences.h:27
boolean rr_amicro
Definition: preferences.h:494
boolean use_screen_gamma
Definition: preferences.h:452
int max_messages
Definition: preferences.h:444
char backend_sync[PATH_MAX *4]
Definition: preferences.h:410
short startup_phase
0 = normal , -1 or 1: fresh install, 2: workdir set, 3: startup tests passed, 4: aud pl chosen,...
Definition: preferences.h:216
int mt_undo_buf
Definition: preferences.h:267
char def_proj_dir[PATH_MAX]
Definition: preferences.h:71
short audio_player
Definition: preferences.h:40
boolean show_tool
Definition: preferences.h:185
char image_ext[16]
Definition: preferences.h:78
boolean auto_nobord
Definition: preferences.h:303
short pb_quality
Definition: preferences.h:31
int max_modes_per_key
maximum effect modes per key
Definition: preferences.h:350
boolean cb_is_switch
Definition: preferences.h:476
boolean render_prompt
Definition: preferences.h:276
uint64_t ds_warn_level
diskspace warn level bytes
Definition: preferences.h:378
int msg_textsize
Definition: preferences.h:445
boolean open_maximised
Definition: preferences.h:28
boolean lamp_buttons
Definition: preferences.h:343
boolean osc_udp_started
Definition: preferences.h:209
boolean pause_during_pb
Definition: preferences.h:177
boolean autoload_subs
Definition: preferences.h:345
char def_vid_load_dir[PATH_MAX]
Definition: preferences.h:67
boolean rr_crash
Definition: preferences.h:488
int scratchback_amount
Definition: preferences.h:229
char jack_aserver[PATH_MAX]
Definition: preferences.h:245
uint64_t capabilities
Definition: plugins.h:177
boolean(* render_frame)(int hsize, int vsize, ticks_t timecode, void **pixel_data, void **return_data, weed_plant_t **play_params)
Definition: plugins.h:137
int palette
width in pixels, but converted to macropixels for the player
Definition: plugins.h:181
uint32_t audio_codec
Definition: plugins.h:169
weed_plant_t ** play_params
Definition: plugins.h:194
int *(* get_audio_fmts)(void)
Definition: plugins.h:167
boolean(* play_frame)(weed_layer_t *frame, ticks_t tc, weed_layer_t *ret)
Definition: plugins.h:140
boolean can_write_to_workdir
Definition: main.h:500
char touch_cmd[PATH_MAX]
Definition: main.h:553
lives_checkstatus_t has_icedax
Definition: main.h:520
int ncpus
Definition: main.h:576
boolean can_write_to_config_new
Definition: main.h:497
char * os_name
Definition: main.h:612
boolean can_write_to_config
Definition: main.h:496
char * distro_codename
Definition: main.h:618
lives_checkstatus_t has_xdotool
Definition: main.h:531
char home_dir[PATH_MAX]
home directory - default location for config file - locale encoding
Definition: main.h:544
char backend_path[PATH_MAX]
Definition: main.h:546
char * cpu_name
Definition: main.h:582
lives_checkstatus_t has_ffprobe
Definition: main.h:517
lives_checkstatus_t has_identify
Definition: main.h:516
lives_checkstatus_t has_midistartstop
Definition: main.h:521
pthread_t gui_thread
Definition: main.h:593
int nmonitors
Definition: main.h:588
pid_t mainpid
Definition: main.h:591
lives_checkstatus_t has_gdb
Definition: main.h:525
char sed_cmd[PATH_MAX]
Definition: main.h:561
char grep_cmd[PATH_MAX]
Definition: main.h:560
int byte_order
Definition: main.h:577
int xstdout
Definition: main.h:587
lives_checkstatus_t has_sox_play
Definition: main.h:508
lives_checkstatus_t has_mpv
Definition: main.h:513
lives_checkstatus_t has_perl
Definition: main.h:505
char chmod_cmd[PATH_MAX]
Definition: main.h:558
char * mountpoint
utf-8
Definition: main.h:610
char * distro_name
Definition: main.h:616
int64_t ds_tot
Definition: main.h:609
lives_checkstatus_t has_wmctrl
Definition: main.h:530
char * distro_ver
Definition: main.h:617
char rmdir_cmd[PATH_MAX]
Definition: main.h:565
lives_checkstatus_t has_encoder_plugins
Definition: main.h:571
char wc_cmd[PATH_MAX]
Definition: main.h:562
lives_checkstatus_t has_ffmpeg
Definition: main.h:518
char mv_cmd[PATH_MAX]
Definition: main.h:555
lives_checkstatus_t has_composite
Definition: main.h:515
lives_checkstatus_t has_mplayer2
Definition: main.h:512
char cat_cmd[PATH_MAX]
Definition: main.h:559
char rm_cmd[PATH_MAX]
Definition: main.h:554
int64_t ds_free
Definition: main.h:609
char cp_cmd[PATH_MAX]
Definition: main.h:556
char * wm_type
window manager type, e.g. x11
Definition: main.h:604
lives_checkstatus_t has_md5sum
Definition: main.h:536
int64_t ds_used
Definition: main.h:609
char ln_cmd[PATH_MAX]
Definition: main.h:557
int primary_monitor
Definition: main.h:589
char * os_release
Definition: main.h:613
char * myname_full
Definition: main.h:579
lives_checkstatus_t has_smogrify
Definition: main.h:502
lives_checkstatus_t has_xwininfo
Definition: main.h:524
short cpu_bits
Definition: main.h:583
lives_checkstatus_t has_youtube_dl
Definition: main.h:532
wm_caps_t wm_caps
Definition: main.h:607
char echo_cmd[PATH_MAX]
Definition: main.h:563
int64_t boot_time
Definition: main.h:586
lives_checkstatus_t has_sox_sox
Definition: main.h:509
int dclick_time
Definition: main.h:622
uint64_t python_version
Definition: main.h:574
lives_checkstatus_t has_gconftool_2
Definition: main.h:527
char * wm_name
window manager name, may be different from wm_caps.wwm_name
Definition: main.h:605
lives_checkstatus_t has_gzip
Definition: main.h:526
char * myname
Definition: main.h:580
char * gui_theme_name
Definition: main.h:599
char * os_hardware
Definition: main.h:614
int dclick_dist
Definition: main.h:623
boolean can_read_from_config
Definition: main.h:494
lives_checkstatus_t has_xdg_screensaver
Definition: main.h:528
char * sysbindir
Definition: main.h:624
lives_checkstatus_t has_jackd
Definition: main.h:522
char startup_msg[1024]
used for returning startup messages from the backend
Definition: main.h:568
lives_checkstatus_t has_dvgrab
Definition: main.h:507
lives_checkstatus_t has_python
Definition: main.h:573
char eject_cmd[PATH_MAX]
Definition: main.h:564
char * mach_name
Definition: main.h:620
LiVESList * all_icons
Definition: main.h:602
lives_checkstatus_t has_mplayer
Definition: main.h:511
int cacheline_size
Definition: main.h:584
mode_t umask
Definition: main.h:597
pthread_t main_thread
Definition: main.h:592
lives_checkstatus_t has_du
Definition: main.h:535
char * username
Definition: main.h:595
lives_checkstatus_t has_pulse_audio
Definition: main.h:523
boolean has_wm_caps
Definition: main.h:606
lives_checkstatus_t has_youtube_dlc
Definition: main.h:533
lives_checkstatus_t has_cdda2wav
Definition: main.h:519
lives_checkstatus_t has_convert
Definition: main.h:514
char * extra_icon_path
Definition: main.h:601
boolean smog_version_correct
Definition: main.h:493
boolean can_write_to_config_backup
Definition: main.h:499
char * icon_theme_name
Definition: main.h:600
int current_palette
plugin should init this to palettes[0] if URI changes
Definition: plugins.h:378
int YUV_sampling
plugin can change per frame
Definition: plugins.h:381
int seek_flag
plugin can change per frame
Definition: plugins.h:397
lives_interlace_t interlace
Definition: plugins.h:350
int * palettes
number forames from one keyframe to the next, 0 if unknown
Definition: plugins.h:375
int frame_width
frame is the surrounding part, including any black border (>=width)
Definition: plugins.h:357
int frame_gamma
values WEED_GAMMA_UNKNOWN (0), WEED_GAMMA_SRGB (1), WEED_GAMMA_LINEAR (2)
Definition: plugins.h:384
int * rec_rowstrides
if non-NULL, plugin can set recommended vals, pointer to single value set by host
Definition: plugins.h:351
corresponds to one clip in the GUI
Definition: main.h:877
int arps
audio physical sample rate (i.e the "normal" sample rate of the clip when played at 1,...
Definition: main.h:905
frames_t frames
number of video frames
Definition: main.h:890
LiVESWidget * menuentry
Definition: main.h:1011
lives_direction_t adirection
audio play direction during playback, FORWARD or REVERSE.
Definition: main.h:1016
void * ext_src
points to opaque source for non-disk types
Definition: main.h:1040
lives_clip_type_t clip_type
Definition: main.h:886
int asampsize
audio sample size in bits (8 or 16)
Definition: main.h:908
lives_img_type_t img_type
Definition: main.h:887
frames_t * frame_index
index of frames for CLIP_TYPE_FILE >0 means corresponding frame within original clip -1 means corresp...
Definition: main.h:1004
boolean deinterlace
auto deinterlace
Definition: main.h:938
int vsize
frame height (vertical) in pixels
Definition: main.h:897
boolean restoring
Definition: main.h:948
void ** alt_srcs
Definition: main.h:1054
volatile off64_t aseek_pos
audio seek posn. (bytes) for when we switch clips
Definition: main.h:1064
int achans
number of audio channels (0, 1 or 2)
Definition: main.h:907
uint32_t signed_endian
bitfield
Definition: main.h:909
double pb_fps
current playback rate, may vary from fps, can be 0. or negative
Definition: main.h:1007
frames_t frameno
Definition: main.h:934
int * alt_src_types
Definition: main.h:1055
int hsize
frame width (horizontal) in pixels (NOT macropixels !)
Definition: main.h:896
lives_subtitles_t * subt
Definition: main.h:1076
size_t afilesize
Definition: main.h:912
double freeze_fps
pb_fps for paused / frozen clips
Definition: main.h:1013
int arate
current audio playback rate (varies if the clip rate is changed)
Definition: main.h:906
double fps
Definition: main.h:893
boolean play_paused
Definition: main.h:1014
boolean opening
Definition: main.h:946
size_t f_size
Definition: main.h:913
uint16_t alpha
Definition: main.h:326
uint16_t blue
Definition: main.h:325
uint16_t green
Definition: main.h:324
uint16_t red
Definition: main.h:323
boolean(* set_palette)(lives_clip_data_t *)
Definition: plugins.h:442
boolean(* get_frame)(const lives_clip_data_t *, int64_t frame, int *rowstrides, int height, void **pixel_data)
frame starts at 0 in these functions; height is height of primary plane
Definition: plugins.h:432
const lives_decoder_sys_t * decoder
Definition: plugins.h:450
lives_clip_data_t * cdata
Definition: plugins.h:451
lives_rfx_t * rfx
pointer to rfx for current delegate (or NULL)
Definition: plugins.h:690
ulong func
menuitem activation function for current delegate
Definition: plugins.h:689
int delegate
offset in list of current delegate
Definition: plugins.h:688
LiVESList * list
list of filter_idx from which user can delegate
Definition: plugins.h:687
screen details
Definition: mainwindow.h:353
LiVESXDevice * mouse_device
unused for gtk+ < 3.0.0
Definition: mainwindow.h:357
LiVESXDisplay * disp
Definition: mainwindow.h:358
LiVESXScreen * screen
Definition: mainwindow.h:359
LiVESWidget * menuitem
the menu item which activates this effect
Definition: plugins.h:643
uint32_t props
Definition: plugins.h:633
char * menu_text
for Weed, this is the filter_class "name"
Definition: plugins.h:627
char * action_desc
for Weed "Applying $s"
Definition: plugins.h:628
boolean is_template
Definition: plugins.h:656
int min_frames
for Weed, 1
Definition: plugins.h:629
int offset
offset in frames (default 0)
Definition: pangotext.h:45
volatile ticks_t lastcheck
Definition: mainwindow.h:693
char * foreign_visual
Definition: mainwindow.h:846
LiVESWidget * autolives
Definition: mainwindow.h:1220
LiVESList * prefs_cache
file caches
Definition: mainwindow.h:1517
LiVESWidget * capture
Definition: mainwindow.h:1190
LiVESList * set_list
number of sets in workdir (minus the current set), -1 if not checked
Definition: mainwindow.h:753
LiVESList * xlays
immediately (to be) affected layout maps
Definition: mainwindow.h:1477
LiVESWidget * paste_as_new
Definition: mainwindow.h:1151
char * overlay_msg
Definition: mainwindow.h:1644
LiVESWidget * raudbar
Definition: mainwindow.h:1286
LiVESWidget * erase_subs
Definition: mainwindow.h:1184
weed_plant_t * ref_message
Definition: mainwindow.h:1730
LiVESWidget * vj_save_set
Definition: mainwindow.h:1231
int def_width
default sizes for when no file is loaded
Definition: mainwindow.h:898
boolean gen_started_play
Definition: mainwindow.h:1694
lives_cursor_t cursor_style
Definition: mainwindow.h:1296
LiVESWidget * m_sepwinbutton
Definition: mainwindow.h:1369
_vid_playback_plugin * vpp
video plugin
Definition: mainwindow.h:1572
weed_plant_t * fd_layer
framedraw preview layer
Definition: mainwindow.h:1276
LiVESWidget * m_rewindbutton
Definition: mainwindow.h:1369
boolean ce_thumbs
Definition: mainwindow.h:1676
int swapped_clip
maintains the current cliplist postion even if we swap fg and bg clips
Definition: mainwindow.h:850
weed_plant_t * frame_layer
Definition: mainwindow.h:948
int num_rendered_effects_builtin
Definition: mainwindow.h:856
boolean close_keep_frames
special value for when generating to clipboard
Definition: mainwindow.h:1438
LiVESWidget * open
menus
Definition: mainwindow.h:1107
int old_scr_width
Definition: mainwindow.h:903
boolean msg_area_configed
Definition: mainwindow.h:1443
LiVESWidget * rewind
Definition: mainwindow.h:1171
int ref_message_n
Definition: mainwindow.h:1732
boolean nervous
some VJ effects / toys
Definition: mainwindow.h:849
LiVESWidget * fade_aud_out
Definition: mainwindow.h:1211
volatile lives_rfx_t * vrfx_update
single access for updating alarm list
Definition: mainwindow.h:1510
boolean stored_event_list_auto_changed
Definition: mainwindow.h:806
volatile int agen_key
which fx key is generating audio [1 based] (or 0 for none)
Definition: mainwindow.h:1649
int num_tracks
Definition: mainwindow.h:1430
LiVESWidget * show_quota
Definition: mainwindow.h:1226
boolean gen_to_clipboard
rendered generators
Definition: mainwindow.h:1564
pthread_mutex_t abuf_frame_mutex
used to synch audio buffer for generators
Definition: mainwindow.h:1496
LiVESWidget * redo
Definition: mainwindow.h:1147
boolean last_transition_ins_frames
Definition: mainwindow.h:865
boolean switch_during_pb
Definition: mainwindow.h:792
boolean aplayer_broken
Definition: mainwindow.h:1653
volatile boolean video_seek_ready
Definition: mainwindow.h:939
LiVESWidget * rename
Definition: mainwindow.h:1216
pthread_mutex_t instance_ref_mutex
refcounting for instances
Definition: mainwindow.h:1504
int img_concat_clip
when opening multiple, image files can get concatenated here (prefs->concat_images)
Definition: mainwindow.h:1561
frames_t rec_vid_frames
values to be written to the event list concurrent with next video ftame event
Definition: mainwindow.h:1529
double aframeno
and the audio 'frame' for when we are looping
Definition: mainwindow.h:962
pthread_mutex_t audio_filewriteend_mutex
sync for ending writing audio to file
Definition: mainwindow.h:1503
LiVESWidget * preferences
Definition: mainwindow.h:1215
int osc_auto
bypass user choices automatically
Definition: mainwindow.h:918
pthread_mutex_t alarmlist_mutex
append / remove with file_buffer list
Definition: mainwindow.h:1507
volatile short scratch
Definition: mainwindow.h:1026
size_t sl_undo_buffer_used
Definition: mainwindow.h:811
LiVESWidget * delaudio_submenu
Definition: mainwindow.h:1205
weed_layer_t * st_fcache
caches for start / end / preview images. This avoids having to reload / reread them from the source,...
Definition: mainwindow.h:1785
boolean no_exit
if TRUE, do not exit after saving set
Definition: mainwindow.h:1490
LiVESList * videodevs
Definition: mainwindow.h:1625
char image_dir[PATH_MAX]
Definition: mainwindow.h:734
boolean debug
debug crashes and asserts
Definition: mainwindow.h:1615
boolean only_close
only close clips - do not exit
Definition: mainwindow.h:1439
volatile uint64_t rte
current max for VJ mode == 64 effects on fg clip
Definition: mainwindow.h:867
int preview_frame
Definition: mainwindow.h:1309
boolean dvgrab_preview
Definition: mainwindow.h:791
LiVESWidget * p_loopbutton
Definition: mainwindow.h:1379
uint32_t signal_caught
Definition: mainwindow.h:1673
LiVESWidget * export_theme
Definition: mainwindow.h:1141
pthread_mutex_t event_list_mutex
prevent simultaneous writing to event_list by audio and video threads
Definition: mainwindow.h:1499
int audio_start
Definition: mainwindow.h:771
char msg[MAINW_MSG_SIZE]
Definition: mainwindow.h:724
LiVESWidget * preview_image
Definition: mainwindow.h:1305
int aud_rec_fd
fd of file we are recording audio to
Definition: mainwindow.h:1525
boolean open_deint
Definition: mainwindow.h:907
volatile ticks_t currticks
wall clock time, updated whenever lives_get_*_ticks is called
Definition: mainwindow.h:1005
LiVESWidget * merge
Definition: mainwindow.h:1152
LiVESWidget * p_playbutton
Definition: mainwindow.h:1379
int last_dprint_file
message output settings
Definition: mainwindow.h:1535
LiVESWidget * change_speed
Definition: mainwindow.h:1189
boolean last_transition_loop_to_fit
Definition: mainwindow.h:863
LiVESWidget * open_loc_menu
Definition: mainwindow.h:1115
boolean toy_go_wild
some silliness
Definition: mainwindow.h:852
LiVESTargetEntry * target_table
drag and drop target table
Definition: mainwindow.h:1623
LiVESWidget * custom_effects_submenu
Definition: mainwindow.h:1418
LiVESWidget * show_file_comments
Definition: mainwindow.h:1222
int last_transition_idx
Definition: mainwindow.h:861
double fixed_fpsd
<=0. means free playback
Definition: mainwindow.h:990
boolean tried_ds_recover
Definition: mainwindow.h:1657
char recent_file[PATH_MAX]
Definition: mainwindow.h:737
LiVESWidget * dsize
Definition: mainwindow.h:1186
unsigned char * sl_undo_mem
Definition: mainwindow.h:812
LiVESWidget * mt_menu
Definition: mainwindow.h:1243
boolean resizing
Definition: mainwindow.h:822
void * pulsed
pulseaudio player
Definition: mainwindow.h:1463
boolean has_custom_tools
Definition: mainwindow.h:1608
boolean ce_upd_clip
Definition: mainwindow.h:1677
double blend_factor
keyboard control parameter
Definition: mainwindow.h:872
boolean leave_recovery
Definition: mainwindow.h:1482
lives_clip_t * files[MAX_FILES+1]
+1 for the clipboard
Definition: mainwindow.h:729
boolean add_clear_ds_button
Definition: mainwindow.h:1655
int rec_signed_endian
Definition: mainwindow.h:1532
volatile boolean record
Definition: mainwindow.h:794
LiVESWidget * tools_menu
Definition: mainwindow.h:1402
pthread_mutex_t fbuffer_mutex
Definition: mainwindow.h:1506
int crash_possible
Definition: mainwindow.h:1722
boolean block_param_updates
block visual param changes from updating real values
Definition: mainwindow.h:1550
boolean suppress_layout_warnings
Definition: mainwindow.h:1798
int n_messages
Definition: mainwindow.h:1731
int def_trans_idx
Definition: mainwindow.h:1747
LiVESWidget * insert
Definition: mainwindow.h:1150
boolean no_configs
Definition: mainwindow.h:1803
ticks_t origsecs
playback start seconds - subtracted from all other ticks to keep numbers smaller
Definition: mainwindow.h:1000
char * recovery_file
the filename of our recover file
Definition: mainwindow.h:1481
LiVESWidget * playall
Definition: mainwindow.h:1166
LiVESWidget * splash_window
splash window
Definition: mainwindow.h:1595
const char * new_vpp
Definition: mainwindow.h:1573
int active_track_list[MAX_TRACKS]
Definition: mainwindow.h:1689
lives_painter_surface_t * ei_surface
Definition: mainwindow.h:1318
boolean last_transition_align_start
Definition: mainwindow.h:864
LiVESWidget * troubleshoot
Definition: mainwindow.h:1244
boolean is_rendering
Definition: mainwindow.h:821
LiVESWidget * tvdev
Definition: mainwindow.h:1126
frames64_t * frame_index
maps frame slots to the presentation values (if >= 0, points to a 'virtual' frame in the source clip,...
Definition: mainwindow.h:1434
LiVESWidget * playsel
Definition: mainwindow.h:1167
LiVESWidget * custom_tools_submenu
Definition: mainwindow.h:1421
lives_mgeometry_t * mgeom
multi-head support
Definition: mainwindow.h:1576
volatile double rec_avel
Definition: mainwindow.h:968
boolean clip_switched
for recording - did we switch clips ?
Definition: mainwindow.h:793
boolean reconfig
set to TRUE if a monitor / screen size change is detected
Definition: mainwindow.h:1743
boolean selwidth_locked
Definition: mainwindow.h:786
LiVESWidget * open_loc
Definition: mainwindow.h:1113
LiVESWidget * laudbar
Definition: mainwindow.h:1286
boolean effects_paused
Definition: mainwindow.h:1055
int sel_start
Definition: mainwindow.h:884
lives_render_error_t(* progress_fn)(boolean reset)
Definition: mainwindow.h:1044
boolean go_away
Definition: mainwindow.h:1614
int sepwin_minheight
Definition: mainwindow.h:1671
char frameblank_path[PATH_MAX]
???
Definition: mainwindow.h:1717
volatile boolean loop_cont
Definition: mainwindow.h:764
boolean jack_can_start
Definition: mainwindow.h:934
lives_painter_surface_t * raudio_drawable
Definition: mainwindow.h:1386
int foreign_width
Definition: mainwindow.h:844
char * string_constants[NUM_LIVES_STRING_CONSTANTS]
Definition: mainwindow.h:1539
char vid_save_dir[PATH_MAX]
Definition: mainwindow.h:731
LiVESIOChannel * iochan
encoder text output
Definition: mainwindow.h:1605
LiVESWidget * resample_video
Definition: mainwindow.h:1214
int assumed_width
Definition: mainwindow.h:1738
boolean dsu_valid
Definition: mainwindow.h:1791
boolean cs_is_permitted
set automatically when cs_permitted can update the clip
Definition: mainwindow.h:1021
boolean ignore_screen_size
applied during frame reconfig events
Definition: mainwindow.h:1745
int def_height
Definition: mainwindow.h:898
mt_opts multi_opts
some multitrack options that survive between mt calls
Definition: mainwindow.h:1492
LiVESWidget * record_perf
Definition: mainwindow.h:1165
boolean has_custom_utilities
Definition: mainwindow.h:1608
boolean no_interp
block interpolation (for single frame previews)
Definition: mainwindow.h:1551
ulong fsp_func
fileselector preview expose (for image thumbnails)
Definition: mainwindow.h:1075
volatile boolean ext_audio
using external video playback plugin to stream audio
Definition: mainwindow.h:774
lives_permmgr_t * permmgr
Definition: mainwindow.h:1795
LiVESWidget * vj_load_set
Definition: mainwindow.h:1232
LiVESWidget * preview_controls
Definition: mainwindow.h:1378
LiVESWidget * playframe
Definition: mainwindow.h:1098
boolean ext_cntl[MAX_EXT_CNTL]
external control inputs
Definition: mainwindow.h:1579
LiVESWidget * resize_menuitem
Definition: mainwindow.h:1436
LiVESWidget * sa_button
Definition: mainwindow.h:1290
LiVESWidget * select_last
Definition: mainwindow.h:1162
boolean noswitch
value set automatically to prevent 'inopportune' clip switching
Definition: mainwindow.h:1019
lives_render_error_t render_error
Definition: mainwindow.h:1664
char proj_load_dir[PATH_MAX]
Definition: mainwindow.h:735
boolean cs_permitted
set to TRUE to allow overriding of noswitch in limited circumstances
Definition: mainwindow.h:1020
int sepwin_minwidth
Definition: mainwindow.h:1671
int blend_subspace
Definition: mainwindow.h:982
LiVESList * cliplist
hash table of clips in menu order
Definition: mainwindow.h:743
lives_alarm_t overlay_alarm
Definition: mainwindow.h:1646
volatile lives_cancel_t cancelled
Definition: mainwindow.h:798
frames64_t pred_frame
Definition: mainwindow.h:955
LiVESWidget * sel_label
Definition: mainwindow.h:1227
int sl_undo_offset
Definition: mainwindow.h:813
LiVESWidget * preview_spinbutton
Definition: mainwindow.h:1306
LiVESWidget * pf_grid
Definition: mainwindow.h:1101
LiVESWidget * delall_audio
Definition: mainwindow.h:1207
lives_painter_surface_t * pi_surface
Definition: mainwindow.h:1318
int blend_clamping
Definition: mainwindow.h:982
int cap_number
Definition: mainwindow.h:739
char vid_dl_dir[PATH_MAX]
Definition: mainwindow.h:732
boolean preview
Definition: mainwindow.h:757
lives_storage_status_t ds_status
Definition: mainwindow.h:1750
int rec_asamps
Definition: mainwindow.h:1532
int next_free_alarm
Definition: mainwindow.h:1640
LiVESWidget * open_sel
Definition: mainwindow.h:1108
boolean osc_block
TODO - make this a mutex and more finely grained : things we need to block are (clip switches,...
Definition: mainwindow.h:916
int current_file
Definition: mainwindow.h:727
boolean no_context_update
may be set temporarily to block wodget context updates
Definition: mainwindow.h:1726
int num_rendered_effects_test
Definition: mainwindow.h:858
boolean is_ready
Definition: mainwindow.h:787
LiVESPixbuf * imframe
Definition: mainwindow.h:1102
boolean show_procd
override showing of "processing..." dialog
Definition: mainwindow.h:1548
int blend_height
Definition: mainwindow.h:981
LiVESWidget * vj_realize
Definition: mainwindow.h:1238
lives_screen_area_t * screen_areas
Definition: mainwindow.h:1687
weed_layer_t * en_fcache
Definition: mainwindow.h:1785
boolean add_clear_ds_adv
Definition: mainwindow.h:1656
pthread_cond_t avseek_cond
Definition: mainwindow.h:937
lives_cancel_type_t cancel_type
Definition: mainwindow.h:799
pthread_mutex_t clip_list_mutex
prevent adding/removing to cliplist while another thread could be reading it
Definition: mainwindow.h:1500
int old_active_track_list[MAX_TRACKS]
Definition: mainwindow.h:1692
LiVESWidget * clear_ds
Definition: mainwindow.h:1143
LiVESWidget * gens_submenu
Definition: mainwindow.h:1414
ticks_t orignsecs
usecs at start of playback - ditto
Definition: mainwindow.h:1001
LiVESWidget * play_window
Definition: mainwindow.h:947
int num_rendered_effects_custom
Definition: mainwindow.h:857
uint64_t next_ds_warn_level
current disk space warning level for the tempdir
Definition: mainwindow.h:1666
boolean has_custom_gens
Definition: mainwindow.h:1608
LiVESWidget * open_lives2lives
Definition: mainwindow.h:1118
LiVESWidget * eventbox4
Definition: mainwindow.h:1334
boolean ext_src_used[MAX_FILES]
Definition: mainwindow.h:1690
LiVESWidget * load_audio
Definition: mainwindow.h:1191
LiVESWidget * loop_video
Definition: mainwindow.h:1173
void * jackd
jack audio player / transport
Definition: mainwindow.h:1453
short endian
Definition: mainwindow.h:817
boolean loop
Definition: mainwindow.h:763
LiVESList * gen_cache
general cache of fi
Definition: mainwindow.h:1519
boolean stored_layout_save_all_vals
Definition: mainwindow.h:807
LiVESList * file_buffers
list of open files for buffered i/o
Definition: mainwindow.h:1523
lives_pgid_t alives_pgid
Definition: mainwindow.h:877
int last_transition_loops
Definition: mainwindow.h:862
boolean ccpd_with_sound
Definition: mainwindow.h:785
LiVESWidget * recaudio_sel
Definition: mainwindow.h:1196
int scrap_file
we throw odd sized frames here when recording in real time; used if a source is a generator or stream
Definition: mainwindow.h:874
LiVESWidget * eventbox5
Definition: mainwindow.h:1335
LiVESWidget * frame2
Definition: mainwindow.h:1095
LiVESList * affected_layout_marks
list of pairs of marks in affected_layouts_map, text between them should be deleted when stored_layou...
Definition: mainwindow.h:1474
LiVESWidget * trim_audio
Definition: mainwindow.h:1203
LiVESWidget * framedraw_preview
the 'redraw' button
Definition: mainwindow.h:1265
boolean insert_after
Definition: mainwindow.h:880
lives_timeout_t alarms[LIVES_MAX_ALARMS]
reserve 1 for emergency msgs
Definition: mainwindow.h:1639
int ce_frame_height
Definition: mainwindow.h:1662
LiVESAdjustment * msg_adj
Definition: mainwindow.h:1326
uint64_t agen_samps_count
count of samples since init
Definition: mainwindow.h:1651
int untitled_number
Definition: mainwindow.h:738
int num_tr_applied
number of transitions active
Definition: mainwindow.h:871
int blend_gamma
Definition: mainwindow.h:983
LiVESWidget * spinbutton_pb_fps
Definition: mainwindow.h:1391
lives_audio_buf_t * afb[2]
used for buffering / feeding audio to video generators
Definition: mainwindow.h:1698
volatile boolean clutch
Definition: mainwindow.h:1060
LiVESWidget * export_proj
Definition: mainwindow.h:1139
boolean recovering_files
Definition: mainwindow.h:1485
weed_plant_t * msg_list
Definition: mainwindow.h:1729
boolean signals_deferred
Definition: mainwindow.h:1674
LiVESWidget * resample_audio
Definition: mainwindow.h:1212
LiVESWidget * spinbutton_end
Definition: mainwindow.h:1288
uint64_t aud_data_written
Definition: mainwindow.h:1720
volatile int blend_palette
here we can store the details of the blend file at the insertion point, if nothing changes we can tar...
Definition: mainwindow.h:980
int n_screen_areas
Definition: mainwindow.h:1684
volatile boolean is_exiting
set during shutdown (inverse of only_close then)
Definition: mainwindow.h:1440
boolean cs_manage
Definition: mainwindow.h:1789
boolean no_switch_dprint
Definition: mainwindow.h:1536
LiVESWidget * toy_tv
Definition: mainwindow.h:1219
LiVESList * new_lmap_errors
Definition: mainwindow.h:815
boolean decoders_loaded
decoders
Definition: mainwindow.h:1611
frames_t fps_mini_measure
show fps stats during playback
Definition: mainwindow.h:779
weed_plant_t * filter_map
Definition: mainwindow.h:1298
LiVESWidget * recent_menu
Definition: mainwindow.h:1127
boolean has_custom_effects
Definition: mainwindow.h:1608
LiVESWidget * load_subs
Definition: mainwindow.h:1183
weed_plant_t * blend_layer
Definition: mainwindow.h:977
boolean fs
Definition: mainwindow.h:762
LiVESWidget * full_screen
Definition: mainwindow.h:1172
void * pulsed_read
Definition: mainwindow.h:1464
ticks_t last_display_ticks
Definition: mainwindow.h:1012
LiVESWidget * m_mutebutton
Definition: mainwindow.h:1370
uint32_t sense_state
Definition: mainwindow.h:1713
boolean recoverable_layout
Definition: mainwindow.h:1483
void *** pchains
Definition: mainwindow.h:1301
uint32_t kb_timer
Definition: mainwindow.h:1058
boolean startup_error
Definition: mainwindow.h:1660
LiVESWidget * import_theme
Definition: mainwindow.h:1140
boolean invalid_clips
Definition: mainwindow.h:1484
int blend_width
Definition: mainwindow.h:981
pthread_mutex_t vpp_stream_mutex
prevent from writing audio when stream is closing
Definition: mainwindow.h:1501
LiVESWidget * select_invert
Definition: mainwindow.h:1163
int pre_src_file
video file we were playing before any ext input started
Definition: mainwindow.h:971
int blend_file
background clip details
Definition: mainwindow.h:976
LiVESWidget * p_playselbutton
Definition: mainwindow.h:1379
int afbuffer_clients
Definition: mainwindow.h:1699
LiVESWidget * p_mutebutton
Definition: mainwindow.h:1379
LiVESWidget * append_audio
Definition: mainwindow.h:1200
char proj_save_dir[PATH_MAX]
Definition: mainwindow.h:736
int play_sequence
currticks when last display was shown (used for fixed fps)
Definition: mainwindow.h:1013
LiVESWidget * export_allaudio
Definition: mainwindow.h:1198
boolean was_set
Definition: mainwindow.h:750
boolean opening_multi
flag to indicate multiple file selection
Definition: mainwindow.h:1555
void * debug_ptr
Definition: mainwindow.h:1616
LiVESWidget * LiVES
WIDGETS.
Definition: mainwindow.h:1093
int pwidth
PLAYBACK.
Definition: mainwindow.h:926
int pre_src_audio_file
audio file we were playing before any ext input started
Definition: mainwindow.h:972
LiVESWidget * framedraw_spinbutton
the frame number button
Definition: mainwindow.h:1266
LiVESWidget * framedraw_reset
the 'redraw' button
Definition: mainwindow.h:1264
LiVESWidget * xdelete
Definition: mainwindow.h:1153
boolean fx_is_auto
Definition: mainwindow.h:1695
boolean did_rfx_preview
Definition: mainwindow.h:1056
LiVESWidget * btoolbar
button toolbar - clip editor
Definition: mainwindow.h:1368
boolean error
Definition: mainwindow.h:801
lives_fx_candidate_t fx_candidates[MAX_FX_CANDIDATE_TYPES]
< effects which can have candidates from which a delegate is selected (current examples are: audio_vo...
Definition: mainwindow.h:1514
boolean ext_playback
using external video playback plugin
Definition: mainwindow.h:773
LiVESWidget * restore
Definition: mainwindow.h:1135
LiVESWidget * ext_audio_checkbutton
Definition: mainwindow.h:1358
boolean suppress_dprint
tidy up, e.g. by blocking "switched to file..." and "closed file..." messages
Definition: mainwindow.h:1537
LiVESWidget * sep_image
Definition: mainwindow.h:1229
short sel_move
Definition: mainwindow.h:885
int pheight
playback height
Definition: mainwindow.h:927
int audio_end
Definition: mainwindow.h:771
LiVESWidget * voladj
Definition: mainwindow.h:1209
LiVESWidget * lock_selwidth
Definition: mainwindow.h:1164
weed_plant_t * audio_event
Definition: mainwindow.h:1300
pthread_mutex_t abuf_mutex
mutices
Definition: mainwindow.h:1495
frames_t play_start
Definition: mainwindow.h:931
LiVESWidget * playclip
Definition: mainwindow.h:1168
boolean opening_loc
opening location (streaming)
Definition: mainwindow.h:790
LiVESWidget * utilities_submenu
Definition: mainwindow.h:1412
int aud_file_to_kill
Definition: mainwindow.h:909
LiVESWidget * show_clipboard_info
Definition: mainwindow.h:1223
volatile int rec_aclip
recording values - to be inserted at the following video frame
Definition: mainwindow.h:967
int new_blend_file
Definition: mainwindow.h:976
boolean sep_win
Definition: mainwindow.h:761
LiVESWidget * eventbox3
Definition: mainwindow.h:1333
ulong spin_start_func
Definition: mainwindow.h:1064
char * urgency_msg
OSD.
Definition: mainwindow.h:1643
LiVESWidget * m_loopbutton
Definition: mainwindow.h:1370
int prefs_changed
Definition: mainwindow.h:894
LiVESWidget * p_rewindbutton
Definition: mainwindow.h:1379
volatile double rec_aseek
Definition: mainwindow.h:969
weed_layer_t * pr_fcache
Definition: mainwindow.h:1785
double rec_fps
Definition: mainwindow.h:1528
double ptrtime
Definition: mainwindow.h:899
boolean leave_files
TRUE to leave clip files on disk even when closing (default FALSE)
Definition: mainwindow.h:751
weed_event_t * stored_event_list
stored mt -> clip editor
Definition: mainwindow.h:804
LiVESWidget * mute_audio
Definition: mainwindow.h:1177
char sepimg_path[PATH_MAX]
Definition: mainwindow.h:1718
boolean unordered_blocks
are we recording unordered blocks ?
Definition: mainwindow.h:1488
LiVESWidget * preview_box
Definition: mainwindow.h:1304
LiVESPixbuf * camframe
Definition: mainwindow.h:1103
LiVESWidget * midi_save
Definition: mainwindow.h:1188
int max_textsize
Definition: mainwindow.h:1794
LiVESWidget * import_proj
Definition: mainwindow.h:1138
lives_proc_thread_t helper_procthreads[N_HLP_PROCTHREADS]
Definition: mainwindow.h:1800
int fixed_fps_denom
Definition: mainwindow.h:989
LiVESSList * clips_group
Definition: mainwindow.h:745
LiVESList * decoder_list
Definition: mainwindow.h:1612
LiVESWidget * framedraw
for the framedraw special widget - TODO - use a sub-struct
Definition: mainwindow.h:1263
boolean playing_sel
list of set names in current workdir, mau be NULL
Definition: mainwindow.h:756
int clips_available
Definition: mainwindow.h:740
LiVESWidget * start_image
Definition: mainwindow.h:1320
char * old_vhash
Definition: mainwindow.h:1758
LiVESWidget * spinbutton_start
Definition: mainwindow.h:1288
LiVESWidget * recaudio_submenu
Definition: mainwindow.h:1194
ulong preview_spin_func
Definition: mainwindow.h:1310
LiVESList * current_layouts_map
map of all layouts for set
Definition: mainwindow.h:1470
boolean has_session_workdir
Definition: mainwindow.h:1659
boolean jack_can_stop
Definition: mainwindow.h:934
boolean recording_recovered
Definition: mainwindow.h:1486
volatile boolean in_fs_preview
Definition: mainwindow.h:797
LiVESWidget * open_yuv4m
Definition: mainwindow.h:1117
pthread_mutex_t fxd_active_mutex
prevent simultaneous writing to active_dummy by audio and video threads
Definition: mainwindow.h:1498
lives_toy_t toy_type
Definition: mainwindow.h:851
volatile boolean record_paused
pause during recording
Definition: mainwindow.h:1557
int ascrap_file
scrap file for recording audio scraps
Definition: mainwindow.h:875
boolean keep_pre
set if previewed frames should be retained as processed frames (for rendered effects / generators)
Definition: mainwindow.h:1567
char * file_open_params
extra parameters for opening special files
Definition: mainwindow.h:906
double audio_stretch
for fixed fps modes, the value is used to speed up / slow down audio
Definition: mainwindow.h:1015
LiVESWidget * msg_area
Definition: mainwindow.h:1324
lives_mt * multitrack
holds a pointer to the entire multitrack environment; NULL in Clip Edit mode
Definition: mainwindow.h:1087
int num_sets
Definition: mainwindow.h:752
pthread_mutex_t avseek_mutex
Definition: mainwindow.h:938
int osc_enc_height
Definition: mainwindow.h:921
boolean faded
Definition: mainwindow.h:759
xprocess * proc_ptr
Definition: mainwindow.h:1090
volatile boolean ping_pong
Definition: mainwindow.h:765
boolean record_starting
start recording at next frame
Definition: mainwindow.h:1559
LiVESWidget * save_selection
Definition: mainwindow.h:1136
uint32_t foreign_key
Definition: mainwindow.h:829
LiVESList * stored_layout_undos
Definition: mainwindow.h:810
int active_sa_clips
Definition: mainwindow.h:1686
boolean foreign
for external window capture
Definition: mainwindow.h:824
int old_scr_height
Definition: mainwindow.h:903
volatile boolean agen_needs_reinit
Definition: mainwindow.h:1650
boolean memok
set to FALSE if a segfault is received, ie. we should assume all memory is corrupted and exit ASAP
Definition: mainwindow.h:1776
pthread_mutex_t cache_buffer_mutex
sync for jack playback termination
Definition: mainwindow.h:1502
boolean stored_event_list_changed
Definition: mainwindow.h:805
boolean save_with_sound
Definition: mainwindow.h:784
lives_painter_surface_t * laudio_drawable
Definition: mainwindow.h:1386
char ** fonts_array
Definition: mainwindow.h:1620
Window foreign_id
Definition: mainwindow.h:840
LiVESWidget * trim_submenu
Definition: mainwindow.h:1202
int blend_sampling
Definition: mainwindow.h:982
LiVESWidget * show_file_info
Definition: mainwindow.h:1221
weed_plant_t * fd_layer_orig
original layer uneffected
Definition: mainwindow.h:1275
int osc_enc_width
encode width, height and fps set externally
Definition: mainwindow.h:921
int * clip_index
Definition: mainwindow.h:1431
LiVESWidget * end_image
Definition: mainwindow.h:1320
LiVESWidget * copy
Definition: mainwindow.h:1148
boolean reverse_pb
used in osc.c
Definition: mainwindow.h:911
LiVESWidget * save_as
Definition: mainwindow.h:1130
LiVESWidget * load_cdtrack
Definition: mainwindow.h:1192
LiVESWidget * int_audio_checkbutton
Definition: mainwindow.h:1358
LiVESWidget * normalize_audio
Definition: mainwindow.h:1201
boolean fatal
got fatal signal
Definition: mainwindow.h:789
boolean internal_messaging
internal fx
Definition: mainwindow.h:1043
boolean is_processing
states
Definition: mainwindow.h:820
boolean preview_rendering
Definition: mainwindow.h:758
LiVESWidget * undo
Definition: mainwindow.h:1146
lives_cconnect_t * cconx
list of out -> in alpha channel connections
Definition: mainwindow.h:1669
LiVESWidget * ldg_menuitem
Definition: mainwindow.h:1395
int rte_keys
which effect is bound to keyboard (m) modechange and ctrl-alt-up-arrow / ctrl-alt-down-arrow param ch...
Definition: mainwindow.h:870
char set_name[256]
Definition: mainwindow.h:749
lives_painter_surface_t * play_surface
Definition: mainwindow.h:950
char audio_dir[PATH_MAX]
Definition: mainwindow.h:733
boolean write_vpp_file
video playback plugin was updated; write settings to a file on exit
Definition: mainwindow.h:1040
LiVESWidget * cut
Definition: mainwindow.h:1149
LiVESWidget * unicap
Definition: mainwindow.h:1124
LiVESWidget * rev_clipboard
Definition: mainwindow.h:1169
volatile int abufs_to_fill
Definition: mainwindow.h:1592
int clipstore[FN_KEYS - 1][2]
stored clips (bookmarks) [0] = clip, [1] = frame
Definition: mainwindow.h:986
char * subt_save_file
name of file to save subtitles to
Definition: mainwindow.h:1618
LiVESWidget * close
Definition: mainwindow.h:1137
uint32_t lazy
Definition: mainwindow.h:1801
int ce_frame_width
Definition: mainwindow.h:1662
int first_free_file
Definition: mainwindow.h:728
LiVESWidget * open_vcd_menu
Definition: mainwindow.h:1109
int afbuffer_clients_read
Definition: mainwindow.h:1700
frames_t play_end
Definition: mainwindow.h:931
LiVESWidget * dsu_widget
Definition: mainwindow.h:1792
LiVESWidget * eventbox2
Definition: mainwindow.h:1332
pthread_t * libthread
current read count. When this reaches abuffer_clients, we swap the read / write buffers
Definition: mainwindow.h:1702
lives_painter_surface_t * si_surface
Definition: mainwindow.h:1318
int pred_clip
Definition: mainwindow.h:956
boolean double_size
Definition: mainwindow.h:760
LiVESWidget * fade_aud_in
Definition: mainwindow.h:1210
LiVESWidget * m_playbutton
Definition: mainwindow.h:1369
boolean force_show
Definition: mainwindow.h:1763
ticks_t fps_mini_ticks
Definition: mainwindow.h:780
int fixed_fps_numer
fixed fps playback; usually fixed_fpsd==0.
Definition: mainwindow.h:989
ticks_t deltaticks
deltaticks for scratching
Definition: mainwindow.h:1006
LiVESWidget * play_image
Definition: mainwindow.h:946
uint32_t last_grabbable_effect
Definition: mainwindow.h:869
boolean lockstats
Definition: mainwindow.h:1774
char * version_hash
Definition: mainwindow.h:1757
volatile ticks_t startticks
effective ticks when current frame was (should have been) displayed
Definition: mainwindow.h:997
weed_plant_t * afilter_map
Definition: mainwindow.h:1299
LiVESWidget * toy_random_frames
Definition: mainwindow.h:1218
ticks_t wall_ticks
Definition: mainwindow.h:1004
volatile boolean audio_seek_ready
Definition: mainwindow.h:940
LiVESWidget * m_playselbutton
Definition: mainwindow.h:1369
LiVESWidget * pl_eventbox
Definition: mainwindow.h:1100
int new_clip
clip we should switch to during playback; switch will happen at the designated SWITCH POINT
Definition: mainwindow.h:1022
LiVESWidget * export_submenu
Definition: mainwindow.h:1197
weed_plant_t * rte_textparm
send keyboard input to this paramter (usually NULL)
Definition: mainwindow.h:1589
LiVESWidget * hruler
Definition: mainwindow.h:1230
frames_t record_frame
frame number to insert in recording
Definition: mainwindow.h:964
int assumed_height
Definition: mainwindow.h:1739
LiVESWidget * expl_missing
Definition: mainwindow.h:1245
LiVESWidget * backup
Definition: mainwindow.h:1134
boolean record_foreign
Definition: mainwindow.h:825
LiVESWidget * vj_reset
Definition: mainwindow.h:1237
LiVESList * affected_layouts_map
map of layouts with errors
Definition: mainwindow.h:1469
boolean midi_channel_lock
Definition: mainwindow.h:1587
boolean mute
Definition: mainwindow.h:770
boolean mt_needs_idlefunc
set if we need to re-add the idlefunc for autobackup
Definition: mainwindow.h:1088
LiVESWidget * frame1
Definition: mainwindow.h:1094
LiVESWidget * select_submenu
Definition: mainwindow.h:1154
lives_pconnect_t * pconx
list of out -> in param connections
Definition: mainwindow.h:1668
LiVESWidget * fade
Definition: mainwindow.h:1185
LiVESWidget * delsel_audio
Definition: mainwindow.h:1206
frames_t actual_frame
actual / last frame being displayed
Definition: mainwindow.h:959
volatile lives_whentostop_t whentostop
Definition: mainwindow.h:929
int playing_file
which number file we are playing (or -1) [generally mainw->current_file]
Definition: mainwindow.h:943
LiVESWidget * trim_to_pstart
Definition: mainwindow.h:1204
uint32_t disk_mon
Definition: mainwindow.h:1807
pthread_mutex_t fx_mutex[FX_KEYS_MAX]
used to prevent fx processing when it is scheduled for deinit
Definition: mainwindow.h:1497
double inst_fps
Definition: mainwindow.h:781
weed_plant_t * frame_layer_preload
predictive caching apparatus
Definition: mainwindow.h:954
int foreign_height
Definition: mainwindow.h:844
volatile lives_audio_buf_t * audio_frame_buffer
used for buffering / feeding audio to video generators
Definition: mainwindow.h:1697
volatile int uflow_count
experimental values, primarily for testing
Definition: mainwindow.h:1761
lives_rfx_t * rendered_fx
rendered fx
Definition: mainwindow.h:855
ulong spin_end_func
Definition: mainwindow.h:1065
int rec_achans
Definition: mainwindow.h:1532
boolean loop_locked
Definition: mainwindow.h:769
FILE * clip_header
Definition: mainwindow.h:1521
LiVESWidget * framecounter
Definition: mainwindow.h:1390
ticks_t flush_audio_tc
reserved space for mbar
Definition: mainwindow.h:1735
int active_sa_fx
Definition: mainwindow.h:1685
int pre_play_file
the current file before playback started
Definition: mainwindow.h:973
LiVESWidget * select_new
Definition: mainwindow.h:1156
LiVESWidget * export_selaudio
Definition: mainwindow.h:1199
char vpp_defs_file[PATH_MAX]
Definition: mainwindow.h:1627
int foreign_bpp
Definition: mainwindow.h:845
lives_decoder_t * track_decoders[MAX_TRACKS]
Definition: mainwindow.h:1691
volatile boolean threaded_dialog
not really threaded ! but threaded_dialog_spin() can be called to animate it
Definition: mainwindow.h:1046
LiVESXWindow * foreign_window
Definition: mainwindow.h:843
int size_warn
warn the user that incorrectly sized frames were found (threshold count)
Definition: mainwindow.h:1017
LiVESWidget * firewire
Definition: mainwindow.h:1125
LiVESPixbuf * imsep
Definition: mainwindow.h:1104
LiVESPixbuf * scrap_pixbuf
cached image for speeding up rendering
Definition: mainwindow.h:1724
boolean is_generating
Definition: mainwindow.h:1565
char vid_load_dir[PATH_MAX]
Definition: mainwindow.h:730
boolean pretty_colours
Definition: mainwindow.h:1796
LiVESWidget * open_device_menu
Definition: mainwindow.h:1120
pthread_mutex_t exit_mutex
prevent multiple threads trying to run cleanup
Definition: mainwindow.h:1505
LiVESWidget * midi_learn
Definition: mainwindow.h:1187
void * jackd_read
dummy
Definition: mainwindow.h:1454
weed_event_t * event_list
current event_list, for recording
Definition: mainwindow.h:803
LiVESList * hdrs_cache
cache of a file header (e.g. header.lives)
Definition: mainwindow.h:1518
LiVESWidget * run_test_rfx_submenu
Definition: mainwindow.h:1415
LiVESWidget * playarea
Definition: mainwindow.h:1321
LiVESWidget * vidbar
Definition: mainwindow.h:1286
LiVESWidget * ins_silence
Definition: mainwindow.h:1208
boolean add_trash_rb
these are freed when the clip is switched or closed, or when the source frame changes or is updated
Definition: mainwindow.h:1788
LiVESWidget * loop_continue
Definition: mainwindow.h:1174
ticks_t cevent_tc
timecode of currently processing event
Definition: mainwindow.h:1553
LiVESWidget * custom_gens_submenu
Definition: mainwindow.h:1424
ticks_t stream_ticks
ticks since first frame sent to playback plugin
Definition: mainwindow.h:1011
char * fname
Definition: main.h:1506
LiVESPixbuf * pixbuf
Definition: main.h:1504
lives_img_type_t img_type
Definition: main.h:1507
LiVESError * error
Definition: main.h:1505
double scale
scale factor for all sizes
boolean non_modal
non-modal for dialogs
char * font_name
readonly for now
boolean alt_button_order
unused for now
boolean show_button_images
whether to show small images in buttons or not
int monitor
monitor we are displaying on
int packing_width
horizontal pixels between widgets
int font_size
ditto
boolean use_markup
whether markup should be used in labels
char * title_prefix
Text which is prepended to window titles, etc.
int border_width
border width in pixels
int apply_theme
theming variation for widget (0 -> no theme, 1 -> normal colours, 2+ -> theme variants)
boolean is_composited
Definition: main.h:439
uint64_t pan_annoy
Definition: main.h:471
char wm_name[64]
Definition: main.h:433
char panel[64]
Definition: main.h:470
uint64_t pan_res
Definition: main.h:472
frames_t frames_done
Definition: mainwindow.h:717
LiVESWidget * processing
Definition: mainwindow.h:706
#define lives_strdup_printf(fmt,...)
Definition: support.c:27
#define _(String)
Definition: support.h:44
#define textdomain(String)
Definition: support.h:38
#define bindtextdomain(Domain, Directory)
Definition: support.h:43
#define P_(String, StringPlural, n)
Definition: support.h:46
#define TRUE
Definition: videoplugin.h:59
#define FALSE
Definition: videoplugin.h:60
#define ABS(a)
Definition: videoplugin.h:63
WEED_GLOBAL_INLINE uint32_t weed_leaf_set_flagbits(weed_plant_t *plant, const char *leaf, uint32_t flagbits)
value ORed with flags
char * weed_palette_get_name_full(int pal, int clamping, int subspace)
WEED_GLOBAL_INLINE uint32_t weed_leaf_clear_flagbits(weed_plant_t *plant, const char *leaf, uint32_t flagbits)
~value ANDed with flags
WIDGET_HELPER_GLOBAL_INLINE boolean lives_window_present(LiVESWindow *window)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_hexpand(LiVESWidget *widget, boolean state)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_xwindow_raise(LiVESXWindow *xwin)
WIDGET_HELPER_GLOBAL_INLINE void lives_menu_item_set_text(LiVESWidget *menuitem, const char *text, boolean use_mnemonic)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_window_get_inner_size(LiVESWindow *win, int *x, int *y)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_rectangle(lives_painter_t *cr, double x, double y, double width, double height)
WIDGET_HELPER_GLOBAL_INLINE int lives_widget_get_allocation_width(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_spin_button_set_value(LiVESSpinButton *button, double value)
WIDGET_HELPER_GLOBAL_INLINE LiVESWidget * lives_widget_set_tooltip_text(LiVESWidget *widget, const char *tip_text)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_window_set_title(LiVESWindow *window, const char *title)
boolean lives_window_center(LiVESWindow *window)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_fill(lives_painter_t *cr)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_opacity(LiVESWidget *widget, double opacity)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_spin_button_update(LiVESSpinButton *button)
WIDGET_HELPER_GLOBAL_INLINE LiVESPixbuf * lives_pixbuf_scale_simple(const LiVESPixbuf *src, int dest_width, int dest_height, LiVESInterpType interp_type)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_set_source_pixbuf(lives_painter_t *cr, const LiVESPixbuf *pixbuf, double pixbuf_x, double pixbuf_y)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_window_resize(LiVESWindow *window, int width, int height)
boolean widget_helper_init(void)
WIDGET_HELPER_GLOBAL_INLINE boolean clear_widget_bg(LiVESWidget *widget, lives_painter_surface_t *s)
WIDGET_HELPER_GLOBAL_INLINE LiVESPixbuf * lives_pixbuf_new_from_file(const char *filename, LiVESError **error)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_window_set_hide_titlebar_when_maximized(LiVESWindow *window, boolean setting)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_signal_handler_unblock(livespointer instance, unsigned long handler_id)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_pixbuf_saturate_and_pixelate(const LiVESPixbuf *src, LiVESPixbuf *dest, float saturation, boolean pixilate)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_queue_draw(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_check_menu_item_get_active(LiVESCheckMenuItem *item)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_sensitive(LiVESWidget *widget, boolean state)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_surface_destroy(lives_painter_surface_t *surf)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_signal_handler_block(livespointer instance, unsigned long handler_id)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_show(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_signal_handler_disconnect(livespointer instance, unsigned long handler_id)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_object_unref(livespointer object)
decrease refcount by one: if refcount==0, object is destroyed
boolean widget_opts_rescale(double scale)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_queue_resize(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE LiVESPixbuf * lives_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, boolean preserve_aspect_ratio, LiVESError **error)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_margin_right(LiVESWidget *widget, int margin)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_show_now(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_menu_shell_insert(LiVESMenuShell *menushell, LiVESWidget *child, int pos)
WIDGET_HELPER_GLOBAL_INLINE int lives_display_get_n_screens(LiVESXDisplay *disp)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_paint(lives_painter_t *cr)
WIDGET_HELPER_GLOBAL_INLINE LiVESWidgetColor * lives_widget_color_copy(LiVESWidgetColor *c1, const LiVESWidgetColor *c2)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_xwindow_invalidate_rect(LiVESXWindow *window, lives_rect_t *rect, boolean inv_childs)
void widget_helper_set_stock_icon_alts(LiVESIconTheme *icon_theme)
WIDGET_HELPER_GLOBAL_INLINE LiVESWidgetColor * lives_rgba_to_widget_color(LiVESWidgetColor *color, lives_colRGBA64_t *lcolor)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_object_ref(livespointer object)
increase refcount by one
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_vexpand(LiVESWidget *widget, boolean state)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_table_set_column_homogeneous(LiVESTable *table, boolean homogeneous)
WIDGET_HELPER_GLOBAL_INLINE lives_colRGBA64_t lives_rgba_col_new(int red, int green, int blue, int alpha)
LIVES_GLOBAL_INLINE boolean lives_widget_destroy(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_window_unmaximize(LiVESWindow *window)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_container_add(LiVESContainer *container, LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_no_show_all(LiVESWidget *widget, boolean set)
boolean set_css_value_direct(LiVESWidget *, LiVESWidgetState state, const char *selector, const char *detail, const char *value)
WIDGET_HELPER_GLOBAL_INLINE lives_painter_t * lives_painter_create_from_surface(lives_painter_surface_t *target)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_hide(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_render_background(LiVESWidget *widget, lives_painter_t *cr, double x, double y, double width, double height)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_show_all(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE double lives_ruler_set_upper(LiVESRuler *ruler, double value)
boolean lives_widget_context_update(void)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_move_to(lives_painter_t *cr, double x, double y)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_destroy(lives_painter_t *cr)
WIDGET_HELPER_GLOBAL_INLINE LiVESWidget * lives_widget_get_parent(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_margin_left(LiVESWidget *widget, int margin)
WIDGET_HELPER_GLOBAL_INLINE lives_colRGBA64_t * lives_painter_set_source_rgb_from_lives_rgba(lives_painter_t *cr, lives_colRGBA64_t *col)
LiVESWidget * lives_standard_menu_item_new_with_label(const char *label)
boolean get_border_size(LiVESWidget *win, int *bx, int *by)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_entry_set_text(LiVESEntry *entry, const char *text)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_line_to(lives_painter_t *cr, double x, double y)
WIDGET_HELPER_GLOBAL_INLINE int lives_widget_get_allocation_height(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE LiVESXWindow * lives_widget_get_xwindow(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_set_size_request(LiVESWidget *widget, int width, int height)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_grab_focus(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_painter_stroke(lives_painter_t *cr)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_window_maximize(LiVESWindow *window)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_process_updates(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_widget_queue_draw_if_visible(LiVESWidget *widget)
WIDGET_HELPER_GLOBAL_INLINE int lives_pixbuf_get_height(const LiVESPixbuf *pixbuf)
WIDGET_HELPER_GLOBAL_INLINE int lives_pixbuf_get_width(const LiVESPixbuf *pixbuf)
WIDGET_HELPER_GLOBAL_INLINE lives_painter_surface_t * lives_xwindow_create_similar_surface(LiVESXWindow *window, lives_painter_content_t cont, int width, int height)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_spin_button_set_range(LiVESSpinButton *button, double min, double max)
WIDGET_HELPER_GLOBAL_INLINE boolean lives_pixbuf_get_has_alpha(const LiVESPixbuf *pixbuf)
@ LIVES_CURSOR_NORMAL
must be zero
ulong lives_signal_connect(LiVESWidget *, const char *signal_name, ulong funcptr, livespointer data)
#define LIVES_HAS_DEVICE_MANAGER
Definition: widget-helper.h:25
widget_opts_t widget_opts
#define N_TEXT_SIZES