| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This video renderer implementation uses IPC to signal the browser process to | |
| 6 // composite the video as a separate layer underneath the backing store. | |
| 7 // | |
| 8 // Extremely experimental. Use at own risk! | |
| 9 | |
| 10 #ifndef CHROME_RENDERER_MEDIA_IPC_VIDEO_RENDERER_H_ | |
| 11 #define CHROME_RENDERER_MEDIA_IPC_VIDEO_RENDERER_H_ | |
| 12 #pragma once | |
| 13 | |
| 14 #include "app/surface/transport_dib.h" | |
| 15 #include "base/waitable_event.h" | |
| 16 #include "gfx/rect.h" | |
| 17 #include "gfx/size.h" | |
| 18 #include "ipc/ipc_message.h" | |
| 19 #include "media/filters/video_renderer_base.h" | |
| 20 #include "webkit/glue/media/web_video_renderer.h" | |
| 21 #include "webkit/glue/webmediaplayer_impl.h" | |
| 22 | |
| 23 class IPCVideoRenderer : public webkit_glue::WebVideoRenderer { | |
| 24 public: | |
| 25 explicit IPCVideoRenderer(int routing_id); | |
| 26 virtual ~IPCVideoRenderer(); | |
| 27 | |
| 28 // WebVideoRenderer implementation. | |
| 29 virtual void SetWebMediaPlayerImplProxy( | |
| 30 webkit_glue::WebMediaPlayerImpl::Proxy* proxy); | |
| 31 virtual void SetRect(const gfx::Rect& rect); | |
| 32 virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect); | |
| 33 | |
| 34 void OnUpdateVideo(); | |
| 35 void OnUpdateVideoAck(); | |
| 36 void OnDestroyVideo(); | |
| 37 | |
| 38 protected: | |
| 39 // VideoRendererBase implementation. | |
| 40 virtual bool OnInitialize(media::VideoDecoder* decoder); | |
| 41 virtual void OnStop(media::FilterCallback* callback); | |
| 42 virtual void OnFrameAvailable(); | |
| 43 | |
| 44 private: | |
| 45 // Send an IPC message to the browser process. The routing ID of the message | |
| 46 // is assumed to match |routing_id_|. | |
| 47 void Send(IPC::Message* msg); | |
| 48 | |
| 49 // Handles updating the video on the render thread. | |
| 50 void DoUpdateVideo(); | |
| 51 | |
| 52 // Handles destroying the video on the render thread. | |
| 53 void DoDestroyVideo(media::FilterCallback* callback); | |
| 54 | |
| 55 // Pointer to our parent object that is called to request repaints. | |
| 56 scoped_refptr<webkit_glue::WebMediaPlayerImpl::Proxy> proxy_; | |
| 57 | |
| 58 // The size of the video. | |
| 59 gfx::Size video_size_; | |
| 60 | |
| 61 // The rect of the video. | |
| 62 gfx::Rect video_rect_; | |
| 63 | |
| 64 // Whether we've created the video layer on the browser. | |
| 65 bool created_; | |
| 66 | |
| 67 // Used to transporting YUV to the browser process. | |
| 68 int routing_id_; | |
| 69 scoped_ptr<TransportDIB> transport_dib_; | |
| 70 | |
| 71 // Used to determine whether we've been instructed to stop. | |
| 72 // TODO(scherkus): work around because we don't have asynchronous stopping. | |
| 73 // Refer to http://crbug.com/16059 | |
| 74 base::WaitableEvent stopped_; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(IPCVideoRenderer); | |
| 77 }; | |
| 78 | |
| 79 #endif // CHROME_RENDERER_MEDIA_IPC_VIDEO_RENDERER_H_ | |
| OLD | NEW |