Skip to content

Conversation

Copy link

Copilot AI commented Aug 30, 2025

This PR resolves issue #78 by updating FFMpegWrapper.cpp to use the modern FFMpeg API, fixing compilation errors with FFMpeg 6.x.

Issues Fixed

The original code used deprecated FFMpeg APIs that were removed in recent versions:

  1. av_register_all() removed: This function was deprecated in FFMpeg 4.0 and removed in 5.0+
  2. Type mismatch: avcodec_find_decoder() now returns const AVCodec * instead of AVCodec *
  3. Channel API changes: channels field replaced with ch_layout.nb_channels in both AVCodecParameters and AVFrame
  4. Channel layout functions: av_get_default_channel_layout() deprecated in favor of av_channel_layout_default()

Changes Made

  • Removed deprecated registration: Replaced av_register_all() call with explanatory comment (auto-registration since FFMpeg 4.0)
  • Fixed decoder type: Changed AVCodec *decoder to const AVCodec *decoder
  • Updated channel access: Replaced all instances of ->channels with ->ch_layout.nb_channels
  • Modernized channel layout setup:
    • Replaced channel_layout field checks with ch_layout equivalents
    • Updated from av_get_default_channel_layout() to av_channel_layout_default()
    • Changed SWR context setup from av_opt_set_int() with *_channel_layout to av_opt_set_chlayout() with *_chlayout
  • Added required header: Included <libavutil/channel_layout.h> for new channel layout API

Testing

  • Successfully compiles with FFMpeg 6.1.1 (libavcodec 60.31.102)
  • All changes maintain existing functionality while using the modern API
  • Built and tested anmp-dump binary executes correctly

Backward Compatibility

These changes target FFMpeg 4.0+ API. The new channel layout API was introduced in FFMpeg 5.1, but the other changes (removing av_register_all(), const correctness) are compatible with FFMpeg 4.0+.

Closes #78

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Provide a solution to @derselbst/ANMP/issues/78 by updating src/InputLibraryWrapper/FFMpegWrapper.cpp to most recent FFMpeg API. Fix FFMpeg API compatibility for modern FFMpeg 6.x Aug 30, 2025
Copilot finished work on behalf of derselbst August 30, 2025 19:31
Copilot AI requested a review from derselbst August 30, 2025 19:31
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.

Build errors on Debian Sid ("use of undeclared identifier 'av_register_all' and more)

2 participants