return NULL;
shift_and_ret:
- ts_start64 = (ts_start + jacosub->shift) * 100LL / jacosub->timeres;
- ts_end64 = (ts_end + jacosub->shift) * 100LL / jacosub->timeres;
+ ts_start64 = (ts_start + (int64_t)jacosub->shift) * 100LL / jacosub->timeres;
+ ts_end64 = (ts_end + (int64_t)jacosub->shift) * 100LL / jacosub->timeres;
*start = ts_start64;
*duration = ts_end64 - ts_start64;
return buf + len;
{
int sign = 1;
int a = 0, b = 0, c = 0, d = 0;
+ int64_t ret;
#define SSEP "%*1[.:]"
int n = sscanf(buf, "%d"SSEP"%d"SSEP"%d"SSEP"%d", &a, &b, &c, &d);
#undef SSEP
a = FFABS(a);
}
+ ret = 0;
switch (n) {
- case 4: return sign * ((a*3600 + b*60 + c) * timeres + d);
- case 3: return sign * (( a*60 + b) * timeres + c);
- case 2: return sign * (( a) * timeres + b);
+ case 4:
+ ret = sign * (((int64_t)a*3600 + b*60 + c) * timeres + d);
+ break;
+ case 3:
+ ret = sign * (( (int64_t)a*60 + b) * timeres + c);
+ break;
+ case 2:
+ ret = sign * (( (int64_t)a) * timeres + b);
+ break;
}
+ if ((int)ret != ret)
+ ret = 0;
- return 0;
+ return ret;
}
static int jacosub_read_header(AVFormatContext *s)
sub = ff_subtitles_queue_insert(&jacosub->q, line, len, merge_line);
if (!sub) {
+ av_bprint_finalize(&header, NULL);
ret = AVERROR(ENOMEM);
goto fail;
}
/* SHIFT and TIMERES affect the whole script so packet timing can only be
* done in a second pass */
for (i = 0; i < jacosub->q.nb_subs; i++) {
- AVPacket *sub = &jacosub->q.subs[i];
+ AVPacket *sub = jacosub->q.subs[i];
read_ts(jacosub, sub->data, &sub->pts, &sub->duration);
}
ff_subtitles_queue_finalize(s, &jacosub->q);
min_ts, ts, max_ts, flags);
}
-AVInputFormat ff_jacosub_demuxer = {
+const AVInputFormat ff_jacosub_demuxer = {
.name = "jacosub",
.long_name = NULL_IF_CONFIG_SMALL("JACOsub subtitle format"),
.priv_data_size = sizeof(JACOsubContext),