ret = parse_string(pb, cur_byte, bp, 0);
if (ret < 0)
return ret;
ret = parse_string(pb, cur_byte, bp, 0);
if (ret < 0)
return ret;
if ((unsigned)*cur_byte - '0' > 9)
return AVERROR_INVALIDDATA;
while (BETWEEN(*cur_byte, '0', '9')) {
if ((unsigned)*cur_byte - '0' > 9)
return AVERROR_INVALIDDATA;
while (BETWEEN(*cur_byte, '0', '9')) {
next_byte(pb, &cur_byte);
ret = expect_byte(pb, &cur_byte, '{');
if (ret < 0)
next_byte(pb, &cur_byte);
ret = expect_byte(pb, &cur_byte, '{');
if (ret < 0)
start = duration = AV_NOPTS_VALUE;
ret = expect_byte(pb, &cur_byte, '{');
if (ret < 0)
start = duration = AV_NOPTS_VALUE;
ret = expect_byte(pb, &cur_byte, '{');
if (ret < 0)
if (!strcmp(label.str, "startOfParagraph")) {
ret = parse_boolean(pb, &cur_byte, &start_of_par);
if (ret < 0)
if (!strcmp(label.str, "startOfParagraph")) {
ret = parse_boolean(pb, &cur_byte, &start_of_par);
if (ret < 0)
} else if (!strcmp(label.str, "content")) {
ret = parse_string(pb, &cur_byte, &content, 1);
if (ret < 0)
} else if (!strcmp(label.str, "content")) {
ret = parse_string(pb, &cur_byte, &content, 1);
if (ret < 0)
} else if (!strcmp(label.str, "startTime")) {
ret = parse_int(pb, &cur_byte, &start);
if (ret < 0)
} else if (!strcmp(label.str, "startTime")) {
ret = parse_int(pb, &cur_byte, &start);
if (ret < 0)
} else if (!strcmp(label.str, "duration")) {
ret = parse_int(pb, &cur_byte, &duration);
if (ret < 0)
} else if (!strcmp(label.str, "duration")) {
ret = parse_int(pb, &cur_byte, &duration);
if (ret < 0)
pkt = ff_subtitles_queue_insert(subs, content.str, content.len, 0);
pkt = ff_subtitles_queue_insert(subs, content.str, content.len, 0);
skip_spaces(pb, &cur_byte);
if (cur_byte != AVERROR_EOF)
skip_spaces(pb, &cur_byte);
if (cur_byte != AVERROR_EOF)
}
static av_cold int tedcaptions_read_header(AVFormatContext *avf)
{
TEDCaptionsDemuxer *tc = avf->priv_data;
}
static av_cold int tedcaptions_read_header(AVFormatContext *avf)
{
TEDCaptionsDemuxer *tc = avf->priv_data;
ret = parse_file(avf->pb, &tc->subs);
if (ret < 0) {
if (ret == AVERROR_INVALIDDATA)
ret = parse_file(avf->pb, &tc->subs);
if (ret < 0) {
if (ret == AVERROR_INVALIDDATA)
}
ff_subtitles_queue_finalize(avf, &tc->subs);
for (i = 0; i < tc->subs.nb_subs; i++)
}
ff_subtitles_queue_finalize(avf, &tc->subs);
for (i = 0; i < tc->subs.nb_subs; i++)
- last = &tc->subs.subs[tc->subs.nb_subs - 1];
- st = avformat_new_stream(avf, NULL);
- if (!st)
- return AVERROR(ENOMEM);
+ last = tc->subs.subs[tc->subs.nb_subs - 1];
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codecpar->codec_id = AV_CODEC_ID_TEXT;
avpriv_set_pts_info(st, 64, 1, 1000);
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codecpar->codec_id = AV_CODEC_ID_TEXT;
avpriv_set_pts_info(st, 64, 1, 1000);
{
static const char *const tags[] = {
"\"captions\"", "\"duration\"", "\"content\"",
{
static const char *const tags[] = {
"\"captions\"", "\"duration\"", "\"content\"",