FFmpeg
ass_split.h
1 /*
2  * SSA/ASS spliting functions
3  * Copyright (c) 2010 Aurelien Jacobs <aurel@gnuage.org>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVCODEC_ASS_SPLIT_H
23 #define AVCODEC_ASS_SPLIT_H
24 
28 typedef struct {
29  char *script_type;
30  char *collisions;
31  int play_res_x;
32  int play_res_y;
33  float timer;
35 
39 typedef struct {
40  char *name;
41  char *font_name;
42  int font_size;
44  int secondary_color;
46  int back_color;
47  int bold;
48  int italic;
49  int underline;
50  int strikeout;
51  float scalex;
52  float scaley;
53  float spacing;
54  float angle;
55  int border_style;
56  float outline;
57  float shadow;
58  int alignment;
61  int margin_l;
62  int margin_r;
63  int margin_v;
64  int alpha_level;
65  int encoding;
66 } ASSStyle;
67 
71 typedef struct {
72  int readorder;
73  int layer;
74  int start;
75  int end;
76  char *style;
77  char *name;
78  int margin_l;
79  int margin_r;
80  int margin_v;
81  char *effect;
82  char *text;
85 } ASSDialog;
86 
90 typedef struct {
96 } ASS;
97 
101 typedef struct ASSSplitContext ASSSplitContext;
102 
110 ASSSplitContext *ff_ass_split(const char *buf);
111 
125 ASSDialog *ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf,
126  int cache, int *number);
127 
131 void ff_ass_free_dialog(ASSDialog **dialogp);
132 
140 ASSDialog *ff_ass_split_dialog2(ASSSplitContext *ctx, const char *buf);
141 
147 void ff_ass_split_free(ASSSplitContext *ctx);
148 
149 
154 typedef struct {
159  void (*text)(void *priv, const char *text, int len);
160  void (*new_line)(void *priv, int forced);
161  void (*style)(void *priv, char style, int close);
162  void (*color)(void *priv, unsigned int /* color */, unsigned int color_id);
163  void (*alpha)(void *priv, int alpha, int alpha_id);
164  void (*font_name)(void *priv, const char *name);
165  void (*font_size)(void *priv, int size);
166  void (*alignment)(void *priv, int alignment);
167  void (*cancel_overrides)(void *priv, const char *style);
174  void (*move)(void *priv, int x1, int y1, int x2, int y2, int t1, int t2);
175  void (*origin)(void *priv, int x, int y);
182  void (*end)(void *priv);
185 
195 int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv,
196  const char *buf);
197 
205 ASSStyle *ff_ass_style_get(ASSSplitContext *ctx, const char *style);
206 
207 #endif /* AVCODEC_ASS_SPLIT_H */
char * style
name of the ASSStyle to use with this dialog
Definition: ass_split.h:76
float timer
time multiplier to apply to SSA clock (in %)
Definition: ass_split.h:33
fields extracted from the [Events] section
Definition: ass_split.h:71
ASSDialog * dialogs
array of split out dialogs
Definition: ass_split.h:94
structure containing the whole split ASS data
Definition: ass_split.h:90
char * script_type
SSA script format version (eg.
Definition: ass_split.h:29
Definition: vf_paletteuse.c:588
int back_color
color of the subtitle outline or shadow
Definition: ass_split.h:46
char * text
actual text which will be displayed as a subtitle, can include style override control codes (see ff_a...
Definition: ass_split.h:82
int alignment
position of the text (left, center, top...), defined after the layout of the numpad (1-3 sub...
Definition: ass_split.h:58
Definition: ass_split.c:197
int layer
higher numbered layers are drawn over lower numbered
Definition: ass_split.h:73
int bold
whether text is bold (1) or not (0)
Definition: ass_split.h:47
int play_res_x
video width that ASS coords are referring to
Definition: ass_split.h:31
int font_size
font height
Definition: ass_split.h:42
int end
end time of the dialog in centiseconds
Definition: ass_split.h:75
int play_res_y
video height that ASS coords are referring to
Definition: ass_split.h:32
int italic
whether text is italic (1) or not (0)
Definition: ass_split.h:48
Set of callback functions corresponding to each override codes that can be encountered in a "Dialogue...
Definition: ass_split.h:154
int primary_color
color that a subtitle will normally appear in
Definition: ass_split.h:43
int start
start time of the dialog in centiseconds
Definition: ass_split.h:74
char * collisions
how subtitles are moved to prevent collisions
Definition: ass_split.h:30
char * font_name
font face (case sensitive)
Definition: ass_split.h:41
ASSScriptInfo script_info
general information about the SSA script
Definition: ass_split.h:91
fields extracted from the [V4(+) Styles] section
Definition: ass_split.h:39
char * name
name of the tyle (case sensitive)
Definition: ass_split.h:40
int dialogs_count
number of ASSDialog in the dialogs array
Definition: ass_split.h:95
int styles_count
number of ASSStyle in the styles array
Definition: ass_split.h:93
int outline_color
color for outline in ASS, called tertiary in SSA
Definition: ass_split.h:45
fields extracted from the [Script Info] section
Definition: ass_split.h:28
int underline
whether text is underlined (1) or not (0)
Definition: ass_split.h:49
ASSStyle * styles
array of split out styles
Definition: ass_split.h:92