41 const char *
f = strchr(
s,
c);
42 return f ? (
f -
s) : -1;
54#define MICRODVD_PERSISTENT_OFF 0
55#define MICRODVD_PERSISTENT_ON 1
56#define MICRODVD_PERSISTENT_OPENED 2
59#define MICRODVD_TAGS "cfshyYpo"
67 memcpy(&tags[tag_index], &
tag,
sizeof(
tag));
71#define MICRODVD_STYLES "ibus"
93 char tag_char = *(
s + 1);
96 if (!tag_char || *(
s + 2) !=
':')
107 while (*
s && *
s !=
'}' &&
s - start < 256) {
110 if (style_index >= 0)
111 tag.data1 |= (1 << style_index);
126 while (*
s ==
'$' || *
s ==
'#')
128 tag.data1 = strtol(
s, &
s, 16) & 0x00ffffff;
143 tag.data_string_len =
len;
154 tag.data1 = strtol(
s, &
s, 10);
167 tag.data_string_len =
len;
178 tag.data1 = (*
s++ ==
'1');
187 tag.data1 = strtol(
s, &
s, 10);
191 tag.data2 = strtol(
s, &
s, 10);
216 switch (tags[
i].
key) {
220 if (tags[
i].
data1 & (1 << sidx))
243 av_bprintf(new_line,
"{\\pos(%"PRId32
",%"PRId32
")}",
260 switch (tags[
i].
key) {
264 if (tags[
i].
data1 & (1 << sidx))
285 int *got_sub_ptr,
const AVPacket *avpkt)
292 if (avpkt->
size <= 0)
355 if (tags[
i].
data1 & (1 << sidx)) {
357 case 'i': italic = 1;
break;
358 case 'b': bold = 1;
break;
359 case 'u': underline = 1;
break;
366 case 's': font_size = tags[
i].
data1;
break;
367 case 'p': alignment = 8;
break;
385 .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)
const char * ff_decode_subtitle_text(AVCodecContext *avctx, const AVPacket *avpkt)
Get the data of a subtitle packet followed by a 0 byte.
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.
char * av_strndup(const char *s, size_t len)
Duplicate a substring of a string.
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.
Memory handling functions.
main external API structure.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure stores compressed data.