aboutsummaryrefslogtreecommitdiffstats
path: root/mediaplugin/src/plugins/media/ffmpeg
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-11-09 16:19:21 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-11-09 16:19:21 +0000
commit1c700b446719e066cd4a66eedbadaf93a97c046e (patch)
tree81d814c2c53c5ee37da7b70943c83852a17e8a75 /mediaplugin/src/plugins/media/ffmpeg
parent4f8c5829e3536d156e6d257b70f312268bb72e41 (diff)
downloadusdx-1c700b446719e066cd4a66eedbadaf93a97c046e.tar.gz
usdx-1c700b446719e066cd4a66eedbadaf93a97c046e.tar.xz
usdx-1c700b446719e066cd4a66eedbadaf93a97c046e.zip
fixes for compilation on mac os x
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2720 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--mediaplugin/src/plugins/media/ffmpeg/Makefile.am2
-rw-r--r--mediaplugin/src/plugins/media/ffmpeg/configure.ac28
-rw-r--r--mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.cpp2
-rw-r--r--mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.h40
-rw-r--r--mediaplugin/src/plugins/media/ffmpeg/ffmpeg_video_decode.h2
5 files changed, 58 insertions, 16 deletions
diff --git a/mediaplugin/src/plugins/media/ffmpeg/Makefile.am b/mediaplugin/src/plugins/media/ffmpeg/Makefile.am
index cc28dd9a..3fbdae37 100644
--- a/mediaplugin/src/plugins/media/ffmpeg/Makefile.am
+++ b/mediaplugin/src/plugins/media/ffmpeg/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libffmpegplugin.la
libffmpegplugin_la_SOURCES = ../core/plugin_core.cpp ../core/util.cpp ../core/logger.cpp ffmpeg_core.cpp ffmpeg_audio_convert.cpp ffmpeg_audio_decode.cpp ffmpeg_video_decode.cpp ffmpeg_plugin.cpp
-libffmpegplugin_la_CXXFLAGS = -I../include \
+libffmpegplugin_la_CXXFLAGS = -I../include -Wall \
$(ffmpeg_CFLAGS) \
$(libswscale_CFLAGS)
libffmpegplugin_la_LDFLAGS = -module -export-dynamic \
diff --git a/mediaplugin/src/plugins/media/ffmpeg/configure.ac b/mediaplugin/src/plugins/media/ffmpeg/configure.ac
index 790ab091..ae5b9508 100644
--- a/mediaplugin/src/plugins/media/ffmpeg/configure.ac
+++ b/mediaplugin/src/plugins/media/ffmpeg/configure.ac
@@ -25,7 +25,7 @@ AC_PRESERVE_HELP_ORDER
# find tools
# -----------------------------------------
-LT_INIT
+#LT_INIT
# options for make command
AC_PROG_MAKE_SET
@@ -49,7 +49,7 @@ AM_INIT_AUTOMAKE([foreign])
# check for compilers
# -----------------------------------------
-AC_CANONICAL_HOST
+#AC_CANONICAL_HOST
# find and test the C compiler (for C-libs and wrappers)
AC_PROG_CC
@@ -59,7 +59,6 @@ AC_LANG([C])
AC_PROG_CXX
AC_LANG([C++])
-
# find pkg-config
PKG_PROG_PKG_CONFIG()
if [[ x$PKG_CONFIG = x ]]; then
@@ -69,23 +68,30 @@ if [[ x$PKG_CONFIG = x ]]; then
!!! Install it and try again.])
fi
+# ADD_DEFINE(DEFINE)
+# adds a preprocessor definition
+AC_DEFUN([ADD_DEFINE],
+[
+ CPPFLAGS="-D$1 $CPPFLAGS"
+])
# -----------------------------------------
# check for libraries
# -----------------------------------------
-# find FFMpeg
+# find FFmpeg
PKG_CHECK_MODULES([ffmpeg], [libavcodec libavformat libavutil], [
- #AC_CHECK_HEADERS(libavcodec/avcodec.h ffmpeg/avcodec.h)
- #AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
+ CPPFLAGS="$ffmpeg_CFLAGS $CPPFLAGS"
+ AC_CHECK_HEADERS(ffmpeg/avformat.h)
+ if [[ HAVE_FFMPEG_AVFORMAT_H ]]; then
+ ADD_DEFINE(HAVE_FFMPEG_INCLUDE_DIR)
+ fi
])
# find FFMpeg's swscale lib (just if FFMpeg is compiled in GPL mode)
PKG_CHECK_MODULES([libswscale], [libswscale],
- [
- HAVE_SWSCALE="yes"
- ], [
- HAVE_SWSCALE="no"
- ])
+ [
+ ADD_DEFINE(HAVE_SWSCALE)
+ ], [])
# -----------------------------------------
# create output files
diff --git a/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.cpp b/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.cpp
index 6456322b..353c72c7 100644
--- a/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.cpp
+++ b/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.cpp
@@ -210,7 +210,7 @@ static int CDECL ffmpegStreamOpen(URLContext *h, const char *filename, int flags
case URL_RDONLY:
mode = FILE_OPEN_MODE_READ;
default:
- return AVERROR(ENOSYS);
+ return AVERROR_NOTSUPP;
}
fileStream_t *stream = pluginCore->fileOpen(utf8Filename.c_str(), mode);
diff --git a/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.h b/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.h
index e55b6a96..98d9664a 100644
--- a/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.h
+++ b/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_core.h
@@ -25,19 +25,40 @@
#ifndef _FFMPEG_CORE_H_
#define _FFMPEG_CORE_H_
+// TODO: check with configure
+#define HAVE_SWSCALE
+
+#ifdef HAVE_SWSCALE
+#define USE_SWSCALE
+#endif
+
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#include <inttypes.h>
#include <string>
extern "C" {
+#ifdef HAVE_FFMPEG_INCLUDE_DIR
+#include <ffmpeg/avcodec.h>
+#include <ffmpeg/avformat.h>
+#include <ffmpeg/avio.h>
+#include <ffmpeg/avutil.h>
+#include <ffmpeg/mathematics.h>
+#include <ffmpeg/rational.h> // used for av_rescale_q
+#ifdef USE_SWSCALE
+#include <ffmpeg/swscale.h>
+#endif
+#else
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libavutil/avutil.h>
#include <libavutil/mathematics.h>
#include <libavutil/rational.h> // used for av_rescale_q
+#ifdef USE_SWSCALE
#include <libswscale/swscale.h>
+#endif
+#endif
}
#include "core/util.h"
@@ -111,6 +132,20 @@ public:
// FFmpeg compatibility with older versions
+#ifndef AV_VERSION_INT
+#define AV_VERSION_INT(a,b,c) (((a)<<16)+((b)<<8)+(c))
+#endif
+
+#ifndef LIBAVFORMAT_VERSION_MAJOR
+#define LIBAVFORMAT_VERSION_MAJOR (LIBAVFORMAT_VERSION_INT>>16)
+#endif
+#ifndef LIBAVCODEC_VERSION_MAJOR
+#define LIBAVCODEC_VERSION_MAJOR (LIBAVCODEC_VERSION_INT>>16)
+#endif
+#ifndef LIBAVUTIL_VERSION_MAJOR
+#define LIBAVUTIL_VERSION_MAJOR (LIBAVUTIL_VERSION_INT>>16)
+#endif
+
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,64,0)
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
@@ -132,7 +167,10 @@ public:
(avpkt)->data, (avpkt)->size)
#endif
-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,69,0)
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,29,0)
+#define av_register_protocol2(prot, size) \
+ register_protocol(prot)
+#elif LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,69,0)
#define av_register_protocol2(prot, size) \
av_register_protocol(prot)
#endif
diff --git a/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_video_decode.h b/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_video_decode.h
index 7abe1257..9b0df889 100644
--- a/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_video_decode.h
+++ b/mediaplugin/src/plugins/media/ffmpeg/ffmpeg_video_decode.h
@@ -28,8 +28,6 @@
#include "ffmpeg_core.h"
#include "core/plugin_video_decode.h"
-#define USE_SWSCALE
-
// uncomment if you want to see the debug stuff
//#define DEBUG_DISPLAY
//#define DEBUG_FRAMES