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

Side by Side Diff: media/base/media_posix.cc

Issue 1141703002: Chromium changes for static linking ffmpeg (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Roll DEPS to fix cros, rebase. 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 unified diff | Download patch
« no previous file with comments | « media/base/media.cc ('k') | media/base/media_stub.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/base/media.h"
6
7 #include <string>
8
9 #include "base/files/file_path.h"
10 #include "base/logging.h"
11 #include "base/strings/stringize_macros.h"
12 #include "media/ffmpeg/ffmpeg_common.h"
13 #include "third_party/ffmpeg/ffmpeg_stubs.h"
14
15 using third_party_ffmpeg::kNumStubModules;
16 using third_party_ffmpeg::kModuleFfmpegsumo;
17 using third_party_ffmpeg::InitializeStubs;
18 using third_party_ffmpeg::StubPathMap;
19
20 namespace media {
21 namespace internal {
22
23 // Handy to prevent shooting ourselves in the foot with macro wizardry.
24 #if !defined(LIBAVCODEC_VERSION_MAJOR) || \
25 !defined(LIBAVFORMAT_VERSION_MAJOR) || \
26 !defined(LIBAVUTIL_VERSION_MAJOR)
27 #error FFmpeg headers not included!
28 #endif
29
30 #define AVCODEC_VERSION STRINGIZE(LIBAVCODEC_VERSION_MAJOR)
31 #define AVFORMAT_VERSION STRINGIZE(LIBAVFORMAT_VERSION_MAJOR)
32 #define AVUTIL_VERSION STRINGIZE(LIBAVUTIL_VERSION_MAJOR)
33
34 #if defined(OS_MACOSX)
35 // TODO(evan): should be using .so like ffmepgsumo here.
36 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." VERSION ".dylib")
37 static const base::FilePath::CharType kSumoLib[] =
38 FILE_PATH_LITERAL("ffmpegsumo.so");
39 #elif defined(OS_POSIX)
40 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." VERSION)
41 static const base::FilePath::CharType kSumoLib[] =
42 FILE_PATH_LITERAL("libffmpegsumo.so");
43 #else
44 #error "Do not know how to construct DSO name for this OS."
45 #endif
46
47 bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) {
48 StubPathMap paths;
49
50 // First try to initialize with Chrome's sumo library.
51 DCHECK_EQ(kNumStubModules, 1);
52 paths[kModuleFfmpegsumo].push_back(module_dir.Append(kSumoLib).value());
53
54 // If that fails, see if any system libraries are available.
55 paths[kModuleFfmpegsumo].push_back(module_dir.Append(
56 FILE_PATH_LITERAL(DSO_NAME("avutil", AVUTIL_VERSION))).value());
57 paths[kModuleFfmpegsumo].push_back(module_dir.Append(
58 FILE_PATH_LITERAL(DSO_NAME("avcodec", AVCODEC_VERSION))).value());
59 paths[kModuleFfmpegsumo].push_back(module_dir.Append(
60 FILE_PATH_LITERAL(DSO_NAME("avformat", AVFORMAT_VERSION))).value());
61
62 return InitializeStubs(paths);
63 }
64
65 } // namespace internal
66 } // namespace media
OLDNEW
« 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