ubuntu 11.10
make之后的错误如下
AudioDecoder.cpp:50:84: error: ‘avcodec_decode_audio4’ was not declared in this scope
AudioDecoder.cpp:60:42: error: ‘AVFrame’ has no member named ‘nb_samples’
AudioDecoder.cpp:109:10: error: ‘AV_SAMPLE_FMT_U8P’ was not declared in this scope
AudioDecoder.cpp:111:46: error: ‘AVFrame’ has no member named ‘extended_data’
AudioDecoder.cpp:112:38: error: ‘AVFrame’ has no member named ‘nb_samples’
AudioDecoder.cpp:119:10: error: ‘AV_SAMPLE_FMT_S16P’ was not declared in this scope
AudioDecoder.cpp:121:48: error: ‘AVFrame’ has no member named ‘extended_data’
AudioDecoder.cpp:122:38: error: ‘AVFrame’ has no member named ‘nb_samples’
AudioDecoder.cpp:129:10: error: ‘AV_SAMPLE_FMT_S32P’ was not declared in this scope
AudioDecoder.cpp:131:48: error: ‘AVFrame’ has no member named ‘extended_data’
AudioDecoder.cpp:132:38: error: ‘AVFrame’ has no member named ‘nb_samples’
AudioDecoder.cpp:139:10: error: ‘AV_SAMPLE_FMT_FLTP’ was not declared in this scope
AudioDecoder.cpp:141:42: error: ‘AVFrame’ has no member named ‘extended_data’
AudioDecoder.cpp:142:38: error: ‘AVFrame’ has no member named ‘nb_samples’
AudioDecoder.cpp:149:10: error: ‘AV_SAMPLE_FMT_DBLP’ was not declared in this scope
AudioDecoder.cpp:151:44: error: ‘AVFrame’ has no member named ‘extended_data’
AudioDecoder.cpp:152:38: error: ‘AVFrame’ has no member named ‘nb_samples’
是由于 avcodec_decode_audio4 不存在,原因是 avcodec 库中此时的接口是 avcodec_decode_audio3 。
以下是 libavcodec-dev 的信息
root@ubuntu:~/QtAV# apt-cache show libavcodec-dev
Package: libavcodec-dev
Priority: optional
Section: libdevel
Installed-Size: 8556
Maintainer: Ubuntu Core Developers [email protected]
Original-Maintainer: Debian multimedia packages maintainers [email protected]
Architecture: amd64
Source: libav
Version: 4:0.7.2-1ubuntu1
Depends: libavcodec53 (>= 4:0.7.2-1ubuntu1) | libavcodec-extra-53 (>= 4:0.7.2), libavcodec53 (<= 4:0.7.2-99) | libavcodec-extra-53 (<= 4:0.7.2.99), libavutil-dev (= 4:0.7.2-1ubuntu1)
Suggests: libfaad-dev, libgsm1-dev, libogg-dev, libschroedinger-dev, libspeex-dev, libtheora-dev (>> 0.0.0.alpha4), libvorbis-dev, libx11-dev, libxext-dev, zlib1g-dev, libraw1394-dev, libdc1394-22-dev
Filename: pool/main/liba/libav/libavcodec-dev_0.7.2-1ubuntu1_amd64.deb
Size: 3110070
MD5sum: 9653f9d3e2e777463d14c0771a261cc1
SHA1: 416f419f3b246c06acbc2f43a66fcb7ec86a956c
SHA256: 0b48a9114e5573411731e125e52edc46425ab770389521b22528974b57964ee2
Description-en: Development files for libavcodec
This is the codec library from Libav. It supports most existing
encoding formats (MPEG, DivX, MPEG4, AC3, DV...).
.
This package contains the header files and static libraries needed to
compile applications or shared objects that use libavcodec.
Homepage: http://libav.org/
Description-md5: 46ab6aef4fc6e2ec40849bd82216def1
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 18m
Package: libavcodec-dev
Priority: optional
Section: libdevel
Installed-Size: 8556
Maintainer: Ubuntu Developers [email protected]
Original-Maintainer: Debian multimedia packages maintainers [email protected]
Architecture: amd64
Source: libav
Version: 4:0.7.6-0ubuntu0.11.10.3
Depends: libavcodec53 (>= 4:0.7.6-0ubuntu0.11.10.3) | libavcodec-extra-53 (>= 4:0.7.6), libavcodec53 (<= 4:0.7.6-99) | libavcodec-extra-53 (<= 4:0.7.6.99), libavutil-dev (= 4:0.7.6-0ubuntu0.11.10.3)
Suggests: libfaad-dev, libgsm1-dev, libogg-dev, libschroedinger-dev, libspeex-dev, libtheora-dev (>> 0.0.0.alpha4), libvorbis-dev, libx11-dev, libxext-dev, zlib1g-dev, libraw1394-dev, libdc1394-22-dev
Filename: pool/main/liba/libav/libavcodec-dev_0.7.6-0ubuntu0.11.10.3_amd64.deb
Size: 3122818
MD5sum: a3be93d9fb14885fc4d7ec4b75de0f04
SHA1: d36df2e41ab3058d4b02a16c175c600f5c638ec4
SHA256: 58fa47ee349435152ee85e9a2650ff0edbfc897be894c71d83a47e24d9f47012
Description-en: Development files for libavcodec
This is the codec library from Libav. It supports most existing
encoding formats (MPEG, DivX, MPEG4, AC3, DV...).
.
This package contains the header files and static libraries needed to
compile applications or shared objects that use libavcodec.
Homepage: http://libav.org/
Description-md5: 46ab6aef4fc6e2ec40849bd82216def1
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 18m
编译后设置环境变量
root@ubuntu:/QtAV# export CPATH=/opt/libav/include/:$CPATH
root@ubuntu:/QtAV# export LIBRARY_PATH=/opt/libav/lib/:$LIBRARY_PATH
您的第二个变量中 (export LIBRARY_PATH=ffmpeg_path/include:portaudio_path/lib:$LIBRARY_PATH) 应该是ffmpeg_path/lib 写成了 ffmpeg_path/include了。
make
发现如下错误
AVDemuxer.cpp: In member function ‘qreal QtAV::AVDemuxer::frameRate() const’:
AVDemuxer.cpp:560:27: error: ‘AVStream’ has no member named ‘r_frame_rate’
AVDemuxer.cpp:560:61: error: ‘AVStream’ has no member named ‘r_frame_rate’
AVDemuxer.cpp: In member function ‘bool QtAV::AVDemuxer::findAVCodec()’:
AVDemuxer.cpp:689:46: error: ‘CODEC_ID_H264’ was not declared in this scope
修改宏 CODEC_ID_H264 到 AV_CODEC_ID_H264 ,宏声明发生了变化。
修改 r_frame_rate 到 avg_frame_rate。也是定义发生了变化导致的。
继续make 发现如下问题
编译的最后 错误如下
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to av_seek_frame@LIBAVFORMAT_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
av_free@LIBAVUTIL_52'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to avcodec_open2@LIBAVCODEC_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
av_strerror@LIBAVUTIL_52'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to avformat_version@LIBAVFORMAT_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avformat_close_input@LIBAVFORMAT_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to avcodec_decode_video2@LIBAVCODEC_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
av_free_packet@LIBAVCODEC_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to avformat_network_deinit@LIBAVFORMAT_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avcodec_close@LIBAVCODEC_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to avcodec_version@LIBAVCODEC_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avpicture_get_size@LIBAVCODEC_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to avformat_alloc_context@LIBAVFORMAT_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avpicture_fill@LIBAVCODEC_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to av_dump_format@LIBAVFORMAT_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avformat_network_init@LIBAVFORMAT_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to av_new_packet@LIBAVCODEC_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avformat_find_stream_info@LIBAVFORMAT_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to avcodec_find_decoder@LIBAVCODEC_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avformat_open_input@LIBAVFORMAT_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to av_register_all@LIBAVFORMAT_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avcodec_alloc_frame@LIBAVCODEC_55'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to av_read_frame@LIBAVFORMAT_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avutil_version@LIBAVUTIL_52'
/root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to avcodec_flush_buffers@LIBAVCODEC_55' /root/QtAV/lib_linux_x64/libQtAV.so: undefined reference to
avcodec_decode_audio4@LIBAVCODEC_55'
导入环境变量 export LD_LIBRARY_PATH=/opt/libav/lib/:$LD_LIBRARY_PATH 后
make 通过