diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-28 17:33:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-28 17:33:35 +0400 |
commit | 07afa420f2f273c58d6d054b9026c92e0ac98785 (patch) | |
tree | aa15508d641ef30f6ae6b9877eabf5be4cc6eb85 | |
parent | 974c161b5077398bf79e57d4b9c4775619a8375f (diff) | |
parent | 1f02209957fc8afde957b48f1be41fc399a725b0 (diff) |
svn merge ^/trunk/blender -r42920:42927
-rw-r--r-- | release/scripts/modules/sys_info.py | 10 | ||||
-rw-r--r-- | release/scripts/presets/ffmpeg/DV.py | 2 | ||||
-rw-r--r-- | release/scripts/presets/ffmpeg/DVD.py | 2 | ||||
-rw-r--r-- | release/scripts/presets/ffmpeg/SVCD.py | 2 | ||||
-rw-r--r-- | release/scripts/presets/ffmpeg/VCD.py | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_customdata_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_defs.h | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_mesh_types.h | 2 | ||||
-rw-r--r-- | source/blender/python/SConscript | 3 | ||||
-rw-r--r-- | source/blender/python/intern/CMakeLists.txt | 16 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app.c | 5 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_ffmpeg.c | 139 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_ffmpeg.h | 32 |
13 files changed, 212 insertions, 7 deletions
diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index 1272d81872d..64ff1c0f007 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -94,6 +94,16 @@ def write_sysinfo(op): output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE'))) output.write('tempdir: {}\n'.format(bpy.app.tempdir)) + output.write('\nFFmpeg:\n') + output.write(lilies) + ffmpeg = bpy.app.ffmpeg + if ffmpeg.supported: + for lib in ['avcodec', 'avdevice', 'avformat', 'avutil', 'swscale']: + output.write('{}:{}{}\n'.format(lib, " "*(10-len(lib)), + getattr(ffmpeg, lib + '_version_string'))) + else: + output.write('Blender was built without FFmpeg support\n') + if bpy.app.background: output.write('\nOpenGL: missing, background mode\n') else: diff --git a/release/scripts/presets/ffmpeg/DV.py b/release/scripts/presets/ffmpeg/DV.py index 926fb241747..241d6938a5f 100644 --- a/release/scripts/presets/ffmpeg/DV.py +++ b/release/scripts/presets/ffmpeg/DV.py @@ -11,4 +11,4 @@ else: bpy.context.scene.render.ffmpeg_audio_mixrate = 48000 bpy.context.scene.render.ffmpeg_audio_codec = "PCM" -bpy.context.scene.render.ffmpeg_audio_channels = 2 +bpy.context.scene.render.ffmpeg_audio_channels = "STEREO" diff --git a/release/scripts/presets/ffmpeg/DVD.py b/release/scripts/presets/ffmpeg/DVD.py index 196b5d68406..07828a755cd 100644 --- a/release/scripts/presets/ffmpeg/DVD.py +++ b/release/scripts/presets/ffmpeg/DVD.py @@ -21,4 +21,4 @@ bpy.context.scene.render.ffmpeg_muxrate = 10080000 bpy.context.scene.render.ffmpeg_audio_codec = "AC3" bpy.context.scene.render.ffmpeg_audio_bitrate = 448 bpy.context.scene.render.ffmpeg_audio_mixrate = 48000 -bpy.context.scene.render.ffmpeg_audio_channels = 6 +bpy.context.scene.render.ffmpeg_audio_channels = "SURROUND51" diff --git a/release/scripts/presets/ffmpeg/SVCD.py b/release/scripts/presets/ffmpeg/SVCD.py index e4459ab5c5c..584f192c3d8 100644 --- a/release/scripts/presets/ffmpeg/SVCD.py +++ b/release/scripts/presets/ffmpeg/SVCD.py @@ -21,4 +21,4 @@ bpy.context.scene.render.ffmpeg_muxrate = 0 bpy.context.scene.render.ffmpeg_audio_bitrate = 224 bpy.context.scene.render.ffmpeg_audio_mixrate = 44100 bpy.context.scene.render.ffmpeg_audio_codec = "MP2" -bpy.context.scene.render.ffmpeg_audio_channels = 2 +bpy.context.scene.render.ffmpeg_audio_channels = "STEREO" diff --git a/release/scripts/presets/ffmpeg/VCD.py b/release/scripts/presets/ffmpeg/VCD.py index c2b73e682a2..35dda07a064 100644 --- a/release/scripts/presets/ffmpeg/VCD.py +++ b/release/scripts/presets/ffmpeg/VCD.py @@ -21,4 +21,4 @@ bpy.context.scene.render.ffmpeg_muxrate = 2352 * 75 * 8 bpy.context.scene.render.ffmpeg_audio_bitrate = 224 bpy.context.scene.render.ffmpeg_audio_mixrate = 44100 bpy.context.scene.render.ffmpeg_audio_codec = "MP2" -bpy.context.scene.render.ffmpeg_audio_channels = 2 +bpy.context.scene.render.ffmpeg_audio_channels = "STEREO" diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index b3ed49754ba..13a1f4fbe8a 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -36,6 +36,8 @@ extern "C" { #endif +#include "DNA_defs.h" /* USE_BMESH_FORWARD_COMPAT */ + /** descriptor and storage for a custom data layer */ typedef struct CustomDataLayer { int type; /* type of data in layer */ diff --git a/source/blender/makesdna/DNA_defs.h b/source/blender/makesdna/DNA_defs.h index 25d95419605..54dfc18a03c 100644 --- a/source/blender/makesdna/DNA_defs.h +++ b/source/blender/makesdna/DNA_defs.h @@ -45,4 +45,6 @@ /* hrmf, we need a better include then this */ #include "../blenloader/BLO_sys_types.h" /* needed for int64_t only! */ +#define USE_BMESH_FORWARD_COMPAT + #endif /* DNA_DEFS_H */ diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 18dd682bfaf..bedb3e7429b 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -36,6 +36,8 @@ #include "DNA_ID.h" #include "DNA_customdata_types.h" +#include "DNA_defs.h" /* USE_BMESH_FORWARD_COMPAT */ + struct DerivedMesh; struct Ipo; struct Key; diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index 7075b0592b8..481d66a9de7 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -46,5 +46,8 @@ if env['WITH_BF_INTERNATIONAL']: if env['WITH_BF_CYCLES']: defs.append('WITH_CYCLES') +if env['WITH_BF_FFMPEG']: + defs.append('WITH_FFMPEG') + sources = env.Glob('intern/*.c') env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361]) diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 63ccdea3f0d..1899936cb50 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -42,9 +42,10 @@ set(INC_SYS ) set(SRC - gpu.c + gpu.c bpy.c bpy_app.c + bpy_app_ffmpeg.c bpy_app_handlers.c bpy_driver.c bpy_interface.c @@ -62,9 +63,10 @@ set(SRC bpy_util.c stubs.c - gpu.h + gpu.h bpy.h bpy_app.h + bpy_app_ffmpeg.h bpy_app_handlers.h bpy_driver.h bpy_intern_string.h @@ -101,7 +103,15 @@ if(WITH_CYCLES) endif() if(WITH_INTERNATIONAL) - add_definitions(-DWITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + +if(WITH_CODEC_FFMPEG) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ) + + add_definitions(-DWITH_FFMPEG) endif() blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index d5f0cd205fa..ea95c4ebd85 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -32,6 +32,9 @@ #include <Python.h> #include "bpy_app.h" + +#include "bpy_app_ffmpeg.h" + #include "bpy_app_handlers.h" #include "bpy_driver.h" @@ -79,6 +82,7 @@ static PyStructSequence_Field app_info_fields[] = { {(char *)"build_system", (char *)"Build system used"}, /* submodules */ + {(char *)"ffmpeg", (char *)"FFmpeg library information backend"}, {(char *)"handlers", (char *)"Application handler callbacks"}, {NULL} }; @@ -147,6 +151,7 @@ static PyObject *make_app_info(void) SetStrItem("Unknown"); #endif + SetObjItem(BPY_app_ffmpeg_struct()); SetObjItem(BPY_app_handlers_struct()); #undef SetIntItem diff --git a/source/blender/python/intern/bpy_app_ffmpeg.c b/source/blender/python/intern/bpy_app_ffmpeg.c new file mode 100644 index 00000000000..9c4428919ec --- /dev/null +++ b/source/blender/python/intern/bpy_app_ffmpeg.c @@ -0,0 +1,139 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Sergey Sharybin + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/python/intern/bpy_app_ffmpeg.c + * \ingroup pythonintern + */ + +#include <Python.h> +#include "BLI_utildefines.h" +#include "BLI_callbacks.h" + +#include "RNA_types.h" +#include "RNA_access.h" +#include "bpy_rna.h" + +#ifdef WITH_FFMPEG +#include <libavcodec/avcodec.h> +#include <libavdevice/avdevice.h> +#include <libavformat/avformat.h> +#include <libavutil/avutil.h> +#include <libswscale/swscale.h> +#endif + +static PyTypeObject BlenderAppFFmpegType; + +#define DEF_FFMPEG_LIB_VERSION(lib) \ + {(char *)(#lib "_version"), (char *)("The " #lib " version as a tuple of 3 numbers")}, \ + {(char *)(#lib "_version_string"), (char *)("The " #lib " version formatted as a string")}, + +static PyStructSequence_Field app_ffmpeg_info_fields[] = { + {(char *)"supported", (char *)("Boolean, True when Blender is built with FFmpeg support")}, + + DEF_FFMPEG_LIB_VERSION(avcodec) + DEF_FFMPEG_LIB_VERSION(avdevice) + DEF_FFMPEG_LIB_VERSION(avformat) + DEF_FFMPEG_LIB_VERSION(avutil) + DEF_FFMPEG_LIB_VERSION(swscale) + {NULL} +}; + +#undef DEF_FFMPEG_LIB_VERSION + +static PyStructSequence_Desc app_ffmpeg_info_desc = { + (char *)"bpy.app.ffmpeg", /* name */ + (char *)"This module contains information about FFmpeg blender is linked against", /* doc */ + app_ffmpeg_info_fields, /* fields */ + (sizeof(app_ffmpeg_info_fields) / sizeof(PyStructSequence_Field)) - 1 +}; + +static PyObject *make_ffmpeg_info(void) +{ + PyObject *ffmpeg_info; + int pos = 0, curversion; + + ffmpeg_info = PyStructSequence_New(&BlenderAppFFmpegType); + if (ffmpeg_info == NULL) { + return NULL; + } + +#define SetIntItem(flag) \ + PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyLong_FromLong(flag)) +#define SetStrItem(str) \ + PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyUnicode_FromString(str)) +#define SetObjItem(obj) \ + PyStructSequence_SET_ITEM(ffmpeg_info, pos++, obj) + +#ifdef WITH_FFMPEG + #define FFMPEG_LIB_VERSION(lib) \ + curversion = lib ## _version(); \ + SetObjItem(Py_BuildValue("(iii)", \ + curversion >> 16, (curversion >> 8) % 256, curversion % 256)); \ + SetObjItem(PyUnicode_FromFormat("%2d, %2d, %2d", \ + curversion >> 16, (curversion >> 8) % 256, curversion % 256)); +#else + #define FFMPEG_LIB_VERSION(lib) \ + SetStrItem("Unknown"); \ + SetStrItem("Unknown"); +#endif + +#ifdef WITH_FFMPEG + SetObjItem(PyBool_FromLong(1)); +#else + SetObjItem(PyBool_FromLong(0)); +#endif + + FFMPEG_LIB_VERSION(avcodec); + FFMPEG_LIB_VERSION(avdevice); + FFMPEG_LIB_VERSION(avformat); + FFMPEG_LIB_VERSION(avutil); + FFMPEG_LIB_VERSION(swscale); + +#undef FFMPEG_LIB_VERSION + + if (PyErr_Occurred()) { + Py_CLEAR(ffmpeg_info); + return NULL; + } + +#undef SetIntItem +#undef SetStrItem +#undef SetObjItem + + return ffmpeg_info; +} + +PyObject *BPY_app_ffmpeg_struct(void) +{ + PyObject *ret; + + PyStructSequence_InitType(&BlenderAppFFmpegType, &app_ffmpeg_info_desc); + + ret = make_ffmpeg_info(); + + /* prevent user from creating new instances */ + BlenderAppFFmpegType.tp_init = NULL; + BlenderAppFFmpegType.tp_new = NULL; + BlenderAppFFmpegType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */ + + return ret; +} diff --git a/source/blender/python/intern/bpy_app_ffmpeg.h b/source/blender/python/intern/bpy_app_ffmpeg.h new file mode 100644 index 00000000000..4ed89cd7902 --- /dev/null +++ b/source/blender/python/intern/bpy_app_ffmpeg.h @@ -0,0 +1,32 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Sergey Sharybin + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/python/intern/bpy_app_ffmpeg.h + * \ingroup pythonintern + */ + +#ifndef BPY_APP_FFMPEG_H +#define BPY_APP_FFMPEG_H + +PyObject *BPY_app_ffmpeg_struct(void); + +#endif // BPY_APP_FFMPEG_H |