diff options
author | John Stebbins <[email protected]> | 2016-05-29 09:43:56 -0600 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-05-29 09:46:12 -0600 |
commit | 1db4f9898de375ee7d83fdf56e2af5de3ef53671 (patch) | |
tree | 09508f3552acd9d169f312529d95e0cc2364315e /gtk/src | |
parent | aae64bbd7be3907633e833d30edde605a5887de1 (diff) |
vpx: add encoder presets
presets are
veryfast - deadline=good:cpu-used=5
faster - deadline=good:cpu-used=4
fast - deadline=good:cpu-used=3
medium - deadline=good:cpu-used=2
slow - deadline=good:cpu-used=1
slower - deadline=good:cpu-used=0
veryslow - deadline=best:cpu-used=0
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/presets.c | 15 | ||||
-rw-r--r-- | gtk/src/videohandler.c | 23 | ||||
-rw-r--r-- | gtk/src/videohandler.h | 1 |
3 files changed, 26 insertions, 13 deletions
diff --git a/gtk/src/presets.c b/gtk/src/presets.c index be2b893dd..c0e238405 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -364,23 +364,12 @@ ghb_preset_to_settings(GhbValue *settings, GhbValue *preset) ghb_dict_remove(settings, "x264Option"); } - int ii, encoder; - const char * const *videoPresets; + int encoder; const char *videoPreset; encoder = ghb_get_video_encoder(settings); - videoPresets = hb_video_encoder_get_presets(encoder); videoPreset = ghb_dict_get_string(settings, "VideoPreset"); - for (ii = 0; videoPreset && videoPresets && videoPresets[ii]; ii++) - { - if (!strcasecmp(videoPreset, videoPresets[ii])) - { - ghb_dict_set_int(settings, "VideoPresetSlider", ii); - break; - } - } - if (videoPreset != NULL) - ghb_dict_set_string(settings, "VideoPreset", videoPreset); + ghb_set_video_preset(settings, encoder, videoPreset); char *videoTune; char *tune = NULL; diff --git a/gtk/src/videohandler.c b/gtk/src/videohandler.c index 10724f333..0ef8ec1bb 100644 --- a/gtk/src/videohandler.c +++ b/gtk/src/videohandler.c @@ -40,6 +40,26 @@ int ghb_get_video_encoder(GhbValue *settings) return hb_video_encoder_get_from_name(encoder); } +void ghb_set_video_preset(GhbValue *settings, int encoder, const char * preset) +{ + const char * const * videoPresets; + int ii; + + videoPresets = hb_video_encoder_get_presets(encoder); + for (ii = 0; preset && videoPresets && videoPresets[ii]; ii++) + { + if (!strcasecmp(preset, videoPresets[ii])) + { + ghb_dict_set_int(settings, "VideoPresetSlider", ii); + break; + } + } + if (preset != NULL) + { + ghb_dict_set_string(settings, "VideoPreset", preset); + } +} + G_MODULE_EXPORT void vcodec_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { @@ -79,6 +99,9 @@ vcodec_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { gtk_range_set_range(GTK_RANGE(presetSlider), 0, count-1); } + ghb_set_video_preset(ud->settings, encoder, "medium"); + GhbValue *gval = ghb_dict_get_value(ud->settings, "VideoPresetSlider"); + ghb_ui_settings_update(ud, ud->settings, "VideoPresetSlider", gval); // Advanced options are only for x264 if (!(encoder & HB_VCODEC_X264_MASK)) diff --git a/gtk/src/videohandler.h b/gtk/src/videohandler.h index 315933924..1ddb9ce80 100644 --- a/gtk/src/videohandler.h +++ b/gtk/src/videohandler.h @@ -30,5 +30,6 @@ int ghb_get_video_encoder(GhbValue *settings); void ghb_video_setting_changed(GtkWidget *widget, signal_user_data_t *ud); +void ghb_set_video_preset(GhbValue *settings, int encoder, const char * preset); #endif // _VIDEOHANDLER_H_ |