| 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 // FFmpegGlue is an adapter for FFmpeg's URLProtocol interface that allows us to | 5 // FFmpegGlue is an adapter for FFmpeg's URLProtocol interface that allows us to |
| 6 // use a DataSource implementation with FFmpeg. For convenience we use FFmpeg's | 6 // use a DataSource implementation with FFmpeg. For convenience we use FFmpeg's |
| 7 // av_open_input_file function, which analyzes the filename given to it and | 7 // av_open_input_file function, which analyzes the filename given to it and |
| 8 // automatically initializes the appropriate URLProtocol. | 8 // automatically initializes the appropriate URLProtocol. |
| 9 // | 9 // |
| 10 // Since the DataSource is already open by time we call av_open_input_file, we | 10 // Since the DataSource is already open by time we call av_open_input_file, we |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // the DataSource as a URLProtocol instance to FFmpeg. Since FFmpegGlue is only | 22 // the DataSource as a URLProtocol instance to FFmpeg. Since FFmpegGlue is only |
| 23 // needed for opening files, when av_open_input_file returns FFmpegDemuxer | 23 // needed for opening files, when av_open_input_file returns FFmpegDemuxer |
| 24 // removes the DataSource from FFmpegGlue's map. | 24 // removes the DataSource from FFmpegGlue's map. |
| 25 | 25 |
| 26 #ifndef MEDIA_FILTERS_FFMPEG_GLUE_H_ | 26 #ifndef MEDIA_FILTERS_FFMPEG_GLUE_H_ |
| 27 #define MEDIA_FILTERS_FFMPEG_GLUE_H_ | 27 #define MEDIA_FILTERS_FFMPEG_GLUE_H_ |
| 28 | 28 |
| 29 #include <map> | 29 #include <map> |
| 30 #include <string> | 30 #include <string> |
| 31 | 31 |
| 32 #include "base/lock.h" | |
| 33 #include "base/singleton.h" | 32 #include "base/singleton.h" |
| 33 #include "base/synchronization/lock.h" |
| 34 | 34 |
| 35 namespace media { | 35 namespace media { |
| 36 | 36 |
| 37 class FFmpegURLProtocol { | 37 class FFmpegURLProtocol { |
| 38 public: | 38 public: |
| 39 FFmpegURLProtocol() { | 39 FFmpegURLProtocol() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual ~FFmpegURLProtocol() { | 42 virtual ~FFmpegURLProtocol() { |
| 43 } | 43 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Only allow Singleton to create and delete FFmpegGlue. | 86 // Only allow Singleton to create and delete FFmpegGlue. |
| 87 friend struct DefaultSingletonTraits<FFmpegGlue>; | 87 friend struct DefaultSingletonTraits<FFmpegGlue>; |
| 88 FFmpegGlue(); | 88 FFmpegGlue(); |
| 89 virtual ~FFmpegGlue(); | 89 virtual ~FFmpegGlue(); |
| 90 | 90 |
| 91 // Returns the unique key for this data source, which can be passed to | 91 // Returns the unique key for this data source, which can be passed to |
| 92 // av_open_input_file as the filename. | 92 // av_open_input_file as the filename. |
| 93 std::string GetProtocolKey(FFmpegURLProtocol* protocol); | 93 std::string GetProtocolKey(FFmpegURLProtocol* protocol); |
| 94 | 94 |
| 95 // Mutual exclusion while adding/removing items from the map. | 95 // Mutual exclusion while adding/removing items from the map. |
| 96 Lock lock_; | 96 base::Lock lock_; |
| 97 | 97 |
| 98 // Map between keys and FFmpegProtocol references. | 98 // Map between keys and FFmpegProtocol references. |
| 99 typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; | 99 typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; |
| 100 ProtocolMap protocols_; | 100 ProtocolMap protocols_; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); | 102 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace media | 105 } // namespace media |
| 106 | 106 |
| 107 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ | 107 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ |
| OLD | NEW |