| 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 12 matching lines...) Expand all Loading... |
| 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 <stdint.h> | 28 #include <stdint.h> |
| 29 | 29 |
| 30 #include <memory> | 30 #include <memory> |
| 31 | 31 |
| 32 #include "base/macros.h" | 32 #include "base/macros.h" |
| 33 #include "media/base/container_names.h" |
| 33 #include "media/base/media_export.h" | 34 #include "media/base/media_export.h" |
| 34 #include "media/ffmpeg/ffmpeg_deleters.h" | 35 #include "media/ffmpeg/ffmpeg_deleters.h" |
| 35 | 36 |
| 36 struct AVFormatContext; | 37 struct AVFormatContext; |
| 37 struct AVIOContext; | 38 struct AVIOContext; |
| 38 | 39 |
| 39 namespace media { | 40 namespace media { |
| 40 | 41 |
| 41 class MEDIA_EXPORT FFmpegURLProtocol { | 42 class MEDIA_EXPORT FFmpegURLProtocol { |
| 42 public: | 43 public: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 64 static void InitializeFFmpeg(); | 65 static void InitializeFFmpeg(); |
| 65 | 66 |
| 66 // See file documentation for usage. |protocol| must outlive FFmpegGlue. | 67 // See file documentation for usage. |protocol| must outlive FFmpegGlue. |
| 67 explicit FFmpegGlue(FFmpegURLProtocol* protocol); | 68 explicit FFmpegGlue(FFmpegURLProtocol* protocol); |
| 68 ~FFmpegGlue(); | 69 ~FFmpegGlue(); |
| 69 | 70 |
| 70 // Opens an AVFormatContext specially prepared to process reads and seeks | 71 // Opens an AVFormatContext specially prepared to process reads and seeks |
| 71 // through the FFmpegURLProtocol provided during construction. | 72 // through the FFmpegURLProtocol provided during construction. |
| 72 bool OpenContext(); | 73 bool OpenContext(); |
| 73 AVFormatContext* format_context() { return format_context_; } | 74 AVFormatContext* format_context() { return format_context_; } |
| 75 // Returns the container name. Note that it is only available after |
| 76 // calling OpenContext. |
| 77 container_names::MediaContainerName container() const { return container_; } |
| 74 | 78 |
| 75 private: | 79 private: |
| 76 bool open_called_; | 80 bool open_called_ = false; |
| 77 AVFormatContext* format_context_; | 81 AVFormatContext* format_context_ = nullptr; |
| 78 std::unique_ptr<AVIOContext, ScopedPtrAVFree> avio_context_; | 82 std::unique_ptr<AVIOContext, ScopedPtrAVFree> avio_context_; |
| 83 container_names::MediaContainerName container_ = |
| 84 container_names::CONTAINER_UNKNOWN; |
| 79 | 85 |
| 80 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); | 86 DISALLOW_COPY_AND_ASSIGN(FFmpegGlue); |
| 81 }; | 87 }; |
| 82 | 88 |
| 83 } // namespace media | 89 } // namespace media |
| 84 | 90 |
| 85 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ | 91 #endif // MEDIA_FILTERS_FFMPEG_GLUE_H_ |
| OLD | NEW |