diff --git a/src/AvTranscoder/avTranscoder.i b/src/AvTranscoder/avTranscoder.i index fe9db742..8b2ec56a 100644 --- a/src/AvTranscoder/avTranscoder.i +++ b/src/AvTranscoder/avTranscoder.i @@ -17,18 +17,17 @@ %include "AvTranscoder/swig/avOperator.i" %{ -#include #include %} %include "AvTranscoder/progress/progress.i" %include "AvTranscoder/properties/properties.i" -%include "AvTranscoder/data/data.i" %include "AvTranscoder/profile/profile.i" +%include "AvTranscoder/data/data.i" -%include %include +%include "AvTranscoder/library.i" %include "AvTranscoder/option.i" %include "AvTranscoder/util.i" %include "AvTranscoder/codec/codec.i" diff --git a/src/AvTranscoder/library.i b/src/AvTranscoder/library.i new file mode 100644 index 00000000..019b906c --- /dev/null +++ b/src/AvTranscoder/library.i @@ -0,0 +1,15 @@ +%{ +#include +%} + +namespace std { +// Allow vector of object with no default constructor +%ignore vector< avtranscoder::Library >::vector(size_type); +%ignore vector< avtranscoder::Library >::resize; + +// Create instantiations of a template classes +%template(Libraries) vector< avtranscoder::Library >; +%template(IntVector) vector< size_t >; +} + +%include diff --git a/src/AvTranscoder/option.i b/src/AvTranscoder/option.i index ff550d2e..4abeb1ad 100644 --- a/src/AvTranscoder/option.i +++ b/src/AvTranscoder/option.i @@ -9,7 +9,7 @@ namespace std { // Create instantiations of a template classes %template(OptionArray) vector< avtranscoder::Option >; -%template(IntPair) pair< size_t, size_t >; +%template(IntPair) pair< int, int >; } %include diff --git a/src/AvTranscoder/properties/properties.i b/src/AvTranscoder/properties/properties.i index e80e70ce..00cbaeaa 100644 --- a/src/AvTranscoder/properties/properties.i +++ b/src/AvTranscoder/properties/properties.i @@ -46,6 +46,9 @@ namespace std { %template(ChannelVector) vector< avtranscoder::Channel >; } +%include +%include + %include %include %include diff --git a/src/AvTranscoder/transcoder/transcoder.i b/src/AvTranscoder/transcoder/transcoder.i index 3b934ab7..ffb1eedd 100644 --- a/src/AvTranscoder/transcoder/transcoder.i +++ b/src/AvTranscoder/transcoder/transcoder.i @@ -3,5 +3,7 @@ #include %} +%template(StreamTranscoderVector) std::vector< avtranscoder::StreamTranscoder* >; + %include %include diff --git a/test/pyTest/testLibrary.py b/test/pyTest/testLibrary.py new file mode 100644 index 00000000..f7c812b9 --- /dev/null +++ b/test/pyTest/testLibrary.py @@ -0,0 +1,33 @@ +from nose.tools import * + +from pyAvTranscoder import avtranscoder as av + + +def testListLibraries(): + """ + Check name and license of libraries. + """ + librariesName = set(["avtranscoder", "avutil", "avformat", "avcodec", "avresample", "swresample", "swscale", "avfilter"]) + + for library in av.getLibraries(): + libraryName = library.getName() + if libraryName == "avtranscoder": + assert_equals(library.getLicense(), "GPL v2 or LGPL v2.1") + assert_in(libraryName, librariesName) + librariesName.remove(libraryName) + + # avresample or swresample, if avtranscoder depends on libav or ffmpeg + assert_equals(len(librariesName), 1) + + +def testSupportedExtensions(): + """ + Check if we can access the supported extensions. + These numbers of input/output extensions correspond to the features implemented in common libraries (not in third parties). + @note Tested with ffmpeg-2.4.2 + """ + inputExtensions = av.getInputExtensions() + outputExtensions = av.getOutputExtensions() + + assert_greater_equal(len(inputExtensions), 162) + assert_greater_equal(len(outputExtensions), 184)