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

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

Issue 14659007: Remove use_system_ffmpeg-related logic from media and other mainline gyp files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more removals Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « build/linux/unbundle/ffmpeg.gyp ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/media.h" 5 #include "media/base/media.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/strings/stringize_macros.h" 12 #include "base/strings/stringize_macros.h"
13 #include "media/ffmpeg/ffmpeg_common.h" 13 #include "media/ffmpeg/ffmpeg_common.h"
14
15 #if !defined(USE_SYSTEM_FFMPEG)
16 #include "third_party/ffmpeg/ffmpeg_stubs.h" 14 #include "third_party/ffmpeg/ffmpeg_stubs.h"
17 15
18 using third_party_ffmpeg::kNumStubModules; 16 using third_party_ffmpeg::kNumStubModules;
19 using third_party_ffmpeg::kModuleFfmpegsumo; 17 using third_party_ffmpeg::kModuleFfmpegsumo;
20 using third_party_ffmpeg::InitializeStubs; 18 using third_party_ffmpeg::InitializeStubs;
21 using third_party_ffmpeg::StubPathMap; 19 using third_party_ffmpeg::StubPathMap;
22 #endif // !defined(USE_SYSTEM_FFMPEG)
23 20
24 namespace media { 21 namespace media {
25 namespace internal { 22 namespace internal {
26 23
27 // Handy to prevent shooting ourselves in the foot with macro wizardry. 24 // Handy to prevent shooting ourselves in the foot with macro wizardry.
28 #if !defined(LIBAVCODEC_VERSION_MAJOR) || \ 25 #if !defined(LIBAVCODEC_VERSION_MAJOR) || \
29 !defined(LIBAVFORMAT_VERSION_MAJOR) || \ 26 !defined(LIBAVFORMAT_VERSION_MAJOR) || \
30 !defined(LIBAVUTIL_VERSION_MAJOR) 27 !defined(LIBAVUTIL_VERSION_MAJOR)
31 #error FFmpeg headers not included! 28 #error FFmpeg headers not included!
32 #endif 29 #endif
33 30
34 #define AVCODEC_VERSION STRINGIZE(LIBAVCODEC_VERSION_MAJOR) 31 #define AVCODEC_VERSION STRINGIZE(LIBAVCODEC_VERSION_MAJOR)
35 #define AVFORMAT_VERSION STRINGIZE(LIBAVFORMAT_VERSION_MAJOR) 32 #define AVFORMAT_VERSION STRINGIZE(LIBAVFORMAT_VERSION_MAJOR)
36 #define AVUTIL_VERSION STRINGIZE(LIBAVUTIL_VERSION_MAJOR) 33 #define AVUTIL_VERSION STRINGIZE(LIBAVUTIL_VERSION_MAJOR)
37 34
38 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
39 // TODO(evan): should be using .so like ffmepgsumo here. 36 // TODO(evan): should be using .so like ffmepgsumo here.
40 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." VERSION ".dylib") 37 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." VERSION ".dylib")
41 static const base::FilePath::CharType kSumoLib[] = 38 static const base::FilePath::CharType kSumoLib[] =
42 FILE_PATH_LITERAL("ffmpegsumo.so"); 39 FILE_PATH_LITERAL("ffmpegsumo.so");
43 #elif defined(OS_POSIX) 40 #elif defined(OS_POSIX)
44 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." VERSION) 41 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." VERSION)
45 static const base::FilePath::CharType kSumoLib[] = 42 static const base::FilePath::CharType kSumoLib[] =
46 FILE_PATH_LITERAL("libffmpegsumo.so"); 43 FILE_PATH_LITERAL("libffmpegsumo.so");
47 #else 44 #else
48 #error "Do not know how to construct DSO name for this OS." 45 #error "Do not know how to construct DSO name for this OS."
49 #endif 46 #endif
50 47
51 bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) { 48 bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) {
52 #if defined(USE_SYSTEM_FFMPEG)
53 // No initialization is necessary when using system ffmpeg,
54 // we just link directly with system ffmpeg libraries.
55 return true;
56 #else
57 StubPathMap paths; 49 StubPathMap paths;
58 50
59 // First try to initialize with Chrome's sumo library. 51 // First try to initialize with Chrome's sumo library.
60 DCHECK_EQ(kNumStubModules, 1); 52 DCHECK_EQ(kNumStubModules, 1);
61 paths[kModuleFfmpegsumo].push_back(module_dir.Append(kSumoLib).value()); 53 paths[kModuleFfmpegsumo].push_back(module_dir.Append(kSumoLib).value());
62 54
63 // If that fails, see if any system libraries are available. 55 // If that fails, see if any system libraries are available.
64 paths[kModuleFfmpegsumo].push_back(module_dir.Append( 56 paths[kModuleFfmpegsumo].push_back(module_dir.Append(
65 FILE_PATH_LITERAL(DSO_NAME("avutil", AVUTIL_VERSION))).value()); 57 FILE_PATH_LITERAL(DSO_NAME("avutil", AVUTIL_VERSION))).value());
66 paths[kModuleFfmpegsumo].push_back(module_dir.Append( 58 paths[kModuleFfmpegsumo].push_back(module_dir.Append(
67 FILE_PATH_LITERAL(DSO_NAME("avcodec", AVCODEC_VERSION))).value()); 59 FILE_PATH_LITERAL(DSO_NAME("avcodec", AVCODEC_VERSION))).value());
68 paths[kModuleFfmpegsumo].push_back(module_dir.Append( 60 paths[kModuleFfmpegsumo].push_back(module_dir.Append(
69 FILE_PATH_LITERAL(DSO_NAME("avformat", AVFORMAT_VERSION))).value()); 61 FILE_PATH_LITERAL(DSO_NAME("avformat", AVFORMAT_VERSION))).value());
70 62
71 return InitializeStubs(paths); 63 return InitializeStubs(paths);
72 #endif // !defined(USE_SYSTEM_FFMPEG)
73 } 64 }
74 65
75 } // namespace internal 66 } // namespace internal
76 } // namespace media 67 } // namespace media
OLDNEW
« no previous file with comments | « build/linux/unbundle/ffmpeg.gyp ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698