OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/filters/ffmpeg_glue.h" | 5 #include "media/filters/ffmpeg_glue.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "media/base/filters.h" | 9 #include "media/base/filters.h" |
10 #include "media/ffmpeg/ffmpeg_common.h" | 10 #include "media/ffmpeg/ffmpeg_common.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 FFmpegGlue::~FFmpegGlue() { | 140 FFmpegGlue::~FFmpegGlue() { |
141 av_lockmgr_register(NULL); | 141 av_lockmgr_register(NULL); |
142 } | 142 } |
143 | 143 |
144 // static | 144 // static |
145 FFmpegGlue* FFmpegGlue::GetInstance() { | 145 FFmpegGlue* FFmpegGlue::GetInstance() { |
146 return Singleton<FFmpegGlue>::get(); | 146 return Singleton<FFmpegGlue>::get(); |
147 } | 147 } |
148 | 148 |
| 149 // static |
| 150 URLProtocol* FFmpegGlue::url_protocol() { |
| 151 return &kFFmpegURLProtocol; |
| 152 } |
| 153 |
149 std::string FFmpegGlue::AddProtocol(FFmpegURLProtocol* protocol) { | 154 std::string FFmpegGlue::AddProtocol(FFmpegURLProtocol* protocol) { |
150 base::AutoLock auto_lock(lock_); | 155 base::AutoLock auto_lock(lock_); |
151 std::string key = GetProtocolKey(protocol); | 156 std::string key = GetProtocolKey(protocol); |
152 if (protocols_.find(key) == protocols_.end()) { | 157 if (protocols_.find(key) == protocols_.end()) { |
153 protocols_[key] = protocol; | 158 protocols_[key] = protocol; |
154 } | 159 } |
155 return key; | 160 return key; |
156 } | 161 } |
157 | 162 |
158 void FFmpegGlue::RemoveProtocol(FFmpegURLProtocol* protocol) { | 163 void FFmpegGlue::RemoveProtocol(FFmpegURLProtocol* protocol) { |
(...skipping 20 matching lines...) Expand all Loading... |
179 } | 184 } |
180 | 185 |
181 std::string FFmpegGlue::GetProtocolKey(FFmpegURLProtocol* protocol) { | 186 std::string FFmpegGlue::GetProtocolKey(FFmpegURLProtocol* protocol) { |
182 // Use the FFmpegURLProtocol's memory address to generate the unique string. | 187 // Use the FFmpegURLProtocol's memory address to generate the unique string. |
183 // This also has the nice property that adding the same FFmpegURLProtocol | 188 // This also has the nice property that adding the same FFmpegURLProtocol |
184 // reference will not generate duplicate entries. | 189 // reference will not generate duplicate entries. |
185 return base::StringPrintf("%s://%p", kProtocol, static_cast<void*>(protocol)); | 190 return base::StringPrintf("%s://%p", kProtocol, static_cast<void*>(protocol)); |
186 } | 191 } |
187 | 192 |
188 } // namespace media | 193 } // namespace media |
OLD | NEW |