summaryrefslogtreecommitdiff
path: root/libavformat/flacdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-06 13:41:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-06 13:42:41 +0100
commitb6a99563962c27380e14c6f725cc8f6ae9ee5d22 (patch)
tree87331cbe19780965be15699b3ee7c4051e60bd83 /libavformat/flacdec.c
parenta51eb6d34ceda7cc4f46fc3f9d0e9b57eba61cb6 (diff)
parent7784f47762d59e859b4d0f74b3e021ad9368ee2c (diff)
Merge commit '7784f47762d59e859b4d0f74b3e021ad9368ee2c'
* commit '7784f47762d59e859b4d0f74b3e021ad9368ee2c': lavf: stop using avpriv_flac_parse_streaminfo() Conflicts: libavcodec/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/flacdec.c')
-rw-r--r--libavformat/flacdec.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index c291393954..1a8dc19af3 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)
{
@@ -75,7 +74,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) {
RETURN_ERROR(AVERROR_INVALIDDATA);
@@ -88,14 +89,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];