summaryrefslogtreecommitdiffstats
path: root/libass/ass_priv.h
Commit message (Collapse)AuthorAgeFilesLines
* Introduce LayoutRes{X,Y} script headersDr.Smile2022-11-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rendering ASS depends on the video’s storage resolution for several tags. Thus transferring a subtitle file to a different version of a video, with e.g. higher resolution or anamorphic squeezing undone, requires adjusting all those tags. Affected are \be, \blur, \frx, \fry and if ScaledBorderAndShadow is not set to "yes", also all tags related to border and shadow. This locks all but simple subtitle files to a specific video storage resolution. If one wants to release several different resolution simultaneously, the same source is reencoded to undo anamorphic squeezing, or a new higher resolution source appears, it is required to manually adjust affected tags and each video version needs a different subtitle file. This is a pain point, and resulted in some releases just relying on user overrides of players, or incompatibly patched renderers to avoid the required manual adjustments. By adding new headers, which will replace the original video storage resolution in all calculations, authors will be able to create files which can be reused across different resolutions as long as the display aspect ratio stays the same. Hopefully this will also halt the spread of incomapatible patches and overrides, which just result in broken files and further ASS fragmentation. For simplicity and to avoid surprises, LayoutRes* headers only take effect if both are present and set to values larger than zero. If LayoutRes{X,Y} is set to corresponds to the actual storage resolution of the video the subs are authored and initially released with, at least the initial/main version will also be effectively compatible to older renderers, which do not understand the new headers yet. This will grant users some time to upgrade and minimise friction from this retroactive format addition. The header concept is also approved by some VSFilters and patches for Cyberbeing/xy-VSFilter’s xy-VSFilter and XySubFilter are pending with only implementation details being still up for discussion. Integration into active Aegisub forks and possibly other common editors will be pursued at a later date. libass-specific: Since API-users can initialise PAR, we must recalcute even existing values when LayoutRes{X,Y} is set to ensure the sub-author-provided values take precedence.
* Parse ScriptType headerOneric2022-10-141-1/+2
| | | | | | | | | | | | | | | | | | | VSFilter uses it for Dialogue lines and Style lines not preceeded by a styles section header. libass requires section headers to parse styles, but this still helps for files without a Styles section (placed before the Events section) and also makes our legacy-FFmpeg detection more accurate. In fact, VSFilter takes _only_ the ScriptType header into account for Dialogue lines and keeps a separate version for styles which is also affected by style section headers. This dual versioning is not implemented by this commit and the lack of any issue reports about it suggests such files may not exist in practice. If however it turned out they do, an additional version variable can be added to parser_priv and we need to decide which one to present to API users.
* Refactor track features to bitflagsOneric2021-12-141-3/+1
| | | | | | This is purely an internal refactor. With the existing and currently planned boolean features, a bit flag will scale better.
* parser_priv: Change type of fontdata_{size,used} to size_tOneric2020-10-271-2/+2
| | | | | | | | | | | | size_t is a more sensible type for as it is unsigned and accurately represents the theoretical limits of object size. int may be larger or smaller than size_t, which both would lead to problems and potential UB with signed overflow. There was no usage of negative values as error flags or similar and those two fields are not part of the public API, so this change should be safe. To stay consistent, also adjust types of related variables in functions.
* Disable bidi bracket matching unless enabled via ASS_FeatureOleg Oshmyan2020-07-141-2/+7
| | | | | | | | | | | | | | | | | | | | | Bracket matching is incompatible with VSFilter (even on modern Windows), so disable it by default. But as it's generally a good thing (and 100% more compliant with current Unicode), keep it available as an ASS_Feature. It can be toggled individually or enabled as part of the catch-all ASS_FEATURE_INCOMPATIBLE_EXTENSIONS feature. If libass is compiled against FriBidi older than 1.0, bracket matching is impossible. Signal this at runtime by failing to recognize the ASS_FEATURE_BIDI_BRACKETS feature. This way, clients who want to use bracket matching can set the feature without any compile-time checks for FriBidi and can be freely linked against libass that is itself compiled against any version of FriBidi; and yet they can detect at runtime whether the feature is actually enabled. Fixes https://github.com/libass/libass/issues/374.
* Extract struct parser_priv into separate header fileOleg Oshmyan2020-07-141-0/+64