32 #define STYLE_FLAG_BOLD (1<<0) 33 #define STYLE_FLAG_ITALIC (1<<1) 34 #define STYLE_FLAG_UNDERLINE (1<<2) 35 #define STYLE_RECORD_SIZE 12 38 #define STYL_BOX (1<<0) 39 #define HLIT_BOX (1<<1) 40 #define HCLR_BOX (1<<2) 42 #define av_bprint_append_any(buf, data, size) av_bprint_append_data(buf, ((const char*)data), size) 70 uint16_t style_entries;
87 for (j = 0; j < s->
count; j++) {
100 tsmb_size =
AV_RB32(&tsmb_size);
110 for (j = 0; j < s->
count; j++) {
127 tsmb_size =
AV_RB32(&tsmb_size);
140 tsmb_size =
AV_RB32(&tsmb_size);
161 static const uint8_t text_sample_entry[] = {
162 0x00, 0x00, 0x00, 0x00,
165 0x00, 0x00, 0x00, 0x00,
178 0xFF, 0xFF, 0xFF, 0xFF,
181 0x00, 0x00, 0x00, 0x12,
187 'S',
'e',
'r',
'i',
'f',
310 uint16_t i = 0, ret = 0;
315 else if ((c & 0xE0) == 0xC0)
317 else if ((c & 0xF0) == 0xE0)
319 else if ((c & 0xF8) == 0xF0)
367 const char *ass = sub->
rects[i]->
ass;
374 #if FF_API_ASS_TIMING 375 if (!strncmp(ass,
"Dialogue: ", 10)) {
378 for (; dialog && num--; dialog++) {
388 #if FF_API_ASS_TIMING 410 if (s->
buffer.len > bufsize - 3) {
417 length = s->
buffer.len + 2;
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
fields extracted from the [Events] section
#define AV_LOG_WARNING
Something somehow does not look correct.
Memory handling functions.
static av_cold int init(AVCodecContext *avctx)
ASSDialog * ff_ass_split_dialog2(ASSSplitContext *ctx, const char *buf)
Split one ASS Dialogue line from a string buffer.
static const size_t box_count
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...
static av_cold int mov_text_encode_init(AVCodecContext *avctx)
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...
This struct can be casted to ASS to access to the split data.
void ff_ass_free_dialog(ASSDialog **dialogp)
Free a dialogue obtained from ff_ass_split_dialog2().
ASSSplitContext * ass_ctx
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, const char *buf)
Split override codes out of a ASS "Dialogue" Text field.
static void mov_text_color_cb(void *priv, unsigned int color, unsigned int color_id)
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
static void mov_text_text_cb(void *priv, const char *text, int len)
void(* encode)(MovTextContext *s, uint32_t tsmb_type)
ASSDialog * ff_ass_split_dialog(ASSSplitContext *ctx, const char *buf, int cache, int *number)
Split one or several ASS "Dialogue" lines from a string buffer and store them in an already initializ...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define STYLE_FLAG_UNDERLINE
#define AV_BPRINT_SIZE_UNLIMITED
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
simple assert() macros that are a bit more flexible than ISO C assert().
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.
#define STYLE_FLAG_ITALIC
static const Box box_types[]
static void mov_text_cleanup(MovTextContext *s)
static uint16_t utf8_strlen(const char *text, int len)
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
Set of callback functions corresponding to each override codes that can be encountered in a "Dialogue...
AVCodec ff_movtext_encoder
StyleBox * style_attributes_temp
#define FF_ARRAY_ELEMS(a)
static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub)
Libavcodec external API header.
typedef void(RENAME(mix_any_func_type))
static const ASSCodesCallbacks mov_text_callbacks
static void encode_hclr(MovTextContext *s, uint32_t tsmb_type)
#define STYLE_RECORD_SIZE
main external API structure.
static int mov_text_encode_close(AVCodecContext *avctx)
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt, FILE *output)
StyleBox ** style_attributes
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
static void encode_hlit(MovTextContext *s, uint32_t tsmb_type)
common internal and external API header
void(* text)(void *priv, const char *text, int len)
static void mov_text_new_line_cb(void *priv, int forced)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static void mov_text_style_cb(void *priv, const char style, int close)
Formatted text, the ass field must be set by the decoder and is authoritative.
void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem)
Add the pointer to an element to a dynamic array.
#define av_bprint_append_any(buf, data, size)
char * ass
0 terminated ASS/SSA compatible event line.
void ff_ass_split_free(ASSSplitContext *ctx)
Free all the memory allocated for an ASSSplitContext.
#define MKTAG(a, b, c, d)
static void encode_styl(MovTextContext *s, uint32_t tsmb_type)
uint8_t * subtitle_header
Header containing style information for text subtitles.