h2xml and xml2py and ffmpeg

"Jeff C. Britton" <[email protected]> Wed, 23 Mar 2011 14:39:34 -0700
Newsgroups gmane.comp.python.ctypes
Message-ID <[email protected]>
I am trying to use h2xml and xml2py to wrap the libraries in ffmpeg.
I tried the following in Ubuntu 10.10, python 2.6.6 and end up with an
error.

Any suggestions to get this to work would be helpful.
Or if anybody has an existing wrapper that would be useful also.

Thanks.


# from root of user directory, get and build ffmpeg
git clone git://git.videolan.org/ffmpeg.git
mkdir ffmpegobjs
cd ffmpegobjs
../ffmpeg/configure --enable-shared
# make takes a while to run
make

cd ..

# from root of user, get and build ctypeslib
svn co http://svn.python.org/projects/ctypes/trunk/ctypeslib
cd ctypeslib
python setup.py build
python setup.py install


export FF=~/ffmpeg
export FFO=~/ffmpegobjs

h2xml.py -c -I $FF $FF/libavcodec/avcodec.h, $FF/libavformat/avformat.h,
$FF/libswscale/swscale.h, $FF/libavdevice/avdevice.h,
$FF/libavfilter/avfilter.h $FF/libpostproc/postprocess.h -o av.xml -D
__STDC_CONSTANT_MACROS


xml2py.py av.xml -o av.py -l $FFO/libavcodec/libavcodec.so -l
$FFO/libavformat/libavformat.so -l $FFO/libswscale/libswscale.so -l
$FFO/libavdevice/libavdevice.so -l $FFO/libavfilter/libavfilter.so -l
$FFO/libpostproc/libpostproc.so


Traceback (most recent call last):
  File "/usr/local/bin/xml2py.py", line 6, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.6/dist-packages/ctypeslib/xml2py.py",
line 166, in main
    dlls = [load_library(name) for name in options.dlls]
  File "/usr/local/lib/python2.6/dist-packages/ctypeslib/xml2py.py",
line 162, in load_library
    return CDLL(path, mode=mode)
  File "/usr/lib/python2.6/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/jbritton/ffmpegobjs/libavcodec/libavcodec.so: symbol
av_get_channel_layout_nb_channels, version LIBAVUTIL_50 not defined in
file libavutil.so.50 with link time reference

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar