1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
from waftools.plugin import plugin
## Code fragments for configuration
avcodec_decode_audio4_fragment = """
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include "libavcodec/avcodec.h"
#else
# include "avcodec.h"
#endif
int main(void) {
AVCodecContext *ctx;
AVFrame *frame;
int got_frame;
AVPacket *pkt;
avcodec_decode_audio4 (ctx, frame, &got_frame, pkt);
return 0;
}
"""
avcodec_free_frame_fragment = """
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
# include "libavcodec/avcodec.h"
#else
# include "avcodec.h"
#endif
int main(void) {
AVFrame *frame;
avcodec_free_frame (&frame);
return 0;
}
"""
def plugin_configure(conf):
conf.check_cfg(package="libavcodec", uselib_store="avcodec",
args="--cflags --libs")
conf.check_cc(header_name="avcodec.h", uselib="avcodec", type="cshlib", mandatory=False)
conf.check_cc(header_name="libavcodec/avcodec.h", uselib="avcodec", type="cshlib", mandatory=False)
# mandatory function avcodec_decode_audio4 available since
# * ffmpeg: commit e4de716, lavc 53.40.0, release 0.9
# * libav: commit 0eea212, lavc 53.25.0, release 0.8
conf.check_cc(fragment=avcodec_decode_audio4_fragment, uselib="avcodec",
uselib_store="avcodec_decode_audio4",
msg="Checking for function avcodec_decode_audio4", mandatory=True)
# non-mandatory function avcodec_free_frame since
# * ffmpeg: commit 46a3595, lavc 54.59.100, release 1.0
# * libav: commit a42aada, lavc 54.28.0, release 9
conf.check_cc(fragment=avcodec_free_frame_fragment, uselib="avcodec",
uselib_store="avcodec_free_frame",
msg="Checking for function avcodec_free_frame", mandatory=False)
configure, build = plugin('avcodec', configure=plugin_configure,
libs=["avcodec"])
|