Skip to content

Commit

Permalink
Fix av error code to string for c++
Browse files Browse the repository at this point in the history
  • Loading branch information
OKaluza committed Nov 1, 2024
1 parent c7c4df6 commit 5d8be68
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/VideoEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ void VideoEncoder::open_video()
void VideoEncoder::write_video_frame(AVFrame *frame)
{
int ret = 0;
char a[AV_ERROR_MAX_STRING_SIZE] = {0};
AVCodecContext *c = video_enc;
AVPacket pkt;
//https://github.com/FFmpeg/FFmpeg/commit/f7db77bd8785d1715d3e7ed7e69bd1cc991f2d07
Expand All @@ -297,7 +298,7 @@ void VideoEncoder::write_video_frame(AVFrame *frame)
break;
else if (ret < 0)
{
fprintf(stderr, "Error encoding a frame: %s\n", av_err2str(ret));
fprintf(stderr, "Error encoding a frame: %s\n", av_make_error_string(a, AV_ERROR_MAX_STRING_SIZE, ret));
exit(1);
}

Expand All @@ -312,7 +313,7 @@ void VideoEncoder::write_video_frame(AVFrame *frame)
* This would be different if one used av_write_frame(). */
if (ret < 0)
{
fprintf(stderr, "Error while writing output packet: %s\n", av_err2str(ret));
fprintf(stderr, "Error while writing output packet: %s\n", av_make_error_string(a, AV_ERROR_MAX_STRING_SIZE, ret));
exit(1);
}
}
Expand Down

0 comments on commit 5d8be68

Please sign in to comment.