You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
lavfi/vf_ass: ignore subtitles decoding errors.
A broken packet with invalid data in the middle of the stream should not prevent from decoding the rest of the file. Work around trac ticket #2264.
This commit is contained in:
@@ -318,14 +318,18 @@ static av_cold int init_subtitles(AVFilterContext *ctx, const char *args)
|
|||||||
|
|
||||||
if (pkt.stream_index == sid) {
|
if (pkt.stream_index == sid) {
|
||||||
ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_subtitle, &pkt);
|
ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_subtitle, &pkt);
|
||||||
if (ret < 0 || !got_subtitle)
|
if (ret < 0) {
|
||||||
break;
|
av_log(ctx, AV_LOG_WARNING, "Error decoding: %s (ignored)\n",
|
||||||
|
av_err2str(ret));
|
||||||
|
} else if (got_subtitle) {
|
||||||
|
/* TODO reindent */
|
||||||
for (i = 0; i < sub.num_rects; i++) {
|
for (i = 0; i < sub.num_rects; i++) {
|
||||||
char *ass_line = sub.rects[i]->ass;
|
char *ass_line = sub.rects[i]->ass;
|
||||||
if (!ass_line)
|
if (!ass_line)
|
||||||
break;
|
break;
|
||||||
ass_process_data(ass->track, ass_line, strlen(ass_line));
|
ass_process_data(ass->track, ass_line, strlen(ass_line));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
av_free_packet(&pkt);
|
av_free_packet(&pkt);
|
||||||
avsubtitle_free(&sub);
|
avsubtitle_free(&sub);
|
||||||
|
Reference in New Issue
Block a user