22 "raw",
"wma2",
"opus",
""};
25 static boolean list_plugins;
30 LiVESList *
get_plugin_result(
const char *command,
const char *delim,
boolean allow_blanks,
boolean strip) {
31 LiVESList *list = NULL;
48 const char *request) {
70 const char *delim,
boolean allow_blanks) {
77 LiVESList *reslist = NULL;
81 if (!plugin_name || !strlen(plugin_name)) {
90 comfile = lives_build_filename(
prefs->
workdir, plugin_name, NULL);
98 lives_printerr(
"will run: %s\n", com);
103 }
else com = lives_strdup(request);
104 list_plugins =
FALSE;
115 LiVESList *
get_plugin_list(
const char *plugin_type,
boolean allow_nonex,
const char *plugdir,
const char *filter_ext) {
129 const char *ext = (filter_ext == NULL) ?
"" : filter_ext;
150 (tmp = lives_filename_from_utf8((
char *)plugdir, -1, NULL, NULL, NULL)), ext);
154 (tmp = lives_filename_from_utf8((
char *)plugdir, -1, NULL, NULL, NULL)), ext);
217 if ((fd =
lives_open3(vpp_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) == -1) {
218 msg =
lives_strdup_printf(
_(
"\n\nUnable to write video playback plugin defaults file\n%s\nError code %d\n"), vpp_file, errno);
228 msg = lives_strdup(
"LiVES vpp defaults file version 2\n");
232 len = strlen(vpp->
name);
278 if (!lives_file_test(vpp_file, LIVES_FILE_TEST_EXISTS)) {
282 d_print(
_(
"Loading video playback plugin defaults from %s..."), vpp_file);
286 if ((fd =
lives_open2(vpp_file, O_RDONLY)) == -1) {
288 if (retval == LIVES_RESPONSE_CANCEL) {
297 msg = lives_strdup(
"LiVES vpp defaults file version 2\n");
299 if (len < 0) len = 0;
305 if (strcmp(msg, buf)) {
321 if (strcmp(buf, vpp->
name)) {
339 _(
"\nThe %s video playback plugin has been updated.\nPlease check your settings in\n"
340 "Tools|Preferences|Playback|Playback Plugins Advanced\n\n"),
394 if (retval == LIVES_RESPONSE_CANCEL) {
402 }
while (retval == LIVES_RESPONSE_RETRY);
439 const char *fixed_fps = NULL;
442 char *cur_pal = NULL;
444 int *pal_list, i = 0;
446 boolean ext_audio =
FALSE;
452 LiVESWidget *textwidget = (LiVESWidget *)lives_widget_object_get_data(LIVES_WIDGET_OBJECT(
mainw->
textwidget_focus),
478 char **array = lives_strsplit(cur_pal,
" ", 2);
479 char *clamping = lives_strdup(array[1] + 1);
481 cur_pal = lives_strdup(array[0]);
485 if (tmp && !strcmp(clamping, tmp)) {
491 lives_strfreev(array);
497 if (!strlen(fixed_fps)) {
502 char **array = lives_strsplit(fixed_fps,
":", 2);
505 lives_strfreev(array);
528 for (i = 0; pal_list[i] != WEED_PALETTE_END; i++) {
569 #ifdef HAVE_PULSE_AUDIO
631 char **array = lives_strsplit(cur_pal,
" ", 2);
632 char *clamping = lives_strdup(array[1] + 1);
634 cur_pal = lives_strdup(array[0]);
638 if (tmp && !strcmp(clamping, tmp)) {
644 lives_strfreev(array);
651 char **array = lives_strsplit(fixed_fps,
":", 2);
654 lives_strfreev(array);
667 for (i = 0; pal_list[i] != WEED_PALETTE_END; i++) {
728 LiVESWidget *dialog_vbox;
732 LiVESWidget *cancelbutton;
733 LiVESWidget *okbutton;
734 LiVESWidget *savebutton;
736 LiVESAccelGroup *accel_group;
744 double wscale = 1., hscale = 1.;
749 LiVESList *fps_list_strings = NULL;
750 LiVESList *pal_list_strings = NULL;
753 const char *pversion;
755 const char *fps_list;
764 if (user_data) intention = LIVES_POINTER_TO_INT(user_data);
784 pversion = (tmpvpp->
version)();
790 title = (
_(
"Quick Transcoding"));
812 tmp =
lives_big_and_bold(
"%s",
_(
"Quick transcode provides a rapid, high quality preview of the selected frames and audio."));
822 char **array = lives_strsplit(fps_list,
"|", -1);
825 for (i = 0; i < nfps; i++) {
826 if (strlen(array[i]) && strcmp(array[i],
"\n")) {
828 fps_list_strings = lives_list_append(fps_list_strings,
remove_trailing_zeroes(lives_strtod(array[i], NULL)));
829 }
else fps_list_strings = lives_list_append(fps_list_strings, lives_strdup(array[i]));
836 LIVES_BOX(dialog_vbox), (tmp2 = (
_(
"Fixed framerate for plugin.\n"))));
843 lives_strfreev(array);
890 LIVES_SPIN_BUTTON(vppa->
spinbuttonh), LIVES_BOX(hbox));
902 for (i = 0; pal_list[i] != WEED_PALETTE_END; i++) {
907 while (clampings[j] != -1) {
909 pal_list_strings = lives_list_append(pal_list_strings, string2);
914 pal_list_strings = lives_list_append(pal_list_strings, lives_strdup(
string));
919 LIVES_BOX(dialog_vbox), tmp2 = (
_(
"Colourspace input to the plugin.\n")));
926 if (clampings[0] != -1)
938 FALSE, LIVES_BOX(dialog_vbox), NULL);
950 if (lives_file_test(fnamex, LIVES_FILE_TEST_EXISTS))
964 LIVES_RESPONSE_CANCEL);
967 LIVES_KEY_Escape, (LiVESXModifierType)0, (LiVESAccelFlags)0);
971 LIVES_RESPONSE_BROWSE);
984 lives_signal_sync_connect(LIVES_GUI_OBJECT(cancelbutton), LIVES_WIDGET_CLICKED_SIGNAL,
987 lives_signal_sync_connect(LIVES_GUI_OBJECT(okbutton), LIVES_WIDGET_CLICKED_SIGNAL,
1044 while (pparams[i]) {
1046 if (--idx < 0)
return pparams[i];
1056 while (pparams[i]) {
1058 if (--idx < 0)
return pparams[i];
1067 int *pal_list, i = 0;
1070 for (i = 0; pal_list[i] != WEED_PALETTE_END; i++) {
1071 if (pal_list[i] ==
palette)
break;
1073 if (pal_list[i] == WEED_PALETTE_END) {
1074 if (!i)
return FALSE;
1087 for (i = 0; yuv_clamping_types[i] != -1; i++) {
1088 if (yuv_clamping_types[i] == lclamping) {
1108 const char *fps_list;
1109 const char *pl_error;
1114 int dlflags = RTLD_LAZY;
1126 handle = dlopen(plugname, dlflags);
1130 "Playback plugin will be disabled,\n"
1131 "it can be re-enabled in Preferences / Playback.\n"), plugname, dlerror());
1154 if ((vpp->
module_check_init = (
const char *(*)())dlsym(handle,
"module_check_init")) == NULL) {
1157 if ((vpp->
version = (
const char *(*)())dlsym(handle,
"version")) == NULL) {
1160 if ((vpp->
get_palette_list = (
int *(*)())dlsym(handle,
"get_palette_list")) == NULL) {
1163 if ((vpp->
set_palette = (
boolean(*)(
int))dlsym(handle,
"set_palette")) == NULL) {
1166 if ((vpp->
get_capabilities = (uint64_t (*)(
int))dlsym(handle,
"get_capabilities")) == NULL) {
1169 if ((vpp->
render_frame = (
boolean(*)(
int,
int, int64_t,
void **,
void **, weed_plant_t **))
1170 dlsym(handle,
"render_frame")) == NULL) {
1172 dlsym(handle,
"play_frame")) == NULL) {
1176 if ((vpp->
get_fps_list = (
const char *(*)(
int))dlsym(handle,
"get_fps_list"))) {
1177 if ((vpp->
set_fps = (
boolean(*)(
double))dlsym(handle,
"set_fps")) == NULL) {
1184 (
_(
"\n\nPlayback module %s\nis missing a mandatory function.\nUnable to use it.\n"), plugname);
1196 msg =
lives_strdup_printf(
_(
"Video playback plugin failed to initialise.\nError was: %s\n"), pl_error);
1211 vpp->
weed_setup = (weed_plant_t *(*)(weed_bootstrap_f))dlsym(handle,
"weed_setup");
1214 weed_set_host_info_callback(
host_info_cb, LIVES_INT_TO_POINTER(100));
1218 vpp->
get_description = (
const char *(*)())dlsym(handle,
"get_description");
1219 vpp->
get_init_rfx = (
const char *(*)())dlsym(handle,
"get_init_rfx");
1221 vpp->get_play_params = (
const weed_plant_t **(*)(weed_bootstrap_f))dlsym(handle,
"get_play_params");
1225 vpp->
get_audio_fmts = (
int *(*)())dlsym(handle,
"get_audio_fmts");
1227 vpp->
init_audio = (
boolean(*)(int, int, int,
char **))dlsym(handle,
"init_audio");
1229 vpp->
exit_screen = (void (*)(uint16_t, uint16_t))dlsym(handle,
"exit_screen");
1230 vpp->
module_unload = (void (*)())dlsym(handle,
"module_unload");
1245 vpp->
palette = palette_list[0];
1283 lives_snprintf(vpp->
name, 256,
"%s", name);
1306 array = lives_strsplit(fps_list,
"|", -1);
1308 char **array2 = lives_strsplit(array[0],
":", 2);
1311 lives_strfreev(array2);
1314 vpp->
fixed_fpsd = lives_strtod(array[0], NULL);
1317 lives_strfreev(array);
1326 if (yuv_clamping_types[0] != -1) vpp->
YUV_clamping = yuv_clamping_types[0];
1337 if (vpp->get_play_params) {
1344 weed_plant_t *ptmpl;
1349 vpp->
play_params[i] = weed_plant_new(WEED_PLANT_PARAMETER);
1350 weed_leaf_copy(vpp->
play_params[i], WEED_LEAF_VALUE, ptmpl, WEED_LEAF_DEFAULT);
1351 weed_set_plantptr_value(vpp->
play_params[i], WEED_LEAF_TEMPLATE, ptmpl);
1355 vpp->
play_params[i] = weed_plant_new(WEED_PLANT_CHANNEL);
1356 weed_set_plantptr_value(vpp->
play_params[i], WEED_LEAF_TEMPLATE, ptmpl);
1363 if (!in_use)
return vpp;
1367 int fwidth = vpp->
fwidth;
1372 if (fixed_fpsd < 0.) vpp->
fixed_fpsd = fixed_fpsd;
1373 if (fwidth < 0) vpp->
fwidth = fwidth;
1374 if (fheight < 0) vpp->
fheight = fheight;
1398 d_print(
_(
"*** Using %s plugin for fs playback, agreed to use palette type %d ( %s ). ***\n"), name,
1400 WEED_YUV_SUBSPACE_YCBCR)));
1450 int i, j = 0, nfmts;
1451 char *astreamer, *com;
1468 array = lives_strsplit(buf,
"|", nfmts);
1471 for (i = 0; i < nfmts; i++) {
1472 if (array[i] && *array[i]) sfmts[j++] = atoi(array[i]);
1476 lives_strfreev(array);
1478 for (i = 0; fmts[i] != -1; i++) {
1496 d_print(
_(
"Audio stream unable to use preferred format '%s'\n"),
anames[fmts[i]]);
1509 if (fmts[i] == -1) {
1511 for (i = 0; fmts[i] != -1; i++) {
1536 _(
"LiVES was unable to find its encoder plugins. Please make sure you have the plugins installed in\n"
1537 "%s%s%s\nor change the value of <lib_dir> in %s\n"),
1539 (tmp = lives_filename_to_utf8(
prefs->
configfile, -1, NULL, NULL, NULL)));
1548 _(
"LiVES did not receive a response from the encoder plugin called '%s'.\n"
1549 "Please make sure you have that plugin installed correctly in\n%s%s%s\n"
1550 "or switch to another plugin using Tools|Preferences|Encoding\n"),
1558 LiVESList *ofmt_all = NULL;
1560 char **array = NULL;
1562 char aspect_buffer[512];
1565 double best_fps = 0.;
1567 double best_fps_delta = 0.;
1569 boolean sizer =
FALSE;
1570 boolean allow_aspect_override =
FALSE;
1571 boolean calc_aspect =
FALSE;
1572 boolean swap_endian =
FALSE;
1576 int height, oheight;
1577 int best_arate_delta = 0;
1578 int hblock = 2, vblock = 2;
1581 int best_fps_num = 0, best_fps_denom = 0;
1582 int arate, achans, asampsize, asigned = 0;
1585 width = owidth =
cfile->hsize;
1586 height = oheight =
cfile->vsize;
1607 for (i = 0; i < lives_list_length(ofmt_all); i++) {
1608 if ((numtok =
get_token_count((
char *)lives_list_nth_data(ofmt_all, i),
'|')) > 2) {
1609 array = lives_strsplit((
char *)lives_list_nth_data(ofmt_all, i),
"|", -1);
1628 lives_strfreev(array);
1631 lives_strfreev(array);
1654 arate =
cfile->arate;
1655 achans =
cfile->achans;
1656 asampsize =
cfile->asampsize;
1680 for (r = 0; r < pieces; r++) {
1683 if (!strncmp(checks[r],
"fps=", 4)) {
1685 int mbest_num = 0, mbest_denom = 0;
1689 best_fps_delta = 1000000000.;
1690 array = lives_strsplit(checks[r],
"=", 2);
1692 array2 = lives_strsplit(array[1],
";", numtok);
1693 for (i = 0; i < numtok; i++) {
1694 mbest_num = mbest_denom = 0;
1696 char **array3 = lives_strsplit(array2[i],
":", 2);
1697 mbest_num = atoi(array3[0]);
1698 mbest_denom = atoi(array3[1]);
1699 lives_strfreev(array3);
1700 if (mbest_denom == 0)
continue;
1701 allowed_fps = (mbest_num * 1.) / (mbest_denom * 1.);
1702 }
else allowed_fps = lives_strtod(array2[i], NULL);
1708 if (allowed_fps >= fps) {
1709 if (allowed_fps - fps < best_fps_delta) {
1710 best_fps_delta = allowed_fps - fps;
1711 if (mbest_denom > 0) {
1712 best_fps_num = mbest_num;
1713 best_fps_denom = mbest_denom;
1718 best_fps_num = best_fps_denom = 0;
1719 best_fps = allowed_fps;
1724 }
else if ((best_fps_denom == 0 && allowed_fps > best_fps) || (best_fps_denom > 0
1725 && allowed_fps > (best_fps_num * 1.) /
1726 (best_fps_denom * 1.))) {
1727 best_fps_delta = fps - allowed_fps;
1728 if (mbest_denom > 0) {
1729 best_fps_num = mbest_num;
1730 best_fps_denom = mbest_denom;
1735 best_fps = allowed_fps;
1736 best_fps_num = best_fps_denom = 0;
1741 if (best_fps_delta <= prefs->fps_tolerance) {
1742 best_fps_delta = 0.;
1743 best_fps_denom = best_fps_num = 0;
1745 if (best_fps_delta == 0.)
break;
1747 lives_strfreev(array);
1748 lives_strfreev(array2);
1752 if (!strncmp(checks[r],
"size=", 5)) {
1754 array = lives_strsplit(checks[r],
"=", 2);
1755 array2 = lives_strsplit(array[1],
"x", 2);
1756 width = atoi(array2[0]);
1757 height = atoi(array2[1]);
1758 lives_strfreev(array2);
1759 lives_strfreev(array);
1764 if (!strncmp(checks[r],
"minw=", 5)) {
1765 array = lives_strsplit(checks[r],
"=", 2);
1766 val = atoi(array[1]);
1767 if (width < val) width = val;
1768 lives_strfreev(array);
1772 if (!strncmp(checks[r],
"minh=", 5)) {
1773 array = lives_strsplit(checks[r],
"=", 2);
1774 val = atoi(array[1]);
1775 if (height < val) height = val;
1776 lives_strfreev(array);
1780 if (!strncmp(checks[r],
"maxh=", 5)) {
1781 array = lives_strsplit(checks[r],
"=", 2);
1782 val = atoi(array[1]);
1783 if (height > val) height = val;
1784 lives_strfreev(array);
1788 if (!strncmp(checks[r],
"maxw=", 5)) {
1789 array = lives_strsplit(checks[r],
"=", 2);
1790 val = atoi(array[1]);
1791 if (width > val) width = val;
1792 lives_strfreev(array);
1796 if (!strncmp(checks[r],
"asigned=", 8) &&
1802 && arate != 0 && achans != 0 && asampsize != 0) {
1803 array = lives_strsplit(checks[r],
"=", 2);
1804 if (!strcmp(array[1],
"signed")) {
1808 if (!strcmp(array[1],
"unsigned")) {
1812 lives_strfreev(array);
1816 lives_strfreev(checks);
1825 (LIVES_TOGGLE_BUTTON
1832 best_arate_delta = 1000000000;
1834 array = lives_strsplit(checks[r],
"=", 2);
1836 array2 = lives_strsplit(array[1],
";", numtok);
1837 for (i = 0; i < numtok; i++) {
1838 allowed_arate = atoi(array2[i]);
1839 if (allowed_arate >= arate) {
1840 if (allowed_arate - arate < best_arate_delta) {
1841 best_arate_delta = allowed_arate - arate;
1842 best_arate = allowed_arate;
1844 }
else if (allowed_arate > best_arate) best_arate = allowed_arate;
1846 lives_strfreev(array2);
1847 lives_strfreev(array);
1851 lives_strfreev(checks);
1857 if (!strncmp(checks[r],
"hblock=", 7)) {
1859 array = lives_strsplit(checks[r],
"=", 2);
1860 hblock = atoi(array[1]);
1861 width = (int)(width / hblock + .5) * hblock;
1862 lives_strfreev(array);
1866 if (!strncmp(checks[r],
"vblock=", 7)) {
1868 array = lives_strsplit(checks[r],
"=", 2);
1869 vblock = atoi(array[1]);
1870 height = (int)(height / vblock + .5) * vblock;
1871 lives_strfreev(array);
1875 if (!strncmp(checks[r],
"aspect=", 7)) {
1879 array = lives_strsplit(checks[r],
"=", 2);
1880 lives_snprintf(aspect_buffer, 512,
"%s", array[1]);
1881 lives_strfreev(array);
1887 lives_strfreev(checks);
1892 double allowed_aspect;
1894 int xheight = height;
1896 width = height = 1000000;
1899 array2 = lives_strsplit(aspect_buffer,
";", numtok);
1904 for (i = 0; i < numtok; i++) {
1905 array3 = lives_strsplit(array2[i],
":", 2);
1906 allowed_aspect = lives_strtod(array3[0], NULL) / lives_strtod(array3[1], NULL);
1907 lives_strfreev(array3);
1910 lives_strfreev(array2);
1913 if (owidth % hblock == 0 && oheight % vblock == 0) allow_aspect_override =
TRUE;
1921 if (sizer) allow_aspect_override =
FALSE;
1926 if (((width != owidth || height != oheight) && width * height > 0) || (best_fps_delta > 0.) || (best_arate_delta > 0 &&
1928 best_arate < 0 || asigned != 0 || swap_endian) {
1931 if ((width != owidth || height != oheight) && width * height > 0) {
1933 if (allow_aspect_override) {
1949 if (
rdet_suggest_values(width, height, best_fps, best_fps_num, best_fps_denom, best_arate, asigned, swap_endian,
1950 allow_aspect_override, (best_fps_delta == 0.))) {
1954 if (best_arate != -1)
rdet->
arate = best_arate;
1966 if (best_fps_delta > 0.) {
1967 if (best_fps_denom > 0) {
1968 rdet->
fps = (best_fps_num * 1.) / (best_fps_denom * 1.);
1974 if (best_arate != -1) {
1987 asigned, swap_endian, allow_aspect_override, save_all)) {
1993 if (!
auto_resample_resize(width, height, best_fps, best_fps_num, best_fps_denom, best_arate, asigned, swap_endian)) {
2007 LiVESList *encoder_capabilities = NULL;
2008 LiVESList *list = encoders, *listnext;
2013 char *blacklist[] = {
2022 boolean skip =
FALSE;
2025 listnext = list->next;
2027 while (blacklist[i]) {
2028 if (!strcmp((
const char *)list->data, blacklist[i])) {
2031 encoders = lives_list_delete_link(encoders, list);
2049 encoders = lives_list_delete_link(encoders, list);
2051 caps = atoi((
char *)lives_list_nth_data(encoder_capabilities, 0));
2054 encoders = lives_list_delete_link(encoders, list);
2063 for (i = 0; blacklist[i]; i++)
lives_free(blacklist[i]);
2073 LiVESList *decoder_plugin, *last_decoder_plugin = NULL;
2075 while (decoder_plugin) {
2076 if (!strcmp((
const char *)(decoder_plugin->data), name)) {
2077 if (last_decoder_plugin) {
2078 last_decoder_plugin->next = decoder_plugin->next;
2084 last_decoder_plugin = decoder_plugin;
2085 decoder_plugin = decoder_plugin->next;
2095 LiVESList *dlist = NULL;
2097 LiVESList *decoder_plugins = decoder_plugins_o;
2099 char *blacklist[3] = {
2100 "zyavformat_decoder",
2101 "ogg_theora_decoder",
2105 const char *dplugname;
2110 while (decoder_plugins) {
2112 dplugname = (
const char *)(decoder_plugins->data);
2113 for (i = 0; blacklist[i]; i++) {
2114 if (!strcmp(dplugname, blacklist[i])) {
2122 if (dplug) dlist = lives_list_append(dlist, (livespointer)dplug);
2124 lives_free((livespointer)decoder_plugins->data);
2125 decoder_plugins = decoder_plugins->next;
2128 lives_list_free(decoder_plugins_o);
2176 LiVESList *disabled;
2191 if (!cdata)
return NULL;
2197 dplug->
cdata = cdata;
2230 while (decoder_plugin) {
2234 decoder_plugin = decoder_plugin->next;
2239 #ifdef DEBUG_DECPLUG
2240 g_print(
"trying decoder %s\n", dpsys->
name);
2250 g_printerr(
"Error in cdata received from decoder plugin:\n%s\nAborting.", dpsys->
name);
2253 if (!sanity_check_cdata(dplug->
cdata)) {
2255 decoder_plugin = decoder_plugin->next;
2258 set_cdata_memfuncs(dplug->
cdata);
2273 decoder_plugin = decoder_plugin->next;
2276 if (!decoder_plugin) {
2300 LiVESList *xdisabled;
2308 if (!lives_file_test(sfile->
file_name, LIVES_FILE_TEST_EXISTS)) {
2323 xdisabled = lives_list_copy(disabled);
2329 xdisabled = lives_list_remove(xdisabled, decplugname);
2330 while (decoder_plugin) {
2332 if (!strcmp(dpsys->
name, decplugname)) {
2336 decoder_plugin = decoder_plugin->next;
2342 dplug = try_decoder_plugins(fake_cdata == NULL ? sfile->
file_name : NULL, xdisabled, fake_cdata);
2344 if (xdisabled) lives_list_free(xdisabled);
2352 return dplug->
cdata;
2355 if (dplug)
return dplug->
cdata;
2367 if (dplug->
refs)
return;
2369 cdata = dplug->
cdata;
2387 char *cwd = lives_get_current_dir();
2416 dplugs = dplugs->next;
2440 char *plugname, *tmp;
2443 int dlflags = RTLD_NOW | RTLD_LOCAL;
2453 #ifdef RTLD_DEEPBIND
2454 dlflags |= RTLD_DEEPBIND;
2457 dplug->
handle = dlopen(plugname, dlflags);
2461 d_print(
_(
"\n\nFailed to open decoder plugin %s\nError was %s\n"), plname, dlerror());
2466 if ((dplug->
version = (
const char *(*)())dlsym(dplug->
handle,
"version")) == NULL) {
2470 dlsym(dplug->
handle,
"get_clip_data")) == NULL) {
2474 dlsym(dplug->
handle,
"get_frame")) == NULL) {
2482 d_print(
_(
"\n\nDecoder plugin %s\nis missing a mandatory function.\nUnable to use it.\n"), plname);
2483 unload_decoder_plugin(dplug);
2494 dlsym(dplug->
handle,
"rip_audio");
2502 unload_decoder_plugin(dplug);
2508 dplug->
name = lives_strdup(plname);
2516 if (!*cdata->
container_name) lives_snprintf(text, maxlen,
"%s",
_(
"unknown"));
2529 if (
cfile->achans == 0)
return;
2538 static void dpa_ok_clicked(LiVESButton * button, livespointer user_data) {
2554 static void dpa_cancel_clicked(LiVESButton * button, livespointer user_data) {
2566 static void on_dpa_cb_toggled(LiVESToggleButton * button,
const char *decname) {
2576 LiVESList *decoder_plugin;
2580 LiVESWidget *checkbutton;
2581 LiVESWidget *scrolledwindow;
2583 LiVESWidget *dialog;
2584 LiVESWidget *dialog_vbox;
2585 LiVESWidget *cancelbutton;
2586 LiVESWidget *okbutton;
2611 while (decoder_plugin) {
2620 LIVES_BOX(hbox), NULL);
2625 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(checkbutton), LIVES_WIDGET_TOGGLED_SIGNAL,
2626 LIVES_GUI_CALLBACK(on_dpa_cb_toggled),
2627 (livespointer)dpsys->
name);
2629 decoder_plugin = decoder_plugin->next;
2633 LIVES_RESPONSE_CANCEL);
2641 LIVES_GUI_CALLBACK(dpa_cancel_clicked),
2645 LIVES_GUI_CALLBACK(dpa_ok_clicked),
2664 d_print(
_(
"Failed to load %s, transitions may not resize.\n"), rfx->
name);
2709 LiVESList *parameter_list, *list;
2734 if (!parameter_list) {
2741 rfx->
num_params = lives_list_length(parameter_list);
2743 list = parameter_list;
2745 for (param_idx = 0; param_idx < rfx->
num_params; param_idx++) {
2746 line = (
char *)list->data;
2750 if (len < 3)
continue;
2752 param_array = lives_strsplit(line, rfx->
delim, -1);
2754 cparam = &rfx->
params[param_idx];
2755 cparam->
name = lives_strdup(param_array[0]);
2756 cparam->
label = lives_strdup(param_array[1]);
2757 cparam->
desc = NULL;
2774 cparam->
value = NULL;
2776 #ifdef DEBUG_RENDER_FX_P
2777 lives_printerr(
"Got parameter %s\n", cparam->
name);
2780 cparam->
list = NULL;
2784 if (!strncmp(param_array[2],
"num", 3)) {
2785 cparam->
dp = atoi(param_array[2] + 3);
2787 }
else if (!strncmp(param_array[2],
"bool", 4)) {
2789 }
else if (!strncmp(param_array[2],
"colRGB24", 8)) {
2791 }
else if (!strncmp(param_array[2],
"string", 8)) {
2793 }
else if (!strncmp(param_array[2],
"string_list", 8)) {
2799 if (len < 6)
continue;
2800 val = lives_strtod(param_array[3], NULL);
2805 cparam->
min = lives_strtod(param_array[4], NULL);
2806 cparam->
max = lives_strtod(param_array[5], NULL);
2808 cparam->
step_size = lives_strtod(param_array[6], NULL);
2819 if (len < 6)
continue;
2820 red = (short)atoi(param_array[3]);
2821 green = (short)atoi(param_array[4]);
2822 blue = (short)atoi(param_array[5]);
2828 if (len < 4)
continue;
2829 cparam->
value = (
_(param_array[3]));
2830 cparam->
def = (
_(param_array[3]));
2831 if (len > 4) cparam->
max = (double)atoi(param_array[4]);
2834 if (len < 4)
continue;
2837 *(
int *)cparam->
def = atoi(param_array[3]);
2847 if (len < 4)
continue;
2848 val = atoi(param_array[3]);
2856 if (len > 4) cparam->
group = atoi(param_array[4]);
2858 if (len < 6)
continue;
2859 cparam->
min = (double)atoi(param_array[4]);
2860 cparam->
max = (double)atoi(param_array[5]);
2862 cparam->
step_size = (double)atoi(param_array[6]);
2876 lives_strfreev(param_array);
2888 LiVESList *slist = NULL;
2890 for (i = offset + 1; i < len; i++) {
2891 string =
subst((tmp = L2U8(array[i])),
"\\n",
"\n");
2895 if (i < len - 1 || *
string) {
2896 slist = lives_list_append(slist,
string);
2904 static int cmp_menu_entries(livesconstpointer a, livesconstpointer b) {
2915 LiVESList *rfx_list = NULL, *xrfx_list;
2916 for (i = num; i > 0; i--) {
2917 rfx_list = lives_list_prepend(rfx_list, (livespointer)&in[i]);
2919 rfx_list = lives_list_sort(rfx_list, cmp_menu_entries);
2922 xrfx_list = rfx_list;
2925 xrfx_list = xrfx_list->next;
2927 lives_list_free(rfx_list);
2949 dest->
name = lives_strdup(src->
name);
3023 dest->
name = lives_strdup(src->
name);
3039 switch (dest->
type) {
3056 dest->
def = lives_strdup((
char *)src->
def);
3061 if (src->
list) dest->
list = lives_list_copy(src->
list);
3110 *value_ptr = lives_strndup(_const, maxlen);
3125 size_t len = strlen(value);
3127 if (!param)
return FALSE;
3129 if (update_visual) {
3130 LiVESList *list = NULL;
3143 if (!param)
return FALSE;
3152 if (red < 0) red = 0;
3153 if (red > 255) red = 255;
3154 if (green < 0) green = 0;
3155 if (green > 255) green = 255;
3156 if (blue < 0) blue = 0;
3157 if (blue > 255) blue = 255;
3160 rgbp->
green = green;
3169 rgbap->
green = green;
3171 rgbap->
alpha = alpha;
3191 if (!rfx)
return NULL;
3206 LiVESList *gtk_list = NULL;
3210 weed_plant_t *gui = NULL;
3212 int cspace, *cols = NULL, red_min = 0, red_max = 255, green_min = 0, green_max = 255, blue_min = 0, blue_max = 255,
3213 *maxi = NULL, *mini = NULL;
3215 double red_mind = 0., red_maxd = 1., green_mind = 0., green_maxd = 1., blue_mind = 0., blue_maxd = 1.,
3216 *maxd = NULL, *mind = NULL;
3218 int nwpars = 0, poffset = 0;
3221 weed_plant_t *wtmpl;
3222 weed_plant_t **wpars = NULL, *wpar = NULL;
3224 weed_plant_t *chann, *ctmpl;
3229 for (i = 0; i < npar; i++) {
3230 if (i - poffset >= nwpars) {
3245 wpar = wpars[i - poffset];
3250 rpar[i].
flags = flags;
3268 rpar[i].
value = NULL;
3271 if (flags & WEED_PARAMETER_VARIABLE_SIZE && !(flags & WEED_PARAMETER_VALUE_PER_CHANNEL)) {
3274 }
else if (flags & WEED_PARAMETER_VALUE_PER_CHANNEL) {
3280 ctmpl = weed_get_plantptr_value(chann, WEED_LEAF_TEMPLATE, NULL);
3282 if (weed_get_boolean_value(ctmpl, WEED_LEAF_IS_AUDIO, NULL) == WEED_TRUE) {
3290 rpar[i].
list = NULL;
3293 if (flags & WEED_PARAMETER_REINIT_ON_VALUE_CHANGE)
3303 switch (param_type) {
3304 case WEED_PARAM_SWITCH:
3305 if (weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 1) {
3313 else if (weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 0)
3314 vali = weed_get_boolean_value(wtmpl, WEED_LEAF_DEFAULT, NULL);
3315 else vali = weed_get_boolean_value(wtmpl, WEED_LEAF_NEW_DEFAULT, NULL);
3317 vali = weed_get_boolean_value(wpar, WEED_LEAF_VALUE, NULL);
3319 if (weed_plant_has_leaf(wtmpl, WEED_LEAF_GROUP)) rpar[i].
group = weed_get_int_value(wtmpl, WEED_LEAF_GROUP, NULL);
3321 case WEED_PARAM_INTEGER:
3322 if (weed_plant_has_leaf(wtmpl, WEED_LEAF_DEFAULT) && weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 1) {
3330 }
else if (weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 0)
3331 vali = weed_get_int_value(wtmpl, WEED_LEAF_DEFAULT, NULL);
3332 else vali = weed_get_int_value(wtmpl, WEED_LEAF_NEW_DEFAULT, NULL);
3334 vali = weed_get_int_value(wpar, WEED_LEAF_VALUE, NULL);
3336 rpar[i].
min = (double)weed_get_int_value(wtmpl, WEED_LEAF_MIN, NULL);
3337 rpar[i].
max = (double)weed_get_int_value(wtmpl, WEED_LEAF_MAX, NULL);
3340 if (weed_plant_has_leaf(gui, WEED_LEAF_CHOICES)) {
3341 listlen = weed_leaf_num_elements(gui, WEED_LEAF_CHOICES);
3342 list = weed_get_string_array(gui, WEED_LEAF_CHOICES, NULL);
3343 for (j = 0; j < listlen; j++) {
3344 gtk_list = lives_list_append(gtk_list, list[j]);
3347 rpar[i].
list = lives_list_copy(gtk_list);
3348 lives_list_free(gtk_list);
3351 rpar[i].
max = listlen;
3352 }
else if (weed_plant_has_leaf(gui, WEED_LEAF_STEP_SIZE))
3353 rpar[i].
step_size = (double)weed_get_int_value(gui, WEED_LEAF_STEP_SIZE, NULL);
3354 if (rpar[i].step_size == 0.) rpar[i].
step_size = 1.;
3357 case WEED_PARAM_FLOAT:
3358 if (weed_plant_has_leaf(wtmpl, WEED_LEAF_DEFAULT) && weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 1) {
3366 else if (weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 0)
3367 vald = weed_get_double_value(wtmpl, WEED_LEAF_DEFAULT, NULL);
3368 else vald = weed_get_double_value(wtmpl, WEED_LEAF_NEW_DEFAULT, NULL);
3370 vald = weed_get_double_value(wpar, WEED_LEAF_VALUE, NULL);
3372 rpar[i].
min = weed_get_double_value(wtmpl, WEED_LEAF_MIN, NULL);
3373 rpar[i].
max = weed_get_double_value(wtmpl, WEED_LEAF_MAX, NULL);
3378 if (weed_plant_has_leaf(gui, WEED_LEAF_STEP_SIZE))
3379 rpar[i].
step_size = weed_get_double_value(gui, WEED_LEAF_STEP_SIZE, NULL);
3380 if (weed_plant_has_leaf(gui, WEED_LEAF_DECIMALS))
3381 rpar[i].
dp = weed_get_int_value(gui, WEED_LEAF_DECIMALS, NULL);
3383 if (rpar[i].step_size == 0.) {
3384 if (rpar[i].max - rpar[i].min > 10. && !(rpar[i].min >= -10. && rpar[i].max <= 10.))
3386 else if (rpar[i].max - rpar[i].min > 1. && !(rpar[i].min >= -1. && rpar[i].max <= 1.))
3391 case WEED_PARAM_TEXT:
3392 if (weed_plant_has_leaf(wtmpl, WEED_LEAF_DEFAULT) && weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 1) {
3398 else if (weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 0)
3399 string = weed_get_string_value(wtmpl, WEED_LEAF_DEFAULT, NULL);
3400 else string = weed_get_string_value(wtmpl, WEED_LEAF_NEW_DEFAULT, NULL);
3401 rpar[i].
def = string;
3402 string = weed_get_string_value(wpar, WEED_LEAF_VALUE, NULL);
3403 rpar[i].
value = string;
3405 if (gui && weed_plant_has_leaf(gui, WEED_LEAF_MAXCHARS)) {
3406 rpar[i].
max = (double)weed_get_int_value(gui, WEED_LEAF_MAXCHARS, NULL);
3407 if (rpar[i].max < 0.) rpar[i].
max = 0.;
3410 case WEED_PARAM_COLOR:
3411 cspace = weed_get_int_value(wtmpl, WEED_LEAF_COLORSPACE, NULL);
3413 case WEED_COLORSPACE_RGB:
3414 if (weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 3) {
3421 if (weed_leaf_seed_type(wtmpl, WEED_LEAF_DEFAULT) == WEED_SEED_INT) {
3424 }
else if (weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 0)
3425 cols = weed_get_int_array(wtmpl, WEED_LEAF_DEFAULT, NULL);
3426 else cols = weed_get_int_array(wtmpl, WEED_LEAF_NEW_DEFAULT, NULL);
3427 if (weed_leaf_num_elements(wtmpl, WEED_LEAF_MAX) == 1) {
3428 red_max = green_max = blue_max = weed_get_int_value(wtmpl, WEED_LEAF_MAX, NULL);
3430 maxi = weed_get_int_array(wtmpl, WEED_LEAF_MAX, NULL);
3432 green_max = maxi[1];
3435 if (weed_leaf_num_elements(wtmpl, WEED_LEAF_MIN) == 1) {
3436 red_min = green_min = blue_min = weed_get_int_value(wtmpl, WEED_LEAF_MIN, NULL);
3438 mini = weed_get_int_array(wtmpl, WEED_LEAF_MIN, NULL);
3440 green_min = mini[1];
3443 if (cols[0] < red_min) cols[0] = red_min;
3444 if (cols[1] < green_min) cols[1] = green_min;
3445 if (cols[2] < blue_min) cols[2] = blue_min;
3446 if (cols[0] > red_max) cols[0] = red_max;
3447 if (cols[1] > green_max) cols[1] = green_max;
3448 if (cols[2] > blue_max) cols[2] = blue_max;
3449 cols[0] = (double)(cols[0] - red_min) / (double)(red_max - red_min) * 255. + .49999;
3450 cols[1] = (double)(cols[1] - green_min) / (double)(green_max - green_min) * 255. + .49999;
3451 cols[2] = (double)(cols[2] - blue_min) / (double)(blue_max - blue_min) * 255. + .49999;
3456 else if (weed_leaf_num_elements(wtmpl, WEED_LEAF_DEFAULT) > 0)
3457 colsd = weed_get_double_array(wtmpl, WEED_LEAF_DEFAULT, NULL);
3458 else colsd = weed_get_double_array(wtmpl, WEED_LEAF_DEFAULT, NULL);
3459 if (weed_leaf_num_elements(wtmpl, WEED_LEAF_MAX) == 1) {
3460 red_maxd = green_maxd = blue_maxd = weed_get_double_value(wtmpl, WEED_LEAF_MAX, NULL);
3462 maxd = weed_get_double_array(wtmpl, WEED_LEAF_MAX, NULL);
3464 green_maxd = maxd[1];
3465 blue_maxd = maxd[2];
3467 if (weed_leaf_num_elements(wtmpl, WEED_LEAF_MIN) == 1) {
3468 red_mind = green_mind = blue_mind = weed_get_double_value(wtmpl, WEED_LEAF_MIN, NULL);
3470 mind = weed_get_double_array(wtmpl, WEED_LEAF_MIN, NULL);
3472 green_mind = mind[1];
3473 blue_mind = mind[2];
3475 if (colsd[0] < red_mind) colsd[0] = red_mind;
3476 if (colsd[1] < green_mind) colsd[1] = green_mind;
3477 if (colsd[2] < blue_mind) colsd[2] = blue_mind;
3478 if (colsd[0] > red_maxd) colsd[0] = red_maxd;
3479 if (colsd[1] > green_maxd) colsd[1] = green_maxd;
3480 if (colsd[2] > blue_maxd) colsd[2] = blue_maxd;
3482 cols[0] = (colsd[0] - red_mind) / (red_maxd - red_mind) * 255. + .49999;
3483 cols[1] = (colsd[1] - green_mind) / (green_maxd - green_mind) * 255. + .49999;
3484 cols[2] = (colsd[2] - blue_mind) / (blue_maxd - blue_mind) * 255. + .49999;
3491 cols = weed_get_int_array(wpar, WEED_LEAF_VALUE, NULL);
3492 if (cols[0] < red_min) cols[0] = red_min;
3493 if (cols[1] < green_min) cols[1] = green_min;
3494 if (cols[2] < blue_min) cols[2] = blue_min;
3495 if (cols[0] > red_max) cols[0] = red_max;
3496 if (cols[1] > green_max) cols[1] = green_max;
3497 if (cols[2] > blue_max) cols[2] = blue_max;
3498 cols[0] = (double)(cols[0] - red_min) / (double)(red_max - red_min) * 255. + .49999;
3499 cols[1] = (double)(cols[1] - green_min) / (double)(green_max - green_min) * 255. + .49999;
3500 cols[2] = (double)(cols[2] - blue_min) / (double)(blue_max - blue_min) * 255. + .49999;
3502 colsd = weed_get_double_array(wpar, WEED_LEAF_VALUE, NULL);
3503 if (colsd[0] < red_mind) colsd[0] = red_mind;
3504 if (colsd[1] < green_mind) colsd[1] = green_mind;
3505 if (colsd[2] < blue_mind) colsd[2] = blue_mind;
3506 if (colsd[0] > red_maxd) colsd[0] = red_maxd;
3507 if (colsd[1] > green_maxd) colsd[1] = green_maxd;
3508 if (colsd[2] > blue_maxd) colsd[2] = blue_maxd;
3509 cols[0] = (colsd[0] - red_mind) / (red_maxd - red_mind) * 255. + .49999;
3510 cols[1] = (colsd[1] - green_mind) / (green_maxd - green_mind) * 255. + .49999;
3511 cols[2] = (colsd[2] - blue_mind) / (blue_maxd - blue_mind) * 255. + .49999;
3528 string = weed_get_string_value(wtmpl, WEED_LEAF_NAME, NULL);
3529 rpar[i].
name = string;
3530 rpar[i].
label = lives_strdup(
string);
3532 if (weed_plant_has_leaf(wtmpl, WEED_LEAF_DESCRIPTION)) {
3533 string = weed_get_string_value(wtmpl, WEED_LEAF_DESCRIPTION, NULL);
3534 rpar[i].
desc = string;
3535 }
else rpar[i].
desc = NULL;
3542 if (weed_plant_has_leaf(gui, WEED_LEAF_LABEL)) {
3543 string = weed_get_string_value(gui, WEED_LEAF_LABEL, NULL);
3545 rpar[i].
label = string;
3547 if (weed_plant_has_leaf(gui, WEED_LEAF_USE_MNEMONIC)) {
3548 rpar[i].
use_mnemonic = weed_get_boolean_value(gui, WEED_LEAF_USE_MNEMONIC, NULL);
3567 weed_plant_t *filter, *inst;
3572 if (weed_get_int_value(plant, WEED_LEAF_TYPE, NULL) == WEED_PLANT_FILTER_INSTANCE) {
3585 string = weed_get_string_value(filter, WEED_LEAF_NAME, NULL);
3594 rfx->
num_params = weed_leaf_num_elements(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES);
3597 rfx->
source = (
void *)inst;
3619 LiVESList *hints = NULL;
3623 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
3625 int *filters = NULL;
3626 char *string, **rfx_strings, *delim;
3636 for (i = 0; i < nfilters; i++) {
3641 if (!weed_plant_has_leaf(filter, WEED_LEAF_GUI))
continue;
3642 gui = weed_get_plantptr_value(filter, WEED_LEAF_GUI, NULL);
3644 if (!weed_plant_has_leaf(gui, WEED_LEAF_LAYOUT_SCHEME))
continue;
3646 string = weed_get_string_value(gui, WEED_LEAF_LAYOUT_SCHEME, NULL);
3647 if (strcmp(
string,
"RFX")) {
3655 lives_snprintf(rfx->
delim, 2,
"%s", delim);
3659 if (!num_hints)
continue;
3661 for (i = 0; i < num_hints; i++) {
3662 hints = lives_list_append(hints, rfx_strings[i]);
3666 if (filters) hints = lives_list_append(hints, lives_strdup(
"internal|nextfilter"));
3679 if (lives_file_test(fnamex, LIVES_FILE_TEST_EXISTS))
lives_rm(fnamex);
3723 char *rfx_scrapname, *rfx_scriptname;
3726 char *fnamex = NULL;
3727 char *res_string = NULL;
3739 if (!rfx_scrapname) {
3746 rfxfile = lives_build_path(
prefs->
workdir, rfx_scriptname, NULL);
3755 sfile = fopen(rfxfile,
"w");
3758 if (retval == LIVES_RESPONSE_CANCEL) {
3766 char *data =
subst(scrap_text,
"\\n",
"\n");
3774 if (retval == LIVES_RESPONSE_CANCEL) {
3779 }
while (retval == LIVES_RESPONSE_RETRY);
3797 rfx->
name = lives_strdup(rfx_scrapname);
3811 fnamex = lives_build_filename(
prefs->
workdir, rfx_scrapname, NULL);
3826 lives_snprintf(rfx->
delim, 2,
"%s", buff);
3843 res_string = lives_strdup(
"");
3850 LiVESWidget *dialog = fxdialog->
dialog;
3858 }
while (res == LIVES_RESPONSE_RETRY);
3860 if (res == LIVES_RESPONSE_OK) {
3886 res_string = lives_strdup(
"");