summaryrefslogtreecommitdiff
path: root/libavformat/oggparseflac.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-07 01:12:23 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-10-07 01:36:05 +0200
commit8f2386b5894d23d802a61b75dfccaa0f4f8e234e (patch)
tree9734f86eda7a69276efd28a3cea9a0c2a16aa3b2 /libavformat/oggparseflac.c
parent630c005b879ad23114a55864426e9c9e0eec9668 (diff)
downloadffmpeg-8f2386b5894d23d802a61b75dfccaa0f4f8e234e.tar.gz
avformat/oggparseflac: fix handling of old flac in ogg
Improves handling of the file in Ticket1617 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggparseflac.c')
-rw-r--r--libavformat/oggparseflac.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index 3ff594e3c4..08fd77e9ed 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -78,11 +78,32 @@ flac_header (AVFormatContext * s, int idx)
static int
old_flac_header (AVFormatContext * s, int idx)
{
+ struct ogg *ogg = s->priv_data;
AVStream *st = s->streams[idx];
+ struct ogg_stream *os = ogg->streams + idx;
+ AVCodecParserContext *parser = av_parser_init(AV_CODEC_ID_FLAC);
+ int size;
+ uint8_t *data;
+
+ if (!parser)
+ return -1;
+
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = AV_CODEC_ID_FLAC;
- return 0;
+ parser->flags = PARSER_FLAG_COMPLETE_FRAMES;
+ av_parser_parse2(parser, st->codec,
+ &data, &size, os->buf + os->pstart, os->psize,
+ AV_NOPTS_VALUE, AV_NOPTS_VALUE, -1);
+
+ av_parser_close(parser);
+
+ if (st->codec->sample_rate) {
+ avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
+ return 0;
+ }
+
+ return 1;
}
const struct ogg_codec ff_flac_codec = {