24static int render_choice;
25static weed_timecode_t last_rec_start_tc = -1;
37 int ntracks = 0, xntracks = 0;
39 if (clips) *clips = weed_get_int_array_counted(event,
WEED_LEAF_CLIPS, &ntracks);
41 if (frames) *frames = weed_get_int64_array_counted(event,
WEED_LEAF_FRAMES, &xntracks);
44 if (ntracks != xntracks && xntracks * ntracks > 0) {
55 if (ntracks != 0)
return ntracks;
61 int ntracks = 0, xntracks = 0;
68 if (ntracks != xntracks && xntracks * ntracks > 0) {
79 if (ntracks != 0)
return ntracks;
85 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
96#define _get_or_zero(a, b, c) (a ? weed_get_##b##_value(a, c, NULL) : 0)
104 if (!plant)
return 0;
105 return weed_get_int_value(plant, WEED_LEAF_EVENT_TYPE, NULL);
131 weed_timecode_t ev_tc;
134 else event = *shortcut;
148 int numaclips, aclipnum = -1;
154 for (i = 0; i < numaclips; i += 2) {
155 if (aclips[i] == track) {
156 aclipnum = aclips[i + 1];
169 double *aseeks = NULL, avel = 1.;
175 for (
register int i = 0; i < numaclips; i += 2) {
176 if (aclips[i] == track) {
177 avel = aseeks[i + 1];
190 double *aseeks = NULL, aseek = 0.;
197 for (
register int i = 0; i < numaclips; i += 2) {
198 if (aclips[i] == track) {
210 int numclips, clipnum;
214 if (numclips <= layer) {
218 clipnum = clips[layer];
230 if (numframes <= layer) {
243 char *xdate = (
char *)cdate;
246 if (elist) evelist = elist;
248 evelist = weed_plant_new(WEED_PLANT_EVENT_LIST);
249 if (!evelist)
return NULL;
251 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
253 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
255 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
258 if (!weed_plant_has_leaf(evelist, WEED_LEAF_WEED_API_VERSION))
259 error = weed_set_int_value(evelist, WEED_LEAF_WEED_API_VERSION, WEED_API_VERSION);
260 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
262 if (!weed_plant_has_leaf(evelist, WEED_LEAF_FILTER_API_VERSION))
263 error = weed_set_int_value(evelist, WEED_LEAF_FILTER_API_VERSION, WEED_FILTER_API_VERSION);
264 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
268 gettimeofday(&otv, NULL);
275 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
279 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
284 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
288 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
303 if (prev_event) weed_set_voidptr_value(prev_event,
WEED_LEAF_NEXT, next_event);
316 weed_plant_free(event);
324 if (xevent) weed_set_voidptr_value(xevent,
WEED_LEAF_NEXT, event);
330 return (xevent != NULL);
343 return (xevent != NULL);
347void replace_event(weed_plant_t *event_list, weed_plant_t *at_event, weed_plant_t *event) {
358 if (!event)
return NULL;
370 if (!event)
return NULL;
382 if (!event)
return NULL;
394 if (!event)
return NULL;
407 if (!event_list)
return NULL;
422 if (!event_list)
return NULL;
441 if (!seek_back)
return NULL;
450static LiVESList *trans_list = NULL;
458 trans_entry *tr_entry = (trans_entry *)
lives_malloc(
sizeof(trans_entry));
459 tr_entry->in_event = in_event;
460 tr_entry->out_event = out_event;
461 trans_list = lives_list_prepend(trans_list, tr_entry);
464static weed_event_t *find_init_event_by_id(weed_plant_t *event,
boolean remove) {
465 LiVESList *list = trans_list;
466 for (; list; list = list->next) {
467 trans_entry *tr_entry = (trans_entry *)list->data;
468 if (tr_entry->in_event == event) {
469 if (!remove)
return tr_entry->out_event;
472 if (list->prev) list->prev->next = list->next;
473 else trans_list = list->next;
474 if (list->next) list->next->prev = list->prev;
475 list->prev = list->next = NULL;
478 lives_list_free(list);
503 clips = weed_get_int_array_counted(event,
WEED_LEAF_CLIPS, &numframes);
506 if (track == numframes - 1) numframes--;
513 for (i = 0; i < numframes && clips[i] < 1; i++);
514 if (i == numframes) {
537 if (numframes > 1)
return FALSE;
541 if (clip < 0 || frame <= 0)
return TRUE;
566 weed_timecode_t min_tc = end_tc;
568 if (!pchange_next)
return end_tc;
569 for (; pchange_next[i]; i++)
if (
get_event_timecode((weed_plant_t *)pchange_next[i]) < min_tc)
576 weed_timecode_t min_tc = start_tc;
578 if (!pchange_prev)
return start_tc;
579 for (; pchange_prev[i]; i++)
if (
get_event_timecode((weed_plant_t *)pchange_prev[i]) < min_tc)
589 weed_plant_t *
event = init_event;
593 while (event && event != pchange_event) {
627 weed_plant_t *event_after = NULL;
628 weed_plant_t *event_before = NULL;
629 weed_plant_t *filter;
631 void *init_event, *new_init_event, **init_events;
642 if (!in_event)
return event_list;
646 if (!event_list)
return NULL;
650 while (event_before) {
658 event = weed_plant_copy(in_event);
663 if (!event)
return NULL;
668 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
669 if (event_after == event) event_after = NULL;
673 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
677 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
680 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
684 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
688 case WEED_EVENT_TYPE_FILTER_INIT:
692 add_init_to_ttable(in_event, event);
694 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
698 in_pchanges = (
void **)
lives_malloc((num_params + 1) *
sizeof(
void *));
699 if (!in_pchanges)
return NULL;
700 for (i = 0; i < num_params; i++) in_pchanges[i] = NULL;
701 error = weed_set_voidptr_array(event, WEED_LEAF_IN_PARAMETERS, num_params,
704 if (
error == WEED_ERROR_MEMORY_ALLOCATION) {
712 case WEED_EVENT_TYPE_FILTER_DEINIT:
714 new_init_event = find_init_event_by_id(init_event,
TRUE);
716 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
720 weed_leaf_delete((weed_plant_t *)new_init_event,
723 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
725 case WEED_EVENT_TYPE_FILTER_MAP:
728 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
729 for (i = 0; i < num_events; i++) {
730 init_events[i] = find_init_event_by_id(init_events[i],
FALSE);
734 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
746 case WEED_EVENT_TYPE_PARAM_CHANGE:
748 new_init_event = find_init_event_by_id(init_event,
FALSE);
750 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
756 if (ret_event) *ret_event = event;
762 int *clips, numclips;
766 if (numclips <= track)
return FALSE;
769 if (clips[track] > 0 && frames[track] > 0) {
780weed_plant_t *
get_frame_event_at(weed_plant_t *event_list, weed_timecode_t tc, weed_plant_t *shortcut,
boolean exact) {
782 weed_plant_t *event, *next_event;
783 weed_timecode_t xtc, next_tc = 0;
785 if (!event_list)
return NULL;
786 if (shortcut)
event = shortcut;
792 if ((labs(tc - xtc) <= 10 || ((next_tc > tc || !next_event) && !exact)) &&
796 if (xtc > tc)
return NULL;
824 weed_plant_t *init_event;
837 if (!init_events[0]) {
842 for (i = 0; i < num_init_events; i++) {
843 init_event = (weed_plant_t *)init_events[i];
862 int *in_tracks, *out_tracks;
871 for (j = 0; j < num_tracks; j++) {
872 if (in_tracks[j] == ctrack) {
882 for (j = 0; j < num_tracks; j++) {
883 if (out_tracks[j] == ctrack) {
903 weed_plant_t *init_event;
908 while (event != stop_event && event) {
916 if (!init_events[0]) {
921 for (i = 0; i < num_init_events; i++) {
922 init_event = (weed_plant_t *)init_events[i];
938 void **init_events = NULL, **new_init_events;
939 int error, num_init_events = 0;
940 register int i, j = 0;
944 if ((init_events = weed_get_voidptr_array_counted(event,
WEED_LEAF_INIT_EVENTS, &num_init_events)) != NULL) {
945 if (add) new_init_events = (
void **)
lives_malloc((num_init_events + 2) *
sizeof(
void *));
946 else new_init_events = (
void **)
lives_malloc((num_init_events + 1) *
sizeof(
void *));
948 for (i = 0; i < num_init_events; i++)
if ((add || (init_event && (init_events[i] != (
void *)init_event))) &&
950 new_init_events[j++] = init_events[i];
951 if (add && init_events[i] == (
void *)init_event) add =
FALSE;
956 weed_plant_t *filter;
969 if (weed_plant_has_leaf(filter, WEED_LEAF_FLAGS)) {
970 tflags = weed_get_int_value(filter, WEED_LEAF_FLAGS, &
error);
971 if (tflags & WEED_FILTER_HINT_PROCESS_LAST) {
981 for (l = j - 1; l >= k; l--) {
982 new_init_events[l + 1] = new_init_events[l];
984 new_init_events[k] = (
void *)init_event;
988 new_init_events[j] = NULL;
990 return new_init_events;
998 new_init_events = (
void **)
lives_malloc(2 *
sizeof(
void *));
999 new_init_events[0] = (
void *)init_event;
1000 new_init_events[1] = NULL;
1002 new_init_events = (
void **)
lives_malloc(
sizeof(
void *));
1003 new_init_events[0] = NULL;
1005 return new_init_events;
1012 while (event != end_event) {
1024 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
1028 if (!at_event)
break;
1046 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
1067 weed_plant_t *event,
boolean before_frames) {
1070 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
1072 if (before_frames) {
1075 if (!at_event)
break;
1095 if (!at_event)
break;
1119 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
1145 int64_t *frames, weed_plant_t **shortcut) {
1153 weed_plant_t *
event = NULL, *new_event, *prev;
1154 weed_plant_t *new_event_list, *xevent_list;
1155 weed_timecode_t xtc;
1160 if (!event_list)
return NULL;
1167 if (shortcut && *shortcut) {
1183 if (shortcut) *shortcut = event;
1186 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
1188 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
1198 if (!(xevent_list =
append_frame_event(event_list, tc, numframes, clips, frames)))
return NULL;
1199 event_list = xevent_list;
1205 if (!(xevent_list =
append_frame_event(event_list, tc, numframes, clips, frames)))
return NULL;
1206 event_list = xevent_list;
1213 if (!(new_event_list =
append_frame_event(NULL, tc, numframes, clips, frames)))
return NULL;
1222 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
1225 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
1227 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
1229 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
1233 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
1236 weed_plant_free(new_event_list);
1238 if (shortcut) *shortcut = new_event;
1251 arv = (double)(
myround(vel * 10000.)) / 10000.;
1255 double *aseeks = NULL;
1258 for (i = 0; i < num_aclips; i += 2) {
1259 if (aclips[i] == track) {
1261 if (num_aclips <= 2) {
1271 for (j = 0; j < num_aclips; j += 2) {
1273 new_aclips[k] = aclips[j];
1274 new_aclips[k + 1] = aclips[j + 1];
1275 new_aseeks[k] = aseeks[j];
1276 new_aseeks[k + 1] = aseeks[j + 1];
1292 aclips[i + 1] = clipnum;
1294 aseeks[i + 1] = arv;
1312 for (i = 0; i < num_aclips; i++) new_aclips[i] = aclips[i];
1313 new_aclips[i++] = track;
1314 new_aclips[i] = clipnum;
1317 for (i = 0; i < num_aclips; i++) new_aseeks[i] = aseeks[i];
1318 new_aseeks[i++] = seek;
1319 new_aseeks[i++] = arv;
1334 new_aclips[0] = track;
1335 new_aclips[1] = clipnum;
1338 new_aseeks[0] = seek;
1339 new_aseeks[1] = arv;
1358 register int i, j = 0;
1360 for (i = 0; i < num_atracks; i += 2) {
1361 if (aclip_index[i] == track)
continue;
1362 new_aclip_index[j] = aclip_index[i];
1363 new_aclip_index[j + 1] = aclip_index[i + 1];
1364 new_aseek_index[j] = aseek_index[i];
1365 new_aseek_index[j + 1] = aseek_index[i + 1];
1383 weed_plant_t *event, *prev;
1387 if (!event_list)
return NULL;
1390 event = weed_plant_new(WEED_PLANT_EVENT);
1394 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
1395 weed_set_int_value(event, WEED_LEAF_EVENT_TYPE, WEED_EVENT_TYPE_MARKER);
1400 g_print(
"adding marker event %p at tc %"PRId64"\n", init_events[0], tc);
1421 weed_plant_t *
event = weed_plant_new(WEED_PLANT_EVENT);
1424 weed_set_int_value(event, WEED_LEAF_EVENT_TYPE, WEED_EVENT_TYPE_MARKER);
1426 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
1435 if (!at_event)
break;
1436 switch (marker_type) {
1442 int *tracks = weed_get_int_array_counted(at_event,
WEED_LEAF_TRACKS, &num_tracks);
1444 for (i = 0; i < num_tracks; i++) {
1445 new_tracks[i] = tracks[i];
1447 new_tracks[i] = LIVES_POINTER_TO_INT(data);
1448 weed_set_int_array(at_event,
WEED_LEAF_TRACKS, num_tracks + 1, new_tracks);
1451 weed_plant_free(event);
1473 weed_plant_t **shortcut) {
1483 weed_plant_t *
event = init_event;
1485 void **new_init_events;
1487 weed_plant_t *event_next;
1496 for (i = 0; new_init_events[i]; i++);
1503 else filter_map = event;
1509 if (weed_plant_has_leaf(init_event, WEED_LEAF_IN_PARAMETERS)) {
1512 void **pchain = weed_get_voidptr_array_counted(init_event, WEED_LEAF_IN_PARAMETERS, &num_params);
1513 for (i = 0; i < num_params; i++) {
1517 pchain[i] = pchain_next;
1528static boolean remove_event_from_filter_map(weed_plant_t *fmap, weed_plant_t *event) {
1532 void **new_init_events;
1536 new_init_events = (
void **)
lives_malloc(num_inits *
sizeof(
void *));
1537 for (i = 0; i < num_inits; i++) {
1538 if (init_events[i] != event) new_init_events[j++] = init_events[i];
1541 if (j == 0 || (j == 1 && (!event || !init_events[0]))) weed_set_voidptr_value(fmap,
WEED_LEAF_INIT_EVENTS, NULL);
1546 return (!(j == 0 || (j == 1 && !event)));
1552 if (!init_events || !init_events[0])
return FALSE;
1553 for (i = 0; i < num_inits; i++) {
1554 if (init_events[i] == (
void **)event)
return TRUE;
1579 for (i = 0; i < num_owners; i++) {
1580 if (owners[i] == track) {
1629 weed_timecode_t pchain_tc;
1631 void *pchain, *pchain_next;
1635 if (!weed_plant_has_leaf(init_event, WEED_LEAF_IN_PARAMETERS))
return;
1637 init_events = weed_get_voidptr_array_counted(init_event, WEED_LEAF_IN_PARAMETERS, &num_inits);
1639 for (i = 0; i < num_inits; i++) {
1640 pchain = init_events[i];
1645 if (pchain_tc > deinit_tc)
delete_event(event_list, (weed_plant_t *)pchain);
1646 pchain = pchain_next;
1653static void rescale_param_changes(weed_plant_t *event_list, weed_plant_t *init_event, weed_timecode_t new_init_tc,
1654 weed_plant_t *deinit_event, weed_timecode_t new_deinit_tc,
double fps) {
1662 weed_timecode_t pchain_tc, new_tc;
1665 weed_plant_t *event;
1669 if (!weed_plant_has_leaf(init_event, WEED_LEAF_IN_PARAMETERS))
return;
1671 init_events = weed_get_voidptr_array_counted(init_event, WEED_LEAF_IN_PARAMETERS, &num_inits);
1673 if (!init_events) num_inits = 0;
1675 for (i = 0; i < num_inits; i++) {
1676 pchain = init_events[i];
1679 new_tc = (weed_timecode_t)((
double)(pchain_tc - old_init_tc) / (
double)(old_deinit_tc - old_init_tc) *
1680 (
double)(new_deinit_tc - new_init_tc)) + new_init_tc;
1682 if (new_tc == pchain_tc) {
1687 event = (weed_plant_t *)pchain;
1688 if (new_tc < pchain_tc) {
1708static boolean is_in_hints(weed_plant_t *event,
void **hints) {
1710 if (!hints)
return FALSE;
1711 for (i = 0; hints[i]; i++) {
1712 if (hints[i] == event)
return TRUE;
1719 weed_plant_t *filter;
1722 if (!event)
return FALSE;
1739 void **init_events, **new_init_events;
1742 int num_inits, i, j = 0;
1744 remove_event_from_filter_map(fmap, event);
1748 if (num_inits <= 1 && (!init_events || !init_events[0])) {
1756 new_init_events = (
void **)
lives_calloc((num_inits + 1),
sizeof(
void *));
1758 for (i = 0; i < num_inits; i++) {
1761 if (mustadd || (!plast && !added && is_in_hints((weed_plant_t *)init_events[i], hints))) {
1762 new_init_events[j++] = event;
1765 if (init_events[i] == event) {
1768 new_init_events[j++] = event;
1771 new_init_events[j++] = init_events[i];
1775 new_init_events[j++] = event;
1785 int error, i, j = 0;
1789 weed_plant_t *
event = init_event, *event_next;
1790 weed_plant_t *filter_map, *copy_filter_map;
1793 void **event_types = NULL;
1794 boolean is_null_filter_map;
1796 rescale_param_changes(event_list, init_event, new_tc, deinit_event, deinit_tc, fps);
1804 is_null_filter_map = !remove_event_from_filter_map(event, init_event);
1805 if ((!filter_map && is_null_filter_map) || (filter_map &&
1808 else filter_map = event;
1827 boolean is_on =
FALSE;
1828 boolean adding =
FALSE;
1829 while (event != deinit_event) {
1834 if (init_events[0]) {
1835 event_types = (
void **)
lives_malloc((num_inits + 1) *
sizeof(
void *));
1836 for (i = 0; i < num_inits; i++) {
1837 if (adding) event_types[j++] = init_events[i];
1838 if (init_events[i] == init_event) adding =
TRUE;
1840 event_types[j] = NULL;
1860 copy_filter_map = weed_plant_copy(filter_map);
1862 filter_map = copy_filter_map;
1864 init_events = (
void **)
lives_malloc(2 *
sizeof(
void *));
1865 init_events[0] = init_event;
1866 init_events[1] = NULL;
1882 else filter_map = event;
1893 double fps,
boolean rescale_pchanges) {
1896 int error, i, j = 0;
1900 weed_plant_t *
event = deinit_event, *event_next;
1901 weed_plant_t *filter_map, *copy_filter_map;
1902 weed_plant_t *xevent;
1905 void **event_types = NULL;
1906 boolean is_null_filter_map;
1908 if (new_tc == tc)
return;
1910 if (rescale_pchanges) rescale_param_changes(event_list, init_event, init_tc, deinit_event, new_tc, fps);
1921 copy_filter_map = weed_plant_copy(filter_map);
1925 }
else copy_filter_map = filter_map;
1926 remove_event_from_filter_map(copy_filter_map, init_event);
1929 else filter_map = copy_filter_map;
1942 is_null_filter_map = !remove_event_from_filter_map(event, init_event);
1943 if ((!filter_map && is_null_filter_map) || (filter_map &&
1946 else filter_map = event;
1956 boolean is_on =
FALSE;
1957 boolean adding =
FALSE;
1965 event_types = (
void **)
lives_malloc((num_inits + 1) *
sizeof(
void *));
1966 for (i = 0; i < num_inits; i++) {
1968 event_types[j++] = init_events[i];
1970 if (init_events[i] == init_event) adding =
TRUE;
1972 event_types[j] = NULL;
1978 event = deinit_event;
1990 while (event != deinit_event) {
1996 else filter_map = event;
2003 event = deinit_event;
2011 copy_filter_map = weed_plant_copy(filter_map);
2013 remove_event_from_filter_map(copy_filter_map, init_event);
2030boolean move_event_right(weed_plant_t *event_list, weed_plant_t *event,
boolean can_stay,
double fps) {
2037 weed_plant_t *xevent = event;
2041 boolean all_ok =
FALSE;
2043 int num_owners = 0, num_clips, i;
2049 if (num_owners > 0) {
2056 for (i = 0; i < num_owners; i++) {
2057 if (owners[i] < 0)
continue;
2070 if (can_stay)
return TRUE;
2075 if (can_stay && (new_tc == tc) && all_ok)
return TRUE;
2090 weed_plant_t *init_event = (weed_plant_t *)weed_get_voidptr_value(event,
WEED_LEAF_INIT_EVENT, NULL);
2103boolean move_event_left(weed_plant_t *event_list, weed_plant_t *event,
boolean can_stay,
double fps) {
2110 weed_plant_t *xevent = event;
2111 weed_plant_t *init_event;
2115 boolean all_ok =
FALSE;
2117 int num_owners = 0, num_clips, i;
2125 if (num_owners > 0) {
2131 for (i = 0; i < num_owners; i++) {
2132 if (owners[i] < 0)
continue;
2146 if (can_stay)
return TRUE;
2155 if (can_stay && (new_tc == tc) && all_ok)
return TRUE;
2182 render_choice = LIVES_POINTER_TO_INT(choice);
2187 LiVESWidget *e_rec_dialog;
2188 LiVESWidget *dialog_vbox;
2192 LiVESWidget *radiobutton;
2193 LiVESWidget *okbutton;
2194 LiVESWidget *cancelbutton;
2195 LiVESSList *radiobutton_group = NULL;
2196 LiVESAccelGroup *accel_group;
2218 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton), LIVES_WIDGET_TOGGLED_SIGNAL,
2229 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton), LIVES_WIDGET_TOGGLED_SIGNAL,
2239 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton), LIVES_WIDGET_TOGGLED_SIGNAL,
2243#ifdef LIBAV_TRANSCODE
2249 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton), LIVES_WIDGET_TOGGLED_SIGNAL,
2258 LIVES_BOX(hbox), NULL);
2260 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton), LIVES_WIDGET_TOGGLED_SIGNAL,
2274 lives_signal_sync_connect(LIVES_GUI_OBJECT(radiobutton), LIVES_WIDGET_TOGGLED_SIGNAL,
2279 LIVES_RESPONSE_CANCEL);
2281 lives_signal_sync_connect(LIVES_GUI_OBJECT(cancelbutton), LIVES_WIDGET_CLICKED_SIGNAL,
2287 LIVES_KEY_Escape, (LiVESXModifierType)0, (LiVESAccelFlags)0);
2296 return e_rec_dialog;
2300static void event_list_free_events(weed_plant_t *event_list) {
2301 weed_plant_t *event, *next_event;
2307 weed_plant_free(event);
2314 if (!event_list)
return;
2315 event_list_free_events(event_list);
2316 weed_plant_free(event_list);
2321 if (!event_list || !new_event_list)
return;
2322 if (event_list == new_event_list)
return;
2323 event_list_free_events(event_list);
2334 weed_plant_t *event;
2336 LiVESResponseType response;
2339 if (!event_list)
return TRUE;
2340 what = (
_(
"memory for the reordering operation"));
2343 response = LIVES_RESPONSE_OK;
2347 }
while (response == LIVES_RESPONSE_RETRY);
2349 if (response == LIVES_RESPONSE_CANCEL) {
2368 weed_timecode_t tc = 0, tc_delta = 0, rec_end_tc = 0, tc_start = 0, tc_offs = 0, last_tc = 0;
2376 if (!event_list)
return;
2381 first_event = event;
2396 if (tc + tc_offs > ntc) {
2400 }
else if (last_tc + tc_offs <= tc) tc -= tc_offs;
2412 tc_delta += tc - rec_end_tc;
2416 last_rec_start_tc = tc + tc_start;
2429 for (event = first_event; event;
event =
get_next_event(event)) {
2437 weed_plant_t **in_ptmpls;
2438 void **pchainx, *pchange;
2443 int num_in_tracks, x = -nbtracks;
2444 int nparams, numigns;
2451 for (i = 0; i < num_in_tracks; i++) {
2452 new_in_tracks[i] = x++;
2461 pchainx = weed_get_voidptr_array_counted(event, WEED_LEAF_IN_PARAMETERS, &nparams);
2463 in_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, NULL);
2465 for (i = 0; i < nparams; i++) {
2466 pchange = (weed_plant_t *)pchainx[i];
2469 fill_param_vals_to((weed_plant_t *)pchange, in_ptmpls[i], behind ? num_in_tracks - 1 : 1);
2470 if (weed_plant_has_leaf((weed_plant_t *)pchange, WEED_LEAF_IGNORE)) {
2471 igns = weed_get_boolean_array_counted((weed_plant_t *)pchange, WEED_LEAF_IGNORE, &numigns);
2474 for (j = 0; j < numigns; j++) {
2476 if (j < numigns - 1) nigns[j] = igns[j];
2477 else nigns[j] = bval;
2479 if (j == 0) nigns[j] = igns[j];
2480 else if (j == 1) nigns[j] = bval;
2481 else nigns[j] = igns[j - 1];
2484 weed_set_boolean_array((weed_plant_t *)pchange, WEED_LEAF_IGNORE, numigns, nigns);
2500 weed_plant_t *event;
2502 int *clips, *newclips, i;
2503 int64_t *frames, *newframes;
2504 int *in_tracks, *out_tracks;
2506 int num_in_tracks, num_out_tracks;
2509 if (!event_list)
return;
2514 case WEED_EVENT_TYPE_FRAME:
2515 clips = weed_get_int_array_counted(event,
WEED_LEAF_CLIPS, &numframes);
2517 if (numframes == 1 && clips[0] == -1 && frames[0] == 0) {
2525 newframes = (int64_t *)
lives_malloc((numframes + 1) * 8);
2527 newclips[layer] = -1;
2528 newframes[layer] = 0;
2529 for (i = 0; i < numframes; i++) {
2531 newclips[i] = clips[i];
2532 newframes[i] = frames[i];
2534 newclips[i + 1] = clips[i];
2535 newframes[i + 1] = frames[i];
2551 for (i = 0; i < atracks; i += 2) {
2552 if (aclips[i] >= 0) aclips[i]++;
2559 case WEED_EVENT_TYPE_FILTER_INIT:
2561 if (num_in_tracks) {
2562 for (i = 0; i < num_in_tracks; i++) {
2563 if (in_tracks[i] >= layer) in_tracks[i]++;
2569 if (num_out_tracks) {
2570 for (i = 0; i < num_out_tracks; i++) {
2571 if (out_tracks[i] >= layer) out_tracks[i]++;
2583static weed_plant_t *create_frame_event(weed_timecode_t tc,
int numframes,
int *clips, int64_t *frames) {
2585 weed_plant_t *event;
2587 event = weed_plant_new(WEED_PLANT_EVENT);
2588 if (!event)
return NULL;
2590 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2592 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2596 error = weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
2597 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2598 error = weed_set_int_value(event, WEED_LEAF_EVENT_TYPE, WEED_EVENT_TYPE_FRAME);
2599 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2602 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2604 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2610weed_plant_t *
append_frame_event(weed_plant_t *event_list, weed_timecode_t tc,
int numframes,
int *clips, int64_t *frames) {
2612 weed_plant_t *event, *prev;
2622 event = create_frame_event(tc, numframes, clips, frames);
2623 if (!event)
return NULL;
2627 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2629 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2632 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2638 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2641 if (
error == WEED_ERROR_MEMORY_ALLOCATION)
return NULL;
2651 weed_plant_t **in_params = NULL, **in_ptmpls;
2653 void **pchain = NULL;
2654 void **in_pchanges = NULL;
2656 weed_plant_t *filter = plant, *in_param;
2660 boolean is_inst =
FALSE;
2670 if (!weed_get_plantptr_value(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, NULL))
return NULL;
2672 in_ptmpls = weed_get_plantptr_array_counted(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, &num_params);
2674 pchain = (
void **)
lives_malloc((num_params + 1) *
sizeof(
void *));
2675 pchain[num_params] = NULL;
2680 in_pchanges = weed_get_voidptr_array_counted(init_event, WEED_LEAF_IN_PARAMETERS, &num_params);
2681 if (leave > num_params) leave = num_params;
2684 for (i = num_params - 1; i >= 0; i--) {
2685 if (i < leave && in_pchanges && in_pchanges[i]) {
2687 pchain[i] = in_pchanges[i];
2691 pchain[i] = weed_plant_new(WEED_PLANT_EVENT);
2692 weed_set_int_value((weed_plant_t *)pchain[i], WEED_LEAF_EVENT_TYPE, WEED_EVENT_TYPE_PARAM_CHANGE);
2693 weed_set_int64_value((weed_plant_t *)pchain[i], WEED_LEAF_TIMECODE, tc);
2695 if (!is_inst) in_param = in_params[i];
2703 weed_leaf_dup((weed_plant_t *)pchain[i], in_param, WEED_LEAF_VALUE);
2725 weed_set_voidptr_array(init_event, WEED_LEAF_IN_PARAMETERS, num_params, pchain);
2732 int num_in_tracks,
int key, weed_plant_t *inst) {
2733 weed_plant_t **ctmpl;
2734 weed_plant_t *event, *prev, *filter, *chan;
2738 int e_in_channels, e_out_channels, e_ins, e_outs;
2739 int total_in_channels = 0;
2740 int total_out_channels = 0;
2741 int my_in_tracks = 0;
2747 if (!event_list)
return NULL;
2750 event = weed_plant_new(WEED_PLANT_EVENT);
2753 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
2754 weed_set_int_value(event, WEED_LEAF_EVENT_TYPE, WEED_EVENT_TYPE_FILTER_INIT);
2760 ctmpl = weed_get_plantptr_array_counted(filter, WEED_LEAF_IN_CHANNEL_TEMPLATES, &total_in_channels);
2762 if (total_in_channels > 0) {
2763 int count[total_in_channels];
2764 for (i = 0; i < total_in_channels; i++) {
2769 }
else count[i] = 0;
2773 if (my_in_tracks < num_in_tracks) {
2776 for (i = 0; i < total_in_channels; i++) {
2777 if (weed_plant_has_leaf(ctmpl[i], WEED_LEAF_MAX_REPEATS) && (count[i] > 0 ||
has_usable_palette(ctmpl[i]))) {
2778 repeats = weed_get_int_value(ctmpl[i], WEED_LEAF_MAX_REPEATS, NULL);
2780 count[i] += num_in_tracks - my_in_tracks;
2789 count[i] += num_in_tracks - my_in_tracks >= repeats - 1 ? repeats - 1 : num_in_tracks - my_in_tracks;
2796 my_in_tracks += count[i] - 1;
2797 if (my_in_tracks == num_in_tracks)
break;
2805 ctmpl = weed_get_plantptr_array_counted(filter, WEED_LEAF_OUT_CHANNEL_TEMPLATES, &total_out_channels);
2807 if (total_out_channels > 0) {
2808 int count[total_out_channels];
2809 ctmpl = weed_get_plantptr_array(filter, WEED_LEAF_OUT_CHANNEL_TEMPLATES, NULL);
2810 for (i = 0; i < total_out_channels; i++) {
2825 for (i = 0; i < e_ins; i++) {
2834 for (i = 0; i < e_outs; i++) {
2841 if (e_in_channels != 0) {
2842 if (e_in_channels == 1) {
2853 if (e_out_channels > 0) {
2864 g_print(
"adding init event at tc %"PRId64"\n", tc);
2883 weed_plant_t *event, *prev;
2887 if (!event_list)
return NULL;
2890 event = weed_plant_new(WEED_PLANT_EVENT);
2893 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
2894 weed_set_int_value(event, WEED_LEAF_EVENT_TYPE, WEED_EVENT_TYPE_FILTER_DEINIT);
2900 while (pchain[num_params]) num_params++;
2901 weed_set_voidptr_array(event, WEED_LEAF_IN_PARAMETERS, num_params, pchain);
2920 weed_plant_t *param,
void *init_event,
void **pchain) {
2921 weed_plant_t *event, *prev, *xevent;
2922 weed_plant_t *last_pchange_event;
2926 if (!event_list)
return NULL;
2929 event = weed_plant_new(WEED_PLANT_EVENT);
2933 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
2934 weed_set_int_value(event, WEED_LEAF_EVENT_TYPE, WEED_EVENT_TYPE_PARAM_CHANGE);
2937 weed_leaf_copy(event, WEED_LEAF_VALUE, param, WEED_LEAF_VALUE);
2939 last_pchange_event = (weed_plant_t *)pchain[pnum];
2940 while ((xevent = (weed_plant_t *)weed_get_voidptr_value(last_pchange_event,
WEED_LEAF_NEXT_CHANGE, NULL)) != NULL)
2941 last_pchange_event = xevent;
2945 last_pchange_event = (weed_plant_t *)weed_get_voidptr_value(last_pchange_event,
WEED_LEAF_PREV_CHANGE, NULL);
2969 weed_plant_t *event, *prev;
2974 if (!event_list)
return NULL;
2977 event = weed_plant_new(WEED_PLANT_EVENT);
2981 weed_set_int64_value(event, WEED_LEAF_TIMECODE, tc);
2982 weed_set_int_value(event, WEED_LEAF_EVENT_TYPE, WEED_EVENT_TYPE_FILTER_MAP);
2984 if (init_events)
for (i = 0; init_events[i]; i++);
2990 g_print(
"adding map event %p at tc %"PRId64"\n", init_events[0], tc);
3015 weed_plant_t **init_events;
3016 weed_plant_t *filter;
3020 int *in_tracks, *out_tracks;
3021 int ninits, nintracks, nouttracks;
3034 for (i = 0; i < num_tracks; i++) {
3035 if ((front == -1 || front == i) && clip_index[i] > 0) {
3042 init_events = (weed_plant_t **)weed_get_voidptr_array_counted(filter_map,
WEED_LEAF_INIT_EVENTS, &ninits);
3043 if (!init_events)
return;
3045 for (i = ninits - 1; i >= 0; i--) {
3051 filter_hash = weed_get_string_value(init_events[i],
WEED_LEAF_FILTER, NULL);
3055 boolean is_valid =
FALSE;
3057 for (j = 0; j < nouttracks; j++) {
3067 for (j = 0; j < nintracks; j++) {
3082weed_plant_t *
process_events(weed_plant_t *next_event,
boolean process_audio, weed_timecode_t curr_tc) {
3086 static weed_timecode_t aseek_tc = 0;
3087 weed_timecode_t tc, next_tc;
3089 static double stored_avel = 0.;
3091 static int dframes = 0, spare_cycles = 0;
3093 int *in_count = NULL;
3097 weed_plant_t *next_frame_event, *return_event;
3098 weed_plant_t *filter;
3099 weed_plant_t *inst, *orig_inst;
3101 weed_plant_t **citmpl = NULL, **cotmpl = NULL;
3102 weed_plant_t **bitmpl = NULL, **botmpl = NULL;
3103 weed_plant_t **source_params, **in_params;
3110 int num_params, offset = 0;
3111 int num_in_count = 0;
3112 int num_in_channels = 0, num_out_channels = 0;
3155 }
else spare_cycles++;
3161 aseek_tc += (weed_timecode_t)((
double)(tc -
mainw->
cevent_tc) * stored_avel);
3167 case WEED_EVENT_TYPE_FRAME:
3170 g_print(
"event: frame event at tc %"PRId64" curr_tc=%"PRId64"\n", tc, curr_tc);
3178 if (aclips[1] > 0) {
3180 stored_avel = aseeks[1];
3209 for (i = 0; i < nclips; i++) {
3251 }
else spare_cycles++;
3268 easing = weed_get_int_value(next_event, WEED_LEAF_EASE_OUT, NULL);
3270 weed_set_int_value(inst, WEED_LEAF_EASE_OUT, easing);
3291 cfile->next_event = return_event;
3292 return_event = NULL;
3319 case WEED_EVENT_TYPE_FILTER_INIT:
3343 g_print(
"event: init effect on key %d at tc %"PRId64" curr_tc=%"PRId64"\n", key, tc, curr_tc);
3346 in_count = weed_get_int_array_counted(next_event,
WEED_LEAF_IN_COUNT, &num_in_count);
3349 citmpl = weed_get_plantptr_array_counted(filter, WEED_LEAF_IN_CHANNEL_TEMPLATES, &num_in_channels);
3350 if (num_in_channels > 0) {
3351 bitmpl = (weed_plant_t **)
lives_malloc(num_in_channels *
sizeof(weed_plant_t *));
3352 if (num_in_channels != num_in_count)
LIVES_ERROR(
"num_in_count != num_in_channels");
3353 for (i = 0; i < num_in_channels; i++) {
3354 bitmpl[i] = weed_plant_copy(citmpl[i]);
3355 if (in_count[i] > 0) {
3364 cotmpl = weed_get_plantptr_array_counted(filter, WEED_LEAF_OUT_CHANNEL_TEMPLATES, &num_out_channels);
3365 if (num_out_channels > 0) {
3366 botmpl = (weed_plant_t **)
lives_malloc(num_out_channels *
sizeof(weed_plant_t *));
3367 for (i = 0; i < num_out_channels; i++) {
3368 botmpl[i] = weed_plant_copy(cotmpl[i]);
3376 if (num_in_channels > 0) {
3377 for (i = 0; i < num_in_channels; i++) {
3380 weed_plant_free(bitmpl[i]);
3386 if (num_out_channels > 0) {
3387 for (i = 0; i < num_out_channels; i++) {
3390 weed_plant_free(botmpl[i]);
3399 if (weed_plant_has_leaf(next_event, WEED_LEAF_IN_PARAMETERS)) {
3401 void **xpchains = weed_get_voidptr_array_counted(next_event, WEED_LEAF_IN_PARAMETERS, &nparams);
3402 pchains[key] = (
void **)
lives_realloc(pchains[key], (nparams + 1) *
sizeof(
void *));
3403 for (i = 0; i < nparams; i++) pchains[key][i] = xpchains[i];
3404 pchains[key][nparams] = NULL;
3406 }
else pchains[key] = NULL;
3412 if (num_params > 0) {
3414 if (weed_plant_has_leaf(next_event, WEED_LEAF_IN_PARAMETERS)) {
3415 in_params = weed_get_plantptr_array(inst, WEED_LEAF_IN_PARAMETERS, NULL);
3416 source_params = (weed_plant_t **)pchains[key];
3418 for (i = 0; i < num_params; i++) {
3419 if (source_params && source_params[i + offset] &&
is_init_pchange(next_event, source_params[i + offset]))
3420 weed_leaf_dup(in_params[i], source_params[i + offset], WEED_LEAF_VALUE);
3425 offset += num_params;
3429 if (weed_plant_has_leaf(filter, WEED_LEAF_INIT_FUNC)) {
3430 weed_init_f init_func = (weed_init_f)weed_get_funcptr_value(filter, WEED_LEAF_INIT_FUNC, NULL);
3454 if ((easing = weed_get_int_value(next_event, WEED_LEAF_EASE_OUT, NULL)) > 0) {
3455 g_print(
"precev found easing %d on %p\n", easing, next_event);
3458 weed_plant_t *
event = deinit;
3459 for (i = 0; i < easing && event; i++) {
3462 if (event != deinit && event) {
3463 weed_set_int_value(event, WEED_LEAF_EASE_OUT, easing);
3478 case WEED_EVENT_TYPE_FILTER_DEINIT:
3481 key_string = weed_get_string_value((weed_plant_t *)init_event,
WEED_LEAF_HOST_TAG, NULL);
3482 key = atoi(key_string);
3485 filter_name = weed_get_string_value((weed_plant_t *)init_event,
WEED_LEAF_FILTER, NULL);
3491 if (!process_audio) {
3504 pchains[key] = NULL;
3508 case WEED_EVENT_TYPE_FILTER_MAP:
3511 g_print(
"got new effect map\n");
3514 case WEED_EVENT_TYPE_PARAM_CHANGE:
3518 key_string = weed_get_string_value((weed_plant_t *)init_event,
WEED_LEAF_HOST_TAG, NULL);
3519 key = atoi(key_string);
3522 filter_name = weed_get_string_value((weed_plant_t *)init_event,
WEED_LEAF_FILTER, NULL);
3528 if (!process_audio) {
3537 weed_leaf_dup(param, next_event, WEED_LEAF_VALUE);
3543 return return_event;
3547static char *set_proc_label(
xprocess * proc,
const char *label,
boolean copy_old) {
3548 char *blabel = NULL;
3549 if (!proc)
return NULL;
3619 static weed_timecode_t rec_delta_tc, atc;
3620 static weed_plant_t *event, *eventnext;
3621 static boolean r_audio, r_video;
3623 weed_timecode_t tc, next_out_tc = 0l, out_tc, dtc = atc;
3626 LiVESPixbuf *pixbuf = NULL;
3628 weed_plant_t *filter;
3629 weed_plant_t **citmpl = NULL, **cotmpl = NULL;
3630 weed_plant_t **bitmpl = NULL, **botmpl = NULL;
3631 weed_plant_t *inst, *orig_inst;
3632 weed_plant_t *next_frame_event = NULL;
3634 int *in_count = NULL;
3636 weed_plant_t **source_params, **in_params;
3637 weed_plant_t **layers, *layer = NULL;
3639 weed_error_t weed_error;
3640 LiVESResponseType retval;
3645 int num_params, offset = 0;
3646 int num_in_count = 0;
3647 int num_in_channels = 0, num_out_channels = 0;
3649 int scrap_track = -1;
3652 static int progress;
3654 static int out_frame;
3656 static int64_t old_scrap_frame;
3657 static int natracks, nbtracks;
3660 boolean is_blank =
TRUE;
3661 boolean completed =
FALSE;
3667 static weed_timecode_t vfade_in_end;
3668 static weed_timecode_t vfade_out_start;
3675 static char nlabel[128];
3677 char *blabel = NULL;
3678 char *key_string, *com;
3684 LiVESList *list = NULL;
3685 r_audio = rend_audio;
3686 r_video = rend_video;
3687 progress = frame = 1;
3689 event =
cfile->next_event;
3692 if (
cfile->old_frames > 0) {
3708 if (
cfile->frames < out_frame) out_frame =
cfile->frames + 1;
3709 cfile->undo_start = out_frame;
3724 old_scrap_frame = -1;
3735 }
else vfade_in_end = 0;
3739 }
else vfade_out_start = end_tc;
3745 natracks = nbtracks = 0;
3754 xaseek[i] = xavel[i] = 0.;
3757 chvols[i] = (double)LIVES_POINTER_TO_INT(list->data) / 1000000.;
3759 }
else chvols[i] = 0.;
3767 lives_snprintf(nlabel, 128,
"%s",
_(
"Rendering audio..."));
3778 else etype = WEED_EVENT_TYPE_FRAME;
3783 if (etype != WEED_EVENT_TYPE_MARKER)
3784 etype = WEED_EVENT_TYPE_FRAME;
3786 if (!r_video && etype != WEED_EVENT_TYPE_FRAME) etype = WEED_EVENT_TYPE_UNDEFINED;
3789 case WEED_EVENT_TYPE_MARKER: {
3794 if (
cfile->old_frames > 0) {
3802 case WEED_EVENT_TYPE_FRAME:
3803 out_tc = (weed_timecode_t)((out_frame - 1) /
cfile->fps
3806 next_out_tc = (weed_timecode_t)(out_frame /
cfile->fps
3825 if (scrap_track == -1) scrap_track = i;
3828 if (scrap_track != -1) {
3914 easing = weed_get_int_value(event, WEED_LEAF_EASE_OUT, NULL);
3915 weed_set_int_value(inst, WEED_LEAF_EASE_OUT, easing);
3921 for (i = 0; layers[i]; i++) {
3922 if (layer != layers[i]) {
3932 if (out_tc < vfade_in_end) {
3933 fadeamt = (double)(vfade_in_end - out_tc) / (double)vfade_in_end;
3934 weed_set_int_value(layer,
"red_adjust", (
double)vfade_in_col.
red / 255.);
3935 weed_set_int_value(layer,
"green_adjust", (
double)vfade_in_col.
green / 255.);
3936 weed_set_int_value(layer,
"blue_adjust", (
double)vfade_in_col.
blue / 255.);
3937 weed_set_double_value(layer,
"colorize", fadeamt);
3939 if (out_tc > vfade_out_start) {
3940 fadeamt = (double)(out_tc - vfade_out_start) / (double)(end_tc - vfade_out_start);
3941 weed_set_int_value(layer,
"red_adjust", (
double)vfade_in_col.
red / 255.);
3942 weed_set_int_value(layer,
"green_adjust", (
double)vfade_in_col.
green / 255.);
3943 weed_set_int_value(layer,
"blue_adjust", (
double)vfade_in_col.
blue / 255.);
3944 weed_set_double_value(layer,
"colorize", fadeamt);
3949 int lpal, width, height;
3950 boolean was_lbox =
FALSE;
3965 && layer_palette != WEED_PALETTE_RGBA32)
3966 layer_palette = WEED_PALETTE_RGB24;
3968 else if (
cfile->img_type ==
IMG_TYPE_PNG && layer_palette != WEED_PALETTE_RGBA32)
3969 layer_palette = WEED_PALETTE_RGBA32;
3971 layer_palette = WEED_PALETTE_RGB24;
3975 if (layer_palette != lpal && (
cfile->hsize > width ||
cfile->vsize > height)) {
3991 (
cfile->vsize - height) / 2,
3992 width, height,
TRUE);
4012 if (xavel[auditracks] != 0.)
break;
4034 NULL, NULL, atc, dtc, chvols, 0., 0., NULL);
4057 if (read_write_error)
return read_write_error;
4061 double *aseeks = NULL;
4064 for (i = 0; i < num_aclips; i += 2) {
4065 if (aclips[i + 1] > 0) {
4067 mytrack = aclips[i] + nbtracks;
4068 if (mytrack < 0) mytrack = 0;
4073 if (xaclips[mytrack] != aclips[i + 1] || fabs(xaseek[mytrack] - aseeks[i]) >
AUD_DIFF_MIN * mult)
4074 xaseek[mytrack] = aseeks[i];
4076 xaclips[mytrack] = aclips[i + 1];
4077 xavel[mytrack] = aseeks[i + 1];
4084 if (!r_video)
break;
4086 if (!next_frame_event && is_blank)
break;
4088 if (next_frame_event) {
4090 if (next_tc < next_out_tc || next_tc - next_out_tc < next_out_tc - tc)
break;
4091 }
else if (next_out_tc > tc)
break;
4094 if (
cfile->old_frames > 0) {
4099 lives_snprintf(oname,
PATH_MAX,
"%s", tmp);
4103 retval = LIVES_RESPONSE_NONE;
4108 lives_error_free(
error);
4112 }
while (retval == LIVES_RESPONSE_RETRY);
4115 if (!saver_thread) {
4126 while (saveargs->
error) {
4128 lives_error_free(saveargs->
error);
4129 saveargs->
error = NULL;
4130 if (retval != LIVES_RESPONSE_RETRY) {
4144 saveargs->
fname = NULL;
4148 if (
cfile->old_frames > 0) {
4154 saveargs->
pixbuf = pixbuf;
4162 if (
cfile->undo_start == -1)
cfile->undo_start = out_frame;
4163 cfile->undo_end = out_frame;
4164 if (out_frame >
cfile->frames)
cfile->frames = out_frame;
4165 if (out_frame >
cfile->end)
cfile->end = out_frame;
4174 case WEED_EVENT_TYPE_FILTER_INIT:
4199 citmpl = weed_get_plantptr_array_counted(filter, WEED_LEAF_IN_CHANNEL_TEMPLATES, &num_in_channels);
4200 if (num_in_channels != num_in_count) {
4203 if (num_in_channels > 0) {
4204 bitmpl = (weed_plant_t **)
lives_malloc(num_in_channels *
sizeof(weed_plant_t *));
4205 for (i = 0; i < num_in_channels; i++) {
4206 bitmpl[i] = weed_plant_copy(citmpl[i]);
4207 if (in_count[i] > 0) {
4217 cotmpl = weed_get_plantptr_array_counted(filter, WEED_LEAF_OUT_CHANNEL_TEMPLATES, &num_out_channels);
4218 if (num_out_channels > 0) {
4219 botmpl = (weed_plant_t **)
lives_malloc(num_out_channels *
sizeof(weed_plant_t *));
4220 for (i = 0; i < num_out_channels; i++) {
4221 botmpl[i] = weed_plant_copy(cotmpl[i]);
4231 if (num_in_channels > 0) {
4232 for (i = 0; i < num_in_channels; i++) {
4235 weed_plant_free(bitmpl[i]);
4241 if (num_out_channels > 0) {
4242 for (i = 0; i < num_out_channels; i++) {
4245 weed_plant_free(botmpl[i]);
4254 if (weed_plant_has_leaf(event, WEED_LEAF_IN_PARAMETERS)) {
4256 void **xpchains = weed_get_voidptr_array_counted(event, WEED_LEAF_IN_PARAMETERS, &nparams);
4257 pchains[key] = (
void **)
lives_realloc(pchains[key], (nparams + 1) *
sizeof(
void *));
4258 for (i = 0; i < nparams; i++) pchains[key][i] = xpchains[i];
4259 pchains[key][nparams] = NULL;
4261 }
else pchains[key] = NULL;
4267 if (num_params > 0) {
4269 if (weed_plant_has_leaf(event, WEED_LEAF_IN_PARAMETERS)) {
4270 source_params = (weed_plant_t **)pchains[key];
4271 in_params = weed_get_plantptr_array(inst, WEED_LEAF_IN_PARAMETERS, &weed_error);
4273 for (i = 0; i < num_params; i++) {
4274 if (source_params && source_params[i + offset] &&
is_init_pchange(event, source_params[i + offset]))
4275 weed_leaf_copy(in_params[i], WEED_LEAF_VALUE, source_params[i + offset], WEED_LEAF_VALUE);
4280 offset += num_params;
4284 if (weed_plant_has_leaf(filter, WEED_LEAF_INIT_FUNC)) {
4285 weed_init_f init_func = (weed_init_f)weed_get_funcptr_value(filter, WEED_LEAF_INIT_FUNC, NULL);
4309 if ((easing = weed_get_int_value(event, WEED_LEAF_EASE_OUT, NULL)) > 0) {
4312 weed_plant_t *xevent = deinit;
4313 for (i = 0; i < easing; i++) {
4316 if (xevent != deinit && xevent) {
4317 weed_set_int_value(xevent, WEED_LEAF_EASE_OUT, easing);
4331 case WEED_EVENT_TYPE_FILTER_DEINIT:
4334 filter_name = weed_get_string_value((weed_plant_t *)init_event,
WEED_LEAF_FILTER, &weed_error);
4342 key_string = weed_get_string_value((weed_plant_t *)init_event,
WEED_LEAF_HOST_TAG, &weed_error);
4343 key = atoi(key_string);
4351 pchains[key] = NULL;
4353 case WEED_EVENT_TYPE_PARAM_CHANGE:
4357 key_string = weed_get_string_value((weed_plant_t *)init_event,
WEED_LEAF_HOST_TAG, NULL);
4358 key = atoi(key_string);
4361 filter_name = weed_get_string_value((weed_plant_t *)init_event,
WEED_LEAF_FILTER, NULL);
4372 weed_leaf_dup(param, event, WEED_LEAF_VALUE);
4377 case WEED_EVENT_TYPE_FILTER_MAP:
4379 g_print(
"got new effect map\n");
4391 while (saveargs->
error) {
4393 lives_error_free(saveargs->
error);
4394 saveargs->
error = NULL;
4406 saver_thread = NULL;
4434 NULL, NULL, atc, next_out_tc, chvols, 0., 0., NULL);
4442 if (read_write_error)
return read_write_error;
4459 double old_pb_fps =
cfile->pb_fps;
4461 int oundo_start =
cfile->undo_start;
4462 int oundo_end =
cfile->undo_end;
4466 if (!event_list || (!render_vid && !render_aud))
return TRUE;
4476 cfile->progress_start = 1;
4479 cfile->pb_fps = 1000000.;
4496 :
_(
"Transcoding")) :
_(
"Pre-rendering audio"))
4510 cfile->undo_start = oundo_start;
4511 cfile->undo_end = oundo_end;
4512 cfile->pb_fps = old_pb_fps;
4516 cfile->next_event = NULL;
4534 cfile->pb_fps = old_pb_fps;
4537 cfile->next_event = NULL;
4542int count_events(weed_plant_t *event_list,
boolean all_events, weed_timecode_t start_tc, weed_timecode_t end_tc) {
4543 weed_plant_t *event;
4547 if (!event_list)
return 0;
4553 (end_tc == 0 || (tc >= start_tc && tc < end_tc))) i++;
4561 weed_plant_t *event;
4562 weed_timecode_t tc, seg_start_tc = 0, seg_end_tc = 0;
4565 int etype, marker_type;
4567 boolean seg_start =
FALSE;
4569 if (!event_list)
return 0;
4574 if (etype == WEED_EVENT_TYPE_FRAME) {
4577 seg_start_tc = seg_end_tc = tc;
4583 if (etype == WEED_EVENT_TYPE_MARKER) {
4587 if (seg_start) rframes += 1 + ((double)(seg_end_tc - seg_start_tc)) /
TICKS_PER_SECOND_DBL * fps;
4595 if (seg_start) rframes += 1 + ((double)(seg_end_tc - seg_start_tc)) /
TICKS_PER_SECOND_DBL * fps;
4638 char *com, *tmp, *clipname = NULL;
4639 double old_fps = 0.;
4640 double afade_in_secs = 0., afade_out_secs = 0.;
4642 double vfade_in_secs = 0., vfade_out_secs = 0.;
4643 LiVESWidgetColor fadecol;
4646 boolean retval =
TRUE, rendaud =
TRUE, response;
4647 boolean norm_after =
FALSE;
4648 int xachans = 0, xarate = 0, xasamps = 0, xse = 0;
4701 }
else clipname = lives_strdup(
"transcode");
4705 if (response == LIVES_RESPONSE_CANCEL) {
4740 old_fps = weed_get_double_value(
mainw->
event_list, WEED_LEAF_FPS, NULL);
4749 cfile->achans = xachans;
4750 cfile->asampsize = xasamps;
4751 cfile->signed_endian = xse;
4767 if (old_fps != 0.) {
4817#ifdef LIBAV_TRANSCODE
4819 if (!transcode_prep()) {
4824 if (!transcode_get_params(&pname)) {
4837 WEED_SEED_BOOLEAN,
"iibV", 1, 0,
TRUE, pname);
4843 d_print(
_(
"Pre-rendering audio..."));
4852 if (afade_in_secs > 0.) {
4853 cfile->undo1_int = 0;
4854 cfile->undo2_dbl = 0.;
4855 cfile->undo1_dbl = afade_in_secs;
4858 if (afade_out_secs > 0.) {
4859 cfile->undo1_int = 1;
4860 cfile->undo2_dbl =
cfile->laudio_time - afade_out_secs;
4869 if (vfade_in_secs > 0.) {
4874 if (vfade_out_secs > 0.) {
4887 if (!transcode)
d_print(
_(
"Rendering..."));
4893 cfile->progress_start = 0;
4916 int old_file = current_file;
4958 cfile->frame_index_back =
cfile->frame_index;
4961 char *what = (
_(
"a new file index"));
4962 LiVESResponseType response;
4966 response = LIVES_RESPONSE_OK;
4967 cfile->frame_index_back =
cfile->frame_index;
4968 cfile->frame_index = NULL;
4970 if (!
cfile->frame_index) {
4971 cfile->frame_index =
cfile->frame_index_back;
4972 cfile->frame_index_back = NULL;
4975 }
while (response == LIVES_RESPONSE_RETRY);
4978 if (response == LIVES_RESPONSE_CANCEL) {
4983 cfile->frame_index =
cfile->frame_index_back;
4984 cfile->frame_index_back = NULL;
4992 for (
int i =
cfile->undo_start - 1; i < cfile->undo_end; i++) {
4993 cfile->frame_index[i] = -1;
5034 if (!esave_file) esave_file = &x;
5035 if (!asave_file) asave_file = &y;
5045 if (fd < 0 ||
THREADVAR(write_failed)) {
5059 while (!
THREADVAR(write_failed) && clist) {
5060 i = LIVES_POINTER_TO_INT(clist->data);
5068 clist = clist->next;
5073 if (fd < 0 ||
THREADVAR(write_failed)) {
5077 if (fd >= 0)
lives_rm(*asave_file);
5086static LiVESResponseType _show_rc_dlg(
void) {
5087 LiVESResponseType resp;
5095static LiVESResponseType show_rc_dlg(
void) {
5096 LiVESResponseType resp;
5106 pthread_mutex_t *event_list_mutex = NULL;
5131#ifdef HAVE_PULSE_AUDIO
5139 nullaudio_get_rec_avals();
5150 if (event_list_mutex) pthread_mutex_lock(event_list_mutex);
5153 if (event_list_mutex) pthread_mutex_unlock(event_list_mutex);
5169 LiVESWidget *elist_dialog;
5173 char *esave_file = NULL, *asave_file = NULL;
5175 boolean new_clip =
FALSE, transcode;
5177 int dh, dw, dar, das, dac, dse;
5208 last_rec_start_tc = -1;
5225 &esave_file, &asave_file);
5232 switch (render_choice) {
5259 cfile->next_event = NULL;
5371 if (esave_file)
lives_rm(esave_file);
5372 if (asave_file)
lives_rm(asave_file);
5401 weed_timecode_t tc, weed_plant_t **shortcut,
boolean bleedthru) {
5402 static weed_plant_t *stored_fmap;
5404 weed_plant_t *frame_event, *fmap;
5407 double *matrix[ntracks + nbtracks];
5410 int64_t *frames = NULL;
5417 ntracks += nbtracks;
5419 if (!shortcut || !*shortcut) stored_fmap = NULL;
5426 vis = (
double *)
lives_malloc(ntracks *
sizeof(
double));
5429 for (i = 0; i < ntracks; i++) {
5438 if (nbtracks > 0) vis[0] = 1.;
5443 if (fmap == *shortcut) fmap = stored_fmap;
5446 for (i = 0; i < ntracks; i++) {
5447 matrix[i] = (
double *)
lives_malloc(ntracks *
sizeof(
double));
5448 for (j = 0; j < ntracks; j++) {
5463 weed_plant_t **iev = (weed_plant_t **)weed_get_voidptr_array_counted(fmap,
WEED_LEAF_INIT_EVENTS, &nins);
5464 for (i = 0; i < nins; i++) {
5465 weed_plant_t *ievent = iev[i];
5478 void **pchains = weed_get_voidptr_array_counted(ievent, WEED_LEAF_IN_PARAMETERS, &npch);
5484 if (weed_leaf_seed_type(in_params[tparam], WEED_LEAF_VALUE) == WEED_SEED_DOUBLE) {
5485 double transd = weed_get_double_value(in_params[tparam], WEED_LEAF_VALUE, NULL);
5486 double tmin = weed_get_double_value(ttmpl, WEED_LEAF_MIN, NULL);
5487 double tmax = weed_get_double_value(ttmpl, WEED_LEAF_MAX, NULL);
5488 trans = (transd - tmin) / (tmax - tmin);
5490 int transi = weed_get_int_value(in_params[tparam], WEED_LEAF_VALUE, NULL);
5491 int tmin = weed_get_int_value(ttmpl, WEED_LEAF_MIN, NULL);
5492 int tmax = weed_get_int_value(ttmpl, WEED_LEAF_MAX, NULL);
5493 trans = (double)(transi - tmin) / (double)(tmax - tmin);
5496 for (j = 0; j < ntracks; j++) {
5500 matrix[in_tracks[1] + nbtracks][j] *= trans;
5501 matrix[in_tracks[0] + nbtracks][j] *= 1. - trans;
5502 matrix[out_tracks[0] + nbtracks][j] = matrix[in_tracks[0] + nbtracks][j] + matrix[in_tracks[1] + nbtracks][j];
5519 for (i = 0; i < nxtracks; i++) {
5520 if (clips[i] >= 0 && frames[i] > 0) {
5530 for (i = 0; i < ntracks; i++) {
5531 if (i >= nbtracks) vis[i] = 0.;
5537 for (i = nbtracks; i < ntracks; i++) {
5538 vis[i] = matrix[got][i];
5541 for (i = 0; i < ntracks; i++) {
5560#if GTK_CHECK_VERSION(3, 0, 0)
5561static void rowexpand(LiVESWidget *
tv, LiVESTreeIter * iter, LiVESTreePath * path, livespointer ud) {
5569static void quant_clicked(LiVESButton * button, livespointer elist) {
5570 weed_plant_t *ev_list = (weed_plant_t *)elist;
5576 weed_set_double_value(ev_list, WEED_LEAF_FPS,
cfile->fps);
5584 weed_timecode_t tc, tc_secs;
5586 LiVESTreeStore *treestore;
5587 LiVESTreeIter iter1, iter2, iter3;
5588 static size_t inistrlen = 0;
5590 char **
string = NULL;
5592 void **voidval = NULL;
5593 double *doubval = NULL;
5594 int64_t *int64val = NULL;
5596 weed_plant_t *event, *ievent;
5598 LiVESWidget *event_dialog, *daa;
5601 LiVESWidget *top_vbox;
5603 LiVESWidget *ok_button;
5604 LiVESWidget *scrolledwindow;
5606 LiVESCellRenderer *renderer;
5607 LiVESTreeViewColumn *column;
5609 LiVESAccelGroup *accel_group;
5613 char *strval = NULL, *desc = NULL;
5615 char *oldval = NULL, *
final = NULL;
5616 char *iname = NULL, *fname = NULL;
5624 int num_elems, seed_type, etype;
5625 int rows, currow = 0;
5656 if (tc < start_tc) {
5660 if (tc >= end_tc)
break;
5674 LIVES_COL_TYPE_STRING, LIVES_COL_TYPE_STRING);
5680 propnames = weed_plant_list_leaves(event, NULL);
5682 for (i = 0; propnames[i]; i++) {
5683 if (!strcmp(propnames[i], WEED_LEAF_TYPE) || !strcmp(propnames[i], WEED_LEAF_EVENT_TYPE) ||
5684 !
lives_strcmp(propnames[i], WEED_LEAF_TIMECODE) || !strncmp(propnames[i],
"host_", 5)) {
5693 num_elems = weed_leaf_num_elements(event, propnames[i]);
5694 seed_type = weed_leaf_seed_type(event, propnames[i]);
5696 switch (seed_type) {
5699 intval = weed_get_int_array(event, propnames[i], NULL);
5701 case WEED_SEED_INT64:
5702 int64val = weed_get_int64_array(event, propnames[i], NULL);
5704 case WEED_SEED_BOOLEAN:
5705 intval = weed_get_boolean_array(event, propnames[i], NULL);
5707 case WEED_SEED_STRING:
5708 string = weed_get_string_array(event, propnames[i], NULL);
5710 case WEED_SEED_DOUBLE:
5711 doubval = weed_get_double_array(event, propnames[i], NULL);
5713 case WEED_SEED_VOIDPTR:
5714 voidval = weed_get_voidptr_array(event, propnames[i], NULL);
5716 case WEED_SEED_PLANTPTR:
5717 voidval = (
void **)weed_get_plantptr_array(event, propnames[i], NULL);
5723 for (j = 0; j < num_elems; j++) {
5724 if (etype == WEED_EVENT_TYPE_PARAM_CHANGE && (!strcmp(propnames[i],
WEED_LEAF_INDEX))
5725 && seed_type == WEED_SEED_INT) {
5727 weed_plant_t *ptmpl = NULL;
5739 pname = weed_get_string_value(ptmpl, WEED_LEAF_NAME, NULL);
5740 else pname = lives_strdup(
"???");
5761 :
_(
"background_clip"));
5775 switch (seed_type) {
5780 case WEED_SEED_INT64:
5783 case WEED_SEED_DOUBLE:
5786 case WEED_SEED_BOOLEAN:
5787 if (intval[j] == WEED_TRUE) strval = (
_(
"TRUE"));
5788 else strval = (
_(
"FALSE"));
5790 case WEED_SEED_STRING:
5791 if (etype == WEED_EVENT_TYPE_FILTER_INIT && (!strcmp(propnames[i],
WEED_LEAF_FILTER))) {
5794 }
else strval = lives_strdup(
string[j]);
5797 case WEED_SEED_VOIDPTR:
5798 if (etype == WEED_EVENT_TYPE_FILTER_DEINIT || etype == WEED_EVENT_TYPE_FILTER_MAP
5799 || etype == WEED_EVENT_TYPE_PARAM_CHANGE) {
5801 ievent = (weed_plant_t *)voidval[j];
5818 else strval = lives_strdup(
" - ");
5821 case WEED_SEED_PLANTPTR:
5825 strval = lives_strdup(
"???");
5833 if (num_elems == 1) {
5850 switch (seed_type) {
5853 case WEED_SEED_BOOLEAN:
5856 case WEED_SEED_INT64:
5859 case WEED_SEED_DOUBLE:
5862 case WEED_SEED_STRING:
5865 case WEED_SEED_VOIDPTR:
5866 case WEED_SEED_PLANTPTR:
5889 (LiVESAttachOptions)(LIVES_EXPAND), (LiVESAttachOptions)(0), 0, 0);
5892 ltext =
"Event list";
5896 case WEED_EVENT_TYPE_FRAME:
5898 ltext =
"Frame with audio";
5902 case WEED_EVENT_TYPE_FILTER_INIT:
5903 ltext =
"Filter on";
break;
5904 case WEED_EVENT_TYPE_FILTER_DEINIT:
5905 ltext =
"Filter off";
break;
5906 case WEED_EVENT_TYPE_PARAM_CHANGE:
5907 ltext =
"Parameter change";
break;
5908 case WEED_EVENT_TYPE_FILTER_MAP:
5909 ltext =
"Filter map";
break;
5910 case WEED_EVENT_TYPE_MARKER:
5911 ltext =
"Marker";
break;
5928 (LiVESAttachOptions)(LIVES_EXPAND), (LiVESAttachOptions)(0), 0, 0);
5937 (LiVESAttachOptions)(LIVES_EXPAND),
5938 (LiVESAttachOptions)(0), 0, 0);
5950 renderer, LIVES_TREE_VIEW_COLUMN_TEXT,
TITLE_COLUMN, NULL);
5952 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
5956 GValue gval = G_VALUE_INIT;
5957 g_value_init(&gval, G_TYPE_INT);
5958 g_value_set_int(&gval, 12);
5961 renderer, LIVES_TREE_VIEW_COLUMN_TEXT,
KEY_COLUMN, NULL);
5962 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
5963 gtk_tree_view_column_set_expand(column,
TRUE);
5969 renderer, LIVES_TREE_VIEW_COLUMN_TEXT,
VALUE_COLUMN, NULL);
5970 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
5971 gtk_tree_view_column_set_expand(column,
TRUE);
5977 renderer, LIVES_TREE_VIEW_COLUMN_TEXT,
DESC_COLUMN, NULL);
5978 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
5979 gtk_tree_view_column_set_expand(column,
TRUE);
5983 (LiVESAttachOptions)(LIVES_FILL | LIVES_EXPAND),
5984 (LiVESAttachOptions)(LIVES_FILL | LIVES_EXPAND), 0, 0);
5986#if GTK_CHECK_VERSION(3, 0, 0)
5987 lives_signal_sync_connect(LIVES_GUI_OBJECT(tree), LIVES_WIDGET_ROW_EXPANDED_SIGNAL,
5988 LIVES_GUI_CALLBACK(rowexpand), NULL);
5993 gtk_tree_view_set_fixed_height_mode(LIVES_TREE_VIEW(tree),
TRUE);
6005#if !GTK_CHECK_VERSION(3, 0, 0)
6021 lives_signal_sync_connect(LIVES_GUI_OBJECT(qbutton), LIVES_WIDGET_CLICKED_SIGNAL,
6022 LIVES_GUI_CALLBACK(quant_clicked), (livespointer)event_list);
6031 LIVES_KEY_Escape, (LiVESXModifierType)0, (LiVESAccelFlags)0);
6033 lives_signal_sync_connect(LIVES_GUI_OBJECT(ok_button), LIVES_WIDGET_CLICKED_SIGNAL,
6050 return event_dialog;
6072LiVESWidget *
add_video_options(LiVESWidget **spwidth,
int defwidth, LiVESWidget **spheight,
int defheight,
6073 LiVESWidget **spfps,
double deffps, LiVESWidget **spframes,
int defframes,
6074 boolean add_aspect, LiVESWidget * extra) {
6076 LiVESWidget *vbox, *hbox, *layout;
6079 double width_step = 4.;
6080 double height_step = 4.;
6089 (
_(
"_Width"), defwidth, width_step,
MAX_FRAME_WIDTH, width_step, width_step, 0, LIVES_BOX(hbox), NULL);
6095 (
_(
"_Height"), defheight, height_step,
MAX_FRAME_WIDTH, height_step, height_step, 0, LIVES_BOX(hbox), NULL);
6110 (
_(
"_Number of frames"), defframes, 1., 100000, 1., 5., 0, LIVES_BOX(hbox), NULL);
6115 (
_(
"_Frames per second"), deffps, 1.,
FPS_MAX, 1., 10., 0, LIVES_BOX(hbox), NULL);
6123static void add_fade_elements(
render_details *
rdet, LiVESWidget * hbox,
boolean is_video) {
6125 LiVESWidget *vbox = NULL;
6139 10., 0., 1000., 1., 1., 2,
6140 LIVES_BOX(hbox), NULL);
6144 10., 0., 1000., 1., 1., 2,
6145 LIVES_BOX(hbox), NULL);
6157 10., 0., 1000., 1., 1., 2,
6158 LIVES_BOX(hbox), NULL);
6162 10., 0., 1000., 1., 1., 2,
6163 LIVES_BOX(hbox), NULL);
6172 LiVESWidget *sp_red, *sp_green, *sp_blue;
6178 FALSE, &rgba, &sp_red,
6179 &sp_green, &sp_blue, NULL);
6197static void rdet_use_current(LiVESButton * button, livespointer user_data) {
6200 char *arate, *achans, *asamps;
6218 if (
cfile->achans > 0) {
6233 aendian =
cfile->signed_endian;
6260 LiVESWidget *top_vbox;
6261 LiVESWidget *dialog_vbox;
6262 LiVESWidget *scrollw = NULL;
6266 LiVESWidget *cancelbutton;
6267 LiVESWidget *alabel;
6269 LiVESWidget *cb_letter;
6270 LiVESWidget *spillover;
6272 LiVESAccelGroup *rdet_accel_group;
6274 LiVESList *ofmt_all = NULL;
6275 LiVESList *ofmt = NULL;
6276 LiVESList *encoders = NULL;
6280 char *tmp, *tmp2, *tmp3;
6283 boolean needs_new_encoder =
FALSE;
6284 boolean no_opts =
FALSE;
6286 int width, height, dwidth, dheight, spht, maxwidth, maxheight;
6328 if (type == 3 || type == 4) {
6329 title = (
_(
"Multitrack Details"));
6330 }
else if (type == 1) title = (
_(
"Encoding Details"));
6331 else title = (
_(
"New Clip Details"));
6369 (tmp2 = lives_strdup(
6370 H_(
"Check this button to always use these values when entering "
6372 "Choice can be re-enabled from Preferences / Multitrack"))));
6383 LIVES_BOX(hbox), (tmp = H_(
"Defines whether black borders will be added when resizing frames\n"
6384 "in order to preserve the original aspect ratio")));
6386 lives_signal_sync_connect(LIVES_GUI_OBJECT(cb_letter), LIVES_WIDGET_TOGGLED_SIGNAL,
6402 if (type == 1) gtk_widget_set_no_show_all(frame,
TRUE);
6416 (tmp3 = (
_(
"The name to give the clip in the Clips menu"))));
6430 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(
rdet->
spinbutton_width), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
6433 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(
rdet->
spinbutton_height), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
6438 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(
rdet->
spinbutton_fps), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
6447 else if (type == 4 &&
cfile->achans != 0) {
6457 TRUE, LIVES_BOX(hbox), NULL);
6492 needs_new_encoder =
TRUE;
6495 needs_new_encoder =
FALSE;
6521 }
else vbox = top_vbox;
6560 for (i = 0; i < lives_list_length(ofmt_all); i++) {
6561 if (
get_token_count((
char *)lives_list_nth_data(ofmt_all, i),
'|') > 2) {
6562 array = lives_strsplit((
char *)lives_list_nth_data(ofmt_all, i),
"|", -1);
6566 ofmt = lives_list_append(ofmt, lives_strdup(array[1]));
6567 lives_strfreev(array);
6632 }
else vbox = top_vbox;
6642 LIVES_BOX(hbox), (tmp2 = (
_(
"Output diagnostic information to STDERR "
6643 "instead of to the GUI."))));
6653 cancelbutton = NULL;
6657 LIVES_RESPONSE_CANCEL);
6661 if (type == 2 || type == 3) {
6665 NULL,
_(
"_Set to current clip values"), LIVES_RESPONSE_RESET);
6667 lives_signal_sync_connect(
rdet->
usecur_button, LIVES_WIDGET_CLICKED_SIGNAL, LIVES_GUI_CALLBACK(rdet_use_current),
6668 (livespointer)
rdet);
6686 LIVES_KEY_Escape, (LiVESXModifierType)0, (LiVESAccelFlags)0);
6689 if (needs_new_encoder) {
6695 lives_signal_sync_connect_after(LIVES_COMBO(
rdet->
acodec_combo), LIVES_WIDGET_CHANGED_SIGNAL,
6714 if (dwidth > maxwidth) dwidth = maxwidth;
6715 if (dheight > maxheight) dheight = maxheight;
6717 if (width > dwidth) width = dwidth;
6718 if (height > dheight) height = dheight;
void audio_free_fnames(void)
int64_t render_audio_segment(int nfiles, int *from_files, int to_file, double *avels, double *fromtime, weed_timecode_t tc_start, weed_timecode_t tc_end, double *chvol, double opvol_start, double opvol_end, lives_audio_buf_t *obuf)
render a chunk of audio, apply effects and mixing it
LIVES_GLOBAL_INLINE char * lives_get_audio_file_name(int fnum)
#define is_realtime_aplayer(ptype)
void on_encoder_ofmt_changed(LiVESCombo *combo, livespointer user_data)
void on_fade_audio_activate(LiVESMenuItem *menuitem, livespointer user_data)
void switch_clip(int type, int newclip, boolean force)
void on_preview_clicked(LiVESButton *button, livespointer user_data)
void on_encoder_entry_changed(LiVESCombo *combo, livespointer ptr)
void lives_notify(int msgnumber, const char *msgstring)
void on_normalise_audio_activate(LiVESMenuItem *menuitem, livespointer user_data)
LIVES_GLOBAL_INLINE void init_conversions(int intent)
LIVES_GLOBAL_INLINE weed_layer_t * lives_layer_new_for_frame(int clip, frames_t frame)
LiVESPixbuf * layer_to_pixbuf(weed_layer_t *layer, boolean realpalette, boolean fordisplay)
boolean letterbox_layer(weed_layer_t *layer, int nwidth, int nheight, int width, int height, LiVESInterpType interp, int tpal, int tclamp)
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_free(weed_layer_t *layer)
frees pixel_data for a layer, then the layer itself
LIVES_GLOBAL_INLINE boolean weed_palette_is_alpha(int pal)
LIVES_GLOBAL_INLINE int weed_layer_get_height(weed_layer_t *layer)
LIVES_GLOBAL_INLINE boolean gamma_convert_layer(int gamma_type, weed_layer_t *layer)
boolean convert_layer_palette(weed_layer_t *layer, int outpl, int op_clamping)
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_palette_get_pixels_per_macropixel(int pal)
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 int weed_layer_get_width(weed_layer_t *layer)
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_nullify_pixel_data(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)
boolean create_frame_index(int fileno, boolean init, frames_t start_offset, frames_t nframes)
void del_frame_index(lives_clip_t *sfile)
boolean save_frame_index(int fileno)
boolean do_header_write_error(int clip)
void do_write_failed_error_s(const char *s, const char *addinfo)
void do_threaded_dialog(const char *trans_text, boolean has_cancel)
void do_encoder_img_fmt_error(render_details *rdet)
LiVESResponseType do_memory_error_dialog(char *op, size_t bytes)
LiVESResponseType do_write_failed_error_s_with_retry(const char *fname, const char *errtext)
void end_threaded_dialog(void)
LIVES_GLOBAL_INLINE boolean do_event_list_warning(void)
void do_read_failed_error_s(const char *s, const char *addinfo)
LIVES_GLOBAL_INLINE LiVESResponseType do_error_dialog(const char *text)
void threaded_dialog_spin(double fraction)
boolean check_storage_space(int clipno, boolean is_processing)
boolean do_progress_dialog(boolean visible, boolean cancellable, const char *text)
char * make_weed_hashname(int filter_idx, boolean fullname, boolean use_extra_authors, char sep, boolean subs)
return value should be freed after use
int rte_key_getmode(int key)
returns current active mode for a key (or -1)
weed_plant_t * weed_instance_get_filter(weed_plant_t *inst, boolean get_compound_parent)
int enabled_out_channels(weed_plant_t *plant, boolean count_repeats)
boolean has_video_chans_in(weed_plant_t *filter, boolean count_opt)
boolean is_perchannel_multiw(weed_plant_t *param)
int weed_add_effectkey_by_idx(int key, int idx)
we will add a filter_class at the next free slot for key, and return the slot number if idx is -1 (pr...
weed_plant_t * rte_keymode_get_instance(int key, int mode)
returns refcounted filter_instance bound to key/mode (or NULL)
char * weed_filter_idx_get_name(int idx, boolean add_subcats, boolean add_notes)
void deinit_render_effects(void)
switch off effects after render preview during rendering/render preview, we use the "keys" FX_KEYS_MA...
int weed_get_idx_for_hashname(const char *hashname, boolean fullname)
fullname includes author and version
void fill_param_vals_to(weed_plant_t *param, weed_plant_t *paramtmpl, int index)
for a multi valued parameter or pchange, we will fill WEED_LEAF_VALUE up to element index with WEED_L...
int num_in_params(weed_plant_t *plant, boolean skip_hidden, boolean skip_internal)
void weed_in_params_free(weed_plant_t **parameters, int num_parameters)
char * cd_to_plugin_dir(weed_plant_t *filter)
change directory to plugin installation dir so it can find any data files
weed_plant_t ** weed_params_create(weed_plant_t *filter, boolean in)
boolean weed_init_effect(int hotkey)
hotkey starts at 1
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)
int enabled_in_channels(weed_plant_t *plant, boolean count_repeats)
boolean interpolate_param(weed_plant_t *param, void *pchain, weed_timecode_t tc)
weed_error_t weed_call_deinit_func(weed_plant_t *instance)
int get_next_free_key(void)
next free "key" for the multitrack system
boolean weed_delete_effectkey(int key, int mode)
unbinds a filter_class from a key/mode
weed_plant_t * weed_filter_in_paramtmpl(weed_plant_t *filter, int param_num, boolean skip_internal)
boolean has_video_chans_out(weed_plant_t *filter, boolean count_opt)
LIVES_GLOBAL_INLINE int weed_instance_unref(weed_plant_t *inst)
LIVES_GLOBAL_INLINE weed_error_t weed_leaf_copy_or_delete(weed_layer_t *dlayer, const char *key, weed_layer_t *slayer)
weed_plant_t * add_filter_deinit_events(weed_plant_t *event_list)
add effect_deinit events to an event_list
weed_plant_t * get_weed_filter(int idx)
int get_transition_param(weed_plant_t *filter, boolean skip_internal)
weed_plant_t * weed_inst_in_param(weed_plant_t *inst, int param_num, boolean skip_hidden, boolean skip_internal)
boolean has_usable_palette(weed_plant_t *chantmpl)
weed_plant_t * get_enabled_channel(weed_plant_t *inst, int which, boolean is_in)
for FILTER_INST
boolean is_pure_audio(weed_plant_t *plant, boolean count_opt)
TRUE if audio in or out and no vid in/out.
weed_plant_t * weed_instance_from_filter(weed_plant_t *filter)
#define WEED_LEAF_HOST_EASING_END
#define WEED_LEAF_HOST_NEXT_INSTANCE
#define WEED_LEAF_HOST_SCRAP_FILE_OFFSET
#define WEED_LEAF_HOST_TAG
#define WEED_LEAF_HOST_MODE
#define WEED_LEAF_HOST_DISABLED
#define WEED_LEAF_AUTO_EASING
#define WEED_LEAF_HOST_INITED
#define WEED_LEAF_HOST_UNUSED
#define WEED_LEAF_HOST_KEY
#define WEED_LEAF_HOST_REPEATS
LiVESWidget * add_audio_options(LiVESWidget **cbbackaudio, LiVESWidget **cbpertrack)
void set_render_choice(LiVESToggleButton *togglebutton, livespointer choice)
void rdetw_spinw_changed(LiVESSpinButton *spinbutton, livespointer user_data)
void remove_audio_for_track(weed_plant_t *event, int track)
int get_audio_frame_clip(weed_plant_t *event, int track)
returns clip number for track (track==-1 is backing audio)
double get_audio_frame_seek(weed_plant_t *event, int track)
returns velocity for track (track==-1 is backing audio)
boolean has_frame_event_at(weed_plant_t *event_list, weed_timecode_t tc, weed_plant_t **shortcut)
lives_render_error_t render_events(boolean reset, boolean rend_video, boolean rend_audio)
render mainw->event_list to a clip
void insert_filter_init_event_at(weed_plant_t *event_list, weed_plant_t *at_event, weed_plant_t *event)
void event_list_add_end_events(weed_event_t *event_list, boolean is_final)
void add_init_event_to_filter_map(weed_plant_t *fmap, weed_plant_t *event, void **hints)
boolean frame_event_has_frame_for_track(weed_plant_t *event, int track)
void add_track_to_avol_init(weed_plant_t *filter, weed_plant_t *event, int nbtracks, boolean behind)
double * get_track_visibility_at_tc(weed_plant_t *event_list, int ntracks, int nbtracks, weed_timecode_t tc, weed_plant_t **shortcut, boolean bleedthru)
calculate the "visibility" of each track at timecode tc
void get_active_track_list(int *clip_index, int num_tracks, weed_plant_t *filter_map)
boolean init_event_is_process_last(weed_plant_t *event)
weed_plant_t * append_filter_map_event(weed_plant_t *event_list, weed_timecode_t tc, void **init_events)
void backup_host_tags(weed_plant_t *event_list, weed_timecode_t curr_tc)
void insert_filter_deinit_event_at(weed_plant_t *event_list, weed_plant_t *at_event, weed_plant_t *event)
weed_plant_t * get_last_frame_event(weed_plant_t *event_list)
weed_plant_t * append_marker_event(weed_plant_t *event_list, weed_timecode_t tc, int marker_type)
void delete_event(weed_plant_t *event_list, weed_plant_t *event)
void unlink_event(weed_plant_t *event_list, weed_plant_t *event)
weed_plant_t * get_prev_frame_event(weed_plant_t *event)
double event_list_get_end_secs(weed_plant_t *event_list)
boolean has_audio_frame(weed_plant_t *event_list)
void ** get_init_events_before(weed_plant_t *event, weed_plant_t *init_event, boolean add)
void insert_param_change_event_at(weed_plant_t *event_list, weed_plant_t *at_event, weed_plant_t *event)
void rdetw_spinh_changed(LiVESSpinButton *spinbutton, livespointer user_data)
boolean move_event_right(weed_plant_t *event_list, weed_plant_t *event, boolean can_stay, double fps)
boolean render_to_clip(boolean new_clip, boolean transcode)
rendering
void delete_param_changes_after_deinit(weed_plant_t *event_list, weed_plant_t *init_event)
weed_timecode_t get_next_paramchange(void **pchange_next, weed_timecode_t end_tc)
boolean filter_init_has_owner(weed_plant_t *init_event, int track)
weed_plant_t * get_next_audio_frame_event(weed_plant_t *event)
LIVES_GLOBAL_INLINE weed_timecode_t weed_event_get_timecode(weed_event_t *event)
frames_t get_frame_event_frame(weed_plant_t *event, int layer)
int get_frame_event_clip(weed_plant_t *event, int layer)
LIVES_GLOBAL_INLINE boolean init_event_in_list(void **init_events, int num_inits, weed_plant_t *event)
render_details * create_render_details(int type)
LIVES_GLOBAL_INLINE weed_plant_t * get_prev_event(weed_plant_t *event)
weed_timecode_t get_prev_paramchange(void **pchange_prev, weed_timecode_t start_tc)
LiVESWidget * events_rec_dialog(void)
weed_plant_t * process_events(weed_plant_t *next_event, boolean process_audio, weed_timecode_t curr_tc)
LIVES_GLOBAL_INLINE int weed_event_get_type(weed_event_t *event)
weed_plant_t * insert_frame_event_at(weed_plant_t *event_list, weed_timecode_t tc, int numframes, int *clips, int64_t *frames, weed_plant_t **shortcut)
void insert_audio_event_at(weed_plant_t *event, int track, int clipnum, double seek, double vel)
boolean deal_with_render_choice(boolean add_deinit)
void move_filter_init_event(weed_plant_t *event_list, weed_timecode_t new_tc, weed_plant_t *init_event, double fps)
weed_timecode_t event_list_get_start_tc(weed_plant_t *event_list)
lives_render_error_t render_events_cb(boolean dummy)
boolean start_render_effect_events(weed_plant_t *event_list, boolean render_vid, boolean render_aud)
boolean event_list_to_block(weed_plant_t *event_list, int num_events)
frames_t count_resampled_events(weed_plant_t *event_list, double fps)
void event_list_replace_events(weed_plant_t *event_list, weed_plant_t *new_event_list)
replace events in event_list with events in new_event_list
LIVES_GLOBAL_INLINE weed_plant_t * get_first_event(weed_plant_t *event_list)
int count_events(weed_plant_t *event_list, boolean all_events, weed_timecode_t start_tc, weed_timecode_t end_tc)
LIVES_GLOBAL_INLINE weed_timecode_t get_event_timecode(weed_plant_t *plant)
void remove_filter_from_event_list(weed_plant_t *event_list, weed_plant_t *init_event)
void remove_frame_from_event(weed_plant_t *event_list, weed_plant_t *event, int track)
LIVES_GLOBAL_INLINE weed_plant_t * get_last_event(weed_plant_t *event_list)
weed_plant_t * append_filter_deinit_event(weed_plant_t *event_list, weed_timecode_t tc, void *init_event, void **pchain)
boolean is_init_pchange(weed_plant_t *init_event, weed_plant_t *pchange_event)
LIVES_GLOBAL_INLINE int weed_frame_event_get_tracks(weed_event_t *event, int **clips, int64_t **frames)
boolean backup_recording(char **esave_file, char **asave_file)
boolean is_blank_frame(weed_plant_t *event, boolean count_audio)
LIVES_GLOBAL_INLINE int get_event_type(weed_plant_t *plant)
LiVESWidget * add_video_options(LiVESWidget **spwidth, int defwidth, LiVESWidget **spheight, int defheight, LiVESWidget **spfps, double deffps, LiVESWidget **spframes, int defframes, boolean add_aspect, LiVESWidget *extra)
boolean insert_filter_map_event_at(weed_plant_t *event_list, weed_plant_t *at_event, weed_plant_t *event, boolean before_frames)
GNU_PURE void *** get_event_pchains(void)
double get_audio_frame_vel(weed_plant_t *event, int track)
returns velocity for track (track==-1 is backing audio)
void event_list_free(weed_plant_t *event_list)
boolean filter_map_has_event(weed_plant_t *fmap, weed_plant_t *event)
weed_plant_t * insert_marker_event_at(weed_plant_t *event_list, weed_plant_t *at_event, int marker_type, livespointer data)
void rdetw_spinf_changed(LiVESSpinButton *spinbutton, livespointer user_data)
weed_plant_t * get_filter_map_before(weed_plant_t *event, int ctrack, weed_plant_t *stop_event)
LIVES_INLINE void dprint_recneg(void)
weed_plant_t * get_first_frame_event(weed_plant_t *event_list)
weed_plant_t * get_filter_map_after(weed_plant_t *event, int ctrack)
weed_plant_t * get_prev_audio_frame_event(weed_plant_t *event)
weed_plant_t * append_filter_init_event(weed_plant_t *event_list, weed_timecode_t tc, int filter_idx, int num_in_tracks, int key, weed_plant_t *inst)
double event_list_get_start_secs(weed_plant_t *event_list)
weed_plant_t * get_audio_block_start(weed_plant_t *event_list, int track, weed_timecode_t tc, boolean seek_back)
#define _get_or_zero(a, b, c)
void event_list_close_gaps(weed_event_t *event_list)
weed_plant_t * append_frame_event(weed_plant_t *event_list, weed_timecode_t tc, int numframes, int *clips, int64_t *frames)
void ** filter_init_add_pchanges(weed_plant_t *event_list, weed_plant_t *plant, weed_plant_t *init_event, int ntracks, int leave)
weed_plant_t * get_frame_event_at(weed_plant_t *event_list, weed_timecode_t tc, weed_plant_t *shortcut, boolean exact)
boolean filter_map_after_frame(weed_plant_t *fmap)
LIVES_GLOBAL_INLINE weed_plant_t * get_next_event(weed_plant_t *event)
boolean insert_event_before(weed_plant_t *at_event, weed_plant_t *event)
weed_plant_t * get_next_frame_event(weed_plant_t *event)
boolean init_event_is_relevant(weed_plant_t *init_event, int ctrack)
LIVES_GLOBAL_INLINE weed_timecode_t weed_event_set_timecode(weed_event_t *event, weed_timecode_t tc)
void update_filter_maps(weed_plant_t *event, weed_plant_t *end_event, weed_plant_t *init_event)
void replace_event(weed_plant_t *event_list, weed_plant_t *at_event, weed_plant_t *event)
void event_list_add_track(weed_plant_t *event_list, int layer)
weed_plant_t * event_copy_and_insert(weed_plant_t *in_event, weed_timecode_t out_tc, weed_plant_t *event_list, weed_event_t **ret_event)
copy (duplicate) in_event and append it to event_list, changing the timecode to out_tc this is called...
boolean insert_event_after(weed_plant_t *at_event, weed_plant_t *event)
LIVES_GLOBAL_INLINE weed_plant_t * insert_blank_frame_event_at(weed_plant_t *event_list, weed_timecode_t tc, weed_plant_t **shortcut)
weed_plant_t * append_param_change_event(weed_plant_t *event_list, weed_timecode_t tc, int pnum, weed_plant_t *param, void *init_event, void **pchain)
weed_event_t * lives_event_list_new(weed_event_t *elist, const char *cdate)
lib-ish stuff
weed_timecode_t event_list_get_end_tc(weed_plant_t *event_list)
void set_render_choice_button(LiVESButton *button, livespointer choice)
void restore_host_tags(weed_plant_t *event_list, weed_timecode_t curr_tc)
LIVES_GLOBAL_INLINE int weed_frame_event_get_audio_tracks(weed_event_t *event, int **clips, double **seeks)
weed_plant_t * get_frame_event_at_or_before(weed_plant_t *event_list, weed_timecode_t tc, weed_plant_t *shortcut)
void move_filter_deinit_event(weed_plant_t *event_list, weed_timecode_t new_tc, weed_plant_t *deinit_event, double fps, boolean rescale_pchanges)
LiVESWidget * create_event_list_dialog(weed_plant_t *event_list, weed_timecode_t start_tc, weed_timecode_t end_tc)
boolean move_event_left(weed_plant_t *event_list, weed_plant_t *event, boolean can_stay, double fps)
void remove_end_blank_frames(weed_plant_t *event_list, boolean remove_filter_inits)
#define WEED_LEAF_HOST_AUDIO_TRANSITION
#define EVENT_MARKER_RECORD_START
#define AUD_DIFF_MIN
ignore audio seek differences < than this (seconds)
#define WEED_EVENT_IS_FRAME(event)
#define AUD_DIFF_REVADJ
allow longer seek differences when audio plauback direction reverses (multiplying factor)
#define WEED_LEAF_IS_DEF_VALUE
#define WEED_LEAF_INIT_EVENTS
#define WEED_LEAF_PREV_CHANGE
#define WEED_LEAF_LIVES_CREATED_VERSION
#define WEED_LEAF_AUDIO_SEEKS
#define WEED_LEAF_CREATED_DATE
#define WEED_LEAF_DEINIT_EVENT
#define WEED_LEAF_TC_ADJUSTMENT
#define RENDER_CHOICE_EVENT_LIST
#define WEED_EVENT_IS_AUDIO_FRAME(event)
#define RENDER_CHOICE_DISCARD
#define WEED_LEAF_EDITED_DATE
#define WEED_LEAF_NEXT_CHANGE
#define WEED_EVENT_IS_FILTER_DEINIT(event)
#define RENDER_CHOICE_NEW_CLIP
#define WEED_LEAF_AUDIO_CLIPS
#define RENDER_CHOICE_MULTITRACK
#define WEED_EVENT_IS_MARKER(event)
#define EVENT_MARKER_RECORD_END
#define RENDER_CHOICE_NONE
#define WEED_LEAF_INIT_EVENT
#define RENDER_CHOICE_PREVIEW
#define RENDER_CHOICE_SAME_CLIP
#define WEED_LEAF_WEED_EVENT_API_VERSION
parts of this may eventually become libweed-events
#define WEED_LEAF_PREVIOUS
#define RENDER_CHOICE_TRANSCODE
#define WEED_LEAF_OUT_COUNT
#define WEED_EVENT_IS_FILTER_INIT(event)
#define WEED_LEAF_HOST_TAG_COPY
#define WEED_LEAF_TCDELTA
#define WEED_LEAF_IN_COUNT
#define WEED_LEAF_IN_TRACKS
#define WEED_LEAF_LIVES_TYPE
#define WEED_PLANT_IS_EVENT_LIST(plant)
weed_plant_t weed_event_t
#define WEED_PLANT_IS_EVENT(plant)
#define WEED_LEAF_OVERLAY_TEXT
#define WEED_EVENT_IS_PARAM_CHANGE(event)
#define EVENT_MARKER_BLOCK_START
#define WEED_LEAF_OUT_TRACKS
#define WEED_EVENT_IS_FILTER_MAP(event)
lives_render_error_t
various return conditions from rendering (multitrack or after recording)
@ LIVES_RENDER_EFFECTS_PAUSED
@ LIVES_RENDER_PROCESSING
@ LIVES_RENDER_ERROR_WRITE_FRAME
@ LIVES_RENDER_ERROR_NONE
@ LIVES_RENDER_ERROR_READ_AUDIO
@ LIVES_RENDER_ERROR_WRITE_AUDIO
#define WEED_LEAF_LIVES_EDITED_VERSION
#define EVENT_MARKER_BLOCK_UNORDERED
void add_to_clipmenu(void)
double lives_ce_update_timeline(int frame, double x)
pointer position in timeline
const lives_special_aspect_t * add_aspect_ratio_button(LiVESSpinButton *sp_width, LiVESSpinButton *sp_height, LiVESBox *box)
void show_playbar_labels(int clipno)
error("LSD_RANDFUNC(ptr, size) must be defined")
LIVES_GLOBAL_INLINE int lives_getgid(void)
char * lives_datetime(uint64_t secs, boolean use_local)
LIVES_GLOBAL_INLINE boolean lives_strcmp(const char *st1, const char *st2)
returns FALSE if strings match
LIVES_GLOBAL_INLINE boolean lives_proc_thread_cancel(lives_proc_thread_t tinfo)
weed_plantptr_t lives_proc_thread_t
lives proc_threads API
LIVES_GLOBAL_INLINE size_t lives_strlen(const char *s)
LIVES_GLOBAL_INLINE void lives_proc_thread_set_cancellable(lives_proc_thread_t tinfo)
only threads with no return value can possibly be cancellable. For threads with a value,...
LIVES_GLOBAL_INLINE boolean lives_proc_thread_check(lives_proc_thread_t tinfo)
returns FALSE while the thread is running, TRUE once it has finished
void update_effort(int nthings, boolean badthings)
LIVES_GLOBAL_INLINE int lives_getuid(void)
LIVES_GLOBAL_INLINE void lives_proc_thread_join(lives_proc_thread_t tinfo)
off_t reget_afilesize_inner(int fileno)
LIVES_GLOBAL_INLINE boolean lives_strncmp(const char *st1, const char *st2, size_t len)
returns FALSE if strings match
void * main_thread_execute(lives_funcptr_t func, int return_type, void *retval, const char *args_fmt,...)
uint64_t lives_thread_join(lives_thread_t work, void **retval)
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)
#define LIVES_THRDATTR_NO_GUI
#define lives_nanosleep_until_nonzero(condition)
void *(* lives_funcptr_t)(void *)
#define LIVES_THRDATTR_NONE
LIVES_GLOBAL_INLINE void free_track_decoders(void)
_palette * palette
interface colour settings
void load_frame_image(int frame)
void init_track_decoders(void)
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 ...
boolean check_layer_ready(weed_layer_t *layer)
block until layer pixel_data is ready.
void * lives_pixbuf_save_threaded(void *args)
save frame to pixbuf in a thread.
void do_quick_switch(int new_file)
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.
void pull_frame_threaded(weed_layer_t *layer, const char *img_ext, weed_timecode_t tc, int width, int height)
void close_current_file(int file_to_switch_to)
close current file, and try to switch to file_to_switch_to
void clear_mainw_msg(void)
int lives_close_buffered(int fd)
boolean load_from_scrap_file(weed_layer_t *layer, int frame)
char * get_untitled_name(int number)
void lives_list_free_all(LiVESList **)
@ UNDO_RENDER
resample/reorder/resize/apply effects
size_t get_token_count(const char *string, int delim)
void get_total_time(lives_clip_t *file)
calculate laudio, raudio and video time (may be deprecated and replaced with macros)
double calc_time_from_frame(int clip, int frame)
#define LIVES_GLOBAL_INLINE
int lives_chdir(const char *path, boolean no_error_dlg)
@ CANCEL_KILL
normal - kill background processes working on current clip
ssize_t lives_write_buffered(int fd, const char *buf, ssize_t count, boolean allow_fail)
#define DEF_FILE_PERMS
non-executable, is modified by the umask
#define IS_NORMAL_CLIP(clip)
void close_scrap_file(boolean remove)
void close_ascrap_file(boolean remove)
int lives_create_buffered(const char *pathname, int mode)
int lives_system(const char *com, boolean allow_error)
void set_undoable(const char *what, boolean sensitive)
ssize_t lives_write_le_buffered(int fd, livesconstpointer buf, ssize_t count, boolean allow_fail)
boolean get_new_handle(int index, const char *name)
#define AFORM_LITTLE_ENDIAN
const char * get_image_ext_for_type(lives_img_type_t imgtype)
#define FPS_MAX
maximum fps we will allow (double)
boolean save_clip_values(int which_file)
#define CURRENT_CLIP_HAS_VIDEO
#define IS_VALID_CLIP(clip)
int lives_rm(const char *file)
void d_print_failed(void)
#define CURRENT_CLIP_IS_NORMAL
void d_print(const char *fmt,...)
int calc_frame_from_time4(int filenum, double time)
nearest frame, no maximum
void add_to_recovery_file(const char *handle)
#define CURRENT_CLIP_IS_VALID
off_t lives_lseek_buffered_rdonly_absolute(int fd, off_t offset)
boolean create_event_space(int length_in_eventsb)
void calc_maxspect(int rwidth, int rheight, int *cwidth, int *cheight)
boolean lives_freep(void **ptr)
@ CLIP_TYPE_FILE
unimported video, not or partially broken in frames
@ CLIP_TYPE_DISK
imported video, broken into frames
#define WEED_LEAF_HOST_DECODER
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
boolean save_clip_value(int which, lives_clip_details_t, void *val)
#define CLIP_TOTAL_TIME(clip)
@ CANCEL_KEEP
user pressed 'Keep'
#define MAINW_MSG_SIZE
mainw->msg bytesize
#define TREE_ROW_HEIGHT
(unexpanded) height of rows in treeviews
#define TICKS_PER_SECOND
ticks per second - GLOBAL TIMEBASE
#define SCR_HEIGHT_SAFETY
#define LIVES_MAIN_WINDOW_WIDGET
#define TICKS_PER_SECOND_DBL
actually microseconds / 100.
@ LIVES_STRING_CONSTANT_ANY
#define LIVES_FILE_EXT_LAYOUT
#define LIVES_FILE_EXT_MGK
#define EFFORT_RANGE_MAX
if set to TRUE during playback then a new frame (or possibly the current one) will be displayed ASAP
#define STYLE_1
turn on theming if set
#define SCR_WIDTH_SAFETY
sepwin/screen size safety margins in pixels
#define LAYOUT_NUMBERING_FILENAME
#define FX_KEYS_MAX
the rest of the keys are accessible through the multitrack renderer (must, be > FX_KEYS_MAX_VIRTUAL)
#define GUI_SCREEN_HEIGHT
void mt_fixup_events(lives_mt *mt, weed_plant_t *old_event, weed_plant_t *new_event)
void recover_layout_cancelled(boolean is_startup)
boolean save_event_list_inner(lives_mt *mt, int fd, weed_plant_t *event_list, unsigned char **mem)
boolean compare_filter_maps(weed_plant_t *fm1, weed_plant_t *fm2, int ctrack)
ctrack can be -1 to compare all events, else we cf for ctrack
void stored_event_list_free_all(boolean wiped)
boolean check_for_layout_del(lives_mt *mt, boolean exiting)
char * get_track_name(lives_mt *mt, int track_num, boolean is_audio)
boolean on_multitrack_activate(LiVESMenuItem *menuitem, weed_plant_t *event_list)
menuitem callback
#define LIVES_OSC_NOTIFY_CLIP_OPENED
sent after a clip is opened
LIVES_GLOBAL_INLINE weed_plant_t * render_text_overlay(weed_layer_t *layer, const char *text)
const lives_special_aspect_t * paramspecial_get_aspect()
LiVESList * filter_encoders_by_img_ext(LiVESList *encoders, const char *img_ext)
LiVESList * get_plugin_list(const char *plugin_type, boolean allow_nonex, const char *plugdir, const char *filter_ext)
boolean chill_decoder_plugin(int fileno)
void close_decoder_plugin(lives_decoder_t *dplug)
LIVES_GLOBAL_INLINE LiVESList * plugin_request_by_line(const char *plugin_type, const char *plugin_name, const char *request)
boolean check_encoder_restrictions(boolean get_extension, boolean user_audio, boolean save_all)
lives_decoder_t * clone_decoder(int fileno)
void rdet_acodec_changed(LiVESCombo *acodec_combo, livespointer user_data)
void toggle_sets_pref(LiVESWidget *widget, livespointer prefidx)
callback to set to make a togglebutton or check_menu_item directly control a boolean pref widget is e...
boolean pref_factory_int(const char *prefidx, int newval, boolean permanent)
boolean pref_factory_bool(const char *prefidx, boolean newval, boolean permanent)
void set_acodec_list_from_allowed(_prefsw *prefsw, render_details *rdet)
#define PREF_REC_EXT_AUDIO
#define SEPWIN_TYPE_NON_STICKY
_future_prefs * future_prefs
_resaudw * create_resaudw(short type, render_details *rdet, LiVESWidget *top_vbox)
resample audio window
weed_plant_t * quantise_events(weed_plant_t *in_list, double qfps, boolean allow_gap)
quantise from event_list_t *in_list to *out_list at the new rate of qfps
LIVES_GLOBAL_INLINE ticks_t q_gint64(ticks_t in, double fps)
LiVESWidgetColor info_base
LiVESWidgetColor info_text
char backend[PATH_MAX *4]
_encoder encoder
from main.h
boolean crash_recovery
TRUE==maintain mainw->recovery file.
int ocp
open_compression_percent : get/set in prefs
boolean event_window_show_frame_events
boolean letterbox_mt
playback with letterbox (multitrack)
char workdir[PATH_MAX]
kept in locale encoding
boolean letterbox
playback with letterbox
boolean show_player_stats
boolean mt_pertrack_audio
boolean btgamma
allows clips to be stored with bt709 gamma - CAUTION not backwards compatible, untested
char backend_sync[PATH_MAX *4]
LiVESWidget * aud_checkbutton
LiVESWidget * entry_asamps
LiVESWidget * rb_littleend
LiVESWidget * rb_unsigned
LiVESWidget * entry_arate
LiVESWidget * entry_achans
lives_checkstatus_t has_encoder_plugins
void * ext_src
points to opaque source for non-disk types
lives_clip_type_t clip_type
lives_img_type_t img_type
int vsize
frame height (vertical) in pixels
int hsize
frame width (horizontal) in pixels (NOT macropixels !)
_vid_playback_plugin * vpp
video plugin
volatile int agen_key
which fx key is generating audio [1 based] (or 0 for none)
double aframeno
and the audio 'frame' for when we are looping
pthread_mutex_t event_list_mutex
prevent simultaneous writing to event_list by audio and video threads
volatile ticks_t currticks
wall clock time, updated whenever lives_get_*_ticks is called
double fixed_fpsd
<=0. means free playback
unsigned char * sl_undo_mem
void * pulsed
pulseaudio player
lives_clip_t * files[MAX_FILES+1]
+1 for the clipboard
weed_layer_t * transrend_layer
int active_track_list[MAX_TRACKS]
frames64_t * frame_index
maps frame slots to the presentation values (if >= 0, points to a 'virtual' frame in the source clip,...
boolean clip_switched
for recording - did we switch clips ?
lives_render_error_t(* progress_fn)(boolean reset)
char * string_constants[NUM_LIVES_STRING_CONSTANTS]
LiVESWidget * select_last
lives_render_error_t render_error
LiVESList * cliplist
hash table of clips in menu order
volatile boolean transrend_ready
volatile lives_cancel_t cancelled
boolean no_context_update
may be set temporarily to block wodget context updates
lives_cancel_type_t cancel_type
int old_active_track_list[MAX_TRACKS]
lives_colRGBA64_t vfade_in_col
boolean ext_src_used[MAX_FILES]
void * jackd
jack audio player / transport
int scrap_file
we throw odd sized frames here when recording in real time; used if a source is a generator or stream
LiVESWidget * spinbutton_pb_fps
volatile boolean is_exiting
set during shutdown (inverse of only_close then)
weed_plant_t * filter_map
ticks_t last_display_ticks
int pre_src_file
video file we were playing before any ext input started
int blend_file
background clip details
lives_colRGBA64_t vfade_out_col
boolean ext_playback
using external video playback plugin
weed_plant_t * audio_event
volatile int rec_aclip
recording values - to be inserted at the following video frame
volatile double rec_aseek
weed_event_t * stored_event_list
stored mt -> clip editor
boolean unordered_blocks
are we recording unordered blocks ?
boolean recording_recovered
volatile boolean record_paused
pause during recording
int ascrap_file
scrap file for recording audio scraps
lives_mt * multitrack
holds a pointer to the entire multitrack environment; NULL in Clip Edit mode
lives_proc_thread_t transrend_proc
volatile boolean agen_needs_reinit
boolean stored_event_list_changed
boolean internal_messaging
internal fx
boolean is_processing
states
boolean preview_rendering
weed_plant_t * afilter_map
frames_t fps_measure
show fps stats after playback
int playing_file
which number file we are playing (or -1) [generally mainw->current_file]
ticks_t flush_audio_tc
reserved space for mbar
lives_decoder_t * track_decoders[MAX_TRACKS]
LiVESPixbuf * scrap_pixbuf
cached image for speeding up rendering
weed_event_t * event_list
current event_list, for recording
ticks_t cevent_tc
timecode of currently processing event
LiVESWidget * spinbutton_height
LiVESWidget * acodec_combo
LiVESWidget * usecur_button
LiVESWidget * pertrack_checkbutton
LiVESWidget * spinbutton_fps
LiVESWidget * encoder_combo
LiVESWidget * backaudio_checkbutton
LiVESWidget * always_checkbutton
LiVESWidget * clipname_entry
LiVESWidget * spinbutton_width
LiVESWidget * always_hbox
boolean suggestion_followed
this struct is used only when physically resampling frames on the disk we create an array of these an...
lives_img_type_t img_type
#define lives_strdup_printf(fmt,...)
WEED_GLOBAL_INLINE weed_plant_t * weed_param_get_template(weed_plant_t *param)
WEED_GLOBAL_INLINE int weed_filter_is_process_last(weed_plant_t *filter)
WEED_GLOBAL_INLINE weed_plant_t ** weed_instance_get_in_params(weed_plant_t *instance, int *nparams)
#define WEED_PLANT_IS_FILTER_INSTANCE(plant)