[FFmpeg-devel] [PATCH] lavf/mpl2dec: skip BOM

wm4 nfxjfg at googlemail.com
Fri Apr 15 14:58:00 CEST 2016


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)
-- 
2.8.0.rc3



More information about the ffmpeg-devel mailing list