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

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

Issue 1684853003: WIP: allow to play Youtube if use_proprieraty_codecs=1 and ffmpeg_branding=Chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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.h ('k') | media/base/mime_util.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "media/base/yuv_convert.h" 14 #include "media/base/yuv_convert.h"
15 15
16 #if !defined(MEDIA_DISABLE_FFMPEG) 16 #if !defined(MEDIA_DISABLE_FFMPEG)
17 #include "media/ffmpeg/ffmpeg_common.h" 17 #include "media/ffmpeg/ffmpeg_common.h"
18 #include "media/filters/ffmpeg_audio_decoder.h"
19 #include "media/filters/ffmpeg_video_decoder.h"
18 #endif 20 #endif
19 21
20 namespace media { 22 namespace media {
21 23
22 // Media must only be initialized once, so use a LazyInstance to ensure this. 24 // Media must only be initialized once, so use a LazyInstance to ensure this.
23 class MediaInitializer { 25 class MediaInitializer {
24 private: 26 private:
25 friend struct base::DefaultLazyInstanceTraits<MediaInitializer>; 27 friend struct base::DefaultLazyInstanceTraits<MediaInitializer>;
26 28
27 MediaInitializer() { 29 MediaInitializer() {
(...skipping 26 matching lines...) Expand all
54 DISALLOW_COPY_AND_ASSIGN(MediaInitializer); 56 DISALLOW_COPY_AND_ASSIGN(MediaInitializer);
55 }; 57 };
56 58
57 static base::LazyInstance<MediaInitializer>::Leaky g_media_library = 59 static base::LazyInstance<MediaInitializer>::Leaky g_media_library =
58 LAZY_INSTANCE_INITIALIZER; 60 LAZY_INSTANCE_INITIALIZER;
59 61
60 void InitializeMediaLibrary() { 62 void InitializeMediaLibrary() {
61 g_media_library.Get(); 63 g_media_library.Get();
62 } 64 }
63 65
66 bool IsAudioCodecSupported(AudioCodec codec) {
67 // Opus is always enabled.
68 if (codec == media::kCodecOpus)
69 return true;
70
71 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_AUDIO_DECODERS)
72 return media::FFmpegAudioDecoder::IsCodecSupported(codec,
73 kUnknownSampleFormat);
74 #else
75 return false;
76 #endif
77 }
78
79 bool IsVideoCodecSupported(VideoCodec codec) {
80 #if !defined(MEDIA_DISABLE_LIBVPX)
81 if (codec == media::kCodecVP9)
82 return true;
83 #endif
84
85 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(DISABLE_FFMPEG_VIDEO_DECODERS)
86 return media::FFmpegVideoDecoder::IsCodecSupported(codec);
87 #else
88 return false;
89 #endif
90 }
91
64 } // namespace media 92 } // namespace media
OLDNEW
« no previous file with comments | « media/base/media.h ('k') | media/base/mime_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698