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