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 interface between FFmpeg and Chrome used to proxy FFmpeg's | 5 // FFmpegGlue is an interface between FFmpeg and Chrome used to proxy FFmpeg's |
6 // read and seek requests to Chrome's internal data structures. The glue works | 6 // read and seek requests to Chrome's internal data structures. The glue works |
7 // through the AVIO interface provided by FFmpeg. | 7 // through the AVIO interface provided by FFmpeg. |
8 // | 8 // |
9 // AVIO works through a special AVIOContext created through avio_alloc_context() | 9 // AVIO works through a special AVIOContext created through avio_alloc_context() |
10 // which is attached to the AVFormatContext used for demuxing. The AVIO context | 10 // which is attached to the AVFormatContext used for demuxing. The AVIO context |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // Returns true if the file position could be set, false otherwise. | 49 // Returns true if the file position could be set, false otherwise. |
50 virtual bool SetPosition(int64 position) = 0; | 50 virtual bool SetPosition(int64 position) = 0; |
51 | 51 |
52 // Returns true and the file size, false if the file size could not be | 52 // Returns true and the file size, false if the file size could not be |
53 // retrieved. | 53 // retrieved. |
54 virtual bool GetSize(int64* size_out) = 0; | 54 virtual bool GetSize(int64* size_out) = 0; |
55 | 55 |
56 // Returns false if this protocol supports random seeking. | 56 // Returns false if this protocol supports random seeking. |
57 virtual bool IsStreaming() = 0; | 57 virtual bool IsStreaming() = 0; |
| 58 |
| 59 protected: |
| 60 virtual ~FFmpegURLProtocol() { } |
58 }; | 61 }; |
59 | 62 |
60 class MEDIA_EXPORT FFmpegGlue { | 63 class MEDIA_EXPORT FFmpegGlue { |
61 public: | 64 public: |
62 static void InitializeFFmpeg(); | 65 static void InitializeFFmpeg(); |
63 | 66 |
64 // See file documentation for usage. |protocol| must outlive FFmpegGlue. | 67 // See file documentation for usage. |protocol| must outlive FFmpegGlue. |
65 explicit FFmpegGlue(FFmpegURLProtocol* protocol); | 68 explicit FFmpegGlue(FFmpegURLProtocol* protocol); |
66 ~FFmpegGlue(); | 69 ~FFmpegGlue(); |
67 | 70 |
68 // Opens an AVFormatContext specially prepared to process reads and seeks | 71 // Opens an AVFormatContext specially prepared to process reads and seeks |
69 // through the FFmpegURLProtocol provided during construction. | 72 // through the FFmpegURLProtocol provided during construction. |
70 bool OpenContext(); | 73 bool OpenContext(); |
71 AVFormatContext* format_context() { return format_context_; } | 74 AVFormatContext* format_context() { return format_context_; } |
72 | 75 |
73 private: | 76 private: |
74 bool open_called_; | 77 bool open_called_; |
75 AVFormatContext* format_context_; | 78 AVFormatContext* format_context_; |
76 scoped_ptr_malloc<AVIOContext, ScopedPtrAVFree> avio_context_; | 79 scoped_ptr_malloc<AVIOContext, ScopedPtrAVFree> avio_context_; |
77 | 80 |
78 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); | 81 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); |
79 }; | 82 }; |
80 | 83 |
81 } // namespace media | 84 } // namespace media |
82 | 85 |
83 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ | 86 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ |
OLD | NEW |