Help with using 3rd party library with Qt
-
wrote on 24 Mar 2013, 13:49 last edited by
I know this is somewhat off-topic to this forum section but I'm really in a hurry, so please let me through this time.
I have been using QMultimedia to play media files, and now it comes to audio decoding. I have decided to stick with SoX for a while. But the things is I have spent a week tried to use libSoX, but it will always give me this:
@
formats: no handler for file extension `mp3'
check failed: input = sox_open_read(argv[i], NULL, NULL, NULL)
@with Vorbis/ogg, it's the same.
@
formats: no handler for file extension `vorbis'
@
What I have done is:- Download SoX from here: http://sox.sourceforge.net/Main/HomePage
- Extract, cd inside then:
@
./configure
make
sudo make install
@- Install libsox-fmt-all
After that, I could use sox and play in terminal to tweak with audio files with no problem at all.
But when I include libsox in my .pro file like so:@ LIBS += -lsox@
And #include <sox.h>
It won't find the codec handle.
If anyone is familiar with using thirdparty lib that depend on other lib like SoX, or have used SoX with Qt, please show me what I have done wrong. I'm really in your debt.
Regard.
-
wrote on 25 Mar 2013, 03:57 last edited by
Your libsox has not had the "optional mp3 or ogg support":http://sox.sourceforge.net/soxformat.html built into it. No amount of fiddling with your source or Qt project file will change that. You need to build libsox with those items. See INSTALL in the source code.
-
wrote on 7 Apr 2013, 15:16 last edited by
Thanks for your reply,
I have built libsox with all the codec that I needed, but the error still occure?
Here's some output I think related:
./configure (Before build sox/libsox):
@BUILD OPTIONS
Debugging build............no
Distro name ...............not specified!
Dynamic loading support....yes
Pkg-config location........$(libdir)/pkgconfig
Play and rec symlinks......yes
Symlinks enabled...........yesOPTIONAL DEVICE DRIVERS
ao (Xiph)..................yes
alsa (Linux)...............yes
coreaudio (Mac OS X).......no
sndio (OpenBSD)............no
oss........................yes
pulseaudio.................yes
sunaudio...................no
waveaudio (MS-Windows).....noOPTIONAL FILE FORMATS
amrnb......................no
amrwb......................no
ffmpeg.....................no
flac.......................yes
gsm........................yes (in-tree)
lpc10......................yes (in-tree)
mp2/mp3....................yes
id3tag....................yes
lame......................yes
lame id3tag...............yes
dlopen lame...............no
mad.......................yes
dlopen mad................no
twolame...................yes
dlopen twolame............no
oggvorbis..................yes
sndfile....................yes
dlopen sndfile............no
wavpack....................yesOTHER OPTIONS
ladspa effects.............yes
magic support..............no
png support................yes
GOMP support...............yes@
ldd
which sox
:@linux-gate.so.1 => (0xb76f1000)
libsox.so.2 => /usr/local/lib/libsox.so.2 (0xb762c000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7611000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb75e6000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7464000)
libltdl.so.7 => /usr/lib/libltdl.so.7 (0xb745a000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb7430000)
libgomp.so.1 => /usr/lib/i386-linux-gnu/libgomp.so.1 (0xb7420000)
libasound.so.2 => /usr/lib/i386-linux-gnu/libasound.so.2 (0xb732e000)
libao.so.4 => /usr/lib/libao.so.4 (0xb7325000)
libFLAC.so.8 => /usr/lib/i386-linux-gnu/libFLAC.so.8 (0xb72d7000)
libmad.so.0 => /usr/lib/libmad.so.0 (0xb72c0000)
libid3tag.so.0 => /usr/lib/libid3tag.so.0 (0xb72b0000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb729a000)
libmp3lame.so.0 => /usr/local/lib/libmp3lame.so.0 (0xb7220000)
libtwolame.so.0 => /usr/lib/libtwolame.so.0 (0xb71fe000)
libpulse.so.0 => /usr/lib/i386-linux-gnu/libpulse.so.0 (0xb71b0000)
libpulse-simple.so.0 => /usr/lib/i386-linux-gnu/libpulse-simple.so.0 (0xb71ab000)
libvorbisenc.so.2 => /usr/lib/i386-linux-gnu/libvorbisenc.so.2 (0xb7033000)
libvorbisfile.so.3 => /usr/lib/i386-linux-gnu/libvorbisfile.so.3 (0xb7028000)
libvorbis.so.0 => /usr/lib/i386-linux-gnu/libvorbis.so.0 (0xb6ffd000)
libogg.so.0 => /usr/lib/i386-linux-gnu/libogg.so.0 (0xb6ff5000)
libwavpack.so.1 => /usr/lib/libwavpack.so.1 (0xb6fcd000)
libsndfile.so.1 => /usr/lib/i386-linux-gnu/libsndfile.so.1 (0xb6f5c000)
/lib/ld-linux.so.2 (0xb76f2000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6f56000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb6f4d000)
libjson.so.0 => /usr/lib/i386-linux-gnu/libjson.so.0 (0xb6f45000)
libpulsecommon-1.0.so => /usr/lib/i386-linux-gnu/libpulsecommon-1.0.so (0xb6ee0000)
libdbus-1.so.3 => /lib/i386-linux-gnu/libdbus-1.so.3 (0xb6e97000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb6e77000)
libwrap.so.0 => /lib/i386-linux-gnu/libwrap.so.0 (0xb6e6d000)
libasyncns.so.0 => /usr/lib/i386-linux-gnu/libasyncns.so.0 (0xb6e66000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb6e62000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb6e5b000)
libnsl.so.1 => /lib/i386-linux-gnu/libnsl.so.1 (0xb6e41000)
libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xb6e2a000)
@ -
Hi,
I don't know the details of sox, but is there a library initialization function ? Like i.e. av_register_all() for libav ?
Are the LD_LIBRARY_PATH pointing to all paths needed ?
Hope it helps