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_ANDROID_VIDEO_SURFACE_CHOOSER_H_ |
| 6 #define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_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/media_gpu_export.h" |
| 14 |
| 15 namespace media { |
| 16 |
| 17 // Manage details of which surface to use for video playback. |
| 18 class MEDIA_GPU_EXPORT AndroidVideoSurfaceChooser { |
| 19 public: |
| 20 // Notify the client that |overlay| is ready for use. The client may get |
| 21 // the surface immediately. |
| 22 using UseOverlayCB = |
| 23 base::Callback<void(std::unique_ptr<AndroidOverlay> overlay)>; |
| 24 |
| 25 // Notify the client that the most recently provided overlay should be |
| 26 // discarded. The overlay is still valid, but we recommend against |
| 27 // using it soon, in favor of a SurfaceTexture. |
| 28 using UseSurfaceTextureCB = base::Callback<void(void)>; |
| 29 |
| 30 // Callback that mirrors AndroidOverlay::DestroyedCB . The surface |
| 31 // that was provided with |overlay| is being destroyed. |
| 32 using StopUsingOverlayImmediatelyCB = base::Callback<void(AndroidOverlay*)>; |
| 33 |
| 34 AndroidVideoSurfaceChooser() {} |
| 35 virtual ~AndroidVideoSurfaceChooser() {} |
| 36 |
| 37 // 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, |
| 39 // either synchronously or post one very soon. |
| 40 virtual void Initialize( |
| 41 UseOverlayCB use_overlay_cb, |
| 42 UseSurfaceTextureCB use_surface_texture_cb, |
| 43 StopUsingOverlayImmediatelyCB stop_immediately_cb, |
| 44 std::unique_ptr<AndroidOverlayFactory> initial_factory) = 0; |
| 45 |
| 46 // Notify us that a new factory has arrived. May be null to indicate that |
| 47 // the most recent factory has been revoked. |
| 48 virtual void ReplaceOverlayFactory( |
| 49 std::unique_ptr<AndroidOverlayFactory> factory) = 0; |
| 50 |
| 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(AndroidVideoSurfaceChooser); |
| 53 }; |
| 54 |
| 55 } // namespace media |
| 56 |
| 57 #endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_H_ |
OLD | NEW |