39 const char *
f = strchr(
s,
c);
40 return f ? (
f -
s) : -1;
52#define MICRODVD_PERSISTENT_OFF 0
53#define MICRODVD_PERSISTENT_ON 1
54#define MICRODVD_PERSISTENT_OPENED 2
57#define MICRODVD_TAGS "cfshyYpo"
65 memcpy(&tags[tag_index], &
tag,
sizeof(
tag));
69#define MICRODVD_STYLES "ibus"
91 char tag_char = *(
s + 1);
94 if (!tag_char || *(
s + 2) !=
':')
105 while (*
s && *
s !=
'}' &&
s - start < 256) {
108 if (style_index >= 0)
109 tag.data1 |= (1 << style_index);
124 while (*
s ==
'$' || *
s ==
'#')
126 tag.data1 = strtol(
s, &
s, 16) & 0x00ffffff;
141 tag.data_string_len =
len;
152 tag.data1 = strtol(
s, &
s, 10);
165 tag.data_string_len =
len;
176 tag.data1 = (*
s++ ==
'1');
185 tag.data1 = strtol(
s, &
s, 10);
189 tag.data2 = strtol(
s, &
s, 10);
214 switch (tags[
i].
key) {
218 if (tags[
i].
data1 & (1 << sidx))
241 av_bprintf(new_line,
"{\\pos(%"PRId32
",%"PRId32
")}",
258 switch (tags[
i].
key) {
262 if (tags[
i].
data1 & (1 << sidx))
283 int *got_sub_ptr,
const AVPacket *avpkt)
287 char *end = avpkt->
data + avpkt->
size;
291 if (avpkt->
size <= 0)
348 if (tags[
i].
data1 & (1 << sidx)) {
350 case 'i': italic = 1;
break;
351 case 'b': bold = 1;
break;
352 case 'u': underline = 1;
break;
359 case 's': font_size = tags[
i].
data1;
break;
360 case 'p': alignment = 8;
break;
377 .p.name =
"microdvd",
const FFCodec ff_microdvd_decoder
av_cold void ff_ass_decoder_flush(AVCodecContext *avctx)
Helper to flush a text subtitles decoder making use of the FFASSDecoderContext.
int ff_ass_subtitle_header(AVCodecContext *avctx, const char *font, int font_size, int color, int back_color, int bold, int italic, int underline, int border_style, int alignment)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS.
int ff_ass_add_rect(AVSubtitle *sub, const char *dialog, int readorder, int layer, const char *style, const char *speaker)
Add an ASS dialog to a subtitle.
#define ASS_DEFAULT_ALIGNMENT
#define ASS_DEFAULT_FONT_SIZE
#define ASS_DEFAULT_COLOR
#define ASS_DEFAULT_BORDERSTYLE
#define ASS_DEFAULT_BACK_COLOR
#define ASS_DEFAULT_UNDERLINE
#define ASS_DEFAULT_ITALIC
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_AUTOMATIC
#define i(width, name, range_min, range_max)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_DECODE_SUB_CB(func)
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize 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_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
static av_const int av_tolower(int c)
Locale-independent conversion of ASCII characters to lowercase.
static char * microdvd_load_tags(struct microdvd_tag *tags, char *s)
static int indexof(const char *s, int c)
static void microdvd_open_tags(AVBPrint *new_line, struct microdvd_tag *tags)
static av_cold int microdvd_init(AVCodecContext *avctx)
static void microdvd_close_no_persistent_tags(AVBPrint *new_line, struct microdvd_tag *tags)
#define MICRODVD_PERSISTENT_ON
static void microdvd_set_tag(struct microdvd_tag *tags, struct microdvd_tag tag)
static int microdvd_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *avpkt)
#define MICRODVD_PERSISTENT_OFF
#define MICRODVD_PERSISTENT_OPENED
static char * check_for_italic_slash_marker(struct microdvd_tag *tags, char *s)
Macro definitions for various function/variable attributes.
main external API structure.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure stores compressed data.