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 // 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 14 matching lines...) Expand all Loading... | |
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/memory/singleton.h" | 32 #include "base/memory/singleton.h" |
33 #include "base/synchronization/lock.h" | 33 #include "base/synchronization/lock.h" |
34 | 34 |
35 struct URLProtocol; | |
36 | |
35 namespace media { | 37 namespace media { |
36 | 38 |
37 class FFmpegURLProtocol { | 39 class FFmpegURLProtocol { |
38 public: | 40 public: |
39 FFmpegURLProtocol() { | 41 FFmpegURLProtocol() { |
scherkus (not reviewing)
2011/08/11 01:26:29
want to clean these up to {}
acolwell GONE FROM CHROMIUM
2011/08/11 23:54:40
Done.
| |
40 } | 42 } |
41 | 43 |
42 virtual ~FFmpegURLProtocol() { | 44 virtual ~FFmpegURLProtocol() { |
43 } | 45 } |
44 | 46 |
45 // Read the given amount of bytes into data, returns the number of bytes read | 47 // Read the given amount of bytes into data, returns the number of bytes read |
46 // if successful, kReadError otherwise. | 48 // if successful, kReadError otherwise. |
47 virtual int Read(int size, uint8* data) = 0; | 49 virtual int Read(int size, uint8* data) = 0; |
48 | 50 |
49 // Returns true and the current file position for this file, false if the | 51 // Returns true and the current file position for this file, false if the |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 // av_open_input_file as the filename. | 94 // av_open_input_file as the filename. |
93 std::string GetProtocolKey(FFmpegURLProtocol* protocol); | 95 std::string GetProtocolKey(FFmpegURLProtocol* protocol); |
94 | 96 |
95 // Mutual exclusion while adding/removing items from the map. | 97 // Mutual exclusion while adding/removing items from the map. |
96 base::Lock lock_; | 98 base::Lock lock_; |
97 | 99 |
98 // Map between keys and FFmpegProtocol references. | 100 // Map between keys and FFmpegProtocol references. |
99 typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; | 101 typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; |
100 ProtocolMap protocols_; | 102 ProtocolMap protocols_; |
101 | 103 |
104 friend class FFmpegGlueTest; | |
105 static URLProtocol* url_protocol(); | |
106 | |
102 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); | 107 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); |
103 }; | 108 }; |
104 | 109 |
105 } // namespace media | 110 } // namespace media |
106 | 111 |
107 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ | 112 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ |
OLD | NEW |