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

Side by Side Diff: webkit/glue/media/video_renderer_impl.h

Issue 8570010: Moving media-related files from webkit/glue/ to webkit/media/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: minor fixes Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_MEDIA_VIDEO_RENDERER_IMPL_H_
6 #define WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_
7
8 #include "media/base/buffers.h"
9 #include "media/base/filters.h"
10 #include "media/filters/video_renderer_base.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h"
12 #include "ui/gfx/size.h"
13 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "webkit/glue/media/web_video_renderer.h"
15
16 namespace webkit_glue {
17
18 // The video renderer implementation to be use by the media pipeline. It lives
19 // inside video renderer thread and also WebKit's main thread. We need to be
20 // extra careful about members shared by two different threads, especially
21 // video frame buffers.
22 class VideoRendererImpl : public WebVideoRenderer {
23 public:
24 explicit VideoRendererImpl(bool pts_logging);
25 virtual ~VideoRendererImpl();
26
27 // WebVideoRenderer implementation.
28 virtual void SetWebMediaPlayerProxy(WebMediaPlayerProxy* proxy) OVERRIDE;
29 virtual void SetRect(const gfx::Rect& rect) OVERRIDE;
30 virtual void Paint(SkCanvas* canvas, const gfx::Rect& dest_rect) OVERRIDE;
31
32 protected:
33 // VideoRendererBase implementation.
34 virtual bool OnInitialize(media::VideoDecoder* decoder) OVERRIDE;
35 virtual void OnStop(const base::Closure& callback) OVERRIDE;
36 virtual void OnFrameAvailable() OVERRIDE;
37
38 private:
39 // Determine the conditions to perform fast paint. Returns true if we can do
40 // fast paint otherwise false.
41 bool CanFastPaint(SkCanvas* canvas, const gfx::Rect& dest_rect);
42
43 // Slow paint does a YUV => RGB, and scaled blit in two separate operations.
44 void SlowPaint(media::VideoFrame* video_frame,
45 SkCanvas* canvas,
46 const gfx::Rect& dest_rect);
47
48 // Fast paint does YUV => RGB, scaling, blitting all in one step into the
49 // canvas. It's not always safe and appropriate to perform fast paint.
50 // CanFastPaint() is used to determine the conditions.
51 void FastPaint(media::VideoFrame* video_frame,
52 SkCanvas* canvas,
53 const gfx::Rect& dest_rect);
54
55 // Pointer to our parent object that is called to request repaints.
56 scoped_refptr<WebMediaPlayerProxy> proxy_;
57
58 // An RGB bitmap used to convert the video frames.
59 SkBitmap bitmap_;
60
61 // These two members are used to determine if the |bitmap_| contains
62 // an already converted image of the current frame. IMPORTANT NOTE: The
63 // value of |last_converted_frame_| must only be used for comparison purposes,
64 // and it should be assumed that the value of the pointer is INVALID unless
65 // it matches the pointer returned from GetCurrentFrame(). Even then, just
66 // to make sure, we compare the timestamp to be sure the bits in the
67 // |current_frame_bitmap_| are valid.
68 media::VideoFrame* last_converted_frame_;
69 base::TimeDelta last_converted_timestamp_;
70
71 // The natural size of the video.
72 gfx::Size natural_size_;
73
74 // Whether we're logging video presentation timestamps (PTS).
75 bool pts_logging_;
76
77 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl);
78 };
79
80 } // namespace webkit_glue
81
82 #endif // WEBKIT_GLUE_MEDIA_VIDEO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/glue/media/simple_data_source_unittest.cc ('k') | webkit/glue/media/video_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698