Commit f19e4118 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/vf_subtitles: enable processing of alpha channel

Fixes #6605.
Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent dda1c23c
...@@ -14005,6 +14005,9 @@ correctly scale the fonts if the aspect ratio has been changed. ...@@ -14005,6 +14005,9 @@ correctly scale the fonts if the aspect ratio has been changed.
Set a directory path containing fonts that can be used by the filter. Set a directory path containing fonts that can be used by the filter.
These fonts will be used in addition to whatever the font provider uses. These fonts will be used in addition to whatever the font provider uses.
@item alpha
Process alpha channel, by default alpha channel is untouched.
@item charenc @item charenc
Set subtitles input character encoding. @code{subtitles} filter only. Only Set subtitles input character encoding. @code{subtitles} filter only. Only
useful if not UTF-8. useful if not UTF-8.
......
...@@ -54,6 +54,7 @@ typedef struct AssContext { ...@@ -54,6 +54,7 @@ typedef struct AssContext {
char *charenc; char *charenc;
char *force_style; char *force_style;
int stream_index; int stream_index;
int alpha;
uint8_t rgba_map[4]; uint8_t rgba_map[4];
int pix_step[4]; ///< steps per pixel for each plane of the main output int pix_step[4]; ///< steps per pixel for each plane of the main output
int original_w, original_h; int original_w, original_h;
...@@ -69,6 +70,7 @@ typedef struct AssContext { ...@@ -69,6 +70,7 @@ typedef struct AssContext {
{"f", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \ {"f", "set the filename of file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \
{"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 }, \ {"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 }, \
{"fontsdir", "set the directory containing the fonts to read", OFFSET(fontsdir), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \ {"fontsdir", "set the directory containing the fonts to read", OFFSET(fontsdir), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS }, \
{"alpha", "enable processing of alpha channel", OFFSET(alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, FLAGS }, \
/* libass supports a log level ranging from 0 to 7 */ /* libass supports a log level ranging from 0 to 7 */
static const int ass_libavfilter_log_level_map[] = { static const int ass_libavfilter_log_level_map[] = {
...@@ -140,7 +142,7 @@ static int config_input(AVFilterLink *inlink) ...@@ -140,7 +142,7 @@ static int config_input(AVFilterLink *inlink)
{ {
AssContext *ass = inlink->dst->priv; AssContext *ass = inlink->dst->priv;
ff_draw_init(&ass->draw, inlink->format, 0); ff_draw_init(&ass->draw, inlink->format, ass->alpha ? FF_DRAW_PROCESS_ALPHA : 0);
ass_set_frame_size (ass->renderer, inlink->w, inlink->h); ass_set_frame_size (ass->renderer, inlink->w, inlink->h);
if (ass->original_w && ass->original_h) if (ass->original_w && ass->original_h)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment