MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / pad_init

Function pad_init

libhb/pad.c:40–146  ·  view source on GitHub ↗

Pad presets and tunes * * There are currently no presets and tunes for pad * The custom pad string is converted to an avformat filter graph string */

Source from the content-addressed store, hash-verified

38 * The custom pad string is converted to an avformat filter graph string
39 */
40static int pad_init(hb_filter_object_t * filter, hb_filter_init_t * init)
41{
42 hb_filter_private_t * pv = NULL;
43
44 pv = calloc(1, sizeof(struct hb_filter_private_s));
45 filter->private_data = pv;
46 if (pv == NULL)
47 {
48 return 1;
49 }
50 pv->input = *init;
51
52 hb_dict_t * settings = filter->settings;
53
54 int width = -1, height = -1, rgb = 0;
55 int top = -1, bottom = -1, left = -1, right = -1;
56 int x = -1, y = -1;
57 char * color = NULL;
58
59 hb_dict_extract_int(&top, settings, "top");
60 hb_dict_extract_int(&bottom, settings, "bottom");
61 hb_dict_extract_int(&left, settings, "left");
62 hb_dict_extract_int(&right, settings, "right");
63
64 hb_dict_extract_int(&width, settings, "width");
65 hb_dict_extract_int(&height, settings, "height");
66 hb_dict_extract_string(&color, settings, "color");
67 hb_dict_extract_int(&x, settings, "x");
68 hb_dict_extract_int(&y, settings, "y");
69
70 if (x < 0)
71 {
72 x = left;
73 }
74 if (y < 0)
75 {
76 y = top;
77 }
78 if (top >= 0 && bottom >= 0 && height < 0)
79 {
80 height = init->geometry.height + top + bottom;
81 }
82 if (left >= 0 && right >= 0 && width < 0)
83 {
84 width = init->geometry.width + left + right;
85 }
86 if (color != NULL)
87 {
88 char * end;
89 rgb = strtol(color, &end, 0);
90 if (end == color)
91 {
92 // Not a numeric value, lookup by name
93 rgb = hb_rgb_lookup_by_name(color);
94 }
95 free(color);
96 color = hb_strdup_printf("0x%06x", rgb);
97 }

Callers

nothing calls this directly

Calls 8

hb_dict_extract_intFunction · 0.85
hb_dict_extract_stringFunction · 0.85
hb_rgb_lookup_by_nameFunction · 0.85
hb_strdup_printfFunction · 0.85
hb_dict_initFunction · 0.85
hb_dict_setFunction · 0.85
hb_value_intFunction · 0.85
hb_value_stringFunction · 0.85

Tested by

no test coverage detected