55 "Failed to move the current subtitle dialog to AVBPrint!\n");
115 "Splitting received ASS dialog text %s failed: %s\n",
138 return s->buffer.len;
191 int *origin_left,
int *origin_top)
213 const char *display_alignment =
NULL;
233 "One or more negative margin values in subtitle style: "
234 "left: %d, right: %d, vertical: %d!\n",
243 "Failed to convert ASS style alignment %d of style %s to "
244 "TTML display and text alignment!\n",
258 av_bprintf(buf,
" tts:origin=\"%d%% %d%%\"\n",
259 origin_left, origin_top);
260 av_bprintf(buf,
" tts:extent=\"%d%% %d%%\"\n",
288 av_bprintf(buf,
" tts:overflow=\"visible\" />\n");
300 size_t additional_extradata_size = 0;
305 "Invalid subtitle reference resolution %dx%d!\n",
318 av_bprintf(&
s->buffer,
" ttp:cellResolution=\"%d %d\"\n",
342 additional_extradata_size =
s->buffer.len;
345 av_mallocz(base_extradata_size + additional_extradata_size))) {
356 s->buffer.str, additional_extradata_size);
const FFCodec ff_ttml_encoder
av_cold ASSSplitContext * ff_ass_split(const char *buf)
Split a full ASS file or a ASS header from a string buffer and store the split structure in a newly a...
void ff_ass_free_dialog(ASSDialog **dialogp)
Free a dialogue obtained from ff_ass_split_dialog().
int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, const char *buf)
Split override codes out of a ASS "Dialogue" Text field.
av_cold void ff_ass_split_free(ASSSplitContext *ctx)
Free all the memory allocated for an ASSSplitContext.
ASSDialog * ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf)
Split one ASS Dialogue line from a string buffer.
Libavcodec external API header.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define i(width, name, range_min, range_max)
#define FF_CODEC_ENCODE_SUB_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define AV_EF_EXPLODE
abort decoding on minor error detection
int(* init)(AVBSFContext *ctx)
@ SUBTITLE_ASS
Formatted text, the ass field must be set by the decoder and is authoritative.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
Escape the content in src and append it to dstbuf.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size)
Init a print buffer using a pre-existing buffer.
#define AVERROR_BUFFER_TOO_SMALL
Buffer too small.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES
Within AV_ESCAPE_MODE_XML, additionally escape double quotes for double quoted attributes.
@ AV_ESCAPE_MODE_XML
Use XML non-markup character data escaping.
static void ttml_get_extent(ASSScriptInfo script_info, ASSStyle style, int *width, int *height)
static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf, int bufsize, const AVSubtitle *sub)
static const char * ttml_get_text_alignment(int alignment)
static void ttml_get_origin(ASSScriptInfo script_info, ASSStyle style, int *origin_left, int *origin_top)
static const ASSCodesCallbacks ttml_callbacks
static const char * ttml_get_display_alignment(int alignment)
static av_cold int ttml_encode_close(AVCodecContext *avctx)
static av_cold int ttml_encode_init(AVCodecContext *avctx)
static void ttml_text_cb(void *priv, const char *text, int len)
static int ttml_write_header_content(AVCodecContext *avctx)
static void ttml_new_line_cb(void *priv, int forced)
static int ttml_write_region(AVCodecContext *avctx, AVBPrint *buf, ASSScriptInfo script_info, ASSStyle style)
#define TTML_DEFAULT_NAMESPACING
#define TTMLENC_EXTRADATA_SIGNATURE
#define TTMLENC_EXTRADATA_SIGNATURE_SIZE
common internal API header
Memory handling functions.
Set of callback functions corresponding to each override codes that can be encountered in a "Dialogue...
fields extracted from the [Events] section
char * style
name of the ASSStyle to use with this dialog
char * text
actual text which will be displayed as a subtitle, can include style override control codes (see ff_a...
fields extracted from the [Script Info] section
int play_res_y
video height that ASS coords are referring to
int play_res_x
video width that ASS coords are referring to
This struct can be casted to ASS to access to the split data.
fields extracted from the [V4(+) Styles] section
char * font_name
font face (case sensitive)
char * name
name of the tyle (case sensitive)
int alignment
position of the text (left, center, top...), defined after the layout of the numpad (1-3 sub,...
structure containing the whole split ASS data
int styles_count
number of ASSStyle in the styles array
ASSStyle * styles
array of split out styles
ASSScriptInfo script_info
general information about the SSA script
main external API structure.
uint8_t * subtitle_header
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
char * ass
0 terminated ASS/SSA compatible event line.
ASSSplitContext * ass_ctx