-
Notifications
You must be signed in to change notification settings - Fork 240
Negative/huge Alignment values in ASS Style lines #262
Description
I stumbled upon this while doing #261, but this is probably best discussed separately.
-
When an ASS (but not SSA) script contains a
Styleline with theAlignmentfield set to a reasonable negative value, VSFilter ignores all alignment override tags in lines with this style. If we want to emulate this, we need either a new bit in alignment values or a separate new flag in theASS_Stylestruct. Both options seem to break the ABI, although I don’t know what promises if ever we’ve given about the alignment values or what assumptions libass users make about them. Even if we tried to add a hidden field toASS_Stylelike we did withASS_ImageinASS_ImagePriv, we would still need to bumpsizeof(ASS_Style)because we have an array of them in the publicASS_Track. -
When an ASS (but not SSA) script contains a
Styleline with theAlignmentfield set to (the value of)INT32_MIN, VSFilter tries to takeabsof this value, which of course returns the same value, and then does several inconsistent things when aligning the event. I have described this in detail in the relevant commit in Integer overflow fixes #261. Do we want to emulate this?If so, then we probably also want to store alignment in
int32_twith the appropriate wraparound for values larger in magnitude than 2³¹, to ensure we handle those values the same as VSFilter as well. This (and another parsing quirk whereby all integers other than in override tags should accept the&Hand0xprefixes like colours do) applies to other fields in style/dialogue lines too, so it would perhaps make sense to do it for all of them simultaneously. The question ofINT32_MINAlignmentstill stands though.