33 #if CONFIG_SUBTITLES_FILTER
60 #define OFFSET(x) offsetof(AssContext, x)
61 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
63 #define COMMON_OPTIONS \
64 {"filename", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \
65 {"f", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \
66 {"original_size", "set the size of the original video (used to scale fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \
97 ass->
library = ass_library_init();
110 ass_set_fonts(ass->
renderer, NULL, NULL, 1, NULL, 1);
119 ass_free_track(ass->
track);
123 ass_library_done(ass->
library);
138 ass_set_frame_size (ass->
renderer, inlink->
w, inlink->
h);
140 ass_set_aspect_ratio(ass->
renderer, (
double)inlink->
w / inlink->
h,
147 #define AR(c) ( (c)>>24)
148 #define AG(c) (((c)>>16)&0xFF)
149 #define AB(c) (((c)>>8) &0xFF)
150 #define AA(c) ((0xFF-c) &0xFF)
153 const ASS_Image *image)
155 for (; image; image = image->next) {
156 uint8_t rgba_color[] = {
AR(image->color),
AG(image->color),
AB(image->color),
AA(image->color)};
162 image->bitmap, image->stride, image->w, image->h,
163 3, 0, image->dst_x, image->dst_y);
172 int detect_change = 0;
174 ASS_Image *image = ass_render_frame(ass->
renderer, ass->
track,
175 time_ms, &detect_change);
204 #if CONFIG_ASS_FILTER
206 static const AVOption ass_options[] = {
224 "Could not create a libass track when reading file '%s'\n",
233 .description =
NULL_IF_CONFIG_SMALL(
"Render ASS subtitles onto input video using the libass library."),
240 .priv_class = &ass_class,
244 #if CONFIG_SUBTITLES_FILTER
246 static const AVOption subtitles_options[] = {
307 "Only text based subtitles are currently supported\n");
318 ass_process_codec_private(ass->
track,
333 }
else if (got_subtitle) {
338 ass_process_data(ass->
track, ass_line, strlen(ass_line));
357 .description =
NULL_IF_CONFIG_SMALL(
"Render text subtitles onto input video using the libass library."),
359 .
init = init_subtitles,
364 .priv_class = &subtitles_class,