Open
Conversation
- Replace deprecated ->channels with ->ch_layout.nb_channels - Replace deprecated ->channel_layout with new AVChannelLayout API - Remove deprecated avcodec_close() calls (avcodec_free_context() is sufficient) - Update channel layout functions to use av_opt_set_chlayout() - Fix av_find_best_stream() to use const AVCodec** for FFmpeg 6+ - Replace deprecated av_stream_get_side_data() with av_packet_side_data_get() - Add libavutil/channel_layout.h header for new API support - All changes wrapped in version checks for backward compatibility
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes compilation errors when building decord with FFmpeg 6+. The changes address deprecated API usage and update to the new FFmpeg 6 APIs while maintaining backward compatibility with older FFmpeg versions.
Changes Made
Audio Reader (
src/audio/audio_reader.cc)->channelswith->ch_layout.nb_channels->channel_layoutwith newAVChannelLayoutAPIavcodec_close()calls (onlyavcodec_free_context()is needed)InitSWR()to useav_opt_set_chlayout()instead ofav_opt_set_channel_layout()Video Reader (
src/video/video_reader.cc)AVCodec *toconst AVCodec *forav_find_best_stream()compatibilityav_stream_get_side_data()withav_packet_side_data_get()FFmpeg Common (
src/video/ffmpeg/ffmpeg_common.h)#include <libavutil/channel_layout.h>for new channel layout API supportCompatibility
All changes are wrapped in version checks (
#if LIBAVCODEC_VERSION_MAJOR >= 59) to maintain backward compatibility with FFmpeg 5 and earlier versions.Testing
Successfully builds with FFmpeg 6+ on macOS with Homebrew-installed FFmpeg.
Related Issues
Fixes compilation errors:
no member named 'channels' in 'AVCodecParameters'no member named 'channel_layout' in 'AVCodecContext'use of undeclared identifier 'avcodec_close'no matching function for call to 'av_find_best_stream'use of undeclared identifier 'av_stream_get_side_data'Pull Request opened by Augment Code with guidance from the PR author