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

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

Issue 300013: Add yasm and ffmpeg into the build tree for linux. (Closed)
Patch Set: Fix mark's comments. Created 11 years, 1 month 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 | « chrome/installer/installer.gyp ('k') | third_party/bzip2/bzip2.gyp » ('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) 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 const FilePath::CharType sumo_name[] =
25 FILE_PATH_LITERAL("libffmpegsumo.dylib");
24 #elif defined(OS_POSIX) 26 #elif defined(OS_POSIX)
25 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." #VERSION) 27 #define DSO_NAME(MODULE, VERSION) ("lib" MODULE ".so." #VERSION)
28 const FilePath::CharType sumo_name[] = FILE_PATH_LITERAL("libffmpegsumo.so");
26 #else 29 #else
27 #error "Do not know how to construct DSO name for this OS." 30 #error "Do not know how to construct DSO name for this OS."
28 #endif 31 #endif
29 32
30 // Retrieves the DSOName for the given key. 33 // Retrieves the DSOName for the given key.
31 std::string GetDSOName(tp_ffmpeg::StubModules stub_key) { 34 std::string GetDSOName(tp_ffmpeg::StubModules stub_key) {
35 // TODO(ajwong): Remove this once mac is migrated. Either that, or have GYP
36 // set a constant that we can switch implementations based off of.
32 switch (stub_key) { 37 switch (stub_key) {
33 case tp_ffmpeg::kModuleAvcodec52: 38 case tp_ffmpeg::kModuleAvcodec52:
34 return FILE_PATH_LITERAL(DSO_NAME("avcodec", 52)); 39 return FILE_PATH_LITERAL(DSO_NAME("avcodec", 52));
35 case tp_ffmpeg::kModuleAvformat52: 40 case tp_ffmpeg::kModuleAvformat52:
36 return FILE_PATH_LITERAL(DSO_NAME("avformat", 52)); 41 return FILE_PATH_LITERAL(DSO_NAME("avformat", 52));
37 case tp_ffmpeg::kModuleAvutil50: 42 case tp_ffmpeg::kModuleAvutil50:
38 return FILE_PATH_LITERAL(DSO_NAME("avutil", 50)); 43 return FILE_PATH_LITERAL(DSO_NAME("avutil", 50));
39 default: 44 default:
40 LOG(DFATAL) << "Invalid stub module requested: " << stub_key; 45 LOG(DFATAL) << "Invalid stub module requested: " << stub_key;
41 return FILE_PATH_LITERAL(""); 46 return FILE_PATH_LITERAL("");
42 } 47 }
43 } 48 }
44 49
45 } // namespace 50 } // namespace
46 51
47 // Attempts to initialize the media library (loading DSOs, etc.). 52 // Attempts to initialize the media library (loading DSOs, etc.).
48 // Returns true if everything was successfully initialized, false otherwise. 53 // Returns true if everything was successfully initialized, false otherwise.
49 bool InitializeMediaLibrary(const FilePath& module_dir) { 54 bool InitializeMediaLibrary(const FilePath& module_dir) {
50 // TODO(ajwong): We need error resolution. 55 // TODO(ajwong): We need error resolution.
51 tp_ffmpeg::StubPathMap paths; 56 tp_ffmpeg::StubPathMap paths;
52 for (int i = 0; i < static_cast<int>(tp_ffmpeg::kNumStubModules); ++i) { 57 for (int i = 0; i < static_cast<int>(tp_ffmpeg::kNumStubModules); ++i) {
53 tp_ffmpeg::StubModules module = static_cast<tp_ffmpeg::StubModules>(i); 58 tp_ffmpeg::StubModules module = static_cast<tp_ffmpeg::StubModules>(i);
59
60 // Add the sumo library first so it takes precedence.
61 paths[module].push_back(module_dir.Append(sumo_name).value());
62
63 // Add the more specific FFmpeg library name.
54 FilePath path = module_dir.Append(GetDSOName(module)); 64 FilePath path = module_dir.Append(GetDSOName(module));
55 paths[module].push_back(path.value()); 65 paths[module].push_back(path.value());
56 } 66 }
57 67
58 return tp_ffmpeg::InitializeStubs(paths); 68 return tp_ffmpeg::InitializeStubs(paths);
59 } 69 }
60 70
61 } // namespace media 71 } // namespace media
OLDNEW
« no previous file with comments | « chrome/installer/installer.gyp ('k') | third_party/bzip2/bzip2.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698