Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
On 2/15/17, Paul B Maholwrote: > Fixes #5442. > > Signed-off-by: Paul B Mahol > --- > libavformat/mpl2dec.c | 8 > 1 file changed, 8 insertions(+) > Will apply this shortly. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
Fixes #5442. Signed-off-by: Paul B Mahol--- libavformat/mpl2dec.c | 8 1 file changed, 8 insertions(+) diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c index 59589d5..dfcdf5a 100644 --- a/libavformat/mpl2dec.c +++ b/libavformat/mpl2dec.c @@ -23,6 +23,8 @@ * MPL2 subtitles format demuxer */ +#include "libavutil/intreadwrite.h" + #include "avformat.h" #include "internal.h" #include "subtitles.h" @@ -39,6 +41,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; + for (i = 0; i < 2; i++) { if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != 3 && sscanf(ptr, "[%"SCNd64"][]%c", , ) != 2) @@ -83,6 +88,9 @@ static int mpl2_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_id = AV_CODEC_ID_MPL2; +if (avio_rb24(s->pb) != 0xefbbbf) +avio_seek(s->pb, -3, SEEK_CUR); + while (!avio_feof(s->pb)) { char line[4096]; char *p = line; -- 2.9.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
On Wed, 15 Feb 2017 10:07:48 +0100 Paul B Maholwrote: > On 2/15/17, wm4 wrote: > > On Sat, 11 Feb 2017 11:56:07 +0100 > > Paul B Mahol wrote: > > > >> Signed-off-by: Paul B Mahol > >> --- > >> libavformat/mpl2dec.c | 8 > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c > >> index 59589d5..0e30cb0 100644 > >> --- a/libavformat/mpl2dec.c > >> +++ b/libavformat/mpl2dec.c > >> @@ -23,6 +23,8 @@ > >> * MPL2 subtitles format demuxer > >> */ > >> > >> +#include "libavutil/intreadwrite.h" > >> + > >> #include "avformat.h" > >> #include "internal.h" > >> #include "subtitles.h" > >> @@ -39,6 +41,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; > >> + > >> for (i = 0; i < 2; i++) { > >> if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != > >> 3 && > >> sscanf(ptr, "[%"SCNd64"][]%c", , ) != > >> 2) > >> @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s) > >> if (!len) > >> break; > >> > >> +if (AV_RB24(p) == 0xefbbbf) > >> +p += 3; > >> + > >> line[strcspn(line, "\r\n")] = 0; > >> > >> if (!read_ts(, _start, )) { > > > > What happened to the equivalent patch I sent almost a year ago? My > > patch skipped it only in the probe function, because the subtitle line > > reader skips BOM already. > > It doesn't appear that is true. Right, seems like it's not using FFTextReader. > > > > It referenced the same trac ticket. > > You needd to resend/ping patch more often. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
On 2/15/17, wm4wrote: > On Sat, 11 Feb 2017 11:56:07 +0100 > Paul B Mahol wrote: > >> Signed-off-by: Paul B Mahol >> --- >> libavformat/mpl2dec.c | 8 >> 1 file changed, 8 insertions(+) >> >> diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c >> index 59589d5..0e30cb0 100644 >> --- a/libavformat/mpl2dec.c >> +++ b/libavformat/mpl2dec.c >> @@ -23,6 +23,8 @@ >> * MPL2 subtitles format demuxer >> */ >> >> +#include "libavutil/intreadwrite.h" >> + >> #include "avformat.h" >> #include "internal.h" >> #include "subtitles.h" >> @@ -39,6 +41,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; >> + >> for (i = 0; i < 2; i++) { >> if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != >> 3 && >> sscanf(ptr, "[%"SCNd64"][]%c", , ) != >> 2) >> @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s) >> if (!len) >> break; >> >> +if (AV_RB24(p) == 0xefbbbf) >> +p += 3; >> + >> line[strcspn(line, "\r\n")] = 0; >> >> if (!read_ts(, _start, )) { > > What happened to the equivalent patch I sent almost a year ago? My > patch skipped it only in the probe function, because the subtitle line > reader skips BOM already. It doesn't appear that is true. > > It referenced the same trac ticket. You needd to resend/ping patch more often. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
On Sat, 11 Feb 2017 11:56:07 +0100 Paul B Maholwrote: > Signed-off-by: Paul B Mahol > --- > libavformat/mpl2dec.c | 8 > 1 file changed, 8 insertions(+) > > diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c > index 59589d5..0e30cb0 100644 > --- a/libavformat/mpl2dec.c > +++ b/libavformat/mpl2dec.c > @@ -23,6 +23,8 @@ > * MPL2 subtitles format demuxer > */ > > +#include "libavutil/intreadwrite.h" > + > #include "avformat.h" > #include "internal.h" > #include "subtitles.h" > @@ -39,6 +41,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; > + > for (i = 0; i < 2; i++) { > if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != 3 && > sscanf(ptr, "[%"SCNd64"][]%c", , ) != 2) > @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s) > if (!len) > break; > > +if (AV_RB24(p) == 0xefbbbf) > +p += 3; > + > line[strcspn(line, "\r\n")] = 0; > > if (!read_ts(, _start, )) { What happened to the equivalent patch I sent almost a year ago? My patch skipped it only in the probe function, because the subtitle line reader skips BOM already. It referenced the same trac ticket. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
On 2/12/17, Clement Boeschwrote: > On Sun, Feb 12, 2017 at 12:51:11PM +0100, Paul B Mahol wrote: >> On 2/11/17, Clement Boesch wrote: >> > On Sat, Feb 11, 2017 at 11:56:07AM +0100, Paul B Mahol wrote: >> >> Signed-off-by: Paul B Mahol >> >> --- >> >> libavformat/mpl2dec.c | 8 >> >> 1 file changed, 8 insertions(+) >> >> >> >> diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c >> >> index 59589d5..0e30cb0 100644 >> >> --- a/libavformat/mpl2dec.c >> >> +++ b/libavformat/mpl2dec.c >> >> @@ -23,6 +23,8 @@ >> >> * MPL2 subtitles format demuxer >> >> */ >> >> >> >> +#include "libavutil/intreadwrite.h" >> >> + >> >> #include "avformat.h" >> >> #include "internal.h" >> >> #include "subtitles.h" >> >> @@ -39,6 +41,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; >> >> + >> >> for (i = 0; i < 2; i++) { >> >> if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) >> >> != >> >> 3 && >> >> sscanf(ptr, "[%"SCNd64"][]%c", , ) >> >> != >> >> 2) >> >> @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s) >> >> if (!len) >> >> break; >> >> >> >> +if (AV_RB24(p) == 0xefbbbf) >> >> +p += 3; >> >> + >> > >> > The BOM is supposed to be at the beginning of the file, not at every >> > line. >> > The check should be outside the while loop. >> > >> > -- >> > Clement B. >> > >> >> Removed check which was there, it appears to still work. > > Doesn't it skip the first event? Or maybe your libc skips it in sscanf? Ah, first even is indeed skipped. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
On Sun, Feb 12, 2017 at 12:51:11PM +0100, Paul B Mahol wrote: > On 2/11/17, Clement Boeschwrote: > > On Sat, Feb 11, 2017 at 11:56:07AM +0100, Paul B Mahol wrote: > >> Signed-off-by: Paul B Mahol > >> --- > >> libavformat/mpl2dec.c | 8 > >> 1 file changed, 8 insertions(+) > >> > >> diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c > >> index 59589d5..0e30cb0 100644 > >> --- a/libavformat/mpl2dec.c > >> +++ b/libavformat/mpl2dec.c > >> @@ -23,6 +23,8 @@ > >> * MPL2 subtitles format demuxer > >> */ > >> > >> +#include "libavutil/intreadwrite.h" > >> + > >> #include "avformat.h" > >> #include "internal.h" > >> #include "subtitles.h" > >> @@ -39,6 +41,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; > >> + > >> for (i = 0; i < 2; i++) { > >> if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != > >> 3 && > >> sscanf(ptr, "[%"SCNd64"][]%c", , ) != > >> 2) > >> @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s) > >> if (!len) > >> break; > >> > >> +if (AV_RB24(p) == 0xefbbbf) > >> +p += 3; > >> + > > > > The BOM is supposed to be at the beginning of the file, not at every line. > > The check should be outside the while loop. > > > > -- > > Clement B. > > > > Removed check which was there, it appears to still work. Doesn't it skip the first event? Or maybe your libc skips it in sscanf? -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
On 2/11/17, Clement Boeschwrote: > On Sat, Feb 11, 2017 at 11:56:07AM +0100, Paul B Mahol wrote: >> Signed-off-by: Paul B Mahol >> --- >> libavformat/mpl2dec.c | 8 >> 1 file changed, 8 insertions(+) >> >> diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c >> index 59589d5..0e30cb0 100644 >> --- a/libavformat/mpl2dec.c >> +++ b/libavformat/mpl2dec.c >> @@ -23,6 +23,8 @@ >> * MPL2 subtitles format demuxer >> */ >> >> +#include "libavutil/intreadwrite.h" >> + >> #include "avformat.h" >> #include "internal.h" >> #include "subtitles.h" >> @@ -39,6 +41,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; >> + >> for (i = 0; i < 2; i++) { >> if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != >> 3 && >> sscanf(ptr, "[%"SCNd64"][]%c", , ) != >> 2) >> @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s) >> if (!len) >> break; >> >> +if (AV_RB24(p) == 0xefbbbf) >> +p += 3; >> + > > The BOM is supposed to be at the beginning of the file, not at every line. > The check should be outside the while loop. > > -- > Clement B. > Removed check which was there, it appears to still work. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
On Sat, Feb 11, 2017 at 11:56:07AM +0100, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol> --- > libavformat/mpl2dec.c | 8 > 1 file changed, 8 insertions(+) > > diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c > index 59589d5..0e30cb0 100644 > --- a/libavformat/mpl2dec.c > +++ b/libavformat/mpl2dec.c > @@ -23,6 +23,8 @@ > * MPL2 subtitles format demuxer > */ > > +#include "libavutil/intreadwrite.h" > + > #include "avformat.h" > #include "internal.h" > #include "subtitles.h" > @@ -39,6 +41,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; > + > for (i = 0; i < 2; i++) { > if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != 3 && > sscanf(ptr, "[%"SCNd64"][]%c", , ) != 2) > @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s) > if (!len) > break; > > +if (AV_RB24(p) == 0xefbbbf) > +p += 3; > + The BOM is supposed to be at the beginning of the file, not at every line. The check should be outside the while loop. -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
2017-02-11 11:56 GMT+01:00 Paul B Mahol: > Signed-off-by: Paul B Mahol Please mention ticket #5442. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/mpl2dec: skip BOM when probing
Signed-off-by: Paul B Mahol--- libavformat/mpl2dec.c | 8 1 file changed, 8 insertions(+) diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c index 59589d5..0e30cb0 100644 --- a/libavformat/mpl2dec.c +++ b/libavformat/mpl2dec.c @@ -23,6 +23,8 @@ * MPL2 subtitles format demuxer */ +#include "libavutil/intreadwrite.h" + #include "avformat.h" #include "internal.h" #include "subtitles.h" @@ -39,6 +41,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; + for (i = 0; i < 2; i++) { if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != 3 && sscanf(ptr, "[%"SCNd64"][]%c", , ) != 2) @@ -94,6 +99,9 @@ static int mpl2_read_header(AVFormatContext *s) if (!len) break; +if (AV_RB24(p) == 0xefbbbf) +p += 3; + line[strcspn(line, "\r\n")] = 0; if (!read_ts(, _start, )) { -- 2.9.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel