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

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

Issue 10855051: Use enum instead of string in MessageLoopFactory::GetMessageLoop* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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/ffmpeg_audio_decoder_unittest.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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // already been demuxed without having the demuxer thread sending the 133 // already been demuxed without having the demuxer thread sending the
134 // buffers. |lock_| must be acquired before any access to |buffer_queue_|, 134 // buffers. |lock_| must be acquired before any access to |buffer_queue_|,
135 // |read_queue_|, or |stopped_|. 135 // |read_queue_|, or |stopped_|.
136 mutable base::Lock lock_; 136 mutable base::Lock lock_;
137 137
138 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); 138 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream);
139 }; 139 };
140 140
141 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol { 141 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer, public FFmpegURLProtocol {
142 public: 142 public:
143 FFmpegDemuxer(MessageLoop* message_loop, 143 FFmpegDemuxer(const scoped_refptr<base::MessageLoopProxy>& message_loop,
144 const scoped_refptr<DataSource>& data_source); 144 const scoped_refptr<DataSource>& data_source);
145 145
146 // Posts a task to perform additional demuxing. 146 // Posts a task to perform additional demuxing.
147 virtual void PostDemuxTask(); 147 virtual void PostDemuxTask();
148 148
149 // Demuxer implementation. 149 // Demuxer implementation.
150 virtual void Initialize(DemuxerHost* host, 150 virtual void Initialize(DemuxerHost* host,
151 const PipelineStatusCB& status_cb) OVERRIDE; 151 const PipelineStatusCB& status_cb) OVERRIDE;
152 virtual void Stop(const base::Closure& callback) OVERRIDE; 152 virtual void Stop(const base::Closure& callback) OVERRIDE;
153 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; 153 virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE;
154 virtual void OnAudioRendererDisabled() OVERRIDE; 154 virtual void OnAudioRendererDisabled() OVERRIDE;
155 virtual void SetPlaybackRate(float playback_rate) OVERRIDE; 155 virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
156 virtual scoped_refptr<DemuxerStream> GetStream( 156 virtual scoped_refptr<DemuxerStream> GetStream(
157 DemuxerStream::Type type) OVERRIDE; 157 DemuxerStream::Type type) OVERRIDE;
158 virtual base::TimeDelta GetStartTime() const OVERRIDE; 158 virtual base::TimeDelta GetStartTime() const OVERRIDE;
159 159
160 // FFmpegURLProtocol implementation. 160 // FFmpegURLProtocol implementation.
161 virtual size_t Read(size_t size, uint8* data) OVERRIDE; 161 virtual size_t Read(size_t size, uint8* data) OVERRIDE;
162 virtual bool GetPosition(int64* position_out) OVERRIDE; 162 virtual bool GetPosition(int64* position_out) OVERRIDE;
163 virtual bool SetPosition(int64 position) OVERRIDE; 163 virtual bool SetPosition(int64 position) OVERRIDE;
164 virtual bool GetSize(int64* size_out) OVERRIDE; 164 virtual bool GetSize(int64* size_out) OVERRIDE;
165 virtual bool IsStreaming() OVERRIDE; 165 virtual bool IsStreaming() OVERRIDE;
166 166
167 // Provide access to FFmpegDemuxerStream. 167 // Provide access to FFmpegDemuxerStream.
168 MessageLoop* message_loop(); 168 scoped_refptr<base::MessageLoopProxy> message_loop();
169 169
170 // Allow FFmpegDemuxerStream to notify us when there is updated information 170 // Allow FFmpegDemuxerStream to notify us when there is updated information
171 // about what buffered data is available. 171 // about what buffered data is available.
172 void NotifyBufferingChanged(); 172 void NotifyBufferingChanged();
173 173
174 private: 174 private:
175 // To allow tests access to privates. 175 // To allow tests access to privates.
176 friend class FFmpegDemuxerTest; 176 friend class FFmpegDemuxerTest;
177 177
178 virtual ~FFmpegDemuxer(); 178 virtual ~FFmpegDemuxer();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // read or kReadError in case of error. 211 // read or kReadError in case of error.
212 virtual void SignalReadCompleted(int size); 212 virtual void SignalReadCompleted(int size);
213 213
214 // Returns the stream from |streams_| that matches |type| as an 214 // Returns the stream from |streams_| that matches |type| as an
215 // FFmpegDemuxerStream. 215 // FFmpegDemuxerStream.
216 scoped_refptr<FFmpegDemuxerStream> GetFFmpegStream( 216 scoped_refptr<FFmpegDemuxerStream> GetFFmpegStream(
217 DemuxerStream::Type type) const; 217 DemuxerStream::Type type) const;
218 218
219 DemuxerHost* host_; 219 DemuxerHost* host_;
220 220
221 MessageLoop* message_loop_; 221 scoped_refptr<base::MessageLoopProxy> message_loop_;
222 222
223 // FFmpeg context handle. 223 // FFmpeg context handle.
224 AVFormatContext* format_context_; 224 AVFormatContext* format_context_;
225 225
226 // |streams_| mirrors the AVStream array in |format_context_|. It contains 226 // |streams_| mirrors the AVStream array in |format_context_|. It contains
227 // FFmpegDemuxerStreams encapsluating AVStream objects at the same index. 227 // FFmpegDemuxerStreams encapsluating AVStream objects at the same index.
228 // 228 //
229 // Since we only support a single audio and video stream, |streams_| will 229 // Since we only support a single audio and video stream, |streams_| will
230 // contain NULL entries for additional audio/video streams as well as for 230 // contain NULL entries for additional audio/video streams as well as for
231 // stream types that we do not currently support. 231 // stream types that we do not currently support.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Set if we know duration of the audio stream. Used when processing end of 266 // Set if we know duration of the audio stream. Used when processing end of
267 // stream -- at this moment we definitely know duration. 267 // stream -- at this moment we definitely know duration.
268 bool duration_known_; 268 bool duration_known_;
269 269
270 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 270 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
271 }; 271 };
272 272
273 } // namespace media 273 } // namespace media
274 274
275 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 275 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder_unittest.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698