diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-03-24 17:26:04 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-04-09 15:47:45 +0200 |
commit | e1e0c2c7f2f499ca47401d75140cfd3042e3bb8a (patch) | |
tree | 05bd6d3f2e68b93ba67416a9a8f5bdc37754cbab | |
parent | 237f9b9682a0f18345dcf6841527a795a32b3eb5 (diff) | |
download | ffmpeg-e1e0c2c7f2f499ca47401d75140cfd3042e3bb8a.tar.gz |
fftools/ffmpeg: drop unnecessary indirection
init_output_stream() can print log messages directly, there is no need
to ship them to the caller.
-rw-r--r-- | fftools/ffmpeg.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index d74145183e..8c0121a066 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -724,23 +724,18 @@ early_exit: return float_pts; } -static int init_output_stream(OutputStream *ost, AVFrame *frame, - char *error, int error_len); +static int init_output_stream(OutputStream *ost, AVFrame *frame); static int init_output_stream_wrapper(OutputStream *ost, AVFrame *frame, unsigned int fatal) { int ret = AVERROR_BUG; - char error[1024] = {0}; if (ost->initialized) return 0; - ret = init_output_stream(ost, frame, error, sizeof(error)); + ret = init_output_stream(ost, frame); if (ret < 0) { - av_log(ost, AV_LOG_ERROR, "Error initializing output stream: %s\n", - error); - if (fatal) exit_program(1); } @@ -3188,8 +3183,7 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) return 0; } -static int init_output_stream(OutputStream *ost, AVFrame *frame, - char *error, int error_len) +static int init_output_stream(OutputStream *ost, AVFrame *frame) { int ret = 0; @@ -3212,19 +3206,16 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame, ret = hw_device_setup_for_encode(ost); if (ret < 0) { - snprintf(error, error_len, "Device setup failed for " - "encoder on output stream #%d:%d : %s", - ost->file_index, ost->index, av_err2str(ret)); + av_log(ost, AV_LOG_ERROR, + "Encoding hardware device setup failed: %s\n", av_err2str(ret)); return ret; } if ((ret = avcodec_open2(ost->enc_ctx, codec, &ost->encoder_opts)) < 0) { if (ret == AVERROR_EXPERIMENTAL) abort_codec_experimental(codec, 1); - snprintf(error, error_len, - "Error while opening encoder for output stream #%d:%d - " - "maybe incorrect parameters such as bit_rate, rate, width or height", - ost->file_index, ost->index); + av_log(ost, AV_LOG_ERROR, "Error while opening encoder - maybe " + "incorrect parameters such as bit_rate, rate, width or height.\n"); return ret; } |