Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: media/filters/ffmpeg_demuxer.h

Issue 6648004: DemuxerFactory is born! (Closed)
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 explicit FFmpegDemuxer(MessageLoop* message_loop); 124 explicit FFmpegDemuxer(MessageLoop* message_loop);
125 virtual ~FFmpegDemuxer(); 125 virtual ~FFmpegDemuxer();
126 126
127 // Posts a task to perform additional demuxing. 127 // Posts a task to perform additional demuxing.
128 virtual void PostDemuxTask(); 128 virtual void PostDemuxTask();
129 129
130 // Filter implementation. 130 // Filter implementation.
131 virtual void Stop(FilterCallback* callback); 131 virtual void Stop(FilterCallback* callback);
132 virtual void Seek(base::TimeDelta time, FilterCallback* callback); 132 virtual void Seek(base::TimeDelta time, FilterCallback* callback);
133 virtual void OnAudioRendererDisabled(); 133 virtual void OnAudioRendererDisabled();
134 virtual void set_host(FilterHost* filter_host);
134 135
135 // Demuxer implementation. 136 // Demuxer implementation.
136 virtual void Initialize(DataSource* data_source, FilterCallback* callback); 137 virtual void Initialize(
acolwell GONE FROM CHROMIUM 2011/03/08 21:48:09 Consider moving this before the Demuxer & Filter i
Ami GONE FROM CHROMIUM 2011/03/08 22:44:48 Done.
138 DataSource* data_source, PipelineStatusCallback* callback);
137 virtual size_t GetNumberOfStreams(); 139 virtual size_t GetNumberOfStreams();
138 virtual scoped_refptr<DemuxerStream> GetStream(int stream_id); 140 virtual scoped_refptr<DemuxerStream> GetStream(int stream_id);
139 141
140 // FFmpegProtocol implementation. 142 // FFmpegProtocol implementation.
141 virtual int Read(int size, uint8* data); 143 virtual int Read(int size, uint8* data);
142 virtual bool GetPosition(int64* position_out); 144 virtual bool GetPosition(int64* position_out);
143 virtual bool SetPosition(int64 position); 145 virtual bool SetPosition(int64 position);
144 virtual bool GetSize(int64* size_out); 146 virtual bool GetSize(int64* size_out);
145 virtual bool IsStreaming(); 147 virtual bool IsStreaming();
146 148
147 // Provide access to FFmpegDemuxerStream. 149 // Provide access to FFmpegDemuxerStream.
148 MessageLoop* message_loop(); 150 MessageLoop* message_loop();
149 151
150 private: 152 private:
151 // Only allow a factory to create this class. 153 // Only allow a factory to create this class.
152 friend class MockFFmpegDemuxer; 154 friend class MockFFmpegDemuxer;
153 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead); 155 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead);
154 156
155 // Carries out initialization on the demuxer thread. 157 // Carries out initialization on the demuxer thread.
156 void InitializeTask(DataSource* data_source, FilterCallback* callback); 158 void InitializeTask(
159 DataSource* data_source, PipelineStatusCallback* callback);
157 160
158 // Carries out a seek on the demuxer thread. 161 // Carries out a seek on the demuxer thread.
159 void SeekTask(base::TimeDelta time, FilterCallback* callback); 162 void SeekTask(base::TimeDelta time, FilterCallback* callback);
160 163
161 // Carries out demuxing and satisfying stream reads on the demuxer thread. 164 // Carries out demuxing and satisfying stream reads on the demuxer thread.
162 void DemuxTask(); 165 void DemuxTask();
163 166
164 // Carries out stopping the demuxer streams on the demuxer thread. 167 // Carries out stopping the demuxer streams on the demuxer thread.
165 void StopTask(FilterCallback* callback); 168 void StopTask(FilterCallback* callback);
166 169
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // signaled when the demuxer is being stopped. 222 // signaled when the demuxer is being stopped.
220 base::WaitableEvent read_event_; 223 base::WaitableEvent read_event_;
221 224
222 // Flag to indicate if read has ever failed. Once set to true, it will 225 // Flag to indicate if read has ever failed. Once set to true, it will
223 // never be reset. This flag is set true and accessed in Read(). 226 // never be reset. This flag is set true and accessed in Read().
224 bool read_has_failed_; 227 bool read_has_failed_;
225 228
226 size_t last_read_bytes_; 229 size_t last_read_bytes_;
227 int64 read_position_; 230 int64 read_position_;
228 231
232 // Initialization can happen before set_host() is called, in which case we
233 // store these bits for deferred reporting to the FilterHost when we get one.
234 base::TimeDelta max_duration_;
235 PipelineError deferred_status_;
236
229 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 237 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
230 }; 238 };
231 239
232 } // namespace media 240 } // namespace media
233 241
234 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 242 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698