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

Unified Diff: media/base/filters.h

Issue 2101022: refactoring decoder interface (Closed)
Patch Set: q Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/media/audio_renderer_impl.cc ('k') | media/base/mock_filters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/filters.h
diff --git a/media/base/filters.h b/media/base/filters.h
index 980e70004816dd77fa28682ec1f603af0d52eb95..c4da5d9143f72477fc4b760903b573db8d41379f 100644
--- a/media/base/filters.h
+++ b/media/base/filters.h
@@ -265,10 +265,24 @@ class VideoDecoder : public MediaFilter {
// Returns the MediaFormat for this filter.
virtual const MediaFormat& media_format() = 0;
- // Schedules a read. Decoder takes ownership of the callback.
- //
- // TODO(scherkus): switch Read() callback to scoped_refptr<>.
- virtual void Read(Callback1<VideoFrame*>::Type* read_callback) = 0;
+ // |set_fill_buffer_done_callback| install permanent callback from downstream
+ // filter (i.e. Renderer). The callback is used to deliver video frames at
+ // runtime to downstream filter
+ typedef Callback1<scoped_refptr<VideoFrame> >::Type FillBufferDoneCallback;
+ void set_fill_buffer_done_callback(FillBufferDoneCallback* callback) {
+ fill_buffer_done_callback_.reset(callback);
+ }
+ FillBufferDoneCallback* fill_buffer_done_callback() {
+ return fill_buffer_done_callback_.get();
+ }
+
+ // Render provides an output buffer for Decoder to write to. These buffers
+ // will be recycled to renderer by fill_buffer_done_callback_;
+ // We could also pass empty pointer here to let decoder provide buffers pool.
+ virtual void FillThisBuffer(scoped_refptr<VideoFrame> frame) = 0;
+
+ private:
+ scoped_ptr<FillBufferDoneCallback> fill_buffer_done_callback_;
};
@@ -289,10 +303,24 @@ class AudioDecoder : public MediaFilter {
// Returns the MediaFormat for this filter.
virtual const MediaFormat& media_format() = 0;
- // Schedules a read. Decoder takes ownership of the callback.
- //
- // TODO(scherkus): switch Read() callback to scoped_refptr<>.
- virtual void Read(Callback1<Buffer*>::Type* read_callback) = 0;
+ // |set_fill_buffer_done_callback| install permanent callback from downstream
+ // filter (i.e. Renderer). The callback is used to deliver buffers at
+ // runtime to downstream filter.
+ typedef Callback1<scoped_refptr<Buffer> >::Type FillBufferDoneCallback;
+ void set_fill_buffer_done_callback(FillBufferDoneCallback* callback) {
+ fill_buffer_done_callback_.reset(callback);
+ }
+ FillBufferDoneCallback* fill_buffer_done_callback() {
+ return fill_buffer_done_callback_.get();
+ }
+
+ // Render provides an output buffer for Decoder to write to. These buffers
+ // will be recycled to renderer by fill_buffer_done_callback_;
+ // We could also pass empty pointer here to let decoder provide buffers pool.
+ virtual void FillThisBuffer(scoped_refptr<Buffer> buffer) = 0;
+
+ private:
+ scoped_ptr<FillBufferDoneCallback> fill_buffer_done_callback_;
};
« no previous file with comments | « chrome/renderer/media/audio_renderer_impl.cc ('k') | media/base/mock_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698