Chromium Code Reviews| Index: media/gpu/android_video_surface_chooser_impl.h |
| diff --git a/media/gpu/android_video_surface_chooser_impl.h b/media/gpu/android_video_surface_chooser_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ad2db79e757de6215668aa455c1f1d52d625b553 |
| --- /dev/null |
| +++ b/media/gpu/android_video_surface_chooser_impl.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ |
| +#define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ |
| + |
| +#include "base/bind.h" |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "media/base/android/android_overlay.h" |
| +#include "media/base/android/android_overlay_factory.h" |
| +#include "media/gpu/android_video_surface_chooser.h" |
| +#include "media/gpu/media_gpu_export.h" |
| + |
| +namespace media { |
| + |
| +// Implementation of AndroidVideoSurfaceChooser. |
| +class MEDIA_GPU_EXPORT AndroidVideoSurfaceChooserImpl |
| + : public AndroidVideoSurfaceChooser { |
| + public: |
| + AndroidVideoSurfaceChooserImpl(); |
| + ~AndroidVideoSurfaceChooserImpl() override; |
| + |
| + // AndroidVideoSurfaceChooser |
| + void Initialize( |
| + UseOverlayCB use_overlay_cb, |
| + UseSurfaceTextureCB use_surface_texture_cb, |
| + StopUsingOverlayImmediatelyCB stop_immediately_cb, |
| + std::unique_ptr<AndroidOverlayFactory> initial_factory) override; |
| + void ReplaceOverlayFactory( |
| + std::unique_ptr<AndroidOverlayFactory> factory) override; |
| + |
| + private: |
| + // AndroidOverlay callbacks. |
| + void OnOverlayReady(AndroidOverlay*); |
| + void OnOverlayFailed(AndroidOverlay*); |
| + void OnSurfaceDestroyed(AndroidOverlay*); |
| + |
| + // Client callbacks. |
| + UseOverlayCB use_overlay_cb_; |
| + UseSurfaceTextureCB use_surface_texture_cb_; |
| + StopUsingOverlayImmediatelyCB stop_immediately_cb_; |
| + |
| + // Current overlay that we've consructed but haven't received ready / failed |
|
watk
2017/05/02 21:00:01
"constructed"
liberato (no reviews please)
2017/05/02 21:50:05
Done.
|
| + // callbacks yet. Will be nullptr if we haven't constructed one, or if we |
| + // sent it to the client already once it became ready to use. |
| + std::unique_ptr<AndroidOverlay> overlay_; |
| + |
| + // If true, we owe the client notification about whether to use an overlay |
| + // or a surface texture. |
| + bool client_notification_pending_ = false; |
| + |
| + std::unique_ptr<AndroidOverlayFactory> overlay_factory_; |
| + |
| + base::WeakPtrFactory<AndroidVideoSurfaceChooserImpl> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AndroidVideoSurfaceChooserImpl); |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ |