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

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

Issue 10837118: Dead code elimination: scythe.chrome_functions:segment.path %media% edition, round 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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
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 <dlfcn.h> 9 #include <dlfcn.h>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/native_library.h" 13 #include "base/native_library.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/stringize_macros.h" 15 #include "base/stringize_macros.h"
16 #include "media/ffmpeg/ffmpeg_common.h" 16 #include "media/ffmpeg/ffmpeg_common.h"
17 #include "third_party/ffmpeg/ffmpeg_stubs.h" 17 #include "third_party/ffmpeg/ffmpeg_stubs.h"
18 #if defined(OS_LINUX)
19 // OpenMAX IL stub is generated only on Linux.
20 #include "third_party/openmax/il_stubs.h"
21 #endif
22 18
23 namespace tp_ffmpeg = third_party_ffmpeg; 19 namespace tp_ffmpeg = third_party_ffmpeg;
24 20
25 namespace media { 21 namespace media {
26 22
27 // Handy to prevent shooting ourselves in the foot with macro wizardry. 23 // Handy to prevent shooting ourselves in the foot with macro wizardry.
28 #if !defined(LIBAVCODEC_VERSION_MAJOR) || \ 24 #if !defined(LIBAVCODEC_VERSION_MAJOR) || \
29 !defined(LIBAVFORMAT_VERSION_MAJOR) || \ 25 !defined(LIBAVFORMAT_VERSION_MAJOR) || \
30 !defined(LIBAVUTIL_VERSION_MAJOR) 26 !defined(LIBAVUTIL_VERSION_MAJOR)
31 #error FFmpeg headers not included! 27 #error FFmpeg headers not included!
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void InitializeMediaLibraryForTesting() { 91 void InitializeMediaLibraryForTesting() {
96 FilePath file_path; 92 FilePath file_path;
97 CHECK(PathService::Get(base::DIR_EXE, &file_path)); 93 CHECK(PathService::Get(base::DIR_EXE, &file_path));
98 CHECK(InitializeMediaLibrary(file_path)); 94 CHECK(InitializeMediaLibrary(file_path));
99 } 95 }
100 96
101 bool IsMediaLibraryInitialized() { 97 bool IsMediaLibraryInitialized() {
102 return g_media_library_is_initialized; 98 return g_media_library_is_initialized;
103 } 99 }
104 100
105 #if defined(OS_LINUX)
106 namespace tp_openmax = third_party_openmax;
107 bool InitializeOpenMaxLibrary(const FilePath& module_dir) {
108 // TODO(ajwong): We need error resolution.
109 tp_openmax::StubPathMap paths;
110 for (int i = 0; i < static_cast<int>(tp_openmax::kNumStubModules); ++i) {
111 tp_openmax::StubModules module = static_cast<tp_openmax::StubModules>(i);
112
113 // Add the OpenMAX library first so it takes precedence.
114 paths[module].push_back(module_dir.Append(openmax_name).value());
115 }
116
117 bool result = tp_openmax::InitializeStubs(paths);
118 if (!result) {
119 LOG(FATAL) << "Cannot load " << openmax_name << "."
120 << " Make sure it exists for OpenMAX.";
121 }
122 return result;
123 }
124 #else
125 bool InitializeOpenMaxLibrary(const FilePath& module_dir) {
126 NOTIMPLEMENTED() << "OpenMAX is only used in Linux.";
127 return false;
128 }
129 #endif
130
131 } // namespace media 101 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698