Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_GLUE_WEBMEDIAPLAYER_PROXY_H_ | |
| 6 #define WEBKIT_GLUE_WEBMEDIAPLAYER_PROXY_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/synchronization/lock.h" | |
| 12 #include "media/filters/chunk_demuxer_client.h" | |
| 13 #include "webkit/glue/media/web_data_source.h" | |
| 14 | |
| 15 class MessageLoop; | |
| 16 class SkCanvas; | |
| 17 | |
| 18 namespace gfx { | |
| 19 class Rect; | |
| 20 } | |
| 21 | |
| 22 namespace webkit_glue { | |
| 23 | |
| 24 class WebMediaPlayerImpl; | |
| 25 class WebVideoRenderer; | |
| 26 | |
| 27 // Acts a thread proxy between the various threads used for multimedia and the | |
|
acolwell GONE FROM CHROMIUM
2011/07/27 16:03:03
s/Acts a/Acts as a/
scherkus (not reviewing)
2011/07/27 17:48:19
Done.
| |
| 28 // render thread that WebMediaPlayerImpl is running on. | |
| 29 class WebMediaPlayerProxy | |
| 30 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, | |
| 31 public media::ChunkDemuxerClient { | |
| 32 public: | |
| 33 WebMediaPlayerProxy(MessageLoop* render_loop, | |
| 34 WebMediaPlayerImpl* webmediaplayer); | |
| 35 | |
| 36 // Methods for Filter -> WebMediaPlayerImpl communication. | |
| 37 void Repaint(); | |
| 38 void SetVideoRenderer(scoped_refptr<WebVideoRenderer> video_renderer); | |
| 39 WebDataSourceBuildObserverHack* GetBuildObserver(); | |
| 40 | |
| 41 // Methods for WebMediaPlayerImpl -> Filter communication. | |
| 42 void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect); | |
| 43 void SetSize(const gfx::Rect& rect); | |
| 44 void Detach(); | |
| 45 void GetCurrentFrame(scoped_refptr<media::VideoFrame>* frame_out); | |
| 46 void PutCurrentFrame(scoped_refptr<media::VideoFrame> frame); | |
| 47 bool HasSingleOrigin(); | |
| 48 void AbortDataSources(); | |
| 49 | |
| 50 // Methods for PipelineImpl -> WebMediaPlayerImpl communication. | |
| 51 void PipelineInitializationCallback(media::PipelineStatus status); | |
| 52 void PipelineSeekCallback(media::PipelineStatus status); | |
| 53 void PipelineEndedCallback(media::PipelineStatus status); | |
| 54 void PipelineErrorCallback(media::PipelineStatus error); | |
| 55 void NetworkEventCallback(media::PipelineStatus status); | |
| 56 | |
| 57 // ChunkDemuxerClient implementation. | |
| 58 virtual void DemuxerOpened(media::ChunkDemuxer* demuxer) OVERRIDE; | |
| 59 virtual void DemuxerClosed() OVERRIDE; | |
| 60 | |
| 61 // Methods for Demuxer communication. | |
| 62 void DemuxerFlush(); | |
| 63 bool DemuxerAppend(const uint8* data, size_t length); | |
| 64 void DemuxerEndOfStream(media::PipelineStatus status); | |
| 65 void DemuxerShutdown(); | |
| 66 | |
| 67 void DemuxerOpenedTask(const scoped_refptr<media::ChunkDemuxer>& demuxer); | |
| 68 void DemuxerClosedTask(); | |
| 69 | |
| 70 // Returns the message loop used by the proxy. | |
| 71 MessageLoop* message_loop() { return render_loop_; } | |
| 72 | |
| 73 private: | |
| 74 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>; | |
| 75 virtual ~WebMediaPlayerProxy(); | |
| 76 | |
| 77 // Adds a data source to data_sources_. | |
| 78 void AddDataSource(WebDataSource* data_source); | |
| 79 | |
| 80 // Invoke |webmediaplayer_| to perform a repaint. | |
| 81 void RepaintTask(); | |
| 82 | |
| 83 // Notify |webmediaplayer_| that initialization has finished. | |
| 84 void PipelineInitializationTask(media::PipelineStatus status); | |
| 85 | |
| 86 // Notify |webmediaplayer_| that a seek has finished. | |
| 87 void PipelineSeekTask(media::PipelineStatus status); | |
| 88 | |
| 89 // Notify |webmediaplayer_| that the media has ended. | |
| 90 void PipelineEndedTask(media::PipelineStatus status); | |
| 91 | |
| 92 // Notify |webmediaplayer_| that a pipeline error has occurred during | |
| 93 // playback. | |
| 94 void PipelineErrorTask(media::PipelineStatus error); | |
| 95 | |
| 96 // Notify |webmediaplayer_| that there's a network event. | |
| 97 void NetworkEventTask(media::PipelineStatus status); | |
| 98 | |
| 99 // The render message loop where WebKit lives. | |
| 100 MessageLoop* render_loop_; | |
| 101 WebMediaPlayerImpl* webmediaplayer_; | |
| 102 | |
| 103 base::Lock data_sources_lock_; | |
| 104 typedef std::list<scoped_refptr<WebDataSource> > DataSourceList; | |
| 105 DataSourceList data_sources_; | |
| 106 scoped_ptr<WebDataSourceBuildObserverHack> build_observer_; | |
| 107 | |
| 108 scoped_refptr<WebVideoRenderer> video_renderer_; | |
| 109 | |
| 110 base::Lock lock_; | |
| 111 int outstanding_repaints_; | |
| 112 | |
| 113 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; | |
| 114 | |
| 115 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); | |
| 116 }; | |
| 117 | |
| 118 } // namespace webkit_glue | |
| 119 | |
| 120 #endif // WEBKIT_GLUE_WEBMEDIAPLAYER_PROXY_H_ | |
| OLD | NEW |