q, buf.str, buf.len, !is_sync);
if (!sub) {
res = AVERROR(ENOMEM);
av_bprint_finalize(&hdr_buf, NULL);
goto end;
}
if (is_sync) {
const char *p = ff_smil_get_attr_ptr(buf.str, "Start");
sub->pos = pos;
sub->pts = p ? strtol(p, NULL, 10) : 0;
if (sub->pts <= INT64_MIN/2 || sub->pts >= INT64_MAX/2) {
res = AVERROR_PATCHWELCOME;
av_bprint_finalize(&hdr_buf, NULL);
goto end;
}
sub->duration = -1;
}
}
av_bprint_clear(&buf);
}
res = ff_bprint_to_codecpar_extradata(st->codecpar, &hdr_buf);
if (res < 0)
goto end;
ff_subtitles_queue_finalize(s, &sami->q);
end:
av_bprint_finalize(&buf, NULL);
return res;
}
const AVInputFormat ff_sami_demuxer = {
.name = "sami",
.long_name = NULL_IF_CONFIG_SMALL("SAMI subtitle format"),
.priv_data_size = sizeof(SAMIContext),
.flags_internal = FF_FMT_INIT_CLEANUP,
.read_probe = sami_probe,
.read_header = sami_read_header,
.extensions = "smi,sami",
.read_packet = ff_subtitles_read_packet,
.read_seek2 = ff_subtitles_read_seek,
.read_close = ff_subtitles_read_close,
};