summaryrefslogtreecommitdiff
path: root/libavformat/apm.c
diff options
context:
space:
mode:
authorZane van Iperen <zane@zanevaniperen.com>2020-06-12 11:46:15 +0000
committerMichael Niedermayer <michael@niedermayer.cc>2020-06-17 21:45:10 +0200
commita37109d55574a3c388f3e65610244d10dac8dd59 (patch)
tree0cbd0de78856278fe0356ac5c0109883514a95c9 /libavformat/apm.c
parent94bac7b3f8dcd8af33d9f7e18b4e4e73c73f98dd (diff)
avformat/apm: check codec tag in probe and add constant
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/apm.c')
-rw-r--r--libavformat/apm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/apm.c b/libavformat/apm.c
index 9d2a856cc4..dc59c16562 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -29,6 +29,7 @@
#define APM_VS12_CHUNK_SIZE 76
#define APM_MAX_READ_SIZE 4096
+#define APM_TAG_CODEC 0x2000
#define APM_TAG_VS12 MKTAG('v', 's', '1', '2')
#define APM_TAG_DATA MKTAG('D', 'A', 'T', 'A')
@@ -74,6 +75,9 @@ static void apm_parse_vs12(APMVS12Chunk *vs12, const uint8_t *buf)
static int apm_probe(const AVProbeData *p)
{
+ if (AV_RL16(p->buf) != APM_TAG_CODEC)
+ return 0;
+
if (p->buf_size < 100)
return 0;
@@ -103,7 +107,7 @@ static int apm_read_header(AVFormatContext *s)
if (st->codecpar->bits_per_coded_sample != 4)
return AVERROR_INVALIDDATA;
- if (st->codecpar->codec_tag != 0x2000)
+ if (st->codecpar->codec_tag != APM_TAG_CODEC)
return AVERROR_INVALIDDATA;
/* ff_get_wav_header() does most of the work, but we need to fix a few things. */