Skip to content
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

update libav API or switch to FFMPEG #110

Open
Be-ing opened this issue Apr 20, 2020 · 3 comments
Open

update libav API or switch to FFMPEG #110

Be-ing opened this issue Apr 20, 2020 · 3 comments

Comments

@Be-ing
Copy link

Be-ing commented Apr 20, 2020

Hi, we are thinking of replacing the Queen Mary DSP key analyzer in Mixxx with libKeyFinder. I wanted to give this application a try before we work on that.

I am trying to build is_KeyFinder on Fedora 31 but cannot because it depends on some old version of libav. There are not Fedora packages for libav anymore; RPMFusion only packages FFMPEG. So I downloaded the latest libav (12) from https://libav.org/download/ . I had to add #include <libavresample/avresample.h> to source/decoderlibav.h then find-and-replace ReSampleContext with AVAudioResampleContext. But there are still dependencies on outdated libav APIs.

I think the best way forward would be moving to FFMPEG. At the least you could document which old version of libav is required to build this.

source/decoderlibav.cpp:26:122: error: use of undeclared identifier 'AVCODEC_MAX_AUDIO_FRAME_SIZE'
AudioFileDecoder::AudioFileDecoder(const QString& filePath, const int maxDuration) : filePathCh(NULL), frameBufferSize(((AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2) * sizeof(uint8_t)), audioStream(-1), badPacketCount(0), badPacketThreshold(100), codec(NULL), fCtx(NULL), cCtx(NULL), dict(NULL), rsCtx(NULL) {
                                                                                                                         ^
source/decoderlibav.cpp:56:27: warning: 'codec' is deprecated [-Wdeprecated-declarations]
    if (fCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
                          ^
/usr/include/libavformat/avformat.h:711:5: note: 'codec' has been explicitly marked deprecated here
    attribute_deprecated
    ^
/usr/include/libavutil/attributes.h:76:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
source/decoderlibav.cpp:79:38: warning: 'codec' is deprecated [-Wdeprecated-declarations]
  cCtx = fCtx->streams[audioStream]->codec;
                                     ^
/usr/include/libavformat/avformat.h:711:5: note: 'codec' has been explicitly marked deprecated here
    attribute_deprecated
    ^
/usr/include/libavutil/attributes.h:76:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
source/decoderlibav.cpp:95:11: error: use of undeclared identifier 'av_audio_resample_init'
  rsCtx = av_audio_resample_init(cCtx->channels, cCtx->channels, cCtx->sample_rate, cCtx->sample_rate, AV_SAMPLE_FMT_S16, cCtx->sample_fmt, 0, 0, 0, 0);
          ^
source/decoderlibav.cpp:108:22: error: use of undeclared identifier 'audio_resample_close'; did you mean 'avresample_close'?
  if (rsCtx != NULL) audio_resample_close(rsCtx);
                     ^~~~~~~~~~~~~~~~~~~~
                     avresample_close
/usr/include/libavresample/avresample.h:204:6: note: 'avresample_close' declared here
void avresample_close(AVAudioResampleContext *avr);
     ^
source/decoderlibav.cpp:115:21: error: use of undeclared identifier 'av_close_input_file'
  if (fCtx != NULL) av_close_input_file(fCtx);
                    ^
source/decoderlibav.cpp:132:44: warning: 'av_free_packet' is deprecated [-Wdeprecated-declarations]
    if (avpkt.stream_index != audioStream) av_free_packet(&avpkt);
                                           ^
/usr/include/libavcodec/avcodec.h:3907:1: note: 'av_free_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:76:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
source/decoderlibav.cpp:141:9: warning: 'av_free_packet' is deprecated [-Wdeprecated-declarations]
        av_free_packet(&avpkt);
        ^
/usr/include/libavcodec/avcodec.h:3907:1: note: 'av_free_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:76:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
source/decoderlibav.cpp:147:5: warning: 'av_free_packet' is deprecated [-Wdeprecated-declarations]
    av_free_packet(&avpkt);
    ^
/usr/include/libavcodec/avcodec.h:3907:1: note: 'av_free_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:76:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
source/decoderlibav.cpp:151:3: warning: 'av_free_packet' is deprecated [-Wdeprecated-declarations]
  av_free_packet(&avpkt);
  ^
/usr/include/libavcodec/avcodec.h:3907:1: note: 'av_free_packet' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:76:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
source/decoderlibav.cpp:164:25: error: use of undeclared identifier 'avcodec_decode_audio3'; did you mean 'avcodec_decode_audio4'?
    int bytesConsumed = avcodec_decode_audio3(cCtx, dataBuffer, &dataSize, &tempPacket);
                        ^~~~~~~~~~~~~~~~~~~~~
                        avcodec_decode_audio4
/usr/include/libavcodec/avcodec.h:4151:5: note: 'avcodec_decode_audio4' declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
    ^
source/decoderlibav.cpp:164:53: error: cannot initialize a parameter of type 'AVFrame *' with an lvalue of type 'int16_t *' (aka 'short *')
    int bytesConsumed = avcodec_decode_audio3(cCtx, dataBuffer, &dataSize, &tempPacket);
                                                    ^~~~~~~~~~
/usr/include/libavcodec/avcodec.h:4151:59: note: passing argument to parameter 'frame' here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
                                                          ^
source/decoderlibav.cpp:164:25: warning: 'avcodec_decode_audio4' is deprecated [-Wdeprecated-declarations]
    int bytesConsumed = avcodec_decode_audio3(cCtx, dataBuffer, &dataSize, &tempPacket);
                        ^
/usr/include/libavcodec/avcodec.h:4150:1: note: 'avcodec_decode_audio4' has been explicitly marked deprecated here
attribute_deprecated
^
/usr/include/libavutil/attributes.h:76:49: note: expanded from macro 'attribute_deprecated'
#    define attribute_deprecated __attribute__((deprecated))
                                                ^
source/decoderlibav.cpp:175:28: error: use of undeclared identifier 'audio_resample'
      int resampleResult = audio_resample(rsCtx, (short*)frameBufferConverted, (short*)frameBuffer, newSamplesDecoded);
                           ^
7 warnings and 7 errors generated.
make: *** [Makefile:1344: decoderlibav.o] Error 1
make: *** Waiting for unfinished jobs....
@Be-ing
Copy link
Author

Be-ing commented Apr 20, 2020

Adding libKeyFiinder to Mixxx's analyzers was easier than trying to getting this to build, so I personally don't have a use for this application anymore. Thanks for the library!

@twhitehead
Copy link

NixOS is in the process of dumping libav due to the fact that it is not being maintained and is accumulating a fairly extensive list of known vulnerabilities. For example

CVE-2014-5271
CVE-2015-3395
CVE-2015-5479
CVE-2016-3062
CVE-2016-6832
CVE-2016-7393
CVE-2016-7424
CVE-2016-8675
CVE-2016-8676
CVE-2017-16803
CVE-2017-9051
CVE-2018-11102
CVE-2018-11224
CVE-2018-18826
CVE-2018-18827
CVE-2018-18828
CVE-2018-18829
CVE-2018-19128
CVE-2018-19129
CVE-2018-19130
CVE-2018-20001
CVE-2018-5684
CVE-2018-5766
CVE-2019-14371
CVE-2019-14372
CVE-2019-14441
CVE-2019-14442
CVE-2019-14443
CVE-2019-9717
CVE-2019-9719
CVE-2019-9720

Would be nice if this could be ported to ffmpeg so we could continue to offer it to our users.

@Be-ing
Copy link
Author

Be-ing commented Feb 1, 2021

This application is unmaintained. If any NixOS users want to use KeyFinder, the easiest way would be using Mixxx 2.3 (currently in beta). We have forked the libkeyfinder library (with @ibsh's permission) and replaced QMake with CMake. You may also consider packaging keyfinder-cli.

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

No branches or pull requests

2 participants