Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-05-30 14:27:45 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-05-30 14:27:45 +0400
commit682a5acd03959e5ed8ac4ff7b4b02435df19f50d (patch)
tree639de9d0992e147095517fef7b365ac82026680b /intern
parent74f43c20fd601c6acfded12c8f7bcebb8c9d8433 (diff)
parent221472f7b50914801845ec78cae05d1618bd3c0a (diff)
merged to r37017 from trunk
Diffstat (limited to 'intern')
-rw-r--r--intern/audaspace/CMakeLists.txt1
-rw-r--r--intern/audaspace/SConscript2
-rw-r--r--intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp24
-rw-r--r--intern/bsp/CMakeLists.txt1
-rw-r--r--intern/bsp/SConscript2
-rw-r--r--intern/container/CTR_TaggedIndex.h10
-rw-r--r--intern/decimation/CMakeLists.txt1
-rw-r--r--intern/decimation/SConscript2
-rwxr-xr-xintern/ffmpeg/ffmpeg_compat.h133
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp3
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm8
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp5
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h14
13 files changed, 183 insertions, 23 deletions
diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt
index 74f483eab05..a2468d0071e 100644
--- a/intern/audaspace/CMakeLists.txt
+++ b/intern/audaspace/CMakeLists.txt
@@ -26,6 +26,7 @@ set(INC
FX SRC
${PTHREADS_INC}
${LIBSAMPLERATE_INC}
+ ../ffmpeg
)
set(SRC
diff --git a/intern/audaspace/SConscript b/intern/audaspace/SConscript
index ecc94987185..67f859b0e5f 100644
--- a/intern/audaspace/SConscript
+++ b/intern/audaspace/SConscript
@@ -8,7 +8,7 @@ defs = []
if env['WITH_BF_FFMPEG']:
sources += env.Glob('ffmpeg/*.cpp')
- incs += ' ffmpeg ' + env['BF_FFMPEG_INC']
+ incs += ' ffmpeg #/intern/ffmpeg ' + env['BF_FFMPEG_INC']
defs.append('WITH_FFMPEG')
if env['WITH_BF_SDL']:
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
index ea6e0c549fa..4597432e7d1 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
@@ -39,6 +39,7 @@
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
+#include "ffmpeg_compat.h"
}
int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
@@ -52,6 +53,10 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
int read_length, data_size;
+ AVPacket tmp_pkt;
+
+ av_init_packet(&tmp_pkt);
+
// as long as there is still data in the package
while(audio_pkg_size > 0)
{
@@ -64,15 +69,14 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
// read samples from the packet
data_size = buf_size - buf_pos;
- /*read_length = avcodec_decode_audio3(m_codecCtx,
- (int16_t*)(((data_t*)buffer.getBuffer())+buf_pos),
- &data_size,
- packet);*/
- read_length = avcodec_decode_audio2(m_codecCtx,
- (int16_t*)(((data_t*)buffer.getBuffer()) + buf_pos),
- &data_size,
- audio_pkg_data,
- audio_pkg_size);
+
+ tmp_pkt.data = audio_pkg_data;
+ tmp_pkt.size = audio_pkg_size;
+
+ read_length = avcodec_decode_audio3(
+ m_codecCtx,
+ (int16_t*)(((data_t*)buffer.getBuffer()) + buf_pos),
+ &data_size, &tmp_pkt);
// read error, next packet!
if(read_length < 0)
@@ -112,7 +116,7 @@ void AUD_FFMPEGReader::init()
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
{
- if((m_formatCtx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
+ if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
&& (m_stream < 0))
{
m_stream=i;
diff --git a/intern/bsp/CMakeLists.txt b/intern/bsp/CMakeLists.txt
index 2e615314543..9f281586867 100644
--- a/intern/bsp/CMakeLists.txt
+++ b/intern/bsp/CMakeLists.txt
@@ -27,6 +27,7 @@
set(INC
./intern
../container
+ ../guardedalloc
../moto/include
../memutil
)
diff --git a/intern/bsp/SConscript b/intern/bsp/SConscript
index 43952f4ff18..4927c33dc8a 100644
--- a/intern/bsp/SConscript
+++ b/intern/bsp/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('intern/*.cpp')
-incs = 'intern ../container ../moto/include ../memutil'
+incs = 'intern ../container ../moto/include ../memutil ../guardedalloc'
env.BlenderLib ('bf_intern_bsp', sources, Split(incs), [], libtype=['core','player'], priority=[200,100] )
diff --git a/intern/container/CTR_TaggedIndex.h b/intern/container/CTR_TaggedIndex.h
index 0a57ce11d19..b5284a5da30 100644
--- a/intern/container/CTR_TaggedIndex.h
+++ b/intern/container/CTR_TaggedIndex.h
@@ -52,6 +52,8 @@
#include <functional>
+#include "MEM_sys_types.h"
+
enum {
empty_tag = 0x0,
@@ -100,9 +102,9 @@ public:
#if defined(_WIN64)
CTR_TaggedIndex(
- const unsigned __int64 val
+ const uint64_t val
) :
- m_val ( ((unsigned __int64)val & index_mask)
+ m_val ( ((uint64_t)val & index_mask)
| ( (empty_tag << tag_shift)
& (~index_mask) ) ) {
}
@@ -140,8 +142,8 @@ public:
}
#if defined(_WIN64)
- operator unsigned __int64 () const {
- return (unsigned __int64)(m_val & index_mask);
+ operator uint64_t () const {
+ return (uint64_t)(m_val & index_mask);
}
#endif
diff --git a/intern/decimation/CMakeLists.txt b/intern/decimation/CMakeLists.txt
index b726a8cd6a1..6f9137b7189 100644
--- a/intern/decimation/CMakeLists.txt
+++ b/intern/decimation/CMakeLists.txt
@@ -27,6 +27,7 @@
set(INC
.
../container
+ ../guardedalloc
../memutil
../moto/include
)
diff --git a/intern/decimation/SConscript b/intern/decimation/SConscript
index 6e2929cb650..6f4befb3ffa 100644
--- a/intern/decimation/SConscript
+++ b/intern/decimation/SConscript
@@ -3,6 +3,6 @@ Import ('env')
sources = env.Glob('intern/*.cpp')
-incs = '. ../moto/include ../container ../memutil'
+incs = '. ../moto/include ../container ../memutil ../guardedalloc'
env.BlenderLib ('bf_intern_decimate', sources, Split(incs) , [], libtype=['core', 'player'], priority = [200, 100] )
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
new file mode 100755
index 00000000000..238519ebaec
--- /dev/null
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -0,0 +1,133 @@
+#ifndef __ffmpeg_compat_h_included__
+#define __ffmpeg_compat_h_included__ 1
+
+/*
+ * $Id: ffmpeg_compat.h 36982 2011-05-28 14:16:56Z schlaile $
+ *
+ * compatibility macros to make every ffmpeg installation appear
+ * like the most current installation (wrapping some functionality sometimes)
+ * it also includes all ffmpeg header files at once, no need to do it
+ * seperately.
+ *
+ * Copyright (c) 2011 Peter Schlaile
+ *
+ * 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.
+ *
+ */
+
+
+#include <libavformat/avformat.h>
+#include <libavcodec/avcodec.h>
+#include <libavutil/rational.h>
+
+#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
+#define FFMPEG_HAVE_PARSE_UTILS 1
+#include <libavutil/parseutils.h>
+#endif
+
+#include <libswscale/swscale.h>
+#include <libavcodec/opt.h>
+
+#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105))
+#define FFMPEG_HAVE_AVIO 1
+#endif
+
+#if (LIBAVCODEC_VERSION_MAJOR > 53) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR > 1)) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR == 1) && (LIBAVCODEC_VERSION_MICRO >= 1))
+#define FFMPEG_HAVE_DEFAULT_VAL_UNION 1
+#endif
+
+#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
+#define FFMPEG_HAVE_AV_DUMP_FORMAT 1
+#endif
+
+#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 45))
+#define FFMPEG_HAVE_AV_GUESS_FORMAT 1
+#endif
+
+#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 23))
+#define FFMPEG_HAVE_DECODE_AUDIO3 1
+#define FFMPEG_HAVE_DECODE_VIDEO2 1
+#endif
+
+#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 64))
+#define FFMPEG_HAVE_AVMEDIA_TYPES 1
+#endif
+
+#if ((LIBAVCODEC_VERSION_MAJOR > 52) || (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29)) && \
+ ((LIBSWSCALE_VERSION_MAJOR > 0) || (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10))
+#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
+#endif
+
+#ifndef FFMPEG_HAVE_AVIO
+#define AVIO_FLAG_WRITE URL_WRONLY
+#define avio_open url_fopen
+#define avio_tell url_ftell
+#define avio_close url_fclose
+#endif
+
+/* there are some version inbetween, which have avio_... functions but no
+ AVIO_FLAG_... */
+#ifndef AVIO_FLAG_WRITE
+#define AVIO_FLAG_WRITE URL_WRONLY
+#endif
+
+#ifndef AV_PKT_FLAG_KEY
+#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
+#endif
+
+#ifndef FFMPEG_HAVE_AV_DUMP_FORMAT
+#define av_dump_format dump_format
+#endif
+
+#ifndef FFMPEG_HAVE_AV_GUESS_FORMAT
+#define av_guess_format guess_format
+#endif
+
+#ifndef FFMPEG_HAVE_PARSE_UTILS
+#define av_parse_video_rate av_parse_video_frame_rate
+#endif
+
+#ifdef FFMPEG_HAVE_DEFAULT_VAL_UNION
+#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val.i64
+#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val.dbl
+#else
+#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val
+#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val
+#endif
+
+#ifndef FFMPEG_HAVE_AVMEDIA_TYPES
+#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+#endif
+
+#ifndef FFMPEG_HAVE_DECODE_AUDIO3
+static inline
+int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
+ int *frame_size_ptr, AVPacket *avpkt)
+{
+ return avcodec_decode_audio2(avctx, samples,
+ frame_size_ptr, avpkt->data,
+ avpkt->size);
+}
+#endif
+
+#ifndef FFMPEG_HAVE_DECODE_VIDEO2
+static inline
+int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
+ int *got_picture_ptr,
+ AVPacket *avpkt)
+{
+ return avcodec_decode_video(avctx, picture, got_picture_ptr,
+ avpkt->data, avpkt->size);
+}
+#endif
+
+#endif
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index b44f2b18225..c53bf7de36c 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -795,6 +795,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
}
default: {
+#ifdef WITH_X11_XINPUT
if(xe->type == window->GetXTablet().MotionEvent)
{
XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe;
@@ -818,7 +819,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
}
else if(xe->type == window->GetXTablet().ProxOutEvent)
window->GetXTablet().CommonData.Active= GHOST_kTabletModeNone;
-
+#endif // WITH_X11_XINPUT
break;
}
}
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 8d28c9d5b17..fb7d4a459c7 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -461,9 +461,13 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
GHOST_WindowCocoa::~GHOST_WindowCocoa()
{
- if (m_customCursor) delete m_customCursor;
-
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ if (m_customCursor) {
+ [m_customCursor release];
+ m_customCursor = nil;
+ }
+
[m_openGLView release];
if (m_window) {
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index aea5b5156d9..fc72ea09f40 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -182,9 +182,12 @@ GHOST_WindowX11(
Atom atoms[2];
int natom;
int glxVersionMajor, glxVersionMinor; // As in GLX major.minor
-
+
+#ifdef WITH_X11_XINPUT
/* initialize incase X11 fails to load */
memset(&m_xtablet, 0, sizeof(m_xtablet));
+#endif
+
m_visual= NULL;
if (!glXQueryVersion(m_display, &glxVersionMajor, &glxVersionMinor)) {
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index 96d8ad77d10..2cb269ea919 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -38,7 +38,9 @@
#include <X11/Xlib.h>
#include <GL/glx.h>
// For tablets
-#include <X11/extensions/XInput.h>
+#ifdef WITH_X11_XINPUT
+# include <X11/extensions/XInput.h>
+#endif
#include <map>
@@ -190,7 +192,7 @@ public:
Window
getXWindow(
);
-
+#ifdef WITH_X11_XINPUT
class XTablet
{
public:
@@ -214,6 +216,10 @@ public:
const GHOST_TabletData* GetTabletData()
{ return &m_xtablet.CommonData; }
+#else // WITH_X11_XINPUT
+ const GHOST_TabletData* GetTabletData()
+ { return NULL; }
+#endif // WITH_X11_XINPUT
/*
* Need this in case that we want start the window
@@ -321,7 +327,9 @@ private :
getEmptyCursor(
);
+#ifdef WITH_X11_XINPUT
void initXInputDevices();
+#endif
GLXContext m_context;
Window m_window;
@@ -350,8 +358,10 @@ private :
/** Cache of XC_* ID's to XCursor structures */
std::map<unsigned int, Cursor> m_standard_cursors;
+#ifdef WITH_X11_XINPUT
/* Tablet devices */
XTablet m_xtablet;
+#endif
void icccmSetState(int state);
int icccmGetState() const;