[FFmpeg-devel] [PATCH 6/7] avformat/apm: name and probe fix
Zane van Iperen
zane at zanevaniperen.com
Tue Jun 9 03:19:55 EEST 2020
Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
---
libavformat/apm.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavformat/apm.c b/libavformat/apm.c
index 46a0c67b79..8ece104ae7 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -31,8 +31,8 @@
#define APM_EXTRADATA_SIZE 28
#define APM_MAX_READ_SIZE 4096
-#define APM_CODEC_TAG 0x2000
+#define APM_TAG_CODEC 0x2000
#define APM_TAG_VS12 MKTAG('v', 's', '1', '2')
#define APM_TAG_DATA MKTAG('D', 'A', 'T', 'A')
@@ -82,6 +82,9 @@ static void apm_parse_extradata(APMExtraData *ed, 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;
@@ -109,7 +112,7 @@ static int apm_read_header(AVFormatContext *s)
* This is 98% a WAVEFORMATEX, but there's something screwy with the extradata
* that ff_get_wav_header() can't (and shouldn't) handle properly.
*/
- if (avio_rl16(s->pb) != APM_CODEC_TAG)
+ if (avio_rl16(s->pb) != APM_TAG_CODEC)
return AVERROR_INVALIDDATA;
par = st->codecpar;
@@ -248,7 +251,7 @@ static int apm_write_header(AVFormatContext *s)
* Bodge a WAVEFORMATEX manually, ff_put_wav_header() can't
* be used because of the extra 2 bytes.
*/
- avio_wl16(s->pb, APM_CODEC_TAG);
+ avio_wl16(s->pb, APM_TAG_CODEC);
avio_wl16(s->pb, par->channels);
avio_wl32(s->pb, par->sample_rate);
avio_wl32(s->pb, par->sample_rate * par->channels * 2);
--
2.25.1
More information about the ffmpeg-devel
mailing list