17 #ifdef LIBAV_TRANSCODE
24 static int render_choice;
25 static 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);
347 void 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;
450 static 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);
464 static 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) {
780 weed_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;
1528 static 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;
1653 static 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) {
1708 static 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);
2030 boolean 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);
2103 boolean 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;
2300 static 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]++;
2583 static 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;
2610 weed_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++) {
3082 weed_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;
3547 static 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;
4542 int 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);
5086 static LiVESResponseType _show_rc_dlg(
void) {
5087 LiVESResponseType resp;
5095 static 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)
5561 static void rowexpand(LiVESWidget *
tv, LiVESTreeIter * iter, LiVESTreePath * path, livespointer ud) {
5569 static 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;
6072 LiVESWidget *
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);
6123 static 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);
6197 static 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;