Preparing for the removal of av_init_packet. It is depricated in the latest release of ffmpeg.

This commit is contained in:
mjbudd77 2021-10-26 20:45:45 -04:00
parent 4cea83fd1b
commit b6ece28e76
1 changed files with 4 additions and 0 deletions

View File

@ -1723,7 +1723,9 @@ static int write_audio_frame( AVFrame *frame )
while (ret >= 0) while (ret >= 0)
{ {
AVPacket pkt = { 0 }; // data and size must be 0; AVPacket pkt = { 0 }; // data and size must be 0;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 59, 0, 0 )
av_init_packet(&pkt); av_init_packet(&pkt);
#endif
ret = avcodec_receive_packet(ost->enc, &pkt); ret = avcodec_receive_packet(ost->enc, &pkt);
if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
{ {
@ -1918,7 +1920,9 @@ static int encode_video_frame( unsigned char *inBuf )
{ {
AVPacket pkt = { 0 }; AVPacket pkt = { 0 };
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 59, 0, 0 )
av_init_packet(&pkt); av_init_packet(&pkt);
#endif
ret = avcodec_receive_packet(c, &pkt); ret = avcodec_receive_packet(c, &pkt);