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

Side by Side Diff: media/blink/video_frame_compositor.h

Issue 495353003: Move WebMediaPlayerImpl and its dependencies to media/blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 months 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
« no previous file with comments | « media/blink/texttrack_impl.cc ('k') | media/blink/video_frame_compositor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_FRAME_COMPOSITOR_H_ 5 #ifndef MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_
6 #define CONTENT_RENDERER_MEDIA_VIDEO_FRAME_COMPOSITOR_H_ 6 #define MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "cc/layers/video_frame_provider.h" 10 #include "cc/layers/video_frame_provider.h"
11 #include "content/common/content_export.h" 11 #include "media/base/media_export.h"
12 #include "ui/gfx/size.h" 12 #include "ui/gfx/size.h"
13 13
14 namespace media { 14 namespace media {
15 class VideoFrame; 15 class VideoFrame;
16 }
17
18 namespace content {
19 16
20 // VideoFrameCompositor handles incoming frames by notifying the compositor and 17 // VideoFrameCompositor handles incoming frames by notifying the compositor and
21 // dispatching callbacks when detecting changes in video frames. 18 // dispatching callbacks when detecting changes in video frames.
22 // 19 //
23 // Typical usage is to deliver ready-to-be-displayed video frames to 20 // Typical usage is to deliver ready-to-be-displayed video frames to
24 // UpdateCurrentFrame() so that VideoFrameCompositor can take care of tracking 21 // UpdateCurrentFrame() so that VideoFrameCompositor can take care of tracking
25 // changes in video frames and firing callbacks as needed. 22 // changes in video frames and firing callbacks as needed.
26 // 23 //
27 // VideoFrameCompositor must live on the same thread as the compositor. 24 // VideoFrameCompositor must live on the same thread as the compositor.
28 class CONTENT_EXPORT VideoFrameCompositor 25 class MEDIA_EXPORT VideoFrameCompositor
29 : NON_EXPORTED_BASE(public cc::VideoFrameProvider) { 26 : NON_EXPORTED_BASE(public cc::VideoFrameProvider) {
30 public: 27 public:
31 // |natural_size_changed_cb| is run with the new natural size of the video 28 // |natural_size_changed_cb| is run with the new natural size of the video
32 // frame whenever a change in natural size is detected. It is not called the 29 // frame whenever a change in natural size is detected. It is not called the
33 // first time UpdateCurrentFrame() is called. Run on the same thread as the 30 // first time UpdateCurrentFrame() is called. Run on the same thread as the
34 // caller of UpdateCurrentFrame(). 31 // caller of UpdateCurrentFrame().
35 // 32 //
36 // |opacity_changed_cb| is run when a change in opacity is detected. It *is* 33 // |opacity_changed_cb| is run when a change in opacity is detected. It *is*
37 // called the first time UpdateCurrentFrame() is called. Run on the same 34 // called the first time UpdateCurrentFrame() is called. Run on the same
38 // thread as the caller of UpdateCurrentFrame(). 35 // thread as the caller of UpdateCurrentFrame().
39 // 36 //
40 // TODO(scherkus): Investigate the inconsistency between the callbacks with 37 // TODO(scherkus): Investigate the inconsistency between the callbacks with
41 // respect to why we don't call |natural_size_changed_cb| on the first frame. 38 // respect to why we don't call |natural_size_changed_cb| on the first frame.
42 // I suspect it was for historical reasons that no longer make sense. 39 // I suspect it was for historical reasons that no longer make sense.
43 VideoFrameCompositor( 40 VideoFrameCompositor(
44 const base::Callback<void(gfx::Size)>& natural_size_changed_cb, 41 const base::Callback<void(gfx::Size)>& natural_size_changed_cb,
45 const base::Callback<void(bool)>& opacity_changed_cb); 42 const base::Callback<void(bool)>& opacity_changed_cb);
46 virtual ~VideoFrameCompositor(); 43 virtual ~VideoFrameCompositor();
47 44
48 // cc::VideoFrameProvider implementation. 45 // cc::VideoFrameProvider implementation.
49 virtual void SetVideoFrameProviderClient( 46 virtual void SetVideoFrameProviderClient(
50 cc::VideoFrameProvider::Client* client) OVERRIDE; 47 cc::VideoFrameProvider::Client* client) OVERRIDE;
51 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE; 48 virtual scoped_refptr<VideoFrame> GetCurrentFrame() OVERRIDE;
52 virtual void PutCurrentFrame( 49 virtual void PutCurrentFrame(
53 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE; 50 const scoped_refptr<VideoFrame>& frame) OVERRIDE;
54 51
55 // Updates the current frame and notifies the compositor. 52 // Updates the current frame and notifies the compositor.
56 void UpdateCurrentFrame(const scoped_refptr<media::VideoFrame>& frame); 53 void UpdateCurrentFrame(const scoped_refptr<VideoFrame>& frame);
57 54
58 private: 55 private:
59 base::Callback<void(gfx::Size)> natural_size_changed_cb_; 56 base::Callback<void(gfx::Size)> natural_size_changed_cb_;
60 base::Callback<void(bool)> opacity_changed_cb_; 57 base::Callback<void(bool)> opacity_changed_cb_;
61 58
62 cc::VideoFrameProvider::Client* client_; 59 cc::VideoFrameProvider::Client* client_;
63 60
64 scoped_refptr<media::VideoFrame> current_frame_; 61 scoped_refptr<VideoFrame> current_frame_;
65 62
66 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); 63 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor);
67 }; 64 };
68 65
69 } // namespace content 66 } // namespace media
70 67
71 #endif // CONTENT_RENDERER_MEDIA_VIDEO_FRAME_COMPOSITOR_H_ 68 #endif // MEDIA_BLINK_VIDEO_FRAME_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « media/blink/texttrack_impl.cc ('k') | media/blink/video_frame_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698