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