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_IMPL_H_ | 5 #ifndef MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ |
6 #define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ | 6 #define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_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/android_video_surface_chooser.h" | 12 #include "media/gpu/android_video_surface_chooser.h" |
13 #include "media/gpu/media_gpu_export.h" | 13 #include "media/gpu/media_gpu_export.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 // Implementation of AndroidVideoSurfaceChooser. | 17 // Implementation of AndroidVideoSurfaceChooser. |
18 class MEDIA_GPU_EXPORT AndroidVideoSurfaceChooserImpl | 18 class MEDIA_GPU_EXPORT AndroidVideoSurfaceChooserImpl |
19 : public AndroidVideoSurfaceChooser { | 19 : public AndroidVideoSurfaceChooser { |
20 public: | 20 public: |
21 AndroidVideoSurfaceChooserImpl(); | 21 AndroidVideoSurfaceChooserImpl(); |
22 ~AndroidVideoSurfaceChooserImpl() override; | 22 ~AndroidVideoSurfaceChooserImpl() override; |
23 | 23 |
24 // AndroidVideoSurfaceChooser | 24 // AndroidVideoSurfaceChooser |
25 void Initialize(UseOverlayCB use_overlay_cb, | 25 void Initialize(UseOverlayCB use_overlay_cb, |
26 UseSurfaceTextureCB use_surface_texture_cb, | 26 UseSurfaceTextureCB use_surface_texture_cb, |
27 StopUsingOverlayImmediatelyCB stop_immediately_cb, | |
28 AndroidOverlayFactoryCB initial_factory) override; | 27 AndroidOverlayFactoryCB initial_factory) override; |
29 void ReplaceOverlayFactory(AndroidOverlayFactoryCB factory) override; | 28 void ReplaceOverlayFactory(AndroidOverlayFactoryCB factory) override; |
30 | 29 |
31 private: | 30 private: |
32 // AndroidOverlay callbacks. | 31 // AndroidOverlay callbacks. |
33 void OnOverlayReady(AndroidOverlay*); | 32 void OnOverlayReady(AndroidOverlay*); |
34 void OnOverlayFailed(AndroidOverlay*); | 33 void OnOverlayFailed(AndroidOverlay*); |
35 void OnSurfaceDestroyed(AndroidOverlay*); | |
36 | 34 |
37 // Client callbacks. | 35 // Client callbacks. |
38 UseOverlayCB use_overlay_cb_; | 36 UseOverlayCB use_overlay_cb_; |
39 UseSurfaceTextureCB use_surface_texture_cb_; | 37 UseSurfaceTextureCB use_surface_texture_cb_; |
40 StopUsingOverlayImmediatelyCB stop_immediately_cb_; | |
41 | 38 |
42 // Current overlay that we've constructed but haven't received ready / failed | 39 // Current overlay that we've constructed but haven't received ready / failed |
43 // callbacks yet. Will be nullptr if we haven't constructed one, or if we | 40 // callbacks yet. Will be nullptr if we haven't constructed one, or if we |
44 // sent it to the client already once it became ready to use. | 41 // sent it to the client already once it became ready to use. |
45 std::unique_ptr<AndroidOverlay> overlay_; | 42 std::unique_ptr<AndroidOverlay> overlay_; |
46 | 43 |
47 // If true, we owe the client notification about whether to use an overlay | 44 // If true, we owe the client notification about whether to use an overlay |
48 // or a surface texture. | 45 // or a surface texture. |
49 bool client_notification_pending_ = false; | 46 bool client_notification_pending_ = false; |
50 | 47 |
51 AndroidOverlayFactoryCB overlay_factory_; | 48 AndroidOverlayFactoryCB overlay_factory_; |
52 | 49 |
53 base::WeakPtrFactory<AndroidVideoSurfaceChooserImpl> weak_factory_; | 50 base::WeakPtrFactory<AndroidVideoSurfaceChooserImpl> weak_factory_; |
54 | 51 |
55 DISALLOW_COPY_AND_ASSIGN(AndroidVideoSurfaceChooserImpl); | 52 DISALLOW_COPY_AND_ASSIGN(AndroidVideoSurfaceChooserImpl); |
56 }; | 53 }; |
57 | 54 |
58 } // namespace media | 55 } // namespace media |
59 | 56 |
60 #endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ | 57 #endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ |
OLD | NEW |