+ uint8_t buf[30], *p = buf;
+
+ // 0x00, 0x00, 0x00, 0x00, // uint32_t displayFlags
+ // 0x01, // int8_t horizontal-justification
+ // 0xFF, // int8_t vertical-justification
+ // 0x00, 0x00, 0x00, 0x00, // uint8_t background-color-rgba[4]
+ // BoxRecord {
+ // 0x00, 0x00, // int16_t top
+ // 0x00, 0x00, // int16_t left
+ // 0x00, 0x00, // int16_t bottom
+ // 0x00, 0x00, // int16_t right
+ // };
+ // StyleRecord {
+ // 0x00, 0x00, // uint16_t startChar
+ // 0x00, 0x00, // uint16_t endChar
+ // 0x00, 0x01, // uint16_t font-ID
+ // 0x00, // uint8_t face-style-flags
+ // 0x12, // uint8_t font-size
+ // 0xFF, 0xFF, 0xFF, 0xFF, // uint8_t text-color-rgba[4]
+ // };
+ // FontTableBox {
+ // 0x00, 0x00, 0x00, 0x12, // uint32_t size
+ // 'f', 't', 'a', 'b', // uint8_t name[4]
+ // 0x00, 0x01, // uint16_t entry-count
+ // FontRecord {
+ // 0x00, 0x01, // uint16_t font-ID
+ // 0x05, // uint8_t font-name-length
+ // 'S', 'e', 'r', 'i', 'f',// uint8_t font[font-name-length]
+ // };
+ // };
+
+ // Populate sample description from ASS header
+ ass = (ASS*)s->ass_ctx;
+ // Compute font scaling factor based on (optionally) provided
+ // output video height and ASS script play_res_y
+ if (s->frame_height && ass->script_info.play_res_y)
+ s->font_scale_factor = (double)s->frame_height / ass->script_info.play_res_y;
+ else
+ s->font_scale_factor = 1;
+
+ style = ff_ass_style_get(s->ass_ctx, "Default");
+ if (!style && ass->styles_count) {
+ style = &ass->styles[0];
+ }
+ s->d.style_fontID = DEFAULT_STYLE_FONT_ID;
+ s->d.style_fontsize = DEFAULT_STYLE_FONTSIZE;
+ s->d.style_color = DEFAULT_STYLE_COLOR;
+ s->d.style_flag = DEFAULT_STYLE_FLAG;
+ if (style) {
+ s->d.style_fontsize = FONTSIZE_SCALE(s, style->font_size);
+ s->d.style_color = BGR_TO_RGB(style->primary_color & 0xffffff) << 8 |
+ 255 - ((uint32_t)style->primary_color >> 24);
+ s->d.style_flag = (!!style->bold * STYLE_FLAG_BOLD) |
+ (!!style->italic * STYLE_FLAG_ITALIC) |
+ (!!style->underline * STYLE_FLAG_UNDERLINE);
+ back_color = (BGR_TO_RGB(style->back_color & 0xffffff) << 8) |
+ (255 - ((uint32_t)style->back_color >> 24));
+ }