summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-03-25 21:11:40 +0100
committerOleg Oshmyan <chortos@inbox.lv>2020-03-29 23:49:38 +0300
commit5d85de31689e970fd9fc135aa935d832a9156930 (patch)
tree397fb0d29af007448a82b6c6c34c29a8fff3aeac /libass
parent3e088dc4e59714a7d150043e58de627d015b8051 (diff)
downloadlibass-5d85de31689e970fd9fc135aa935d832a9156930.tar.bz2
libass-5d85de31689e970fd9fc135aa935d832a9156930.tar.xz
api: add ass_track_set_feature()
Since C does not allow empty enums, there is an "example", which doesn't do anything. I think we might be able to make this change the default bidi direction or so. As if this commit, the flag set by it is also not available outside of ass.c, which should be solved by moving parser_priv to an internal header.
Diffstat (limited to 'libass')
-rw-r--r--libass/Makefile.am2
-rw-r--r--libass/ass.c13
-rw-r--r--libass/ass.h32
-rw-r--r--libass/libass.sym1
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