X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavcodec%2Fsubviewerdec.c;h=a0088285404347fee0ea1e1a7a458c43b803d4a1;hp=63be4188b92f4fa8e3c5efd11389f0d1e48bb65b;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavcodec/subviewerdec.c b/ffmpeg/libavcodec/subviewerdec.c index 63be418..a008828 100644 --- a/ffmpeg/libavcodec/subviewerdec.c +++ b/ffmpeg/libavcodec/subviewerdec.c @@ -43,33 +43,26 @@ static int subviewer_event_to_ass(AVBPrint *buf, const char *p) } } - av_bprintf(buf, "\r\n"); return 0; } static int subviewer_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt) { - char c; + int ret = 0; AVSubtitle *sub = data; const char *ptr = avpkt->data; AVBPrint buf; - /* To be removed later */ - if (ptr && sscanf(ptr, "%*u:%*u:%*u.%*u,%*u:%*u:%*u.%*u%c", &c) == 1) { - av_log(avctx, AV_LOG_ERROR, "AVPacket is not clean (contains timing " - "information). You need to upgrade your libavformat or " - "sanitize your packet.\n"); - return AVERROR_INVALIDDATA; - } - av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); // note: no need to rescale pts & duration since they are in the same // timebase as ASS (1/100) if (ptr && avpkt->size > 0 && !subviewer_event_to_ass(&buf, ptr)) - ff_ass_add_rect(sub, buf.str, avpkt->pts, avpkt->duration, 0); - *got_sub_ptr = sub->num_rects > 0; + ret = ff_ass_add_rect_bprint(sub, &buf, avpkt->pts, avpkt->duration); av_bprint_finalize(&buf, NULL); + if (ret < 0) + return ret; + *got_sub_ptr = sub->num_rects > 0; return avpkt->size; }