[FFmpeg-devel] [PATCH 4/6] doc/examples/transcode: improve reporting when the encoder is not found

Stefano Sabatini stefasab at gmail.com
Sat Sep 2 02:14:45 EEST 2023


Also return EINVAL in place of INVALIDDATA.
---
 doc/examples/transcode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c
index 1ec4a3c230..aa6594f4ec 100644
--- a/doc/examples/transcode.c
+++ b/doc/examples/transcode.c
@@ -161,8 +161,8 @@ static int open_output_file(const char *filename)
             /* in this example, we choose transcoding to same codec */
             encoder = avcodec_find_encoder(dec_ctx->codec_id);
             if (!encoder) {
-                av_log(NULL, AV_LOG_FATAL, "Necessary encoder not found\n");
-                return AVERROR_INVALIDDATA;
+                av_log(NULL, AV_LOG_FATAL, "Necessary encoder with ID %d not found\n", dec_ctx->codec_id);
+                return AVERROR(EINVAL);
             }
             enc_ctx = avcodec_alloc_context3(encoder);
             if (!enc_ctx) {
-- 
2.34.1



More information about the ffmpeg-devel mailing list