Josiah Bryan wrote:
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

(snip)

collect2: ld returned 1 exit status
make: *** [QT_ffmpeg_video] Error 1


Alright, fixed it. Not sure how, but I did.

What I did: I downloaded the latest ffmpeg (bz2 fmt) snapshot from http://ffmpeg.org/download.html, built and installed that (./configure --prefix=/usr && make -j4 install). That went fine. Then I checked out the linker command for the ffmpeg binary, copied names of libraries that it linked against and added them to my QT .pro file. Then I removed the libraries one by one until it caused the error. I narrowed it down to the following list of required libraries:

-lavdevice -lavformat -lavcodec -lavutil -lswscale -lbz2

So, in summary, all that's needed (in addition to that "extern" block mentioned earlier), is to add "LIBS += -lavdevice -lavformat -lavcodec -lavutil -lswscale -lbz2" to the QT project file, and it builds great! Now, to actually *run* the program - thats another story. Will test next...

Thanks for all your help, everyone! I couldn't have done it without the hint about the 'extern "C" {' block. Thanks!

-josiah

-=-=-=-=-=-=-=-=-=-=-=-=-
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

Reply via email to