FFDemuxSubtitlesQueue q;
} PJSContext;
-static int pjs_probe(AVProbeData *p)
+static int pjs_probe(const AVProbeData *p)
{
char c;
int64_t start, end;
if (sscanf(*line, "%"SCNd64",%"SCNd64, &start, &end) == 2) {
*line += strcspn(*line, "\"");
*line += !!**line;
+ if (end < start || end - (uint64_t)start > INT_MAX)
+ return AV_NOPTS_VALUE;
*duration = end - start;
return start;
}
{
PJSContext *pjs = s->priv_data;
AVStream *st = avformat_new_stream(s, NULL);
- int res = 0;
if (!st)
return AVERROR(ENOMEM);
p[strcspn(p, "\"")] = 0;
sub = ff_subtitles_queue_insert(&pjs->q, p, strlen(p), 0);
- if (!sub)
+ if (!sub) {
+ ff_subtitles_queue_clean(&pjs->q);
return AVERROR(ENOMEM);
+ }
sub->pos = pos;
sub->pts = pts_start;
sub->duration = duration;
}
ff_subtitles_queue_finalize(s, &pjs->q);
- return res;
+ return 0;
}
static int pjs_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
-AVInputFormat ff_pjs_demuxer = {
+const AVInputFormat ff_pjs_demuxer = {
.name = "pjs",
.long_name = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitles"),
.priv_data_size = sizeof(PJSContext),