X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fass.h;h=314b43b686bfe118a043c43016344beefba0e363;hb=31fe3c4d23aab8b43614b1ea825603080775677e;hp=621a7ba7f3df125521c20e76a1327e6847bc5e30;hpb=e7b8ec8b6fd85464da473d317593ba061529932c;p=ffmpeg diff --git a/libavcodec/ass.h b/libavcodec/ass.h index 621a7ba7f3d..314b43b686b 100644 --- a/libavcodec/ass.h +++ b/libavcodec/ass.h @@ -43,6 +43,10 @@ #define ASS_DEFAULT_BORDERSTYLE 1 /** @} */ +typedef struct FFASSDecoderContext { + int readorder; +} FFASSDecoderContext; + /** * Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS. * @@ -74,55 +78,23 @@ int ff_ass_subtitle_header(AVCodecContext *avctx, int ff_ass_subtitle_header_default(AVCodecContext *avctx); /** - * Add an ASS dialog line to an AVSubtitle as a new AVSubtitleRect. - * - * @param sub pointer to the AVSubtitle - * @param dialog ASS dialog to add to sub - * @param ts_start start timestamp for this dialog (in 1/100 second unit) - * @param duration duration for this dialog (in 1/100 second unit), can be -1 - * to last until the end of the presentation - * @param raw when set to 2, it indicates that dialog contains an ASS - * dialog line as muxed in Matroska - * when set to 1, it indicates that dialog contains a whole SSA - * dialog line which should be copied as is. - * when set to 0, it indicates that dialog contains only the Text - * part of the ASS dialog line, the rest of the line - * will be generated. - * @return number of characters read from dialog. It can be less than the whole - * length of dialog, if dialog contains several lines of text. - * A negative value indicates an error. + * Craft an ASS dialog string. */ -int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, - int ts_start, int duration, int raw); +char *ff_ass_get_dialog(int readorder, int layer, const char *style, + const char *speaker, const char *text); /** - * Same as ff_ass_add_rect, but taking an AVBPrint buffer instead of a - * string, and assuming raw=0. + * Add an ASS dialog to a subtitle. */ -int ff_ass_add_rect_bprint(AVSubtitle *sub, AVBPrint *buf, - int ts_start, int duration); +int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, + int readorder, int layer, const char *style, + const char *speaker); /** - * Add an ASS dialog line to an AVBPrint buffer. - * - * @param buf pointer to an initialized AVBPrint buffer - * @param dialog ASS dialog to add to sub - * @param ts_start start timestamp for this dialog (in 1/100 second unit) - * @param duration duration for this dialog (in 1/100 second unit), can be -1 - * to last until the end of the presentation - * @param raw when set to 2, it indicates that dialog contains an ASS - * dialog line as muxed in Matroska - * when set to 1, it indicates that dialog contains a whole SSA - * dialog line which should be copied as is. - * when set to 0, it indicates that dialog contains only the Text - * part of the ASS dialog line, the rest of the line - * will be generated. - * @return number of characters read from dialog. It can be less than the whole - * length of dialog, if dialog contains several lines of text. - * A negative value indicates an error. + * Helper to flush a text subtitles decoder making use of the + * FFASSDecoderContext. */ -int ff_ass_bprint_dialog(AVBPrint *buf, const char *dialog, - int ts_start, int duration, int raw); +void ff_ass_decoder_flush(AVCodecContext *avctx); /** * Escape a text subtitle using ASS syntax into an AVBPrint buffer.