| 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 |
| 11 // is initialized with read and seek methods which FFmpeg calls when necessary. | 11 // is initialized with read and seek methods which FFmpeg calls when necessary. |
| 12 // | 12 // |
| 13 // During OpenContext() FFmpegGlue will tell FFmpeg to use Chrome's AVIO context | 13 // During OpenContext() FFmpegGlue will tell FFmpeg to use Chrome's AVIO context |
| 14 // by passing NULL in for the filename parameter to avformat_open_input(). All | 14 // by passing NULL in for the filename parameter to avformat_open_input(). All |
| 15 // FFmpeg operations using the configured AVFormatContext will then redirect | 15 // FFmpeg operations using the configured AVFormatContext will then redirect |
| 16 // reads and seeks through the glue. | 16 // reads and seeks through the glue. |
| 17 // | 17 // |
| 18 // The glue in turn processes those read and seek requests using the | 18 // The glue in turn processes those read and seek requests using the |
| 19 // FFmpegURLProtocol provided during construction. | 19 // FFmpegURLProtocol provided during construction. |
| 20 // | 20 // |
| 21 // FFmpegGlue is also responsible for initializing FFmpeg, which is done once | 21 // FFmpegGlue is also responsible for initializing FFmpeg, which is done once |
| 22 // per process. Initialization includes: turning off log messages, registering | 22 // per process. Initialization includes: turning off log messages, registering |
| 23 // a lock manager, and finally registering all demuxers and codecs. | 23 // a lock manager, and finally registering all demuxers and codecs. |
| 24 | 24 |
| 25 #ifndef MEDIA_FILTERS_FFMPEG_GLUE_H_ | 25 #ifndef MEDIA_FILTERS_FFMPEG_GLUE_H_ |
| 26 #define MEDIA_FILTERS_FFMPEG_GLUE_H_ | 26 #define MEDIA_FILTERS_FFMPEG_GLUE_H_ |
| 27 | 27 |
| 28 #include "base/macros.h" |
| 28 #include "base/memory/scoped_ptr.h" | 29 #include "base/memory/scoped_ptr.h" |
| 29 #include "media/base/media_export.h" | 30 #include "media/base/media_export.h" |
| 30 #include "media/ffmpeg/ffmpeg_deleters.h" | 31 #include "media/ffmpeg/ffmpeg_deleters.h" |
| 31 | 32 |
| 32 struct AVFormatContext; | 33 struct AVFormatContext; |
| 33 struct AVIOContext; | 34 struct AVIOContext; |
| 34 | 35 |
| 35 namespace media { | 36 namespace media { |
| 36 | 37 |
| 37 class MEDIA_EXPORT FFmpegURLProtocol { | 38 class MEDIA_EXPORT FFmpegURLProtocol { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 bool open_called_; | 73 bool open_called_; |
| 73 AVFormatContext* format_context_; | 74 AVFormatContext* format_context_; |
| 74 scoped_ptr<AVIOContext, ScopedPtrAVFree> avio_context_; | 75 scoped_ptr<AVIOContext, ScopedPtrAVFree> avio_context_; |
| 75 | 76 |
| 76 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); | 77 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace media | 80 } // namespace media |
| 80 | 81 |
| 81 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ | 82 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ |
| OLD | NEW |