void ghb_dict_copy(GhbValue *dst, const GhbValue *src) { GhbDictIter iter; const char *key; GhbValue *val, *dst_val; iter = ghb_dict_iter_init(src); while (ghb_dict_iter_next(src, &iter, &key, &val)) { dst_val = ghb_dict_get(dst, key); if (ghb_value_type(val) == GHB_DICT) { if (dst_val == NULL || ghb_value_type(dst_val) != GHB_DICT) { dst_val = ghb_value_dup(val); ghb_dict_set(dst, key, dst_val); } else if (ghb_value_type(dst_val) == GHB_DICT) { ghb_dict_copy(dst_val, val); } } else { ghb_dict_set(dst, key, ghb_value_dup(val)); } } }
GhbValue* ghb_dict_get_value(const GhbValue *dict, const gchar *key) { GhbValue *value; value = ghb_dict_get(dict, key); if (value == NULL) g_debug("returning null (%s)", key); return value; }
G_MODULE_EXPORT void live_preview_start_cb(GtkWidget *xwidget, signal_user_data_t *ud) { gchar *tmp_dir; gchar *name; gint frame = ud->preview->frame; tmp_dir = ghb_get_tmp_dir(); name = g_strdup_printf("%s/live%02d", tmp_dir, ud->preview->frame); free(tmp_dir); if (ud->preview->current) g_free(ud->preview->current); ud->preview->current = name; if (ud->preview->encoded[frame] && g_file_test(name, G_FILE_TEST_IS_REGULAR)) { #if defined(_ENABLE_GST) if (ud->preview->pause) live_preview_start(ud); else live_preview_pause(ud); #endif } else { GhbValue *js; GhbValue *range, *dest; ud->preview->encode_frame = frame; js = ghb_value_dup(ud->settings); ghb_finalize_job(js); range = ghb_get_job_range_settings(js); dest = ghb_get_job_dest_settings(js); ghb_dict_set_string(dest, "File", name); ghb_dict_set_string(range, "Type", "preview"); ghb_dict_set_int(range, "Start", ud->preview->frame + 1); ghb_dict_set_int(range, "End", ghb_dict_get_int(ud->prefs, "live_duration") * 90000); ghb_dict_set_int(range, "SeekPoints", ghb_dict_get_int(ud->prefs, "preview_count")); GhbValue *job_dict = ghb_dict_get(js, "Job"); ud->preview->live_id = ghb_add_job(ghb_live_handle(), job_dict); ghb_start_live_encode(); ghb_value_free(&js); } }