OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Implements the Demuxer interface using FFmpeg's libavformat. At this time | 5 // Implements the Demuxer interface using FFmpeg's libavformat. At this time |
6 // will support demuxing any audio/video format thrown at it. The streams | 6 // will support demuxing any audio/video format thrown at it. The streams |
7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer | 7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer |
8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs | 8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs |
9 // can be used to create and initialize the corresponding FFmpeg decoder. | 9 // can be used to create and initialize the corresponding FFmpeg decoder. |
10 // | 10 // |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // FilterFactory provider. | 113 // FilterFactory provider. |
114 static FilterFactory* CreateFilterFactory() { | 114 static FilterFactory* CreateFilterFactory() { |
115 return new FilterFactoryImpl0<FFmpegDemuxer>(); | 115 return new FilterFactoryImpl0<FFmpegDemuxer>(); |
116 } | 116 } |
117 | 117 |
118 // Posts a task to perform additional demuxing. | 118 // Posts a task to perform additional demuxing. |
119 virtual void PostDemuxTask(); | 119 virtual void PostDemuxTask(); |
120 | 120 |
121 // MediaFilter implementation. | 121 // MediaFilter implementation. |
122 virtual void Stop(); | 122 virtual void Stop(); |
123 virtual void Seek(base::TimeDelta time); | 123 virtual void Seek(base::TimeDelta time, FilterCallback* callback); |
124 | 124 |
125 // Demuxer implementation. | 125 // Demuxer implementation. |
126 virtual bool Initialize(DataSource* data_source); | 126 virtual void Initialize(DataSource* data_source, FilterCallback* callback); |
127 virtual size_t GetNumberOfStreams(); | 127 virtual size_t GetNumberOfStreams(); |
128 virtual scoped_refptr<DemuxerStream> GetStream(int stream_id); | 128 virtual scoped_refptr<DemuxerStream> GetStream(int stream_id); |
129 | 129 |
130 private: | 130 private: |
131 // Only allow a factory to create this class. | 131 // Only allow a factory to create this class. |
132 friend class FilterFactoryImpl0<FFmpegDemuxer>; | 132 friend class FilterFactoryImpl0<FFmpegDemuxer>; |
133 FFmpegDemuxer(); | 133 FFmpegDemuxer(); |
134 virtual ~FFmpegDemuxer(); | 134 virtual ~FFmpegDemuxer(); |
135 | 135 |
136 // Carries out initialization on the demuxer thread. | 136 // Carries out initialization on the demuxer thread. |
137 void InititalizeTask(DataSource* data_source); | 137 void InititalizeTask(DataSource* data_source, FilterCallback* callback); |
138 | 138 |
139 // Carries out a seek on the demuxer thread. | 139 // Carries out a seek on the demuxer thread. |
140 void SeekTask(base::TimeDelta time); | 140 void SeekTask(base::TimeDelta time, FilterCallback* callback); |
141 | 141 |
142 // Carries out demuxing and satisfying stream reads on the demuxer thread. | 142 // Carries out demuxing and satisfying stream reads on the demuxer thread. |
143 void DemuxTask(); | 143 void DemuxTask(); |
144 | 144 |
145 // Carries out stopping the demuxer streams on the demuxer thread. | 145 // Carries out stopping the demuxer streams on the demuxer thread. |
146 void StopTask(); | 146 void StopTask(); |
147 | 147 |
148 // Returns true if any of the streams have pending reads. Since we lazily | 148 // Returns true if any of the streams have pending reads. Since we lazily |
149 // post a DemuxTask() for every read, we use this method to quickly terminate | 149 // post a DemuxTask() for every read, we use this method to quickly terminate |
150 // the tasks if there is no work to do. | 150 // the tasks if there is no work to do. |
(...skipping 26 matching lines...) Expand all Loading... |
177 typedef std::vector< scoped_refptr<FFmpegDemuxerStream> > StreamVector; | 177 typedef std::vector< scoped_refptr<FFmpegDemuxerStream> > StreamVector; |
178 StreamVector streams_; | 178 StreamVector streams_; |
179 StreamVector packet_streams_; | 179 StreamVector packet_streams_; |
180 | 180 |
181 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 181 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
182 }; | 182 }; |
183 | 183 |
184 } // namespace media | 184 } // namespace media |
185 | 185 |
186 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 186 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |