summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 00:33:16 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 00:33:16 +0000
commit808663e89da849cd5192bf04b1757975b7fba0f2 (patch)
tree2b357127fbda563822764371ed98236eb01d60bd /media
parent1082b1dd85c92e5260911989d8022988bacb676e (diff)
downloadchromium_src-808663e89da849cd5192bf04b1757975b7fba0f2.zip
chromium_src-808663e89da849cd5192bf04b1757975b7fba0f2.tar.gz
chromium_src-808663e89da849cd5192bf04b1757975b7fba0f2.tar.bz2
Fix use_system_ffmpeg and clean up ffmpeg.gyp
To make use_system_ffmpeg work more correctly, we now use the system include path for headers and make use of the version number macros to determine the shared library names. Also removed a bunch of cruft without breaking anything on Windows, Mac or Linux. BUG=23602, 39430 TEST=ffmpeg should still work both with and without use_system_ffmpeg Review URL: http://codereview.chromium.org/1503002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/media_posix.cc25
-rw-r--r--media/ffmpeg/ffmpeg_common.h7
2 files changed, 24 insertions, 8 deletions
diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc
index 210bea3..eebae5e 100644
--- a/media/base/media_posix.cc
+++ b/media/base/media_posix.cc
@@ -11,6 +11,7 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
+#include "media/ffmpeg/ffmpeg_common.h"
#include "third_party/ffmpeg/ffmpeg_stubs.h"
#if defined(OS_LINUX)
// OpenMAX IL stub is generated only on Linux.
@@ -23,12 +24,26 @@ namespace media {
namespace {
+// Handy to prevent shooting ourselves in the foot with macro wizardry.
+#if !defined(LIBAVCODEC_VERSION_MAJOR) || \
+ !defined(LIBAVFORMAT_VERSION_MAJOR) || \
+ !defined(LIBAVUTIL_VERSION_MAJOR)
+#error FFmpeg headers not included!
+#endif
+
+#define STRINGIZE(x) #x
+#define STRINGIZE_MACRO(x) STRINGIZE(x)
+
+#define AVCODEC_VERSION STRINGIZE_MACRO(LIBAVCODEC_VERSION_MAJOR)
+#define AVFORMAT_VERSION STRINGIZE_MACRO(LIBAVFORMAT_VERSION_MAJOR)
+#define AVUTIL_VERSION STRINGIZE_MACRO(LIBAVUTIL_VERSION_MAJOR)
+
#if defined(OS_MACOSX)
-#define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." #VERSION ".dylib")
+#define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." VERSION ".dylib")
const FilePath::CharType sumo_name[] =
FILE_PATH_LITERAL("libffmpegsumo.dylib");
#elif defined(OS_POSIX)
-#define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." #VERSION)
+#define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." VERSION)
const FilePath::CharType sumo_name[] = FILE_PATH_LITERAL("libffmpegsumo.so");
#else
#error "Do not know how to construct DSO name for this OS."
@@ -41,11 +56,11 @@ std::string GetDSOName(tp_ffmpeg::StubModules stub_key) {
// set a constant that we can switch implementations based off of.
switch (stub_key) {
case tp_ffmpeg::kModuleAvcodec52:
- return FILE_PATH_LITERAL(DSO_NAME("avcodec", 52));
+ return FILE_PATH_LITERAL(DSO_NAME("avcodec", AVCODEC_VERSION));
case tp_ffmpeg::kModuleAvformat52:
- return FILE_PATH_LITERAL(DSO_NAME("avformat", 52));
+ return FILE_PATH_LITERAL(DSO_NAME("avformat", AVFORMAT_VERSION));
case tp_ffmpeg::kModuleAvutil50:
- return FILE_PATH_LITERAL(DSO_NAME("avutil", 50));
+ return FILE_PATH_LITERAL(DSO_NAME("avutil", AVUTIL_VERSION));
default:
LOG(DFATAL) << "Invalid stub module requested: " << stub_key;
return FILE_PATH_LITERAL("");
diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
index 4b60046..555eb9a 100644
--- a/media/ffmpeg/ffmpeg_common.h
+++ b/media/ffmpeg/ffmpeg_common.h
@@ -19,9 +19,10 @@ extern "C" {
// Temporarily disable possible loss of data warning.
// TODO(scherkus): fix and upstream the compiler warnings.
MSVC_PUSH_DISABLE_WARNING(4244);
-#include "third_party/ffmpeg/source/patched-ffmpeg-mt/libavcodec/avcodec.h"
-#include "third_party/ffmpeg/source/patched-ffmpeg-mt/libavformat/avformat.h"
-#include "third_party/ffmpeg/source/patched-ffmpeg-mt/libavutil/log.h"
+#include <libavcodec/avcodec.h>
+#include <libavformat/avformat.h>
+#include <libavutil/avutil.h>
+#include <libavutil/log.h>
MSVC_POP_WARNING();
} // extern "C"