OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ | 5 #ifndef MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ |
6 #define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ | 6 #define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "media/base/android/android_overlay.h" | 11 #include "media/base/android/android_overlay.h" |
12 #include "media/gpu/media_gpu_export.h" | 12 #include "media/gpu/media_gpu_export.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 // Manage details of which surface to use for video playback. | 16 // Manage details of which surface to use for video playback. |
17 class MEDIA_GPU_EXPORT AndroidVideoSurfaceChooser { | 17 class MEDIA_GPU_EXPORT AndroidVideoSurfaceChooser { |
18 public: | 18 public: |
19 // Notify the client that |overlay| is ready for use. The client may get | 19 // Notify the client that |overlay| is ready for use. The client may get |
20 // the surface immediately. | 20 // the surface immediately. |
21 using UseOverlayCB = | 21 using UseOverlayCB = |
22 base::RepeatingCallback<void(std::unique_ptr<AndroidOverlay> overlay)>; | 22 base::RepeatingCallback<void(std::unique_ptr<AndroidOverlay> overlay)>; |
23 | 23 |
24 // Notify the client that the most recently provided overlay should be | 24 // Notify the client that the most recently provided overlay should be |
25 // discarded. The overlay is still valid, but we recommend against | 25 // discarded. The overlay is still valid, but we recommend against |
26 // using it soon, in favor of a SurfaceTexture. | 26 // using it soon, in favor of a SurfaceTexture. |
27 using UseSurfaceTextureCB = base::RepeatingCallback<void(void)>; | 27 using UseSurfaceTextureCB = base::RepeatingCallback<void(void)>; |
28 | 28 |
29 // Callback that mirrors AndroidOverlay::DestroyedCB . The surface | |
30 // that was provided with |overlay| is being destroyed. | |
31 using StopUsingOverlayImmediatelyCB = | |
32 base::RepeatingCallback<void(AndroidOverlay*)>; | |
33 | |
34 AndroidVideoSurfaceChooser() {} | 29 AndroidVideoSurfaceChooser() {} |
35 virtual ~AndroidVideoSurfaceChooser() {} | 30 virtual ~AndroidVideoSurfaceChooser() {} |
36 | 31 |
37 // Notify us that our client is ready for overlays. We will send it a | 32 // Notify us that our client is ready for overlays. We will send it a |
38 // callback telling it whether to start with a SurfaceTexture or overlay, | 33 // callback telling it whether to start with a SurfaceTexture or overlay, |
39 // either synchronously or post one very soon. |initial_factory| can be | 34 // either synchronously or post one very soon. |initial_factory| can be |
40 // an empty callback to indicate "no factory". | 35 // an empty callback to indicate "no factory". |
41 virtual void Initialize(UseOverlayCB use_overlay_cb, | 36 virtual void Initialize(UseOverlayCB use_overlay_cb, |
42 UseSurfaceTextureCB use_surface_texture_cb, | 37 UseSurfaceTextureCB use_surface_texture_cb, |
43 StopUsingOverlayImmediatelyCB stop_immediately_cb, | |
44 AndroidOverlayFactoryCB initial_factory) = 0; | 38 AndroidOverlayFactoryCB initial_factory) = 0; |
45 | 39 |
46 // Notify us that a new factory has arrived. May be is_null() to indicate | 40 // Notify us that a new factory has arrived. May be is_null() to indicate |
47 // that the most recent factory has been revoked. | 41 // that the most recent factory has been revoked. |
48 virtual void ReplaceOverlayFactory(AndroidOverlayFactoryCB factory) = 0; | 42 virtual void ReplaceOverlayFactory(AndroidOverlayFactoryCB factory) = 0; |
49 | 43 |
50 private: | 44 private: |
51 DISALLOW_COPY_AND_ASSIGN(AndroidVideoSurfaceChooser); | 45 DISALLOW_COPY_AND_ASSIGN(AndroidVideoSurfaceChooser); |
52 }; | 46 }; |
53 | 47 |
54 } // namespace media | 48 } // namespace media |
55 | 49 |
56 #endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ | 50 #endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ |
OLD | NEW |