OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/path_service.h" | 13 #include "base/path_service.h" |
14 #include "third_party/ffmpeg/ffmpeg_stubs.h" | 14 #include "third_party/ffmpeg/ffmpeg_stubs.h" |
15 | 15 |
16 namespace tp_ffmpeg = third_party_ffmpeg; | 16 namespace tp_ffmpeg = third_party_ffmpeg; |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
23 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." #VERSION ".dylib") | 23 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE "." #VERSION ".dylib") |
24 #elif defined(OS_LINUX) | 24 #elif defined(OS_POSIX) |
25 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." #VERSION) | 25 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." #VERSION) |
26 #else | 26 #else |
27 #error "Do not know how to construct DSO name for this OS." | 27 #error "Do not know how to construct DSO name for this OS." |
28 #endif | 28 #endif |
29 | 29 |
30 // Retrieves the DSOName for the given key. | 30 // Retrieves the DSOName for the given key. |
31 std::string GetDSOName(tp_ffmpeg::StubModules stub_key) { | 31 std::string GetDSOName(tp_ffmpeg::StubModules stub_key) { |
32 switch (stub_key) { | 32 switch (stub_key) { |
33 case tp_ffmpeg::kModuleAvcodec52: | 33 case tp_ffmpeg::kModuleAvcodec52: |
34 return FILE_PATH_LITERAL(DSO_NAME("avcodec", 52)); | 34 return FILE_PATH_LITERAL(DSO_NAME("avcodec", 52)); |
(...skipping 17 matching lines...) Expand all Loading... |
52 for (int i = 0; i < static_cast<int>(tp_ffmpeg::kNumStubModules); ++i) { | 52 for (int i = 0; i < static_cast<int>(tp_ffmpeg::kNumStubModules); ++i) { |
53 tp_ffmpeg::StubModules module = static_cast<tp_ffmpeg::StubModules>(i); | 53 tp_ffmpeg::StubModules module = static_cast<tp_ffmpeg::StubModules>(i); |
54 FilePath path = module_dir.Append(GetDSOName(module)); | 54 FilePath path = module_dir.Append(GetDSOName(module)); |
55 paths[module].push_back(path.value()); | 55 paths[module].push_back(path.value()); |
56 } | 56 } |
57 | 57 |
58 return tp_ffmpeg::InitializeStubs(paths); | 58 return tp_ffmpeg::InitializeStubs(paths); |
59 } | 59 } |
60 | 60 |
61 } // namespace media | 61 } // namespace media |
OLD | NEW |