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

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

Issue 9968117: Move Demuxer::set_host() to Initialize(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: fixes Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/dummy_demuxer.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 public: 132 public:
133 FFmpegDemuxer(MessageLoop* message_loop, 133 FFmpegDemuxer(MessageLoop* message_loop,
134 const scoped_refptr<DataSource>& data_source, 134 const scoped_refptr<DataSource>& data_source,
135 bool local_source); 135 bool local_source);
136 virtual ~FFmpegDemuxer(); 136 virtual ~FFmpegDemuxer();
137 137
138 // Posts a task to perform additional demuxing. 138 // Posts a task to perform additional demuxing.
139 virtual void PostDemuxTask(); 139 virtual void PostDemuxTask();
140 140
141 // Demuxer implementation. 141 // Demuxer implementation.
142 virtual void set_host(DemuxerHost* demuxer_host) OVERRIDE; 142 virtual void Initialize(DemuxerHost* host,
143 virtual void Initialize(const PipelineStatusCB& status_cb) OVERRIDE; 143 const PipelineStatusCB& status_cb) OVERRIDE;
144 virtual void Stop(const base::Closure& callback) OVERRIDE; 144 virtual void Stop(const base::Closure& callback) OVERRIDE;
145 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; 145 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE;
146 virtual void OnAudioRendererDisabled() OVERRIDE; 146 virtual void OnAudioRendererDisabled() OVERRIDE;
147 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; 147 virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
148 virtual scoped_refptr<DemuxerStream> GetStream( 148 virtual scoped_refptr<DemuxerStream> GetStream(
149 DemuxerStream::Type type) OVERRIDE; 149 DemuxerStream::Type type) OVERRIDE;
150 virtual base::TimeDelta GetStartTime() const OVERRIDE; 150 virtual base::TimeDelta GetStartTime() const OVERRIDE;
151 virtual int GetBitrate() OVERRIDE; 151 virtual int GetBitrate() OVERRIDE;
152 virtual bool IsLocalSource() OVERRIDE; 152 virtual bool IsLocalSource() OVERRIDE;
153 virtual bool IsSeekable() OVERRIDE; 153 virtual bool IsSeekable() OVERRIDE;
(...skipping 10 matching lines...) Expand all
164 164
165 // For testing purposes. 165 // For testing purposes.
166 void disable_first_seek_hack_for_testing() { first_seek_hack_ = false; } 166 void disable_first_seek_hack_for_testing() { first_seek_hack_ = false; }
167 167
168 private: 168 private:
169 // Only allow a factory to create this class. 169 // Only allow a factory to create this class.
170 friend class MockFFmpegDemuxer; 170 friend class MockFFmpegDemuxer;
171 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead); 171 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead);
172 172
173 // Carries out initialization on the demuxer thread. 173 // Carries out initialization on the demuxer thread.
174 void InitializeTask(const PipelineStatusCB& status_cb); 174 void InitializeTask(DemuxerHost* host, const PipelineStatusCB& status_cb);
175 175
176 // Carries out a seek on the demuxer thread. 176 // Carries out a seek on the demuxer thread.
177 void SeekTask(base::TimeDelta time, const PipelineStatusCB& cb); 177 void SeekTask(base::TimeDelta time, const PipelineStatusCB& cb);
178 178
179 // Carries out demuxing and satisfying stream reads on the demuxer thread. 179 // Carries out demuxing and satisfying stream reads on the demuxer thread.
180 void DemuxTask(); 180 void DemuxTask();
181 181
182 // Carries out stopping the demuxer streams on the demuxer thread. 182 // Carries out stopping the demuxer streams on the demuxer thread.
183 void StopTask(const base::Closure& callback); 183 void StopTask(const base::Closure& callback);
184 184
(...skipping 12 matching lines...) Expand all
197 // Must be called on the demuxer thread. 197 // Must be called on the demuxer thread.
198 void StreamHasEnded(); 198 void StreamHasEnded();
199 199
200 // Wait for asynchronous read to complete and return number of bytes read. 200 // Wait for asynchronous read to complete and return number of bytes read.
201 virtual int WaitForRead(); 201 virtual int WaitForRead();
202 202
203 // Signal the blocked thread that the read has completed, with |size| bytes 203 // Signal the blocked thread that the read has completed, with |size| bytes
204 // read or kReadError in case of error. 204 // read or kReadError in case of error.
205 virtual void SignalReadCompleted(int size); 205 virtual void SignalReadCompleted(int size);
206 206
207 DemuxerHost* host_;
208
207 MessageLoop* message_loop_; 209 MessageLoop* message_loop_;
208 210
209 // True if the media is a local resource, false if the media require network 211 // True if the media is a local resource, false if the media require network
210 // access to be loaded. 212 // access to be loaded.
211 bool local_source_; 213 bool local_source_;
212 214
213 // FFmpeg context handle. 215 // FFmpeg context handle.
214 AVFormatContext* format_context_; 216 AVFormatContext* format_context_;
215 217
216 // |streams_| mirrors the AVStream array in |format_context_|. It contains 218 // |streams_| mirrors the AVStream array in |format_context_|. It contains
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // Whether audio has been disabled for this demuxer (in which case this class 258 // Whether audio has been disabled for this demuxer (in which case this class
257 // drops packets destined for AUDIO demuxer streams on the floor). 259 // drops packets destined for AUDIO demuxer streams on the floor).
258 bool audio_disabled_; 260 bool audio_disabled_;
259 261
260 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 262 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
261 }; 263 };
262 264
263 } // namespace media 265 } // namespace media
264 266
265 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 267 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/filters/dummy_demuxer.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698