This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 40f085ac3d12e7150f97dea70efd0f8ac9186d50 Author: Jun Zhao <[email protected]> AuthorDate: Sun Mar 8 22:44:17 2026 +0800 Commit: toots <[email protected]> CommitDate: Wed Mar 18 02:08:09 2026 +0000 doc/examples: fix output context cleanup in transcode examples avformat_close_input() is designed for input format contexts only. Using it on output contexts is API misuse — it accesses iformat (which is NULL for output contexts) and does not follow the correct output cleanup path. Replace with the proper pattern already used in remux.c and transcode.c: avio_closep() to close the IO handle, followed by avformat_free_context() to free the format context. Signed-off-by: Jun Zhao <[email protected]> --- doc/examples/qsv_transcode.c | 4 +++- doc/examples/vaapi_transcode.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/examples/qsv_transcode.c b/doc/examples/qsv_transcode.c index c3f507e8e6..b4230e7a38 100644 --- a/doc/examples/qsv_transcode.c +++ b/doc/examples/qsv_transcode.c @@ -430,7 +430,9 @@ int main(int argc, char **argv) end: avformat_close_input(&ifmt_ctx); - avformat_close_input(&ofmt_ctx); + if (ofmt_ctx && !(ofmt_ctx->oformat->flags & AVFMT_NOFILE)) + avio_closep(&ofmt_ctx->pb); + avformat_free_context(ofmt_ctx); avcodec_free_context(&decoder_ctx); avcodec_free_context(&encoder_ctx); av_buffer_unref(&hw_device_ctx); diff --git a/doc/examples/vaapi_transcode.c b/doc/examples/vaapi_transcode.c index e1b7a43883..dba37d4bcb 100644 --- a/doc/examples/vaapi_transcode.c +++ b/doc/examples/vaapi_transcode.c @@ -294,7 +294,9 @@ int main(int argc, char **argv) end: avformat_close_input(&ifmt_ctx); - avformat_close_input(&ofmt_ctx); + if (ofmt_ctx && !(ofmt_ctx->oformat->flags & AVFMT_NOFILE)) + avio_closep(&ofmt_ctx->pb); + avformat_free_context(ofmt_ctx); avcodec_free_context(&decoder_ctx); avcodec_free_context(&encoder_ctx); av_buffer_unref(&hw_device_ctx); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
