summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2014-09-11 21:10:43 +0200
committerClément Bœsch <u@pkh.me>2014-09-16 21:23:33 +0200
commit4b58349bc8ff2ff5dfbc9eef1e5856fd16e1f517 (patch)
tree525d51dbe9c15439f462993d3d328b9e642d4834
parent8a9c5db29e847b35a70e1866dde2a1d056e2a265 (diff)
avfilter/ass: add shaping option
The documentation is mostly based on ass.h public header.
-rw-r--r--doc/filters.texi20
-rw-r--r--libavfilter/version.h2
-rw-r--r--libavfilter/vf_subtitles.c7
3 files changed, 28 insertions, 1 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index bb486eac36..e9dab4713b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2552,6 +2552,26 @@ Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
and libavformat to work. On the other hand, it is limited to ASS (Advanced
Substation Alpha) subtitles files.
+This filter accepts the following option in addition to the common options from
+the @ref{subtitles} filter:
+
+@table @option
+@item shaping
+Set the shaping engine
+
+Available values are:
+@table @samp
+@item auto
+The default libass shaping engine, which is the best available.
+@item simple
+Fast, font-agnostic shaper that can do only substitutions
+@item complex
+Slower shaper using OpenType for substitutions and positioning
+@end table
+
+The default is @code{auto}.
+@end table
+
@section bbox
Compute the bounding box for the non-black pixels in the input frame
diff --git a/libavfilter/version.h b/libavfilter/version.h
index e855fd31d7..9ce4fcdf9e 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MINOR 1
-#define LIBAVFILTER_VERSION_MICRO 100
+#define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index c9c21a797f..be4c6a534d 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -55,6 +55,7 @@ typedef struct {
uint8_t rgba_map[4];
int pix_step[4]; ///< steps per pixel for each plane of the main output
int original_w, original_h;
+ int shaping;
FFDrawContext draw;
} AssContext;
@@ -141,6 +142,8 @@ static int config_input(AVFilterLink *inlink)
if (ass->original_w && ass->original_h)
ass_set_aspect_ratio(ass->renderer, (double)inlink->w / inlink->h,
(double)ass->original_w / ass->original_h);
+ if (ass->shaping != -1)
+ ass_set_shaper(ass->renderer, ass->shaping);
return 0;
}
@@ -207,6 +210,10 @@ static const AVFilterPad ass_outputs[] = {
static const AVOption ass_options[] = {
COMMON_OPTIONS
+ {"shaping", "set shaping engine", OFFSET(shaping), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, FLAGS, "shaping_mode"},
+ {"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = -1}, INT_MIN, INT_MAX, FLAGS, "shaping_mode"},
+ {"simple", "simple shaping", 0, AV_OPT_TYPE_CONST, {.i64 = ASS_SHAPING_SIMPLE}, INT_MIN, INT_MAX, FLAGS, "shaping_mode"},
+ {"complex", "complex shaping", 0, AV_OPT_TYPE_CONST, {.i64 = ASS_SHAPING_COMPLEX}, INT_MIN, INT_MAX, FLAGS, "shaping_mode"},
{NULL},
};