diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-08-28 10:13:25 +0000 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-11-06 09:02:25 +0100 |
commit | 7784f47762d59e859b4d0f74b3e021ad9368ee2c (patch) | |
tree | 41486f3a547794d187e4261a8716e4e7900aa38d /libavformat/flacdec.c | |
parent | 56dc46a1893251e74be1ad63e54fb38d754bb1fe (diff) | |
download | ffmpeg-7784f47762d59e859b4d0f74b3e021ad9368ee2c.tar.gz |
lavf: stop using avpriv_flac_parse_streaminfo()
The only parameters needed by the demuxers are the sample rate and sample
count, which can be trivially extracted manually, without resorting to
an avpriv function.
Diffstat (limited to 'libavformat/flacdec.c')
-rw-r--r-- | libavformat/flacdec.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index e044fd0b5a..8abdd9d5b4 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -27,7 +27,6 @@ #include "oggdec.h" #include "vorbiscomment.h" #include "replaygain.h" -#include "libavcodec/bytestream.h" static int flac_read_header(AVFormatContext *s) { @@ -76,7 +75,9 @@ static int flac_read_header(AVFormatContext *s) } if (metadata_type == FLAC_METADATA_TYPE_STREAMINFO) { - FLACStreaminfo si; + uint32_t samplerate; + uint64_t samples; + /* STREAMINFO can only occur once */ if (found_streaminfo) { av_freep(&buffer); @@ -91,14 +92,16 @@ static int flac_read_header(AVFormatContext *s) st->codec->extradata_size = metadata_size; buffer = NULL; - /* get codec params from STREAMINFO header */ - avpriv_flac_parse_streaminfo(st->codec, &si, st->codec->extradata); + /* get sample rate and sample count from STREAMINFO header; + * other parameters will be extracted by the parser */ + samplerate = AV_RB24(st->codec->extradata + 10) >> 4; + samples = (AV_RB64(st->codec->extradata + 13) >> 24) & ((1ULL << 36) - 1); /* set time base and duration */ - if (si.samplerate > 0) { - avpriv_set_pts_info(st, 64, 1, si.samplerate); - if (si.samples > 0) - st->duration = si.samples; + if (samplerate > 0) { + avpriv_set_pts_info(st, 64, 1, samplerate); + if (samples > 0) + st->duration = samples; } } else if (metadata_type == FLAC_METADATA_TYPE_CUESHEET) { uint8_t isrc[13]; |