diff options
author | jstebbins <jstebbins.hb@gmail.com> | 2011-01-28 23:18:21 +0000 |
---|---|---|
committer | jstebbins <jstebbins.hb@gmail.com> | 2011-01-28 23:18:21 +0000 |
commit | f839f412fb7c05e20201d3b09560e5ba085a4fe1 (patch) | |
tree | 92be215f512b5801337b3363bbb3ed597a72dcbc /gtk/src/presets.c | |
parent | 5eac1c0562ead268ffa4ace6bf86981c7f884faf (diff) |
LinGui: add CFR option for "Same as source" framerate.
Since there seem to be a lot of players that do not properly support VFR,
add a CFR option that can be used with "Same as source". The framerate to
use comes from the title and the cfr flag is set in the job.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3770 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/presets.c')
-rw-r--r-- | gtk/src/presets.c | 111 |
1 files changed, 107 insertions, 4 deletions
diff --git a/gtk/src/presets.c b/gtk/src/presets.c index db3cd6d0c..17e00346b 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -2682,8 +2682,81 @@ import_xlat_preset(GValue *dict) ghb_boolean_value_new(TRUE)); } break; } + import_value_xlat(dict); + GValue *mode = ghb_dict_lookup(dict, "VideoFramerateMode"); + if (mode == NULL) + { + GValue *fr = ghb_dict_lookup(dict, "VideoFramerate"); + if (fr) + { + gchar *str; + gboolean pfr = FALSE; + GValue *pfr_val = ghb_dict_lookup(dict, "VideoFrameratePFR"); + if (pfr_val) + { + pfr = ghb_value_boolean(pfr_val); + } + str = ghb_value_string(fr); + if (strcmp(str, "source") == 0) + { + ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"), + ghb_boolean_value_new(FALSE)); + ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"), + ghb_boolean_value_new(TRUE)); + } + else if (!pfr) + { + ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"), + ghb_boolean_value_new(TRUE)); + ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"), + ghb_boolean_value_new(FALSE)); + } + else + { + ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"), + ghb_boolean_value_new(FALSE)); + ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"), + ghb_boolean_value_new(FALSE)); + } + g_free(str); + } + } + else + { + gchar *str; + str = ghb_value_string(mode); + if (strcmp(str, "cfr") == 0) + { + ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"), + ghb_boolean_value_new(TRUE)); + ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"), + ghb_boolean_value_new(FALSE)); + ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"), + ghb_boolean_value_new(FALSE)); + } + else if (strcmp(str, "pfr") == 0) + { + ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"), + ghb_boolean_value_new(FALSE)); + ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"), + ghb_boolean_value_new(TRUE)); + ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"), + ghb_boolean_value_new(FALSE)); + } + else + { + ghb_dict_insert(dict, g_strdup("VideoFramerateCFR"), + ghb_boolean_value_new(FALSE)); + ghb_dict_insert(dict, g_strdup("VideoFrameratePFR"), + ghb_boolean_value_new(FALSE)); + ghb_dict_insert(dict, g_strdup("VideoFramerateVFR"), + ghb_boolean_value_new(TRUE)); + } + g_free(str); + } + gdouble vquality; const GValue *gval; @@ -2787,6 +2860,22 @@ export_xlat_preset(GValue *dict) ghb_int_value_new(2)); } + if (ghb_value_boolean(preset_dict_get_value(dict, "VideoFramerateCFR"))) + { + ghb_dict_insert(dict, g_strdup("VideoFramerateMode"), + ghb_string_value_new("cfr")); + } + else if (ghb_value_boolean(preset_dict_get_value(dict, "VideoFrameratePFR"))) + { + ghb_dict_insert(dict, g_strdup("VideoFramerateMode"), + ghb_string_value_new("pfr")); + } + else + { + ghb_dict_insert(dict, g_strdup("VideoFramerateMode"), + ghb_string_value_new("vfr")); + } + GValue *alist, *adict; gint count, ii; @@ -2806,11 +2895,25 @@ export_xlat_preset(GValue *dict) } } + GValue *internal; + GHashTableIter iter; + gchar *key; + GValue *value; + internal = plist_get_dict(internalPlist, "XlatPresets"); + ghb_dict_iter_init(&iter, internal); + // middle (void*) cast prevents gcc warning "defreferencing type-punned + // pointer will break strict-aliasing rules" + while (g_hash_table_iter_next( + &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&value)) + { + ghb_dict_remove(dict, key); + } + + // remove obsolete keys ghb_dict_remove(dict, "UsesMaxPictureSettings"); - ghb_dict_remove(dict, "autoscale"); - ghb_dict_remove(dict, "vquality_type_target"); - ghb_dict_remove(dict, "vquality_type_bitrate"); - ghb_dict_remove(dict, "vquality_type_constant"); + ghb_dict_remove(dict, "VFR"); + ghb_dict_remove(dict, "VideoFrameratePFR"); + export_value_xlat(dict); } |