diff options
-rw-r--r-- | libass/Makefile.am | 2 | ||||
-rw-r--r-- | libass/ass.c | 13 | ||||
-rw-r--r-- | libass/ass.h | 32 | ||||
-rw-r--r-- | libass/libass.sym | 1 |
4 files changed, 46 insertions, 2 deletions
diff --git a/libass/Makefile.am b/libass/Makefile.am index c7c17f6..21d98d4 100644 --- a/libass/Makefile.am +++ b/libass/Makefile.am @@ -5,7 +5,7 @@ AM_CFLAGS = -std=gnu99 -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter \ LIBASS_LT_CURRENT = 9 LIBASS_LT_REVISION = 2 -LIBASS_LT_AGE = 0 +LIBASS_LT_AGE = 1 nasm_verbose = $(nasm_verbose_$(V)) nasm_verbose_ = $(nasm_verbose_$(AM_DEFAULT_VERBOSITY)) diff --git a/libass/ass.c b/libass/ass.c index 50b0df2..c47ea20 100644 --- a/libass/ass.c +++ b/libass/ass.c @@ -58,6 +58,8 @@ struct parser_priv { uint32_t *read_order_bitmap; int read_order_elems; // size in uint32_t units of read_order_bitmap int check_readorder; + + int enable_extensions; }; #define ASS_STYLES_ALLOC 20 @@ -1327,6 +1329,17 @@ ASS_Track *ass_new_track(ASS_Library *library) return track; } +int ass_track_set_feature(ASS_Track *track, ASS_Feature feature, int enable) +{ + switch (feature) { + case ASS_FEATURE_INCOMPATIBLE_EXTENSIONS: + track->parser_priv->enable_extensions = !!enable; + return 0; + default: + return -1; + } +} + /** * \brief Prepare track for rendering */ diff --git a/libass/ass.h b/libass/ass.h index 78951a9..35aeeb7 100644 --- a/libass/ass.h +++ b/libass/ass.h @@ -24,7 +24,7 @@ #include <stdarg.h> #include "ass_types.h" -#define LIBASS_VERSION 0x01400000 +#define LIBASS_VERSION 0x01400001 #ifdef __cplusplus extern "C" { @@ -199,6 +199,19 @@ typedef enum { ASS_FONTPROVIDER_DIRECTWRITE, } ASS_DefaultFontProvider; +typedef enum { + /** + * Enable libass extensions that would display ASS subtitles incorrectly. + * These may be useful for applications, which use libass as renderer for + * subtitles converted from another format, or which use libass for other + * purposes that do not involve actual ASS subtitles authored for + * distribution. + */ + ASS_FEATURE_INCOMPATIBLE_EXTENSIONS, + + // New enum values can be added here in new ABI-compatible library releases. +} ASS_Feature; + /** * \brief Initialize the library. * \return library handle or NULL if failed @@ -513,6 +526,23 @@ ASS_Image *ass_render_frame(ASS_Renderer *priv, ASS_Track *track, ASS_Track *ass_new_track(ASS_Library *); /** + * \brief Enable or disable certain features + * This manages flags that control the behavior of the renderer and how certain + * tags etc. within the track are interpreted. The defaults on a newly created + * ASS_Track are such that rendering is compatible with traditional renderers + * like VSFilter, and/or old versions of libass. Calling ass_process_data() or + * ass_process_codec_private() may change some of these flags according to file + * headers. (ass_process_chunk() will not change any of the flags.) + * Additions to ASS_Feature are backward compatible to old libass releases (ABI + * compatibility). + * \param track track + * \param feature the specific feature to enable or disable + * \param enable 0 for disable, any non-0 value for enable + * \return 0 if feature set, -1 if feature is unknown + */ +int ass_track_set_feature(ASS_Track *track, ASS_Feature feature, int enable); + +/** * \brief Deallocate track and all its child objects (styles and events). * \param track track to deallocate */ diff --git a/libass/libass.sym b/libass/libass.sym index 42ca0cd..affc553 100644 --- a/libass/libass.sym +++ b/libass/libass.sym @@ -43,3 +43,4 @@ ass_set_pixel_aspect ass_set_selective_style_override_enabled ass_set_selective_style_override ass_set_check_readorder +ass_track_set_feature |