yading@10: /* yading@10: * SSA/ASS common functions yading@10: * Copyright (c) 2010 Aurelien Jacobs yading@10: * yading@10: * This file is part of FFmpeg. yading@10: * yading@10: * FFmpeg is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * FFmpeg is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with FFmpeg; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: #ifndef AVCODEC_ASS_H yading@10: #define AVCODEC_ASS_H yading@10: yading@10: #include "avcodec.h" yading@10: yading@10: /** yading@10: * @name Default values for ASS style yading@10: * @{ yading@10: */ yading@10: #define ASS_DEFAULT_FONT "Arial" yading@10: #define ASS_DEFAULT_FONT_SIZE 16 yading@10: #define ASS_DEFAULT_COLOR 0xffffff yading@10: #define ASS_DEFAULT_BACK_COLOR 0 yading@10: #define ASS_DEFAULT_BOLD 0 yading@10: #define ASS_DEFAULT_ITALIC 0 yading@10: #define ASS_DEFAULT_UNDERLINE 0 yading@10: #define ASS_DEFAULT_ALIGNMENT 2 yading@10: /** @} */ yading@10: yading@10: /** yading@10: * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. yading@10: * yading@10: * @param avctx pointer to the AVCodecContext yading@10: * @param font name of the default font face to use yading@10: * @param font_size default font size to use yading@10: * @param color default text color to use (ABGR) yading@10: * @param back_color default background color to use (ABGR) yading@10: * @param bold 1 for bold text, 0 for normal text yading@10: * @param italic 1 for italic text, 0 for normal text yading@10: * @param underline 1 for underline text, 0 for normal text yading@10: * @param alignment position of the text (left, center, top...), defined after yading@10: * the layout of the numpad (1-3 sub, 4-6 mid, 7-9 top) yading@10: * @return >= 0 on success otherwise an error code <0 yading@10: */ yading@10: int ff_ass_subtitle_header(AVCodecContext *avctx, yading@10: const char *font, int font_size, yading@10: int color, int back_color, yading@10: int bold, int italic, int underline, yading@10: int alignment); yading@10: yading@10: /** yading@10: * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS yading@10: * with default style. yading@10: * yading@10: * @param avctx pointer to the AVCodecContext yading@10: * @return >= 0 on success otherwise an error code <0 yading@10: */ yading@10: int ff_ass_subtitle_header_default(AVCodecContext *avctx); yading@10: yading@10: /** yading@10: * Add an ASS dialog line to an AVSubtitle as a new AVSubtitleRect. yading@10: * yading@10: * @param sub pointer to the AVSubtitle yading@10: * @param dialog ASS dialog to add to sub yading@10: * @param ts_start start timestamp for this dialog (in 1/100 second unit) yading@10: * @param duration duration for this dialog (in 1/100 second unit), can be -1 yading@10: * to last until the end of the presentation yading@10: * @param raw when set to 2, it indicates that dialog contains an ASS yading@10: * dialog line as muxed in Matroska yading@10: * when set to 1, it indicates that dialog contains a whole SSA yading@10: * dialog line which should be copied as is. yading@10: * when set to 0, it indicates that dialog contains only the Text yading@10: * part of the ASS dialog line, the rest of the line yading@10: * will be generated. yading@10: * @return number of characters read from dialog. It can be less than the whole yading@10: * length of dialog, if dialog contains several lines of text. yading@10: * A negative value indicates an error. yading@10: */ yading@10: int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, yading@10: int ts_start, int duration, int raw); yading@10: yading@10: #endif /* AVCODEC_ASS_H */