Implement ffmpeg 5.0 support #9

Merged
SlavekB merged 1 commits from ffmpeg5-support into master 2 years ago
Collaborator

Version 5.0 of ffmpeg removed a lot of deprecated API which causes akode to fail to build against it. The ffmpeg plugin has been amended to allow akode to build against the new version as well as older versions, plus a call to "av_register_all" has been re-instated for earlier versions to ensure the player functions correctly.

Signed-off-by: aneejit1 aneejit1@gmail.com

Version 5.0 of ffmpeg removed a lot of deprecated API which causes akode to fail to build against it. The ffmpeg plugin has been amended to allow akode to build against the new version as well as older versions, plus a call to "av_register_all" has been re-instated for earlier versions to ensure the player functions correctly. Signed-off-by: aneejit1 <aneejit1@gmail.com>
aneejit1 added 1 commit 2 years ago
40b64f4b1c
Implement ffmpeg 5.0 support
Poster
Collaborator

As far as I can tell, the removed call to "av_register_all" has caused the ffmpeg plugin to be unusable to the extent that it refused to open the input file and then segfaults. This is the situation when akode is built for Debian 9.

Restoring this call has enabled the player to get past these errors. However, my Debian 9 system is in a virtual machine and appears to be having issues with playback that I suspect may be due to the limited CPU resources it has (I'm getting heavy distortion). A little additional testing on an older system would be helpful before merging this one. The plugin can be invoked when ".wma" or ".m4a" format files are used.

I've got playback for ffmpeg 5 working fine.

EDIT
I found the problem with my Debian 9 playback and that's working fine now too, so this one's good to go.

As far as I can tell, the removed call to "av_register_all" has caused the ffmpeg plugin to be unusable to the extent that it refused to open the input file and then segfaults. This is the situation when akode is built for Debian 9. Restoring this call has enabled the player to get past these errors. ~~However, my Debian 9 system is in a virtual machine and appears to be having issues with playback that I suspect may be due to the limited CPU resources it has (I'm getting heavy distortion). A little additional testing on an older system would be helpful before merging this one. The plugin can be invoked when ".wma" or ".m4a" format files are used.~~ I've got playback for ffmpeg 5 working fine. *EDIT* I found the problem with my Debian 9 playback and that's working fine now too, so this one's good to go.
SlavekB requested changes 2 years ago
SlavekB left a comment
Owner

I did a test on the old system and got FTBFS – see comments below.

I did a test on the old system and got FTBFS – see comments below.
// allocate a codec context
d->audioStream_ctx = avcodec_alloc_context3(d->codec);
if (d->audioStream_ctx) {
avcodec_parameters_to_context(d->audioStream_ctx, d->ic->streams[d->audioStream]->codecpar);
Owner
../akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp:225:91: error: 'AVStream' has no member named 'codecpar'
         avcodec_parameters_to_context(d->audioStream_ctx, d->ic->streams[d->audioStream]->codecpar);
                                                                                           ^
../akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp:225:99: error: 'avcodec_parameters_to_context' was not declared in this scope
         avcodec_parameters_to_context(d->audioStream_ctx, d->ic->streams[d->audioStream]->codecpar);
                                                                                                   ^
``` ../akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp:225:91: error: 'AVStream' has no member named 'codecpar' avcodec_parameters_to_context(d->audioStream_ctx, d->ic->streams[d->audioStream]->codecpar); ^ ../akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp:225:99: error: 'avcodec_parameters_to_context' was not declared in this scope avcodec_parameters_to_context(d->audioStream_ctx, d->ic->streams[d->audioStream]->codecpar); ^ ```
Poster
Collaborator

I'd got the wrong version check in. This and the missing ampersand have been corrected, so give it another go.

I'd got the wrong version check in. This and the missing ampersand have been corrected, so give it another go.
SlavekB marked this conversation as resolved
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
d->packet = av_packet_alloc();
#else
av_init_packet(d->_packet);
Owner
../akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp: In member function 'bool aKode::FFMPEGDecod
er::readPacket()':
../akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp:303:34: error: cannot convert 'AVPacket' to
'AVPacket*' for argument '1' to 'void av_init_packet(AVPacket*)'
         av_init_packet(d->_packet);
                                  ^
``` ../akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp: In member function 'bool aKode::FFMPEGDecod er::readPacket()': ../akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp:303:34: error: cannot convert 'AVPacket' to 'AVPacket*' for argument '1' to 'void av_init_packet(AVPacket*)' av_init_packet(d->_packet); ^ ```
Poster
Collaborator

Oops! Missing an ampersand!

Oops! Missing an ampersand!
SlavekB marked this conversation as resolved
aneejit1 force-pushed ffmpeg5-support from 40b64f4b1c to c057782b44 2 years ago
aneejit1 force-pushed ffmpeg5-support from c057782b44 to 9e2710c9d8 2 years ago
SlavekB approved these changes 2 years ago
SlavekB left a comment
Owner

Tested on a very old distribution and also on unstable – both without any problems.

Tested on a very old distribution and also on unstable – both without any problems.
SlavekB added a new dependency 2 years ago
SlavekB merged commit 9e2710c9d8 into master 2 years ago
SlavekB deleted branch ffmpeg5-support 2 years ago
SlavekB added this to the R14.0.13 release milestone 2 years ago

Reviewers

SlavekB approved these changes 2 years ago
The pull request has been merged as 9e2710c9d8.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Blocks
Reference: TDE/akode#9
Loading…
There is no content yet.