fftools/ffmpeg: add a helper function to access output file size

Stop accessing muxer internals from outside of ffmpeg_mux.
This commit is contained in:
Anton Khirnov
2021-12-11 14:44:38 +01:00
parent 6a23be92d2
commit 9fe62a545f
3 changed files with 16 additions and 9 deletions

View File

@@ -333,3 +333,17 @@ int of_muxer_init(OutputFile *of)
return 0;
}
int64_t of_filesize(OutputFile *of)
{
AVIOContext *pb = of->ctx->pb;
int64_t ret = -1;
if (pb) {
ret = avio_size(pb);
if (ret <= 0) // FIXME improve avio_size() so it works with non seekable output too
ret = avio_tell(pb);
}
return ret;
}