summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_mux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-12-11 14:44:38 +0100
committerAnton Khirnov <anton@khirnov.net>2022-07-23 11:53:19 +0200
commit9fe62a545f02c63ebae3a2fe26e4018e4be1e655 (patch)
treebcc55b05d9d97cdda2636eb6fe9734281bf82355 /fftools/ffmpeg_mux.c
parent6a23be92d2a0b1f5100afa0fd3ff33e8510b6eb3 (diff)
downloadffmpeg-9fe62a545f02c63ebae3a2fe26e4018e4be1e655.tar.gz
fftools/ffmpeg: add a helper function to access output file size
Stop accessing muxer internals from outside of ffmpeg_mux.
Diffstat (limited to 'fftools/ffmpeg_mux.c')
-rw-r--r--fftools/ffmpeg_mux.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index e47a55c4e9..83558f7f7d 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -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;
+}