On Fri, 15 Apr 2016 15:01:23 +0200 Clément Bœsch <u...@pkh.me> wrote:
> On Fri, Apr 15, 2016 at 02:58:00PM +0200, wm4 wrote: > > Stolen from microdvddec.c. > > > > Fixes ticket #5442. > > --- > > libavformat/mpl2dec.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c > > index 59589d5..2a0cb28 100644 > > --- a/libavformat/mpl2dec.c > > +++ b/libavformat/mpl2dec.c > > @@ -26,6 +26,7 @@ > > #include "avformat.h" > > #include "internal.h" > > #include "subtitles.h" > > +#include "libavutil/intreadwrite.h" > > > > typedef struct { > > FFDemuxSubtitlesQueue q; > > @@ -39,6 +40,9 @@ static int mpl2_probe(AVProbeData *p) > > const unsigned char *ptr = p->buf; > > const unsigned char *ptr_end = ptr + p->buf_size; > > > > + if (AV_RB24(ptr) == 0xEFBBBF) > > + ptr += 3; /* skip UTF-8 BOM */ > > + > > for (i = 0; i < 2; i++) { > > if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", &start, &end, &c) != 3 > > && > > sscanf(ptr, "[%"SCNd64"][]%c", &start, &c) != > > 2) > > make sure you don't need it in the read_header() callback too. > > BTW, as a side note, it will be appropriate to s/if/while/, I have a few > samples with more than one bom... IIRC only in ASS files but we probably > to have it uniformly across sub text decoder. It's fine to keep it > consistent with a single if for now. > > thanks > Indeed the BOM causes dropping the first subtitle event in read_header(). _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel