diff options
Diffstat (limited to 'source/gameengine/VideoTexture')
-rw-r--r-- | source/gameengine/VideoTexture/CMakeLists.txt | 104 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/SConscript | 1 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/VideoFFmpeg.cpp | 16 | ||||
-rw-r--r-- | source/gameengine/VideoTexture/VideoFFmpeg.h | 8 |
4 files changed, 116 insertions, 13 deletions
diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index fb10b619f17..56600a30b0f 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -1,3 +1,4 @@ +<<<<<<< .working # $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -92,3 +93,106 @@ if(WITH_CODEC_FFMPEG) endif() blender_add_lib(ge_videotex "${SRC}" "${INC}") +======= +# $Id$ +# ***** 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. +# +# The Original Code is Copyright (C) 2006, Blender Foundation +# All rights reserved. +# +# The Original Code is: all of this file. +# +# Contributor(s): Jacques Beaurain. +# +# ***** END GPL LICENSE BLOCK ***** + +set(INC + . + ../BlenderRoutines + ../Expressions + ../GameLogic + ../Ketsji + ../Rasterizer + ../Rasterizer/RAS_OpenGLRasterizer + ../SceneGraph + ../../blender/blenkernel + ../../blender/blenlib + ../../blender/editors/include + ../../blender/gpu + ../../blender/imbuf + ../../blender/makesdna + ../../blender/python + ../../blender/python/generic + ../../../intern/container + ../../../intern/ffmpeg + ../../../intern/guardedalloc + ../../../intern/moto/include + ../../../intern/string +) + +set(INC_SYS + ${GLEW_INCLUDE_PATH} +) + +set(SRC + Exception.cpp + FilterBase.cpp + FilterBlueScreen.cpp + FilterColor.cpp + FilterNormal.cpp + FilterSource.cpp + ImageBase.cpp + ImageBuff.cpp + ImageMix.cpp + ImageRender.cpp + ImageViewport.cpp + PyTypeList.cpp + Texture.cpp + VideoBase.cpp + VideoFFmpeg.cpp + blendVideoTex.cpp + + BlendType.h + Common.h + Exception.h + FilterBase.h + FilterBlueScreen.h + FilterColor.h + FilterNormal.h + FilterSource.h + ImageBase.h + ImageBuff.h + ImageMix.h + ImageRender.h + ImageViewport.h + PyTypeList.h + Texture.h + VideoBase.h + VideoFFmpeg.h +) + +if(WITH_CODEC_FFMPEG) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ${PTHREADS_INCLUDE_DIRS} + ) + add_definitions(-DWITH_FFMPEG) + add_definitions(-D__STDC_CONSTANT_MACROS) +endif() + +blender_add_lib(ge_videotex "${SRC}" "${INC}" "${INC_SYS}") +>>>>>>> .merge-right.r38806 diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript index 5091082e87a..b39a59e4504 100644 --- a/source/gameengine/VideoTexture/SConscript +++ b/source/gameengine/VideoTexture/SConscript @@ -13,6 +13,7 @@ incs += ' #source/blender/editors/include #source/blender/blenlib #source/blende incs += ' #source/blender/makesdna #source/blender/imbuf #source/blender/python #source/blender/python/generic' incs += ' #source/blender/gpu #intern/string #intern/moto/include' incs += ' #intern/guardedalloc #intern/container #extern/glew/include' +incs += ' #intern/ffmpeg' defs = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw'): diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index 63dbc5bb7ba..f8274756c8b 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp +++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp @@ -182,7 +182,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV { if(formatCtx->streams[i] && get_codec_from_stream(formatCtx->streams[i]) && - (get_codec_from_stream(formatCtx->streams[i])->codec_type==CODEC_TYPE_VIDEO)) + (get_codec_from_stream(formatCtx->streams[i])->codec_type==AVMEDIA_TYPE_VIDEO)) { videoStream=i; break; @@ -368,9 +368,9 @@ void *VideoFFmpeg::cacheThread(void *data) BLI_remlink(&video->m_packetCacheBase, cachePacket); // use m_frame because when caching, it is not used in main thread // we can't use currentFrame directly because we need to convert to RGB first - avcodec_decode_video(video->m_codecCtx, + avcodec_decode_video2(video->m_codecCtx, video->m_frame, &frameFinished, - cachePacket->packet.data, cachePacket->packet.size); + &cachePacket->packet); if(frameFinished) { AVFrame * input = video->m_frame; @@ -641,7 +641,7 @@ void VideoFFmpeg::openCam (char * file, short camIdx) if (m_captRate <= 0.f) m_captRate = defFrameRate; sprintf(rateStr, "%f", m_captRate); - av_parse_video_frame_rate(&frameRate, rateStr); + av_parse_video_rate(&frameRate, rateStr); // populate format parameters // need to specify the time base = inverse of rate formatParams.time_base.num = frameRate.den; @@ -924,10 +924,10 @@ AVFrame *VideoFFmpeg::grabFrame(long position) { if (packet.stream_index == m_videoStream) { - avcodec_decode_video( + avcodec_decode_video2( m_codecCtx, m_frame, &frameFinished, - packet.data, packet.size); + &packet); if (frameFinished) { m_curPosition = (long)((packet.dts-startTs) * (m_baseFrameRate*timeBase) + 0.5); @@ -999,9 +999,9 @@ AVFrame *VideoFFmpeg::grabFrame(long position) { if(packet.stream_index == m_videoStream) { - avcodec_decode_video(m_codecCtx, + avcodec_decode_video2(m_codecCtx, m_frame, &frameFinished, - packet.data, packet.size); + &packet); // remember dts to compute exact frame number dts = packet.dts; if (frameFinished && !posFound) diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h index 9b09c485329..139b90dc463 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.h +++ b/source/gameengine/VideoTexture/VideoFFmpeg.h @@ -31,17 +31,15 @@ http://www.gnu.org/copyleft/lesser.txt. extern "C" { #undef __cplusplus #include <pthread.h> -#include <libavformat/avformat.h> -#include <libavcodec/avcodec.h> -#include <libavutil/rational.h> -#include <libswscale/swscale.h> + +#include "ffmpeg_compat.h" + #include "DNA_listBase.h" #include "BLI_threads.h" #include "BLI_blenlib.h" #define __cplusplus } - #if LIBAVFORMAT_VERSION_INT < (49 << 16) #define FFMPEG_OLD_FRAME_RATE 1 #else |