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