You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-11 14:30:22 +02:00
movtextdec.c: Add support for fontsize
Add support for fontsize in style records. The patch uses reset to directly change back to default style instead of using closing tags, since we are not handling the default styles right now. Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
This commit is contained in:
@ -39,6 +39,7 @@ typedef struct {
|
|||||||
uint16_t style_start;
|
uint16_t style_start;
|
||||||
uint16_t style_end;
|
uint16_t style_end;
|
||||||
uint8_t style_flag;
|
uint8_t style_flag;
|
||||||
|
uint8_t fontsize;
|
||||||
} StyleBox;
|
} StyleBox;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -120,13 +121,14 @@ static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
|
|||||||
// fontID = AV_RB16(tsmb);
|
// fontID = AV_RB16(tsmb);
|
||||||
tsmb += 2;
|
tsmb += 2;
|
||||||
m->s_temp->style_flag = AV_RB8(tsmb);
|
m->s_temp->style_flag = AV_RB8(tsmb);
|
||||||
|
tsmb++;
|
||||||
|
m->s_temp->fontsize = AV_RB8(tsmb);
|
||||||
av_dynarray_add(&m->s, &m->count_s, m->s_temp);
|
av_dynarray_add(&m->s, &m->count_s, m->s_temp);
|
||||||
if(!m->s) {
|
if(!m->s) {
|
||||||
mov_text_cleanup(m);
|
mov_text_cleanup(m);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
// fontsize = AV_RB8(tsmb);
|
tsmb++;
|
||||||
tsmb += 2;
|
|
||||||
// text-color-rgba
|
// text-color-rgba
|
||||||
tsmb += 4;
|
tsmb += 4;
|
||||||
}
|
}
|
||||||
@ -150,12 +152,7 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end,
|
|||||||
if (m->box_flags & STYL_BOX) {
|
if (m->box_flags & STYL_BOX) {
|
||||||
for (i = 0; i < m->style_entries; i++) {
|
for (i = 0; i < m->style_entries; i++) {
|
||||||
if (m->s[i]->style_flag && text_pos == m->s[i]->style_end) {
|
if (m->s[i]->style_flag && text_pos == m->s[i]->style_end) {
|
||||||
if (m->s[i]->style_flag & STYLE_FLAG_BOLD)
|
av_bprintf(buf, "{\\r}");
|
||||||
av_bprintf(buf, "{\\b0}");
|
|
||||||
if (m->s[i]->style_flag & STYLE_FLAG_ITALIC)
|
|
||||||
av_bprintf(buf, "{\\i0}");
|
|
||||||
if (m->s[i]->style_flag & STYLE_FLAG_UNDERLINE)
|
|
||||||
av_bprintf(buf, "{\\u0}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < m->style_entries; i++) {
|
for (i = 0; i < m->style_entries; i++) {
|
||||||
@ -166,6 +163,7 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end,
|
|||||||
av_bprintf(buf, "{\\i1}");
|
av_bprintf(buf, "{\\i1}");
|
||||||
if (m->s[i]->style_flag & STYLE_FLAG_UNDERLINE)
|
if (m->s[i]->style_flag & STYLE_FLAG_UNDERLINE)
|
||||||
av_bprintf(buf, "{\\u1}");
|
av_bprintf(buf, "{\\u1}");
|
||||||
|
av_bprintf(buf, "{\\fs%d}", m->s[i]->fontsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user