mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
avformat/mpl2dec: skip BOM when probing
Fixes #5442. Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
a5c1c7a8b3
commit
74267333a1
@ -23,6 +23,8 @@
|
|||||||
* MPL2 subtitles format demuxer
|
* MPL2 subtitles format demuxer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/intreadwrite.h"
|
||||||
|
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "subtitles.h"
|
#include "subtitles.h"
|
||||||
@ -39,6 +41,9 @@ static int mpl2_probe(AVProbeData *p)
|
|||||||
const unsigned char *ptr = p->buf;
|
const unsigned char *ptr = p->buf;
|
||||||
const unsigned char *ptr_end = ptr + p->buf_size;
|
const unsigned char *ptr_end = ptr + p->buf_size;
|
||||||
|
|
||||||
|
if (AV_RB24(ptr) == 0xefbbbf)
|
||||||
|
ptr += 3;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", &start, &end, &c) != 3 &&
|
if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", &start, &end, &c) != 3 &&
|
||||||
sscanf(ptr, "[%"SCNd64"][]%c", &start, &c) != 2)
|
sscanf(ptr, "[%"SCNd64"][]%c", &start, &c) != 2)
|
||||||
@ -83,6 +88,9 @@ static int mpl2_read_header(AVFormatContext *s)
|
|||||||
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
|
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
|
||||||
st->codecpar->codec_id = AV_CODEC_ID_MPL2;
|
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)) {
|
while (!avio_feof(s->pb)) {
|
||||||
char line[4096];
|
char line[4096];
|
||||||
char *p = line;
|
char *p = line;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user