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/detelecine.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/detelecine.c')
-rw-r--r-- | libhb/detelecine.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/libhb/detelecine.c b/libhb/detelecine.c index d25c64803..dd5d26d42 100644 --- a/libhb/detelecine.c +++ b/libhb/detelecine.c @@ -103,15 +103,22 @@ static int hb_detelecine_work( hb_filter_object_t * filter, static void hb_detelecine_close( hb_filter_object_t * filter ); +static const char detelecine_template[] = + "skip-left=^"HB_INT_REG"$:skip-right=^"HB_INT_REG"$:" + "skip-top=^"HB_INT_REG"$:skip-bottom=^"HB_INT_REG"$:" + "strict-breaks=^"HB_BOOL_REG"$:plane=^([012])$:parity=^([01])$:" + "disable=^"HB_BOOL_REG"$"; + hb_filter_object_t hb_filter_detelecine = { - .id = HB_FILTER_DETELECINE, - .enforce_order = 1, - .name = "Detelecine (pullup)", - .settings = NULL, - .init = hb_detelecine_init, - .work = hb_detelecine_work, - .close = hb_detelecine_close, + .id = HB_FILTER_DETELECINE, + .enforce_order = 1, + .name = "Detelecine (pullup)", + .settings = NULL, + .init = hb_detelecine_init, + .work = hb_detelecine_work, + .close = hb_detelecine_close, + .settings_template = detelecine_template, }; /* @@ -826,17 +833,14 @@ static int hb_detelecine_init( hb_filter_object_t * filter, ctx->metric_plane = 0; ctx->parity = -1; - if( filter->settings ) - { - sscanf( filter->settings, "%d:%d:%d:%d:%d:%d:%d", - &ctx->junk_left, - &ctx->junk_right, - &ctx->junk_top, - &ctx->junk_bottom, - &ctx->strict_breaks, - &ctx->metric_plane, - &ctx->parity ); - } + // "Skip" array [top, bottom, left, right] + hb_dict_extract_int(&ctx->junk_top, filter->settings, "skip-top"); + hb_dict_extract_int(&ctx->junk_bottom, filter->settings, "skip-bottom"); + hb_dict_extract_int(&ctx->junk_left, filter->settings, "skip-left"); + hb_dict_extract_int(&ctx->junk_right, filter->settings, "skip-right"); + hb_dict_extract_int(&ctx->strict_breaks, filter->settings, "strict-breaks"); + hb_dict_extract_int(&ctx->metric_plane, filter->settings, "plane"); + hb_dict_extract_int(&ctx->parity, filter->settings, "parity"); ctx->format = PULLUP_FMT_Y; ctx->nplanes = 4; |