diff options
author | John Stebbins <[email protected]> | 2016-02-20 18:00:46 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-03-09 13:10:10 -0700 |
commit | a44ccb49f182d4eeb122fbe675b28deb5c36b793 (patch) | |
tree | 6cc064cc24dacc2a80d41fb9543640c9004895af /libhb/vfr.c | |
parent | 96c02dd6f256f4a4e74f8962f56502d28e5e65a3 (diff) |
filters: make job filter settings an hb_dict_t
This simplifies accessing and changing filter parameters
programatically. It also changes the custom filter string format to a
':' separated list of key/value pairs.
Diffstat (limited to 'libhb/vfr.c')
-rw-r--r-- | libhb/vfr.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libhb/vfr.c b/libhb/vfr.c index cc995ff59..d097a7ab1 100644 --- a/libhb/vfr.c +++ b/libhb/vfr.c @@ -48,16 +48,20 @@ static int hb_vfr_work( hb_filter_object_t * filter, static void hb_vfr_close( hb_filter_object_t * filter ); static hb_filter_info_t * hb_vfr_info( hb_filter_object_t * filter ); +static const char hb_vfr_template[] = + "mode=^([012])$:rate=^"HB_RATIONAL_REG"$"; + hb_filter_object_t hb_filter_vfr = { - .id = HB_FILTER_VFR, - .enforce_order = 1, - .name = "Framerate Shaper", - .settings = NULL, - .init = hb_vfr_init, - .work = hb_vfr_work, - .close = hb_vfr_close, - .info = hb_vfr_info, + .id = HB_FILTER_VFR, + .enforce_order = 1, + .name = "Framerate Shaper", + .settings = NULL, + .init = hb_vfr_init, + .work = hb_vfr_work, + .close = hb_vfr_close, + .info = hb_vfr_info, + .settings_template = hb_vfr_template, }; // Create gamma lookup table. @@ -301,11 +305,8 @@ static int hb_vfr_init(hb_filter_object_t *filter, hb_filter_init_t *init) pv->cfr = init->cfr; pv->input_vrate = pv->vrate = init->vrate; - if (filter->settings != NULL) - { - sscanf(filter->settings, "%d:%d:%d", - &pv->cfr, &pv->vrate.num, &pv->vrate.den); - } + hb_dict_extract_int(&pv->cfr, filter->settings, "mode"); + hb_dict_extract_rational(&pv->vrate, filter->settings, "rate"); pv->job = init->job; |