You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Refactored and fixed many include paths (not sure how they worked before). Also, refactored SWIG bindings into separate folders, and added Ruby as the 2nd officially supported language for libopenshot.
This commit is contained in:
78
src/bindings/python/CMakeLists.txt
Normal file
78
src/bindings/python/CMakeLists.txt
Normal file
@@ -0,0 +1,78 @@
|
||||
####################### CMakeLists.txt (libopenshot) #########################
|
||||
# @brief CMake build file for libopenshot (used to generate Python SWIG bindings)
|
||||
# @author Jonathan Thomas <jonathan@openshot.org>
|
||||
#
|
||||
# @section LICENSE
|
||||
#
|
||||
# Copyright (c) 2008-2014 OpenShot Studios, LLC
|
||||
# <http://www.openshotstudios.com/>. This file is part of
|
||||
# OpenShot Library (libopenshot), an open-source project dedicated to
|
||||
# delivering high quality video editing and animation solutions to the
|
||||
# world. For more information visit <http://www.openshot.org/>.
|
||||
#
|
||||
# OpenShot Library (libopenshot) is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU Affero General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# OpenShot Library (libopenshot) is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Also, if your software can interact with users remotely through a computer
|
||||
# network, you should also make sure that it provides a way for users to
|
||||
# get its source. For example, if your program is a web application, its
|
||||
# interface could display a "Source" link that leads users to an archive
|
||||
# of the code. There are many ways you could offer source, and different
|
||||
# solutions will be better for different programs; see section 13 for the
|
||||
# specific requirements.
|
||||
#
|
||||
# You should also get your employer (if you work as a programmer) or
|
||||
# school, if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
# For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
|
||||
############### SWIG PYTHON BINDINGS ################
|
||||
FIND_PACKAGE(SWIG 2.0 REQUIRED)
|
||||
INCLUDE(${SWIG_USE_FILE})
|
||||
|
||||
FIND_PACKAGE(PythonLibs 3)
|
||||
FIND_PACKAGE(PythonInterp 3)
|
||||
IF (PYTHONLIBS_FOUND)
|
||||
IF (PYTHONINTERP_FOUND)
|
||||
|
||||
### Include Python header files
|
||||
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
### Enable C++ support in SWIG
|
||||
SET_SOURCE_FILES_PROPERTIES(openshot.i PROPERTIES CPLUSPLUS ON)
|
||||
|
||||
### Add the SWIG interface file (which defines all the SWIG methods)
|
||||
SWIG_ADD_MODULE(openshot python openshot.i)
|
||||
|
||||
### Link the new python wrapper library with libopenshot
|
||||
SWIG_LINK_LIBRARIES(openshot ${PYTHON_LIBRARIES} openshot)
|
||||
|
||||
### FIND THE PYTHON INTERPRETER (AND THE SITE PACKAGES FOLDER)
|
||||
EXECUTE_PROCESS ( COMMAND ${PYTHON_EXECUTABLE} -c "import site; print(site.getsitepackages()[0])"
|
||||
OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
GET_FILENAME_COMPONENT(_ABS_PYTHON_MODULE_PATH "${_ABS_PYTHON_MODULE_PATH}" ABSOLUTE)
|
||||
FILE(RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH})
|
||||
SET(PYTHON_MODULE_PATH ${_REL_PYTHON_MODULE_PATH})
|
||||
|
||||
|
||||
############### INSTALL HEADERS & LIBRARY ################
|
||||
### Install Python bindings
|
||||
INSTALL(TARGETS _openshot DESTINATION ${PYTHON_MODULE_PATH} )
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/openshot.py DESTINATION ${PYTHON_MODULE_PATH} )
|
||||
|
||||
ENDIF(PYTHONINTERP_FOUND)
|
||||
ENDIF (PYTHONLIBS_FOUND)
|
||||
154
src/bindings/python/openshot.i
Normal file
154
src/bindings/python/openshot.i
Normal file
@@ -0,0 +1,154 @@
|
||||
####################### src/openshot.i (libopenshot) ########################
|
||||
# @brief SWIG configuration for libopenshot (to generate Python SWIG bindings)
|
||||
# @author Jonathan Thomas <jonathan@openshot.org>
|
||||
#
|
||||
# @section LICENSE
|
||||
#
|
||||
# Copyright (c) 2008-2014 OpenShot Studios, LLC
|
||||
# <http://www.openshotstudios.com/>. This file is part of
|
||||
# OpenShot Library (libopenshot), an open-source project dedicated to
|
||||
# delivering high quality video editing and animation solutions to the
|
||||
# world. For more information visit <http://www.openshot.org/>.
|
||||
#
|
||||
# OpenShot Library (libopenshot) is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU Affero General Public License
|
||||
# as published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# OpenShot Library (libopenshot) is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Also, if your software can interact with users remotely through a computer
|
||||
# network, you should also make sure that it provides a way for users to
|
||||
# get its source. For example, if your program is a web application, its
|
||||
# interface could display a "Source" link that leads users to an archive
|
||||
# of the code. There are many ways you could offer source, and different
|
||||
# solutions will be better for different programs; see section 13 for the
|
||||
# specific requirements.
|
||||
#
|
||||
# You should also get your employer (if you work as a programmer) or
|
||||
# school, if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
# For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
################################################################################
|
||||
|
||||
|
||||
%module openshot
|
||||
|
||||
/* Enable inline documentation */
|
||||
%feature("autodoc", "1");
|
||||
|
||||
/* Include various SWIG helpers */
|
||||
%include "typemaps.i"
|
||||
%include "std_string.i"
|
||||
%include "std_list.i"
|
||||
%include "std_vector.i"
|
||||
|
||||
/* Unhandled STL Exception Handling */
|
||||
%include <std_except.i>
|
||||
|
||||
/* Include shared pointer code */
|
||||
#define SWIG_SHARED_PTR_SUBNAMESPACE tr1
|
||||
%include <std_shared_ptr.i>
|
||||
|
||||
/* Mark these classes as shared_ptr classes */
|
||||
%shared_ptr(Magick::Image)
|
||||
%shared_ptr(juce::AudioSampleBuffer)
|
||||
%shared_ptr(openshot::Frame)
|
||||
%shared_ptr(Frame)
|
||||
|
||||
%{
|
||||
#include "../../../include/Version.h"
|
||||
#include "../../../include/ReaderBase.h"
|
||||
#include "../../../include/WriterBase.h"
|
||||
#include "../../../include/Cache.h"
|
||||
#include "../../../include/ChunkReader.h"
|
||||
#include "../../../include/ChunkWriter.h"
|
||||
#include "../../../include/ClipBase.h"
|
||||
#include "../../../include/Clip.h"
|
||||
#include "../../../include/Coordinate.h"
|
||||
#include "../../../include/Color.h"
|
||||
#include "../../../include/DummyReader.h"
|
||||
#include "../../../include/EffectBase.h"
|
||||
#include "../../../include/Effects.h"
|
||||
#include "../../../include/Exceptions.h"
|
||||
#include "../../../include/FFmpegReader.h"
|
||||
#include "../../../include/FFmpegWriter.h"
|
||||
#include "../../../include/Fraction.h"
|
||||
#include "../../../include/Frame.h"
|
||||
#include "../../../include/FrameMapper.h"
|
||||
#include "../../../include/ImageReader.h"
|
||||
#include "../../../include/PlayerBase.h"
|
||||
#include "../../../include/Point.h"
|
||||
#include "../../../include/Profile.h"
|
||||
#include "../../../include/QtPlayer.h"
|
||||
#include "../../../include/KeyFrame.h"
|
||||
#include "../../../include/RendererBase.h"
|
||||
#include "../../../include/SDLPlayer.h"
|
||||
#include "../../../include/TextReader.h"
|
||||
#include "../../../include/Timeline.h"
|
||||
|
||||
%}
|
||||
|
||||
#ifdef USE_BLACKMAGIC
|
||||
%{
|
||||
#include "../../../include/DecklinkReader.h"
|
||||
#include "../../../include/DecklinkWriter.h"
|
||||
%}
|
||||
#endif
|
||||
|
||||
|
||||
%include "../../../include/Version.h"
|
||||
%include "../../../include/ReaderBase.h"
|
||||
%include "../../../include/WriterBase.h"
|
||||
%include "../../../include/Cache.h"
|
||||
%include "../../../include/ChunkReader.h"
|
||||
%include "../../../include/ChunkWriter.h"
|
||||
%include "../../../include/ClipBase.h"
|
||||
%include "../../../include/Clip.h"
|
||||
%include "../../../include/Coordinate.h"
|
||||
%include "../../../include/Color.h"
|
||||
#ifdef USE_BLACKMAGIC
|
||||
%include "../../../include/DecklinkReader.h"
|
||||
%include "../../../include/DecklinkWriter.h"
|
||||
#endif
|
||||
%include "../../../include/DummyReader.h"
|
||||
%include "../../../include/EffectBase.h"
|
||||
%include "../../../include/Exceptions.h"
|
||||
%include "../../../include/FFmpegReader.h"
|
||||
%include "../../../include/FFmpegWriter.h"
|
||||
%include "../../../include/Fraction.h"
|
||||
%include "../../../include/Frame.h"
|
||||
%include "../../../include/FrameMapper.h"
|
||||
%include "../../../include/ImageReader.h"
|
||||
%include "../../../include/PlayerBase.h"
|
||||
%include "../../../include/Point.h"
|
||||
%include "../../../include/Profile.h"
|
||||
%include "../../../include/QtPlayer.h"
|
||||
%include "../../../include/KeyFrame.h"
|
||||
%include "../../../include/RendererBase.h"
|
||||
%include "../../../include/SDLPlayer.h"
|
||||
%include "../../../include/TextReader.h"
|
||||
%include "../../../include/Timeline.h"
|
||||
|
||||
/* Effects */
|
||||
%include "../../../include/effects/ChromaKey.h"
|
||||
%include "../../../include/effects/Deinterlace.h"
|
||||
%include "../../../include/effects/Mask.h"
|
||||
%include "../../../include/effects/Negate.h"
|
||||
|
||||
|
||||
/* Wrap std templates (list, vector, etc...) */
|
||||
namespace std {
|
||||
%template(ClipList) list<Clip *>;
|
||||
%template(EffectBaseList) list<EffectBase *>;
|
||||
%template(CoordinateVector) vector<Coordinate>;
|
||||
%template(PointsVector) vector<Point>;
|
||||
%template(FieldVector) vector<Field>;
|
||||
%template(MappedFrameVector) vector<MappedFrame>;
|
||||
}
|
||||
Reference in New Issue
Block a user