Go to the documentation of this file.
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;
303 if (script_info.play_res_x <= 0 || script_info.play_res_y <= 0) {
305 "Invalid subtitle reference resolution %dx%d!\n",
306 script_info.play_res_x, script_info.play_res_y);
318 av_bprintf(&
s->buffer,
" ttp:cellResolution=\"%d %d\"\n",
319 script_info.play_res_x, script_info.play_res_y);
342 additional_extradata_size =
s->buffer.len;
345 av_mallocz(base_extradata_size + additional_extradata_size))) {
356 s->buffer.str, additional_extradata_size);
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_EF_EXPLODE
abort decoding on minor error detection
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Set of callback functions corresponding to each override codes that can be encountered in a "Dialogue...
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
int alignment
position of the text (left, center, top...), defined after the layout of the numpad (1-3 sub,...
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
ASSDialog * ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf)
Split one ASS Dialogue line from a string buffer.
const FFCodec ff_ttml_encoder
ASSStyle * styles
array of split out styles
uint8_t * subtitle_header
static void ttml_get_extent(ASSScriptInfo script_info, ASSStyle style, int *width, int *height)
char * style
name of the ASSStyle to use with this dialog
@ SUBTITLE_ASS
Formatted text, the ass field must be set by the decoder and is authoritative.
#define TTMLENC_EXTRADATA_SIGNATURE_SIZE
char * font_name
font face (case sensitive)
static void ttml_text_cb(void *priv, const char *text, int len)
AVCodec p
The public AVCodec.
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.
static int ttml_write_header_content(AVCodecContext *avctx)
char * ass
0 terminated ASS/SSA compatible event line.
#define TTMLENC_EXTRADATA_SIGNATURE
void ff_ass_free_dialog(ASSDialog **dialogp)
Free a dialogue obtained from ff_ass_split_dialog().
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void ttml_get_origin(ASSScriptInfo script_info, ASSStyle style, int *origin_left, int *origin_top)
#define AV_ESCAPE_FLAG_XML_DOUBLE_QUOTES
Within AV_ESCAPE_MODE_XML, additionally escape double quotes for double quoted attributes.
#define CODEC_LONG_NAME(str)
int play_res_y
video height that ASS coords are referring to
structure containing the whole split ASS data
static const ASSCodesCallbacks ttml_callbacks
int play_res_x
video width that ASS coords are referring to
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.
static void ttml_new_line_cb(void *priv, int forced)
static int ttml_encode_frame(AVCodecContext *avctx, uint8_t *buf, int bufsize, const AVSubtitle *sub)
fields extracted from the [Script Info] section
ASSSplitContext * ass_ctx
#define FF_CODEC_ENCODE_SUB_CB(func)
This struct can be casted to ASS to access to the split data.
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...
fields extracted from the [V4(+) Styles] section
int(* init)(AVBSFContext *ctx)
void ff_ass_split_free(ASSSplitContext *ctx)
Free all the memory allocated for an ASSSplitContext.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
char * text
actual text which will be displayed as a subtitle, can include style override control codes (see ff_a...
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
char * name
name of the tyle (case sensitive)
@ AV_ESCAPE_MODE_XML
Use XML non-markup character data escaping.
static av_cold int ttml_encode_init(AVCodecContext *avctx)
static const char * ttml_get_text_alignment(int alignment)
#define i(width, name, range_min, range_max)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
int styles_count
number of ASSStyle in the styles array
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
#define AV_INPUT_BUFFER_PADDING_SIZE
main external API structure.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
fields extracted from the [Events] section
static int ttml_write_region(AVCodecContext *avctx, AVBPrint *buf, ASSScriptInfo script_info, ASSStyle style)
#define TTML_DEFAULT_NAMESPACING
static const char * ttml_get_display_alignment(int alignment)
static av_cold int ttml_encode_close(AVCodecContext *avctx)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, const char *buf)
Split override codes out of a ASS "Dialogue" Text field.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
void(* text)(void *priv, const char *text, int len)
ASSScriptInfo script_info
general information about the SSA script