OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // avformat_open_input() function, which analyzes the filename given to it and | 7 // avformat_open_input() 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 avformat_open_input(), | 10 // Since the DataSource is already open by time we call avformat_open_input(), |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "media/base/media_export.h" | 34 #include "media/base/media_export.h" |
35 | 35 |
36 struct URLProtocol; | 36 struct URLProtocol; |
37 | 37 |
38 namespace media { | 38 namespace media { |
39 | 39 |
40 class MEDIA_EXPORT FFmpegURLProtocol { | 40 class MEDIA_EXPORT FFmpegURLProtocol { |
41 public: | 41 public: |
42 FFmpegURLProtocol() {} | 42 FFmpegURLProtocol() {} |
43 | 43 |
44 virtual ~FFmpegURLProtocol() {} | |
45 | |
46 // Read the given amount of bytes into data, returns the number of bytes read | 44 // Read the given amount of bytes into data, returns the number of bytes read |
47 // if successful, kReadError otherwise. | 45 // if successful, kReadError otherwise. |
48 virtual size_t Read(size_t size, uint8* data) = 0; | 46 virtual size_t Read(size_t size, uint8* data) = 0; |
49 | 47 |
50 // Returns true and the current file position for this file, false if the | 48 // Returns true and the current file position for this file, false if the |
51 // file position could not be retrieved. | 49 // file position could not be retrieved. |
52 virtual bool GetPosition(int64* position_out) = 0; | 50 virtual bool GetPosition(int64* position_out) = 0; |
53 | 51 |
54 // Returns true if the file position could be set, false otherwise. | 52 // Returns true if the file position could be set, false otherwise. |
55 virtual bool SetPosition(int64 position) = 0; | 53 virtual bool SetPosition(int64 position) = 0; |
56 | 54 |
57 // Returns true and the file size, false if the file size could not be | 55 // Returns true and the file size, false if the file size could not be |
58 // retrieved. | 56 // retrieved. |
59 virtual bool GetSize(int64* size_out) = 0; | 57 virtual bool GetSize(int64* size_out) = 0; |
60 | 58 |
61 // Returns false if this protocol supports random seeking. | 59 // Returns false if this protocol supports random seeking. |
62 virtual bool IsStreaming() = 0; | 60 virtual bool IsStreaming() = 0; |
63 | 61 |
| 62 protected: |
| 63 virtual ~FFmpegURLProtocol() {} |
| 64 |
64 private: | 65 private: |
65 DISALLOW_COPY_AND_ASSIGN(FFmpegURLProtocol); | 66 DISALLOW_COPY_AND_ASSIGN(FFmpegURLProtocol); |
66 }; | 67 }; |
67 | 68 |
68 class MEDIA_EXPORT FFmpegGlue { | 69 class MEDIA_EXPORT FFmpegGlue { |
69 public: | 70 public: |
70 // Returns the singleton instance. | 71 // Returns the singleton instance. |
71 static FFmpegGlue* GetInstance(); | 72 static FFmpegGlue* GetInstance(); |
72 | 73 |
73 // Adds a FFmpegProtocol to the FFmpeg glue layer and returns a unique string | 74 // Adds a FFmpegProtocol to the FFmpeg glue layer and returns a unique string |
(...skipping 28 matching lines...) Expand all Loading... |
102 | 103 |
103 friend class FFmpegGlueTest; | 104 friend class FFmpegGlueTest; |
104 static URLProtocol* url_protocol(); | 105 static URLProtocol* url_protocol(); |
105 | 106 |
106 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); | 107 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); |
107 }; | 108 }; |
108 | 109 |
109 } // namespace media | 110 } // namespace media |
110 | 111 |
111 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ | 112 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ |
OLD | NEW |