[FFmpeg-devel] [PATCH 1/2] lavfi/vf_ass: ignore subtitles decoding errors.

Clément Bœsch ubitux at gmail.com
Wed Feb 13 17:12:17 CET 2013


On Wed, Feb 13, 2013 at 10:56:17AM +0100, Nicolas George wrote:
> 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.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/vf_ass.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> 
> Note: keeping the "Comment" lines in the packets seems like a bug of the ASS
> demuxer. mkvmerge drops Comment lines when building a Matroska file, for
> example.
> 
> 
> diff --git a/libavfilter/vf_ass.c b/libavfilter/vf_ass.c
> index ade1b37..d684e54 100644
> --- a/libavfilter/vf_ass.c
> +++ b/libavfilter/vf_ass.c
> @@ -318,8 +318,9 @@ static av_cold int init_subtitles(AVFilterContext *ctx, const char *args)
>  
>          if (pkt.stream_index == sid) {
>              ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_subtitle, &pkt);
> -            if (ret < 0 || !got_subtitle)
> -                break;
> +            if (ret < 0)
> +                av_log(ctx, AV_LOG_WARNING, "Error decoding: %s (ignored)\n",
> +                       av_err2str(ret));

I'm not sure about removing the got_subtitle check. You might read again
from the previous decoded sub (if any).

>              for (i = 0; i < sub.num_rects; i++) {
>                  char *ass_line = sub.rects[i]->ass;
>                  if (!ass_line)

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130213/37ee1101/attachment.asc>


More information about the ffmpeg-devel mailing list