Arjan wrote:
Be aware that Qt is C++ while ffmpeg is C. Include the
avformat/avcodec/etc headers in an 'extern "C" {' [...] '}' block.
for example,
#ifdef __cplusplus
extern "C" {
#include "avformat/avformat.h"
}
#endif
Thanks! I applied those changes to the source (I include avformat.h,
avcodec.h, and swscale.h). Now, when I build, I get still get an
undefined reference for "avcodec_register_all", but now it's also
throwing undef-ref errors for a bunch of ff_flac_*, ff_mpeg4audio*,
ffmpa_*, BZ2_* functions and more. Crikey! Any ideas?
Thanks for your help thus far!
[r...@josiah-desktop QT_ffmpeg_video]# make
g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.5.2/lib
-Wl,-rpath,/usr/local/Trolltech/Qt-4.5.2/lib -o QT_ffmpeg_video
.obj/release-shared/playmessage.o .obj/release-shared/VideoThread.o
.obj/release-shared/VideoWidget.o .obj/release-shared/main.o
.obj/release-shared/moc_playmessage.o
.obj/release-shared/moc_VideoThread.o
.obj/release-shared/moc_VideoWidget.o -L/opt/qtsdk/qt/lib -lavcodec
-lavformat -lswscale -lavutil -logg -lQtGui -L/opt/qtsdk/qt/lib
-L/usr/X11R6/lib -pthread -lpng -lfreetype -lgobject-2.0 -lSM -lICE
-pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lz -lm
-pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread -ldl
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(allformats.o):
In function `av_register_all':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/allformats.c:47:
undefined reference to `avcodec_register_all'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(utils.o): In
function `av_find_stream_info':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/utils.c:2199:
undefined reference to `avcodec_pix_fmt_to_codec_tag'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(adtsenc.o):
In function `decode_extradata':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/adtsenc.c:74:
undefined reference to `ff_copy_pce_data'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(flacdec.o):
In function `flac_read_header':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/flacdec.c:61:
undefined reference to `ff_flac_parse_block_header'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/flacdec.c:100:
undefined reference to `ff_flac_parse_streaminfo'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(flacenc.o):
In function `ff_flac_write_header':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/flacenc.c:34:
undefined reference to `ff_flac_is_extradata_valid'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(flacenc.o):
In function `flac_write_trailer':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/flacenc.c:60:
undefined reference to `ff_flac_is_extradata_valid'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(flacenc.o):
In function `ff_flac_write_header':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/flacenc.c:34:
undefined reference to `ff_flac_is_extradata_valid'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(flvdec.o):
In function `flv_read_packet':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/flvdec.c:442:
undefined reference to `ff_mpeg4audio_get_config'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/flvdec.c:446:
undefined reference to `ff_mpeg4audio_channels'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(matroskadec.o):
In function `matroska_decode_buffer':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/matroskadec.c:917:
undefined reference to `BZ2_bzDecompressInit'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/matroskadec.c:926:
undefined reference to `BZ2_bzDecompress'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/matroskadec.c:929:
undefined reference to `BZ2_bzDecompressEnd'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(matroskadec.o):
In function `matroska_aac_sri':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/matroskadec.c:1111:
undefined reference to `ff_mpeg4audio_sample_rates'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/matroskadec.c:1111:
undefined reference to `ff_mpeg4audio_sample_rates'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(matroskaenc.o):
In function `get_aac_sample_rates':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/matroskaenc.c:438:
undefined reference to `ff_mpeg4audio_sample_rates'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/matroskaenc.c:447:
undefined reference to `ff_mpeg4audio_sample_rates'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(mov.o): In
function `mov_read_esds':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/mov.c:435:
undefined reference to `ff_mpeg4audio_get_config'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/mov.c:439:
undefined reference to `ff_mpeg4audio_channels'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/mov.c:441:
undefined reference to `ff_mpa_freq_tab'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(mp3.o): In
function `mp3_parse_vbr_tags':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/mp3.c:87:
undefined reference to `ff_mpegaudio_decode_header'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(mp3.o): In
function `mp3_read_probe':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/mp3.c:54:
undefined reference to `ff_mpa_decode_header'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(nutenc.o):
In function `find_expected_header':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/nutenc.c:54:
undefined reference to `ff_mpa_freq_tab'
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/nutenc.c:64:
undefined reference to `ff_mpa_bitrate_tab'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(oggparseflac.o):
In function `flac_header':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/oggparseflac.c:58:
undefined reference to `ff_flac_parse_streaminfo'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libavformat.a(oggenc.o):
In function `ogg_build_flac_headers':
/home/josiah/Download/vlc-0.9.9a/extras/contrib/src/ffmpeg/libavformat/oggenc.c:94:
undefined reference to `ff_flac_is_extradata_valid'
collect2: ld returned 1 exit status
make: *** [QT_ffmpeg_video] Error 1
also, make sure you are using a compiler which is both supported by
ffmpeg and Qt.
Ussing gcc 4.1.2:
[r...@josiah-desktop QT_ffmpeg_video]# gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic
--host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
-=-=-=-=-=-=-=-=-=-=-=-=-
Josiah Bryan
Productive Concepts, Inc.
[email protected]
(765) 964-6009, ext. 224
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user