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 | |
154 std::string FFmpegGlue::AddProtocol(FFmpegURLProtocol* protocol) { | 149 std::string FFmpegGlue::AddProtocol(FFmpegURLProtocol* protocol) { |
155 base::AutoLock auto_lock(lock_); | 150 base::AutoLock auto_lock(lock_); |
156 std::string key = GetProtocolKey(protocol); | 151 std::string key = GetProtocolKey(protocol); |
157 if (protocols_.find(key) == protocols_.end()) { | 152 if (protocols_.find(key) == protocols_.end()) { |
158 protocols_[key] = protocol; | 153 protocols_[key] = protocol; |
159 } | 154 } |
160 return key; | 155 return key; |
161 } | 156 } |
162 | 157 |
163 void FFmpegGlue::RemoveProtocol(FFmpegURLProtocol* protocol) { | 158 void FFmpegGlue::RemoveProtocol(FFmpegURLProtocol* protocol) { |
(...skipping 20 matching lines...) Expand all Loading... |
184 } | 179 } |
185 | 180 |
186 std::string FFmpegGlue::GetProtocolKey(FFmpegURLProtocol* protocol) { | 181 std::string FFmpegGlue::GetProtocolKey(FFmpegURLProtocol* protocol) { |
187 // Use the FFmpegURLProtocol's memory address to generate the unique string. | 182 // Use the FFmpegURLProtocol's memory address to generate the unique string. |
188 // This also has the nice property that adding the same FFmpegURLProtocol | 183 // This also has the nice property that adding the same FFmpegURLProtocol |
189 // reference will not generate duplicate entries. | 184 // reference will not generate duplicate entries. |
190 return base::StringPrintf("%s://%p", kProtocol, static_cast<void*>(protocol)); | 185 return base::StringPrintf("%s://%p", kProtocol, static_cast<void*>(protocol)); |
191 } | 186 } |
192 | 187 |
193 } // namespace media | 188 } // namespace media |
OLD | NEW |