summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2014-04-12 18:13:32 +0200
committerRainer Hochecker <fernetmenta@online.de>2014-04-14 17:43:19 +0200
commite1fcd3a007591193891df1095f5263e9e5e71958 (patch)
treef8fb9e88811822f97235bffc07e04f54cee7b3bb /libavcodec
parente89f3d0ed21259a714a8bd5d05d95af5b1e0f73f (diff)
downloadffmpeg-e1fcd3a007591193891df1095f5263e9e5e71958.tar.gz
flac demuxer: improve seeking
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/flac_parser.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index ba1f060fd9..6ff4d9c85f 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -489,6 +489,14 @@ static int get_best_header(FLACParseContext* fpc, const uint8_t **poutbuf,
&fpc->wrap_buf,
&fpc->wrap_buf_allocated_size);
+
+ if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){
+ if (header->fi.is_var_size)
+ fpc->pc->pts = header->fi.frame_or_sample_num;
+ else if (header->best_child)
+ fpc->pc->pts = header->fi.frame_or_sample_num * header->fi.blocksize;
+ }
+
fpc->best_header_valid = 0;
fpc->last_fi_valid = 1;
fpc->last_fi = header->fi;
@@ -516,6 +524,11 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
s->duration = fi.blocksize;
if (!avctx->sample_rate)
avctx->sample_rate = fi.samplerate;
+ if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){
+ fpc->pc->pts = fi.frame_or_sample_num;
+ if (!fi.is_var_size)
+ fpc->pc->pts *= fi.blocksize;
+ }
}
*poutbuf = buf;
*poutbuf_size = buf_size;