diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-02-01 10:51:46 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2016-02-01 10:51:46 +0100 |
commit | 9ca5b27240105b89bd914db45329d9a310c55c18 (patch) | |
tree | 7e797a660fd97bb0609fb411ca8963b87af260e8 | |
parent | 09b3a42495b43d1bfc5ed36d924b6223b0761f91 (diff) | |
download | ffmpeg-streaming-9ca5b27240105b89bd914db45329d9a310c55c18.zip ffmpeg-streaming-9ca5b27240105b89bd914db45329d9a310c55c18.tar.gz |
lavf/adxdec: Add Autodetection.
-rw-r--r-- | libavformat/adxdec.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index 66ea8ab..05cef0b 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -34,6 +34,19 @@ typedef struct ADXDemuxerContext { int header_size; } ADXDemuxerContext; +static int adx_probe(AVProbeData *p) +{ + int offset; + if (AV_RB16(p->buf) != 0x8000) + return 0; + offset = AV_RB16(&p->buf[2]); + if ( offset < 8 + || offset > p->buf_size - 4 + || memcmp(p->buf + offset - 2, "(c)CRI", 6)) + return 0; + return AVPROBE_SCORE_MAX * 3 / 4; +} + static int adx_read_packet(AVFormatContext *s, AVPacket *pkt) { ADXDemuxerContext *c = s->priv_data; @@ -107,6 +120,7 @@ static int adx_read_header(AVFormatContext *s) AVInputFormat ff_adx_demuxer = { .name = "adx", .long_name = NULL_IF_CONFIG_SMALL("CRI ADX"), + .read_probe = adx_probe, .priv_data_size = sizeof(ADXDemuxerContext), .read_header = adx_read_header, .read_packet = adx_read_packet, |