Skip to content

Fix deprecated FFmpeg functions #3073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Podre-Henrique
Copy link

@Podre-Henrique Podre-Henrique commented Apr 24, 2025

Warnings when building with FFmpeg support:

whisper.cpp/examples/ffmpeg-transcode.cpp:282:23: warning: ‘void av_init_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
  282 |         av_init_packet(&packet);
      |         ~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/libavcodec/avcodec.h:44,
                 from whisper.cpp/examples/ffmpeg-transcode.cpp:28:
/usr/include/libavcodec/packet.h:670:6: note: declared here
  670 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
whisper.cpp/examples/ffmpeg-transcode.cpp:307:22: warning: ‘int avcodec_close(AVCodecContext*)’ is deprecated [-Wdeprecated-declarations]
  307 |         avcodec_close(codec);
      |         ~~~~~~~~~~~~~^~~~~~~
/usr/include/libavcodec/avcodec.h:2398:5: note: declared here
 2398 | int avcodec_close(AVCodecContext *avctx);

Replace av_init_packet with av_packet_alloc
Replace avcodec_close with avcodec_free_context
Also add packet cleanup with av_packet_free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants