diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-06 13:41:07 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-06 13:42:41 +0100 |
commit | b6a99563962c27380e14c6f725cc8f6ae9ee5d22 (patch) | |
tree | 87331cbe19780965be15699b3ee7c4051e60bd83 /libavformat/oggparseflac.c | |
parent | a51eb6d34ceda7cc4f46fc3f9d0e9b57eba61cb6 (diff) | |
parent | 7784f47762d59e859b4d0f74b3e021ad9368ee2c (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/oggparseflac.c')
-rw-r--r-- | libavformat/oggparseflac.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c index 9f0f808b37..c7fb44618d 100644 --- a/libavformat/oggparseflac.c +++ b/libavformat/oggparseflac.c @@ -34,7 +34,6 @@ flac_header (AVFormatContext * s, int idx) struct ogg_stream *os = ogg->streams + idx; AVStream *st = s->streams[idx]; GetBitContext gb; - FLACStreaminfo si; int mdt; if (os->buf[os->pstart] == 0xff) @@ -46,6 +45,8 @@ flac_header (AVFormatContext * s, int idx) if (mdt == OGG_FLAC_METADATA_TYPE_STREAMINFO) { uint8_t *streaminfo_start = os->buf + os->pstart + 5 + 4 + 4 + 4; + uint32_t samplerate; + skip_bits_long(&gb, 4*8); /* "FLAC" */ if(get_bits(&gb, 8) != 1) /* unsupported major version */ return -1; @@ -56,8 +57,6 @@ flac_header (AVFormatContext * s, int idx) if (get_bits_long(&gb, 32) != FLAC_STREAMINFO_SIZE) return -1; - avpriv_flac_parse_streaminfo(st->codec, &si, streaminfo_start); - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_FLAC; st->need_parsing = AVSTREAM_PARSE_HEADERS; @@ -66,7 +65,11 @@ flac_header (AVFormatContext * s, int idx) return AVERROR(ENOMEM); memcpy(st->codec->extradata, streaminfo_start, st->codec->extradata_size); - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); + samplerate = AV_RB24(st->codec->extradata + 10) >> 4; + if (!samplerate) + return AVERROR_INVALIDDATA; + + avpriv_set_pts_info(st, 64, 1, samplerate); } else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) { ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 4, os->psize - 4); } |