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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // retrieved. | 57 // retrieved. |
58 virtual bool GetSize(int64* size_out) = 0; | 58 virtual bool GetSize(int64* size_out) = 0; |
59 | 59 |
60 // Returns false if this protocol supports random seeking. | 60 // Returns false if this protocol supports random seeking. |
61 virtual bool IsStreaming() = 0; | 61 virtual bool IsStreaming() = 0; |
62 | 62 |
63 private: | 63 private: |
64 DISALLOW_COPY_AND_ASSIGN(FFmpegURLProtocol); | 64 DISALLOW_COPY_AND_ASSIGN(FFmpegURLProtocol); |
65 }; | 65 }; |
66 | 66 |
67 class FFmpegGlue : public Singleton<FFmpegGlue> { | 67 class FFmpegGlue { |
68 public: | 68 public: |
| 69 // Returns the singleton instance. |
| 70 static FFmpegGlue* GetInstance(); |
| 71 |
69 // Adds a FFmpegProtocol to the FFmpeg glue layer and returns a unique string | 72 // Adds a FFmpegProtocol to the FFmpeg glue layer and returns a unique string |
70 // that can be passed to FFmpeg to identify the data source. | 73 // that can be passed to FFmpeg to identify the data source. |
71 std::string AddProtocol(FFmpegURLProtocol* protocol); | 74 std::string AddProtocol(FFmpegURLProtocol* protocol); |
72 | 75 |
73 // Removes a FFmpegProtocol from the FFmpeg glue layer. Using strings from | 76 // Removes a FFmpegProtocol from the FFmpeg glue layer. Using strings from |
74 // previously added FFmpegProtocols will no longer work. | 77 // previously added FFmpegProtocols will no longer work. |
75 void RemoveProtocol(FFmpegURLProtocol* protocol); | 78 void RemoveProtocol(FFmpegURLProtocol* protocol); |
76 | 79 |
77 // Assigns the FFmpegProtocol identified with by the given key to | 80 // Assigns the FFmpegProtocol identified with by the given key to |
78 // |protocol|, or assigns NULL if no such FFmpegProtocol could be found. | 81 // |protocol|, or assigns NULL if no such FFmpegProtocol could be found. |
(...skipping 16 matching lines...) Expand all Loading... |
95 // Map between keys and FFmpegProtocol references. | 98 // Map between keys and FFmpegProtocol references. |
96 typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; | 99 typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; |
97 ProtocolMap protocols_; | 100 ProtocolMap protocols_; |
98 | 101 |
99 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); | 102 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); |
100 }; | 103 }; |
101 | 104 |
102 } // namespace media | 105 } // namespace media |
103 | 106 |
104 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ | 107 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ |
OLD | NEW |