summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2015-04-18 18:34:40 +0000
committerjstebbins <[email protected]>2015-04-18 18:34:40 +0000
commit906ec1611817b6a0eb26f694f34aaacd13aabdbc (patch)
treefc0a6a469b8d88cb4ffbf733d030be31f005af2e /gtk
parent3fcfbceaa26b116283e3ea1a76c45a66b04842ef (diff)
LinGui: Check for NULL filter settings string
And add more warnings where appropriate git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7102 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/hb-backend.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 68c43a816..a44886fd7 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -4512,14 +4512,17 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
{
const char *filter_str;
filter_str = ghb_dict_get_string(js, "PictureDenoiseCustom");
- filter_dict = json_pack_ex(&error, 0, "{s:o, s:o}",
- "ID", hb_value_int(filter_id),
- "Settings", hb_value_string(filter_str));
+ filter_dict = json_pack_ex(&error, 0, "{s:o}",
+ "ID", hb_value_int(filter_id));
if (filter_dict == NULL)
{
g_warning("json pack denoise filter failure: %s", error.text);
return;
}
+ if (filter_str != NULL)
+ {
+ hb_dict_set(filter_dict, "Settings", hb_value_string(filter_str));
+ }
hb_value_array_append(filter_list, filter_dict);
}
else
@@ -4528,14 +4531,23 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
preset = ghb_dict_get_string(js, "PictureDenoisePreset");
tune = ghb_dict_get_string(js, "PictureDenoiseTune");
filter_str = hb_generate_filter_settings(filter_id, preset, tune);
- filter_dict = json_pack_ex(&error, 0, "{s:o, s:o}",
- "ID", hb_value_int(filter_id),
- "Settings", hb_value_string(filter_str));
+ if (filter_str == NULL)
+ {
+ g_warning("Invalid %s preset %s and/or tune %s",
+ filter_id == HB_FILTER_HQDN3D ? "HQDN3D" : "NLMeans",
+ preset, tune);
+ }
+ filter_dict = json_pack_ex(&error, 0, "{s:o}",
+ "ID", hb_value_int(filter_id));
if (filter_dict == NULL)
{
g_warning("json pack denoise filter failure: %s", error.text);
return;
}
+ if (filter_str != NULL)
+ {
+ hb_dict_set(filter_dict, "Settings", hb_value_string(filter_str));
+ }
hb_value_array_append(filter_list, filter_dict);
g_free(filter_str);
}
@@ -4546,14 +4558,17 @@ add_job(hb_handle_t *h, GhbValue *js, gint unique_id)
if( deblock >= 5 )
{
filter_str = g_strdup_printf("%d", deblock);
- filter_dict = json_pack_ex(&error, 0, "{s:o, s:o}",
- "ID", hb_value_int(HB_FILTER_DEBLOCK),
- "Settings", hb_value_string(filter_str));
+ filter_dict = json_pack_ex(&error, 0, "{s:o}",
+ "ID", hb_value_int(HB_FILTER_DEBLOCK));
if (filter_dict == NULL)
{
g_warning("json pack deblock filter failure: %s", error.text);
return;
}
+ if (filter_str != NULL)
+ {
+ hb_dict_set(filter_dict, "Settings", hb_value_string(filter_str));
+ }
hb_value_array_append(filter_list, filter_dict);
g_free(filter_str);
}