Open zuzzurro opened 2 years ago
Probably just a missing #include
-- I still see AVCodecContext
here: https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/avcodec.h
Mmmh, adding the avcodec include improves things but does not fixes it all.
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c: In function ‘ffmpeg_open_file’:
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c:102:51: error: ‘AVStream’ has no member named ‘codec’
102 | if (ih->format_context->streams[j]->codec->codec_type ==
| ^~
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c:115:58: error: ‘AVStream’ has no member named ‘codec’
115 | ih->format_context->streams[ih->audio_stream]->codec;
| ^~
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c:126:19: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
126 | ih->codec = avcodec_find_decoder(ih->codec_context->codec_id);
| ^
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c:137:41: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
137 | AVCodec *possible_float_codec = avcodec_find_decoder_by_name(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c: In function ‘decode_packet’:
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c:245:15: warning: implicit declaration of function ‘avcodec_decode_audio4’; did you mean ‘avcodec_decode_subtitle2’? [-Wimplicit-function-declaration]
245 | ret = avcodec_decode_audio4(ih->codec_context, ih->frame,
| ^~~~~~~~~~~~~~~~~~~~~
| avcodec_decode_subtitle2
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c: In function ‘ffmpeg_read_one_packet’:
/git/loudness-scanner/scanner/inputaudio/ffmpeg/input_ffmpeg.c:279:25: warning: implicit declaration of function ‘av_free_packet’; did you mean ‘av_get_packet’? [-Wimplicit-function-declaration]
279 | av_free_packet(&ih->packet);
| ^~~~~~~~~~~~~~
| av_get_packet
make[2]: *** [scanner/inputaudio/ffmpeg/CMakeFiles/input_ffmpeg.dir/build.make:76: scanner/inputaudio/ffmpeg/CMakeFiles/input_ffmpeg.dir/input_ffmpeg.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:423: scanner/inputaudio/ffmpeg/CMakeFiles/input_ffmpeg.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Also, i see other projects having to deal with this, it seems: https://github.com/opencv/opencv/issues/20147
And this seems extremely relevant:
https://github.com/opencv/opencv/pull/21754/commits/7b2b5a55731be0c7bca6346b565b83e83797913d
I can confirm build failure on Ubuntu 22.04 and Debian 12. You can get the build to succeed by not installing libavcodec-dev and libavformat-dev libraries.
The build switch -DDISABLE_FFMPEG=true does not seem to do anything. If you have libavcodec-dev and libavformat-dev libraries installed and use this build switch the build fails anyway.
I try to build this on Gentoo stable. I also get a build failure.
The default "cmake .. && make" procedure produces:
$ LC_ALL=C make
[ 3%] Building C object ebur128/ebur128/CMakeFiles/ebur128.dir/ebur128.c.o
[ 6%] Linking C static library ../../libebur128.a
[ 6%] Built target ebur128
[ 10%] Building C object scanner/scanner-common/CMakeFiles/scanner-common.dir/parse_args.c.o
[ 13%] Building C object scanner/scanner-common/CMakeFiles/scanner-common.dir/nproc.c.o
[ 16%] Building C object scanner/scanner-common/CMakeFiles/scanner-common.dir/scanner-common.c.o
[ 20%] Linking C static library ../../libscanner-common.a
[ 20%] Built target scanner-common
[ 23%] Building C object scanner/CMakeFiles/scanner-lib.dir/scanner-scan.c.o
[ 26%] Building C object scanner/CMakeFiles/scanner-lib.dir/scanner-dump.c.o
[ 30%] Linking C static library ../libscanner-lib.a
[ 30%] Built target scanner-lib
[ 33%] Building C object scanner/scanner-tag/CMakeFiles/scanner-tag.dir/scanner-tag.c.o
[ 36%] Building CXX object scanner/scanner-tag/CMakeFiles/scanner-tag.dir/rgtag.cpp.o
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp: In function 'int16_t to_opus_gain(double)':
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp:277:20: error: 'INT16_MIN' was not declared in this scope
277 | if (gain < INT16_MIN) {
| ^~~~~~~~~
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp:281:21: error: 'INT16_MAX' was not declared in this scope
281 | if (gain >= INT16_MAX) {
| ^~~~~~~~~
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp:26:1: note: 'INT16_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
25 | #include <iomanip>
+++ |+#include <cstdint>
26 | #include <ios>
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp: In function 'int tag_vorbis_comment(const char*, const char*, gain_data*, gain_data_strings*, const OpusTagInfo*)':
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp:358:41: error: 'uint16_t' does not name a type
358 | static_cast<uint16_t>(opus_header_gain_int) & 0xff);
| ^~~~~~~~
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp:358:41: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp:360:41: error: 'uint16_t' does not name a type
360 | static_cast<uint16_t>(opus_header_gain_int) >> 8);
| ^~~~~~~~
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp:360:41: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
make[2]: *** [scanner/scanner-tag/CMakeFiles/scanner-tag.dir/build.make:90: scanner/scanner-tag/CMakeFiles/scanner-tag.dir/rgtag.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:476: scanner/scanner-tag/CMakeFiles/scanner-tag.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
There seems to be no "avcodec" package I could not install here :-(
I try to build this on Gentoo stable. I also get a build failure.
The default "cmake .. && make" procedure produces:
/home/tobias/tmp/git/loudness-scanner/scanner/scanner-tag/rgtag.cpp:360:41: note: 'uint16_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'? make[2]: *** [scanner/scanner-tag/CMakeFiles/scanner-tag.dir/build.make:90: scanner/scanner-tag/CMakeFiles/scanner-tag.dir/rgtag.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:476: scanner/scanner-tag/CMakeFiles/scanner-tag.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
There seems to be no "avcodec" package I could not install here :-(
No, that's only missing #include for official header file uint16_t
.
Might be that disabled ffmpeg triggers if before opportunistic reuse of #include from ffmpeg applied. But might also trigger by varying cc versions.
PR https://github.com/jiixyj/loudness-scanner/pull/44 for issue https://github.com/jiixyj/loudness-scanner/issues/33 already exists.
Building myself on Gentoo successfully.
Just a heads up, I will check and see what the fix may be. And this is not the whole error log, just a few lines.
This is on Fedora 36 beta that has ffmpeg 5.0