提交 40665d27 编写于 作者: U Uwe L. Korn 提交者: Martin Storsjö

flvdec: Document how the duration is retrieved at the end of the file

Signed-off-by: NMartin Storsjö <martin@martin.st>
上级 fe42f94c
......@@ -845,9 +845,13 @@ skip:
if (s->pb->seekable && (!s->duration || s->duration == AV_NOPTS_VALUE)) {
int size;
const int64_t pos = avio_tell(s->pb);
// Read the last 4 bytes of the file, this should be the size of the
// previous FLV tag. Use the timestamp of its payload as duration.
const int64_t fsize = avio_size(s->pb);
avio_seek(s->pb, fsize - 4, SEEK_SET);
size = avio_rb32(s->pb);
// Seek to the start of the last FLV tag at position (fsize - 4 - size)
// but skip the byte indicating the type.
avio_seek(s->pb, fsize - 3 - size, SEEK_SET);
if (size == avio_rb24(s->pb) + 11) {
uint32_t ts = avio_rb24(s->pb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册