Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: media/base/media_posix.cc

Issue 1161183003: Revert "Chromium changes to statically link ffmpeg." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/media.cc ('k') | media/base/media_stub.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media_posix.cc
diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f8f0c99a6f4189b168605d5a7ff5d175cdbcc053
--- /dev/null
+++ b/media/base/media_posix.cc
@@ -0,0 +1,66 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/media.h"
+
+#include <string>
+
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "base/strings/stringize_macros.h"
+#include "media/ffmpeg/ffmpeg_common.h"
+#include "third_party/ffmpeg/ffmpeg_stubs.h"
+
+using third_party_ffmpeg::kNumStubModules;
+using third_party_ffmpeg::kModuleFfmpegsumo;
+using third_party_ffmpeg::InitializeStubs;
+using third_party_ffmpeg::StubPathMap;
+
+namespace media {
+namespace internal {
+
+// 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 AVCODEC_VERSION STRINGIZE(LIBAVCODEC_VERSION_MAJOR)
+#define AVFORMAT_VERSION STRINGIZE(LIBAVFORMAT_VERSION_MAJOR)
+#define AVUTIL_VERSION STRINGIZE(LIBAVUTIL_VERSION_MAJOR)
+
+#if defined(OS_MACOSX)
+// TODO(evan): should be using .so like ffmepgsumo here.
+#define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." VERSION ".dylib")
+static const base::FilePath::CharType kSumoLib[] =
+ FILE_PATH_LITERAL("ffmpegsumo.so");
+#elif defined(OS_POSIX)
+#define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." VERSION)
+static const base::FilePath::CharType kSumoLib[] =
+ FILE_PATH_LITERAL("libffmpegsumo.so");
+#else
+#error "Do not know how to construct DSO name for this OS."
+#endif
+
+bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) {
+ StubPathMap paths;
+
+ // First try to initialize with Chrome's sumo library.
+ DCHECK_EQ(kNumStubModules, 1);
+ paths[kModuleFfmpegsumo].push_back(module_dir.Append(kSumoLib).value());
+
+ // If that fails, see if any system libraries are available.
+ paths[kModuleFfmpegsumo].push_back(module_dir.Append(
+ FILE_PATH_LITERAL(DSO_NAME("avutil", AVUTIL_VERSION))).value());
+ paths[kModuleFfmpegsumo].push_back(module_dir.Append(
+ FILE_PATH_LITERAL(DSO_NAME("avcodec", AVCODEC_VERSION))).value());
+ paths[kModuleFfmpegsumo].push_back(module_dir.Append(
+ FILE_PATH_LITERAL(DSO_NAME("avformat", AVFORMAT_VERSION))).value());
+
+ return InitializeStubs(paths);
+}
+
+} // namespace internal
+} // namespace media
« no previous file with comments | « media/base/media.cc ('k') | media/base/media_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698