Commit d9f272fe authored by Clément Bœsch's avatar Clément Bœsch

avcodec/ass_split: extend recognized fields in ASS splitter

This simplifies the logic for the fix in the next commit.
parent 40b9f286
...@@ -44,7 +44,7 @@ typedef struct { ...@@ -44,7 +44,7 @@ typedef struct {
int size; int size;
int offset; int offset;
int offset_count; int offset_count;
ASSFields fields[10]; ASSFields fields[24];
} ASSSection; } ASSSection;
static const ASSSection ass_sections[] = { static const ASSSection ass_sections[] = {
...@@ -68,11 +68,25 @@ static const ASSSection ass_sections[] = { ...@@ -68,11 +68,25 @@ static const ASSSection ass_sections[] = {
{"Fontname", ASS_STR, offsetof(ASSStyle, font_name) }, {"Fontname", ASS_STR, offsetof(ASSStyle, font_name) },
{"Fontsize", ASS_INT, offsetof(ASSStyle, font_size) }, {"Fontsize", ASS_INT, offsetof(ASSStyle, font_size) },
{"PrimaryColour",ASS_COLOR,offsetof(ASSStyle, primary_color)}, {"PrimaryColour",ASS_COLOR,offsetof(ASSStyle, primary_color)},
{"SecondaryColour",ASS_COLOR,offsetof(ASSStyle, secondary_color)},
{"OutlineColour",ASS_COLOR,offsetof(ASSStyle, outline_color)},
{"BackColour", ASS_COLOR,offsetof(ASSStyle, back_color) }, {"BackColour", ASS_COLOR,offsetof(ASSStyle, back_color) },
{"Bold", ASS_INT, offsetof(ASSStyle, bold) }, {"Bold", ASS_INT, offsetof(ASSStyle, bold) },
{"Italic", ASS_INT, offsetof(ASSStyle, italic) }, {"Italic", ASS_INT, offsetof(ASSStyle, italic) },
{"Underline", ASS_INT, offsetof(ASSStyle, underline) }, {"Underline", ASS_INT, offsetof(ASSStyle, underline) },
{"StrikeOut", ASS_INT, offsetof(ASSStyle, strikeout) },
{"ScaleX", ASS_FLT, offsetof(ASSStyle, scalex) },
{"ScaleY", ASS_FLT, offsetof(ASSStyle, scaley) },
{"Spacing", ASS_FLT, offsetof(ASSStyle, spacing) },
{"Angle", ASS_FLT, offsetof(ASSStyle, angle) },
{"BorderStyle", ASS_INT, offsetof(ASSStyle, border_style) },
{"Outline", ASS_FLT, offsetof(ASSStyle, outline) },
{"Shadow", ASS_FLT, offsetof(ASSStyle, shadow) },
{"Alignment", ASS_INT, offsetof(ASSStyle, alignment) }, {"Alignment", ASS_INT, offsetof(ASSStyle, alignment) },
{"MarginL", ASS_INT, offsetof(ASSStyle, margin_l) },
{"MarginR", ASS_INT, offsetof(ASSStyle, margin_r) },
{"MarginV", ASS_INT, offsetof(ASSStyle, margin_v) },
{"Encoding", ASS_INT, offsetof(ASSStyle, encoding) },
{0}, {0},
} }
}, },
...@@ -86,10 +100,20 @@ static const ASSSection ass_sections[] = { ...@@ -86,10 +100,20 @@ static const ASSSection ass_sections[] = {
{"Fontname", ASS_STR, offsetof(ASSStyle, font_name) }, {"Fontname", ASS_STR, offsetof(ASSStyle, font_name) },
{"Fontsize", ASS_INT, offsetof(ASSStyle, font_size) }, {"Fontsize", ASS_INT, offsetof(ASSStyle, font_size) },
{"PrimaryColour",ASS_COLOR,offsetof(ASSStyle, primary_color)}, {"PrimaryColour",ASS_COLOR,offsetof(ASSStyle, primary_color)},
{"SecondaryColour", ASS_COLOR, offsetof(ASSStyle, secondary_color) },
{"TertiaryColour", ASS_COLOR, offsetof(ASSStyle, outline_color) },
{"BackColour", ASS_COLOR,offsetof(ASSStyle, back_color) }, {"BackColour", ASS_COLOR,offsetof(ASSStyle, back_color) },
{"Bold", ASS_INT, offsetof(ASSStyle, bold) }, {"Bold", ASS_INT, offsetof(ASSStyle, bold) },
{"Italic", ASS_INT, offsetof(ASSStyle, italic) }, {"Italic", ASS_INT, offsetof(ASSStyle, italic) },
{"BorderStyle", ASS_INT, offsetof(ASSStyle, border_style) },
{"Outline", ASS_FLT, offsetof(ASSStyle, outline) },
{"Shadow", ASS_FLT, offsetof(ASSStyle, shadow) },
{"Alignment", ASS_ALGN, offsetof(ASSStyle, alignment) }, {"Alignment", ASS_ALGN, offsetof(ASSStyle, alignment) },
{"MarginL", ASS_INT, offsetof(ASSStyle, margin_l) },
{"MarginR", ASS_INT, offsetof(ASSStyle, margin_r) },
{"MarginV", ASS_INT, offsetof(ASSStyle, margin_v) },
{"AlphaLevel", ASS_INT, offsetof(ASSStyle, alpha_level) },
{"Encoding", ASS_INT, offsetof(ASSStyle, encoding) },
{0}, {0},
} }
}, },
...@@ -103,6 +127,11 @@ static const ASSSection ass_sections[] = { ...@@ -103,6 +127,11 @@ static const ASSSection ass_sections[] = {
{"Start", ASS_TIMESTAMP, offsetof(ASSDialog, start) }, {"Start", ASS_TIMESTAMP, offsetof(ASSDialog, start) },
{"End", ASS_TIMESTAMP, offsetof(ASSDialog, end) }, {"End", ASS_TIMESTAMP, offsetof(ASSDialog, end) },
{"Style", ASS_STR, offsetof(ASSDialog, style) }, {"Style", ASS_STR, offsetof(ASSDialog, style) },
{"Name", ASS_STR, offsetof(ASSDialog, name) },
{"MarginL", ASS_INT, offsetof(ASSDialog, margin_l) },
{"MarginR", ASS_INT, offsetof(ASSDialog, margin_r) },
{"MarginV", ASS_INT, offsetof(ASSDialog, margin_v) },
{"Effect", ASS_STR, offsetof(ASSDialog, effect) },
{"Text", ASS_STR, offsetof(ASSDialog, text) }, {"Text", ASS_STR, offsetof(ASSDialog, text) },
{0}, {0},
} }
......
...@@ -41,13 +41,28 @@ typedef struct { ...@@ -41,13 +41,28 @@ typedef struct {
char *font_name; /**< font face (case sensitive) */ char *font_name; /**< font face (case sensitive) */
int font_size; /**< font height */ int font_size; /**< font height */
int primary_color; /**< color that a subtitle will normally appear in */ int primary_color; /**< color that a subtitle will normally appear in */
int secondary_color;
int outline_color; /**< color for outline in ASS, called tertiary in SSA */
int back_color; /**< color of the subtitle outline or shadow */ int back_color; /**< color of the subtitle outline or shadow */
int bold; /**< whether text is bold (1) or not (0) */ int bold; /**< whether text is bold (1) or not (0) */
int italic; /**< whether text is italic (1) or not (0) */ int italic; /**< whether text is italic (1) or not (0) */
int underline; /**< whether text is underlined (1) or not (0) */ int underline; /**< whether text is underlined (1) or not (0) */
int strikeout;
float scalex;
float scaley;
float spacing;
float angle;
int border_style;
float outline;
float shadow;
int alignment; /**< position of the text (left, center, top...), int alignment; /**< position of the text (left, center, top...),
defined after the layout of the numpad defined after the layout of the numpad
(1-3 sub, 4-6 mid, 7-9 top) */ (1-3 sub, 4-6 mid, 7-9 top) */
int margin_l;
int margin_r;
int margin_v;
int alpha_level;
int encoding;
} ASSStyle; } ASSStyle;
/** /**
...@@ -58,6 +73,11 @@ typedef struct { ...@@ -58,6 +73,11 @@ typedef struct {
int start; /**< start time of the dialog in centiseconds */ int start; /**< start time of the dialog in centiseconds */
int end; /**< end time of the dialog in centiseconds */ int end; /**< end time of the dialog in centiseconds */
char *style; /**< name of the ASSStyle to use with this dialog */ char *style; /**< name of the ASSStyle to use with this dialog */
char *name;
int margin_l;
int margin_r;
int margin_v;
char *effect;
char *text; /**< actual text which will be displayed as a subtitle, char *text; /**< actual text which will be displayed as a subtitle,
can include style override control codes (see can include style override control codes (see
ff_ass_split_override_codes()) */ ff_ass_split_override_codes()) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment