blob: e217fa06bf6af53983d163685adfe75eea01a3db (
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
|
// Copyright (c) 2012 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.
#ifndef WEBKIT_MEDIA_SIMPLE_VIDEO_FRAME_PROVIDER_H_
#define WEBKIT_MEDIA_SIMPLE_VIDEO_FRAME_PROVIDER_H_
#include "base/time.h"
#include "ui/gfx/size.h"
#include "webkit/media/video_frame_provider.h"
namespace base {
class MessageLoopProxy;
}
namespace webkit_media {
// A simple implementation of VideoFrameProvider generates raw frames and
// passes them to webmediaplayer.
class SimpleVideoFrameProvider : public VideoFrameProvider {
public:
SimpleVideoFrameProvider(
const gfx::Size& size,
const base::TimeDelta& frame_duration,
const base::Closure& error_cb,
const RepaintCB& repaint_cb);
// VideoFrameProvider implementation.
virtual void Start() OVERRIDE;
virtual void Stop() OVERRIDE;
virtual void Play() OVERRIDE;
virtual void Pause() OVERRIDE;
protected:
virtual ~SimpleVideoFrameProvider();
private:
enum State {
kStarted,
kPaused,
kStopped,
};
void GenerateFrame();
scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
gfx::Size size_;
State state_;
base::TimeDelta current_time_;
base::TimeDelta frame_duration_;
base::Closure error_cb_;
RepaintCB repaint_cb_;
DISALLOW_COPY_AND_ASSIGN(SimpleVideoFrameProvider);
};
} // namespace webkit_media
#endif // WEBKIT_MEDIA_SIMPLE_VIDEO_FRAME_PROVIDER_H_
|