...
|
...
|
@@ -393,6 +393,8 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
|
393
|
393
|
}
|
394
|
394
|
if (ass->charenc)
|
395
|
395
|
av_dict_set(&codec_opts, "sub_charenc", ass->charenc, 0);
|
|
396
|
+ if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,25,100))
|
|
397
|
+ av_dict_set(&codec_opts, "sub_text_format", "ass", 0);
|
396
|
398
|
ret = avcodec_open2(dec_ctx, dec, &codec_opts);
|
397
|
399
|
if (ret < 0)
|
398
|
400
|
goto end;
|
...
|
...
|
@@ -436,11 +438,17 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
|
436
|
436
|
av_log(ctx, AV_LOG_WARNING, "Error decoding: %s (ignored)\n",
|
437
|
437
|
av_err2str(ret));
|
438
|
438
|
} else if (got_subtitle) {
|
|
439
|
+ const int64_t start_time = av_rescale_q(sub.pts, AV_TIME_BASE_Q, av_make_q(1, 1000));
|
|
440
|
+ const int64_t duration = sub.end_display_time;
|
439
|
441
|
for (i = 0; i < sub.num_rects; i++) {
|
440
|
442
|
char *ass_line = sub.rects[i]->ass;
|
441
|
443
|
if (!ass_line)
|
442
|
444
|
break;
|
443
|
|
- ass_process_data(ass->track, ass_line, strlen(ass_line));
|
|
445
|
+ if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,25,100))
|
|
446
|
+ ass_process_data(ass->track, ass_line, strlen(ass_line));
|
|
447
|
+ else
|
|
448
|
+ ass_process_chunk(ass->track, ass_line, strlen(ass_line),
|
|
449
|
+ start_time, duration);
|
444
|
450
|
}
|
445
|
451
|
}
|
446
|
452
|
}
|