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

Function Init

libhb/enctx3gsub.c:22–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20};
21
22static int Init(hb_work_object_t *w, hb_job_t *job)
23{
24 hb_work_private_t *pv = calloc(1, sizeof(hb_work_private_t));
25
26 if (pv == NULL)
27 {
28 hb_error("enctx3gsubInit: calloc private data failed");
29 return 1;
30 }
31
32 w->private_data = pv;
33
34 pv->job = job;
35 pv->subtitle = w->subtitle;
36 pv->tx3g = hb_tx3g_style_init(job->height,
37 pv->subtitle->extradata->bytes,
38 pv->subtitle->extradata->size);
39
40 if (pv->tx3g == NULL)
41 {
42 hb_error("enctx3gsubInit: hb_tx3g_style_init failed");
43 goto fail;
44 }
45
46 // Build codec extradata for tx3g
47 uint8_t properties[] = {
48 0x00, 0x00, 0x00, 0x00, // Display Flags
49 0x01, // Horiz. Justification
50 0xff, // Vert. Justification
51 0x00, 0x00, 0x00, 0xff, // Bg color
52 0x00, 0x00, 0x00, 0x00, // Default text box
53 0x00, 0x00, 0x00, 0x00,
54 0x00, 0x00, 0x00, 0x00, // Reserved
55 0x00, 0x01, // Font ID
56 0x00, // Font face
57 0x18, // Font size
58 0xff, 0xff, 0xff, 0xff, // Fg color
59 // Font table:
60 0x00, 0x00, 0x00, 0x12, // Font table size
61 'f','t','a','b', // Tag
62 0x00, 0x01, // Count
63 0x00, 0x01, // Font ID
64 0x05, // Font name length
65 'A','r','i','a','l' // Font name
66 };
67
68 int width, height, font_size;
69 width = job->width * job->par.num / job->par.den;
70 font_size = 0.05 * job->height;
71 if (font_size < 12)
72 {
73 font_size = 12;
74 }
75 else if (font_size > 255)
76 {
77 font_size = 255;
78 }
79 properties[25] = font_size;

Callers

nothing calls this directly

Calls 3

hb_errorFunction · 0.85
hb_tx3g_style_initFunction · 0.85
hb_set_extradataFunction · 0.85

Tested by

no test coverage detected