Go to the documentation of this file.
48 AVBPrint cur_line = { 0 };
56 "Failed to move the current subtitle dialog to AVBPrint!\n");
89 for (
i=0;
i<
sub->num_rects;
i++) {
90 const char *ass =
sub->rects[
i]->ass;
116 "Splitting received ASS dialog text %s failed: %s\n",
139 if (
av_strlcpy(buf,
s->buffer.str, bufsize) > bufsize - 1) {
144 return s->buffer.len;
199 int *origin_left,
int *origin_top)
221 const char *display_alignment =
NULL;
222 const char *text_alignment =
NULL;
241 "One or more negative margin values in subtitle style: "
242 "left: %d, right: %d, vertical: %d!\n",
249 if (!display_alignment || !text_alignment) {
251 "Failed to convert ASS style alignment %d of style %s to "
252 "TTML display and text alignment!\n",
266 av_bprintf(buf,
" tts:origin=\"%d%% %d%%\"\n",
267 origin_left, origin_top);
268 av_bprintf(buf,
" tts:extent=\"%d%% %d%%\"\n",
296 av_bprintf(buf,
" tts:overflow=\"visible\" />\n");
308 size_t additional_extradata_size = 0;
310 if (script_info.play_res_x <= 0 || script_info.play_res_y <= 0) {
312 "Invalid subtitle reference resolution %dx%d!\n",
313 script_info.play_res_x, script_info.play_res_y);
323 av_bprintf(&
s->buffer,
" ttp:cellResolution=\"%d %d\"\n",
324 script_info.play_res_x, script_info.play_res_y);
346 additional_extradata_size =
s->buffer.len;
349 av_mallocz(base_extradata_size + additional_extradata_size))) {
358 if (additional_extradata_size)
360 s->buffer.str, additional_extradata_size);
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
#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...
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
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
static float sub(float src0, float src1)
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
Header containing style information for text subtitles.
static void ttml_get_extent(ASSScriptInfo script_info, ASSStyle style, int *width, int *height)
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
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.
#define AVERROR_BUFFER_TOO_SMALL
Buffer too small.
static int ttml_write_header_content(AVCodecContext *avctx)
#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.
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
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...
#define AV_EF_EXPLODE
abort decoding on minor error detection
fields extracted from the [V4(+) Styles] section
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
void ff_ass_split_free(ASSSplitContext *ctx)
Free all the memory allocated for an ASSSplitContext.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
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,...)
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.
#define AV_INPUT_BUFFER_PADDING_SIZE
main external API structure.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
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 const char ttml_default_namespacing[]
static int ttml_write_region(AVCodecContext *avctx, AVBPrint *buf, ASSScriptInfo script_info, ASSStyle style)
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.
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
#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(* text)(void *priv, const char *text, int len)
ASSScriptInfo script_info
general information about the SSA script