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

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

Issue 6171009: Remove MessageLoop methods from Filter interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied more CR suggestions & removed message_loop() methods where possible. Created 9 years, 11 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.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) 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 // Used to translate bitstream formats. 115 // Used to translate bitstream formats.
116 scoped_ptr<BitstreamConverter> bitstream_converter_; 116 scoped_ptr<BitstreamConverter> bitstream_converter_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); 118 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream);
119 }; 119 };
120 120
121 class FFmpegDemuxer : public Demuxer, 121 class FFmpegDemuxer : public Demuxer,
122 public FFmpegURLProtocol { 122 public FFmpegURLProtocol {
123 public: 123 public:
124 FFmpegDemuxer(); 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 134
135 // Demuxer implementation. 135 // Demuxer implementation.
136 virtual void Initialize(DataSource* data_source, FilterCallback* callback); 136 virtual void Initialize(DataSource* data_source, FilterCallback* callback);
137 virtual size_t GetNumberOfStreams(); 137 virtual size_t GetNumberOfStreams();
138 virtual scoped_refptr<DemuxerStream> GetStream(int stream_id); 138 virtual scoped_refptr<DemuxerStream> GetStream(int stream_id);
139 139
140 // FFmpegProtocol implementation. 140 // FFmpegProtocol implementation.
141 virtual int Read(int size, uint8* data); 141 virtual int Read(int size, uint8* data);
142 virtual bool GetPosition(int64* position_out); 142 virtual bool GetPosition(int64* position_out);
143 virtual bool SetPosition(int64 position); 143 virtual bool SetPosition(int64 position);
144 virtual bool GetSize(int64* size_out); 144 virtual bool GetSize(int64* size_out);
145 virtual bool IsStreaming(); 145 virtual bool IsStreaming();
146 146
147 // Provide access to FFmpegDemuxerStream.
148 MessageLoop* message_loop();
149
147 private: 150 private:
148 // Only allow a factory to create this class. 151 // Only allow a factory to create this class.
149 friend class MockFFmpegDemuxer; 152 friend class MockFFmpegDemuxer;
150 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead); 153 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead);
151 154
152 // Carries out initialization on the demuxer thread. 155 // Carries out initialization on the demuxer thread.
153 void InitializeTask(DataSource* data_source, FilterCallback* callback); 156 void InitializeTask(DataSource* data_source, FilterCallback* callback);
154 157
155 // Carries out a seek on the demuxer thread. 158 // Carries out a seek on the demuxer thread.
156 void SeekTask(base::TimeDelta time, FilterCallback* callback); 159 void SeekTask(base::TimeDelta time, FilterCallback* callback);
(...skipping 23 matching lines...) Expand all
180 // read has completed, this method will be called from DataSource with 183 // read has completed, this method will be called from DataSource with
181 // number of bytes read or kDataSource in case of error. 184 // number of bytes read or kDataSource in case of error.
182 void OnReadCompleted(size_t size); 185 void OnReadCompleted(size_t size);
183 186
184 // Wait for asynchronous read to complete and return number of bytes read. 187 // Wait for asynchronous read to complete and return number of bytes read.
185 virtual size_t WaitForRead(); 188 virtual size_t WaitForRead();
186 189
187 // Signal that read has completed, and |size| bytes have been read. 190 // Signal that read has completed, and |size| bytes have been read.
188 virtual void SignalReadCompleted(size_t size); 191 virtual void SignalReadCompleted(size_t size);
189 192
193 MessageLoop* message_loop_;
194
190 // FFmpeg context handle. 195 // FFmpeg context handle.
191 AVFormatContext* format_context_; 196 AVFormatContext* format_context_;
192 197
193 // Two vector of streams: 198 // Two vector of streams:
194 // - |streams_| is indexed for the Demuxer interface GetStream(), which only 199 // - |streams_| is indexed for the Demuxer interface GetStream(), which only
195 // contains supported streams and no NULL entries. 200 // contains supported streams and no NULL entries.
196 // - |packet_streams_| is indexed to mirror AVFormatContext when dealing 201 // - |packet_streams_| is indexed to mirror AVFormatContext when dealing
197 // with AVPackets returned from av_read_frame() and contain NULL entries 202 // with AVPackets returned from av_read_frame() and contain NULL entries
198 // representing unsupported streams where we throw away the data. 203 // representing unsupported streams where we throw away the data.
199 // 204 //
(...skipping 20 matching lines...) Expand all
220 225
221 size_t last_read_bytes_; 226 size_t last_read_bytes_;
222 int64 read_position_; 227 int64 read_position_;
223 228
224 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 229 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
225 }; 230 };
226 231
227 } // namespace media 232 } // namespace media
228 233
229 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 234 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_audio_decoder.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698