diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2015-10-02 03:15:04 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2015-10-02 03:15:04 +0200 |
commit | da767f06f50f352c8b5d41fa73b99c65f525dfb5 (patch) | |
tree | 9bd4c2adf3fa9608699cf03663e05bb13d8d42b9 /libavformat/rawdec.c | |
parent | 94d50b5d00ced1d341cf8bfd3f318ebec76dbdea (diff) | |
download | ffmpeg-da767f06f50f352c8b5d41fa73b99c65f525dfb5.tar.gz |
lavf/rawdec: Autodetect raw TrueHD streams.
Diffstat (limited to 'libavformat/rawdec.c')
-rw-r--r-- | libavformat/rawdec.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 56ac1997ce..ef84d37a5a 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -206,14 +206,14 @@ static int mjpeg_probe(AVProbeData *p) FF_DEF_RAWVIDEO_DEMUXER2(mjpeg, "raw MJPEG video", mjpeg_probe, "mjpg,mjpeg,mpo", AV_CODEC_ID_MJPEG, AVFMT_GENERIC_INDEX|AVFMT_NOTIMESTAMPS) #endif -#if CONFIG_MLP_DEMUXER -static int mlp_probe(AVProbeData *p) +#if CONFIG_MLP_DEMUXER || CONFIG_TRUEHD_DEMUXER +static int av_always_inline mlp_thd_probe(AVProbeData *p, uint32_t sync) { const uint8_t *buf, *last_buf = p->buf, *end = p->buf + p->buf_size; int frames = 0, valid = 0, size = 0; for (buf = p->buf; buf + 8 <= end; buf++) { - if (AV_RB32(buf + 4) == 0xf8726fbb) { + if (AV_RB32(buf + 4) == sync) { frames++; if (last_buf + size == buf) { valid++; @@ -228,6 +228,13 @@ static int mlp_probe(AVProbeData *p) return AVPROBE_SCORE_MAX; return 0; } +#endif + +#if CONFIG_MLP_DEMUXER +static int mlp_probe(AVProbeData *p) +{ + return mlp_thd_probe(p, 0xf8726fbb); +} AVInputFormat ff_mlp_demuxer = { .name = "mlp", @@ -242,9 +249,15 @@ AVInputFormat ff_mlp_demuxer = { #endif #if CONFIG_TRUEHD_DEMUXER +static int thd_probe(AVProbeData *p) +{ + return mlp_thd_probe(p, 0xf8726fba); +} + AVInputFormat ff_truehd_demuxer = { .name = "truehd", .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"), + .read_probe = thd_probe, .read_header = ff_raw_audio_read_header, .read_packet = ff_raw_read_partial_packet, .flags = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS, |