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

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: Apply CR suggestions & fix style issues. 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
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 MessageLoop* message_loop();
scherkus (not reviewing) 2011/01/13 23:52:50 who's calling this method today?
acolwell GONE FROM CHROMIUM 2011/01/14 01:14:12 FFmpegDemuxerStream. Some rework could be done to
148
147 private: 149 private:
148 // Only allow a factory to create this class. 150 // Only allow a factory to create this class.
149 friend class MockFFmpegDemuxer; 151 friend class MockFFmpegDemuxer;
150 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead); 152 FRIEND_TEST_ALL_PREFIXES(FFmpegDemuxerTest, ProtocolRead);
151 153
152 // Carries out initialization on the demuxer thread. 154 // Carries out initialization on the demuxer thread.
153 void InitializeTask(DataSource* data_source, FilterCallback* callback); 155 void InitializeTask(DataSource* data_source, FilterCallback* callback);
154 156
155 // Carries out a seek on the demuxer thread. 157 // Carries out a seek on the demuxer thread.
156 void SeekTask(base::TimeDelta time, FilterCallback* callback); 158 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 182 // read has completed, this method will be called from DataSource with
181 // number of bytes read or kDataSource in case of error. 183 // number of bytes read or kDataSource in case of error.
182 void OnReadCompleted(size_t size); 184 void OnReadCompleted(size_t size);
183 185
184 // Wait for asynchronous read to complete and return number of bytes read. 186 // Wait for asynchronous read to complete and return number of bytes read.
185 virtual size_t WaitForRead(); 187 virtual size_t WaitForRead();
186 188
187 // Signal that read has completed, and |size| bytes have been read. 189 // Signal that read has completed, and |size| bytes have been read.
188 virtual void SignalReadCompleted(size_t size); 190 virtual void SignalReadCompleted(size_t size);
189 191
192 MessageLoop* message_loop_;
193
190 // FFmpeg context handle. 194 // FFmpeg context handle.
191 AVFormatContext* format_context_; 195 AVFormatContext* format_context_;
192 196
193 // Two vector of streams: 197 // Two vector of streams:
194 // - |streams_| is indexed for the Demuxer interface GetStream(), which only 198 // - |streams_| is indexed for the Demuxer interface GetStream(), which only
195 // contains supported streams and no NULL entries. 199 // contains supported streams and no NULL entries.
196 // - |packet_streams_| is indexed to mirror AVFormatContext when dealing 200 // - |packet_streams_| is indexed to mirror AVFormatContext when dealing
197 // with AVPackets returned from av_read_frame() and contain NULL entries 201 // with AVPackets returned from av_read_frame() and contain NULL entries
198 // representing unsupported streams where we throw away the data. 202 // representing unsupported streams where we throw away the data.
199 // 203 //
(...skipping 20 matching lines...) Expand all
220 224
221 size_t last_read_bytes_; 225 size_t last_read_bytes_;
222 int64 read_position_; 226 int64 read_position_;
223 227
224 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 228 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
225 }; 229 };
226 230
227 } // namespace media 231 } // namespace media
228 232
229 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 233 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698