diff options
author | wm4 <nfxjfg@googlemail.com> | 2014-03-02 22:36:41 +0100 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2014-03-03 23:26:27 +0100 |
commit | 0786598f51ce0811cce7a087ba76fa6fd984327e (patch) | |
tree | fd05adbc80ed03e80470f27d71b0380830d46fb0 /libavformat/microdvddec.c | |
parent | b79dfd16cbf08ffb250945ecfcac04a2a4775702 (diff) | |
download | ffmpeg-0786598f51ce0811cce7a087ba76fa6fd984327e.tar.gz |
avformat/microdvd: skip BOM properly
The BOM is already skipped in the probe function, but not the header
read function. This could cause the header to be misparsed, such as
not interpreting the FPS line.
Diffstat (limited to 'libavformat/microdvddec.c')
-rw-r--r-- | libavformat/microdvddec.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libavformat/microdvddec.c b/libavformat/microdvddec.c index 7b49e43976..42c6de0098 100644 --- a/libavformat/microdvddec.c +++ b/libavformat/microdvddec.c @@ -71,22 +71,29 @@ static int get_duration(const char *buf) return -1; } +static const char *bom = "\xEF\xBB\xBF"; + static int microdvd_read_header(AVFormatContext *s) { AVRational pts_info = (AVRational){ 2997, 125 }; /* default: 23.976 fps */ MicroDVDContext *microdvd = s->priv_data; AVStream *st = avformat_new_stream(s, NULL); int i = 0; - char line[MAX_LINESIZE]; + char line_buf[MAX_LINESIZE]; if (!st) return AVERROR(ENOMEM); while (!url_feof(s->pb)) { - char *p = line; + char *p; AVPacket *sub; int64_t pos = avio_tell(s->pb); - int len = ff_get_line(s->pb, line, sizeof(line)); + int len = ff_get_line(s->pb, line_buf, sizeof(line_buf)); + char *line = line_buf; + + if (!strncmp(line, bom, 3)) + line += 3; + p = line; if (!len) break; |