summaryrefslogtreecommitdiffstats
path: root/libavcodec/flac_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2014-04-14 18:34:53 +0200
committerMichael Niedermayer <[email protected]>2014-04-14 18:35:02 +0200
commit3df787a1ef1600dda034d9e0c0b13bf27e952f22 (patch)
treea06d3a96d243f870271ad2a331700b6f580b4708 /libavcodec/flac_parser.c
parent46d5625f44185271862337d61cd246fd569c42a4 (diff)
parentd8b19ee672965641a12048f0b0b366d9146a166c (diff)
Merge branch 'flac' of https://github.com/FernetMenta/FFmpeg
Merged-by: Michael Niedermayer <[email protected]>
Diffstat (limited to 'libavcodec/flac_parser.c')
-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;