yading@10
|
1 /*
|
yading@10
|
2 * SSA/ASS common functions
|
yading@10
|
3 * Copyright (c) 2010 Aurelien Jacobs <aurel@gnuage.org>
|
yading@10
|
4 *
|
yading@10
|
5 * This file is part of FFmpeg.
|
yading@10
|
6 *
|
yading@10
|
7 * FFmpeg is free software; you can redistribute it and/or
|
yading@10
|
8 * modify it under the terms of the GNU Lesser General Public
|
yading@10
|
9 * License as published by the Free Software Foundation; either
|
yading@10
|
10 * version 2.1 of the License, or (at your option) any later version.
|
yading@10
|
11 *
|
yading@10
|
12 * FFmpeg is distributed in the hope that it will be useful,
|
yading@10
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@10
|
15 * Lesser General Public License for more details.
|
yading@10
|
16 *
|
yading@10
|
17 * You should have received a copy of the GNU Lesser General Public
|
yading@10
|
18 * License along with FFmpeg; if not, write to the Free Software
|
yading@10
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@10
|
20 */
|
yading@10
|
21
|
yading@10
|
22 #ifndef AVCODEC_ASS_H
|
yading@10
|
23 #define AVCODEC_ASS_H
|
yading@10
|
24
|
yading@10
|
25 #include "avcodec.h"
|
yading@10
|
26
|
yading@10
|
27 /**
|
yading@10
|
28 * @name Default values for ASS style
|
yading@10
|
29 * @{
|
yading@10
|
30 */
|
yading@10
|
31 #define ASS_DEFAULT_FONT "Arial"
|
yading@10
|
32 #define ASS_DEFAULT_FONT_SIZE 16
|
yading@10
|
33 #define ASS_DEFAULT_COLOR 0xffffff
|
yading@10
|
34 #define ASS_DEFAULT_BACK_COLOR 0
|
yading@10
|
35 #define ASS_DEFAULT_BOLD 0
|
yading@10
|
36 #define ASS_DEFAULT_ITALIC 0
|
yading@10
|
37 #define ASS_DEFAULT_UNDERLINE 0
|
yading@10
|
38 #define ASS_DEFAULT_ALIGNMENT 2
|
yading@10
|
39 /** @} */
|
yading@10
|
40
|
yading@10
|
41 /**
|
yading@10
|
42 * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
|
yading@10
|
43 *
|
yading@10
|
44 * @param avctx pointer to the AVCodecContext
|
yading@10
|
45 * @param font name of the default font face to use
|
yading@10
|
46 * @param font_size default font size to use
|
yading@10
|
47 * @param color default text color to use (ABGR)
|
yading@10
|
48 * @param back_color default background color to use (ABGR)
|
yading@10
|
49 * @param bold 1 for bold text, 0 for normal text
|
yading@10
|
50 * @param italic 1 for italic text, 0 for normal text
|
yading@10
|
51 * @param underline 1 for underline text, 0 for normal text
|
yading@10
|
52 * @param alignment position of the text (left, center, top...), defined after
|
yading@10
|
53 * the layout of the numpad (1-3 sub, 4-6 mid, 7-9 top)
|
yading@10
|
54 * @return >= 0 on success otherwise an error code <0
|
yading@10
|
55 */
|
yading@10
|
56 int ff_ass_subtitle_header(AVCodecContext *avctx,
|
yading@10
|
57 const char *font, int font_size,
|
yading@10
|
58 int color, int back_color,
|
yading@10
|
59 int bold, int italic, int underline,
|
yading@10
|
60 int alignment);
|
yading@10
|
61
|
yading@10
|
62 /**
|
yading@10
|
63 * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS
|
yading@10
|
64 * with default style.
|
yading@10
|
65 *
|
yading@10
|
66 * @param avctx pointer to the AVCodecContext
|
yading@10
|
67 * @return >= 0 on success otherwise an error code <0
|
yading@10
|
68 */
|
yading@10
|
69 int ff_ass_subtitle_header_default(AVCodecContext *avctx);
|
yading@10
|
70
|
yading@10
|
71 /**
|
yading@10
|
72 * Add an ASS dialog line to an AVSubtitle as a new AVSubtitleRect.
|
yading@10
|
73 *
|
yading@10
|
74 * @param sub pointer to the AVSubtitle
|
yading@10
|
75 * @param dialog ASS dialog to add to sub
|
yading@10
|
76 * @param ts_start start timestamp for this dialog (in 1/100 second unit)
|
yading@10
|
77 * @param duration duration for this dialog (in 1/100 second unit), can be -1
|
yading@10
|
78 * to last until the end of the presentation
|
yading@10
|
79 * @param raw when set to 2, it indicates that dialog contains an ASS
|
yading@10
|
80 * dialog line as muxed in Matroska
|
yading@10
|
81 * when set to 1, it indicates that dialog contains a whole SSA
|
yading@10
|
82 * dialog line which should be copied as is.
|
yading@10
|
83 * when set to 0, it indicates that dialog contains only the Text
|
yading@10
|
84 * part of the ASS dialog line, the rest of the line
|
yading@10
|
85 * will be generated.
|
yading@10
|
86 * @return number of characters read from dialog. It can be less than the whole
|
yading@10
|
87 * length of dialog, if dialog contains several lines of text.
|
yading@10
|
88 * A negative value indicates an error.
|
yading@10
|
89 */
|
yading@10
|
90 int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,
|
yading@10
|
91 int ts_start, int duration, int raw);
|
yading@10
|
92
|
yading@10
|
93 #endif /* AVCODEC_ASS_H */
|