OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 5 #ifndef CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ |
6 #define CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 6 #define CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 // resolution coordinates | 25 // resolution coordinates |
26 // * updates VideoPlane when screen resolution changes | 26 // * updates VideoPlane when screen resolution changes |
27 // * handles threading correctly (posting SetGeometry to media thread). | 27 // * handles threading correctly (posting SetGeometry to media thread). |
28 // * coalesces multiple calls in short space of time to prevent flooding the | 28 // * coalesces multiple calls in short space of time to prevent flooding the |
29 // media thread with SetGeometry calls (which are expensive on many | 29 // media thread with SetGeometry calls (which are expensive on many |
30 // platforms). | 30 // platforms). |
31 // All public methods should be called from the same thread that the class was | 31 // All public methods should be called from the same thread that the class was |
32 // constructed on. | 32 // constructed on. |
33 class VideoPlaneController { | 33 class VideoPlaneController { |
34 public: | 34 public: |
35 explicit VideoPlaneController( | 35 VideoPlaneController( |
36 const Size& graphics_resolution, | |
36 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner); | 37 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner); |
37 ~VideoPlaneController(); | 38 ~VideoPlaneController(); |
38 // Sets the video plane geometry in *graphics plane coordinates*. If there is | 39 // Sets the video plane geometry in *graphics plane coordinates*. If there is |
39 // no change to video plane parameters from the last call to this method, it | 40 // no change to video plane parameters from the last call to this method, it |
40 // is a no-op. | 41 // is a no-op. |
41 void SetGeometry(const RectF& display_rect, VideoPlane::Transform transform); | 42 void SetGeometry(const RectF& display_rect, VideoPlane::Transform transform); |
42 | 43 |
43 // Sets physical screen resolution. This must be called at least once when | 44 // Sets physical screen resolution. This must be called at least once when |
44 // the final output resolution (HDMI signal or panel resolution) is known, | 45 // the final output resolution (HDMI signal or panel resolution) is known, |
45 // then later when it changes. If there is no change to the screen resolution | 46 // then later when it changes. If there is no change to the screen resolution |
46 // from the last call to this method, it is a no-op. | 47 // from the last call to this method, it is a no-op. |
47 void SetScreenResolution(const Size& resolution); | 48 void SetScreenResolution(const Size& resolution); |
48 | 49 |
49 // Sets graphics hardware plane resolution, and clears any cached video plane | 50 // Sets graphics hardware plane resolution, and clears any cached video plane |
50 // geometry parameters. This must be called at least once when the hardware | 51 // geometry parameters. This must be called at least once when the hardware |
51 // graphics plane resolution (same resolution as display::Screen) is known, | 52 // graphics plane resolution (same resolution as display::Screen) is known, |
52 // then later when it changes. If there is no change to the graphics plane | 53 // then later when it changes. If there is no change to the graphics plane |
53 // resolution from the last call to this method, it is a no-op. | 54 // resolution from the last call to this method, it is a no-op. |
54 void SetGraphicsPlaneResolution(const Size& resolution); | 55 void SetGraphicsPlaneResolution(const Size& resolution); |
alokp
2016/05/12 21:35:16
Now that we pass graphics resolution in the constr
halliwell
2016/05/13 23:48:03
Yep, not needed.
| |
55 | 56 |
56 // After Pause is called, no further calls to VideoPlane::SetGeometry will be | 57 // After Pause is called, no further calls to VideoPlane::SetGeometry will be |
57 // made except for any pending calls already scheduled on the media thread. | 58 // made except for any pending calls already scheduled on the media thread. |
58 // The Set methods will however update cached parameters that will take | 59 // The Set methods will however update cached parameters that will take |
59 // effect once the class is resumed. Safe to call multiple times. | 60 // effect once the class is resumed. Safe to call multiple times. |
60 // TODO(esum): Handle the case where there are pending calls already on the | 61 // TODO(esum): Handle the case where there are pending calls already on the |
61 // media thread. When this returns, the caller needs to know that absolutely | 62 // media thread. When this returns, the caller needs to know that absolutely |
62 // no more SetGeometry calls will be made. | 63 // no more SetGeometry calls will be made. |
63 void Pause(); | 64 void Pause(); |
64 // Makes class active again, and clears any cached video plane geometry | 65 // Makes class active again, and clears any cached video plane geometry |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 | 100 |
100 base::ThreadChecker thread_checker_; | 101 base::ThreadChecker thread_checker_; |
101 | 102 |
102 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController); | 103 DISALLOW_COPY_AND_ASSIGN(VideoPlaneController); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace media | 106 } // namespace media |
106 } // namespace chromecast | 107 } // namespace chromecast |
107 | 108 |
108 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ | 109 #endif // CHROMECAST_MEDIA_VIDEO_PLANE_CONTROLLER_H_ |
OLD | NEW |