lavc: reindent a few decoders after previous commits

This commit is contained in:
Clément Bœsch 2016-02-26 22:15:20 +01:00
parent 22ebbda637
commit b5451d88cf
3 changed files with 43 additions and 46 deletions

View File

@ -343,10 +343,9 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf,
if (!strncmp(ass, "Dialogue: ", 10)) {
int num;
dialog = ff_ass_split_dialog(s->ass_ctx, ass, 0, &num);
// TODO reindent
for (; dialog && num--; dialog++) {
ff_ass_split_override_codes(&mov_text_callbacks, s, dialog->text);
}
for (; dialog && num--; dialog++) {
ff_ass_split_override_codes(&mov_text_callbacks, s, dialog->text);
}
} else {
#endif
dialog = ff_ass_split_dialog2(s->ass_ctx, ass);

View File

@ -248,12 +248,11 @@ static int encode_frame(AVCodecContext *avctx,
if (!strncmp(ass, "Dialogue: ", 10)) {
int num;
dialog = ff_ass_split_dialog(s->ass_ctx, ass, 0, &num);
// TODO reindent
for (; dialog && num--; dialog++) {
s->alignment_applied = 0;
srt_style_apply(s, dialog->style);
ff_ass_split_override_codes(cb, s, dialog->text);
}
for (; dialog && num--; dialog++) {
s->alignment_applied = 0;
srt_style_apply(s, dialog->style);
ff_ass_split_override_codes(cb, s, dialog->text);
}
} else {
#endif
dialog = ff_ass_split_dialog2(s->ass_ctx, ass);

View File

@ -156,47 +156,46 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
{
ASSContext *ass = s->priv_data;
// TODO: reindent
long int layer;
char *p = pkt->data;
int64_t start = pkt->pts;
int64_t end = start + pkt->duration;
int hh1, mm1, ss1, ms1;
int hh2, mm2, ss2, ms2;
DialogueLine *dialogue = av_mallocz(sizeof(*dialogue));
long int layer;
char *p = pkt->data;
int64_t start = pkt->pts;
int64_t end = start + pkt->duration;
int hh1, mm1, ss1, ms1;
int hh2, mm2, ss2, ms2;
DialogueLine *dialogue = av_mallocz(sizeof(*dialogue));
if (!dialogue)
return AVERROR(ENOMEM);
if (!dialogue)
return AVERROR(ENOMEM);
dialogue->readorder = strtol(p, &p, 10);
if (dialogue->readorder < ass->expected_readorder)
av_log(s, AV_LOG_WARNING, "Unexpected ReadOrder %d\n",
dialogue->readorder);
if (*p == ',')
p++;
dialogue->readorder = strtol(p, &p, 10);
if (dialogue->readorder < ass->expected_readorder)
av_log(s, AV_LOG_WARNING, "Unexpected ReadOrder %d\n",
dialogue->readorder);
if (*p == ',')
p++;
if (ass->ssa_mode && !strncmp(p, "Marked=", 7))
p += 7;
if (ass->ssa_mode && !strncmp(p, "Marked=", 7))
p += 7;
layer = strtol(p, &p, 10);
if (*p == ',')
p++;
hh1 = (int)(start / 360000); mm1 = (int)(start / 6000) % 60;
hh2 = (int)(end / 360000); mm2 = (int)(end / 6000) % 60;
ss1 = (int)(start / 100) % 60; ms1 = (int)(start % 100);
ss2 = (int)(end / 100) % 60; ms2 = (int)(end % 100);
if (hh1 > 9) hh1 = 9, mm1 = 59, ss1 = 59, ms1 = 99;
if (hh2 > 9) hh2 = 9, mm2 = 59, ss2 = 59, ms2 = 99;
layer = strtol(p, &p, 10);
if (*p == ',')
p++;
hh1 = (int)(start / 360000); mm1 = (int)(start / 6000) % 60;
hh2 = (int)(end / 360000); mm2 = (int)(end / 6000) % 60;
ss1 = (int)(start / 100) % 60; ms1 = (int)(start % 100);
ss2 = (int)(end / 100) % 60; ms2 = (int)(end % 100);
if (hh1 > 9) hh1 = 9, mm1 = 59, ss1 = 59, ms1 = 99;
if (hh2 > 9) hh2 = 9, mm2 = 59, ss2 = 59, ms2 = 99;
dialogue->line = av_asprintf("%s%ld,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s",
ass->ssa_mode ? "Marked=" : "",
layer, hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, p);
if (!dialogue->line) {
av_free(dialogue);
return AVERROR(ENOMEM);
}
insert_dialogue(ass, dialogue);
purge_dialogues(s, ass->ignore_readorder);
dialogue->line = av_asprintf("%s%ld,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s",
ass->ssa_mode ? "Marked=" : "",
layer, hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, p);
if (!dialogue->line) {
av_free(dialogue);
return AVERROR(ENOMEM);
}
insert_dialogue(ass, dialogue);
purge_dialogues(s, ass->ignore_readorder);
return 0;
}