OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ | 5 #ifndef MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ |
6 #define MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ | 6 #define MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "media/base/renderer.h" | 11 #include "media/base/renderer.h" |
| 12 #include "media/base/surface_manager.h" |
12 #include "media/mojo/interfaces/renderer.mojom.h" | 13 #include "media/mojo/interfaces/renderer.mojom.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
| 15 #include "url/gurl.h" |
14 | 16 |
15 namespace base { | 17 namespace base { |
16 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; |
17 } | 19 } |
18 | 20 |
19 namespace media { | 21 namespace media { |
20 | 22 |
21 class DemuxerStreamProvider; | 23 class DemuxerStreamProvider; |
22 class VideoOverlayFactory; | 24 class VideoOverlayFactory; |
23 class VideoRendererSink; | 25 class VideoRendererSink; |
(...skipping 24 matching lines...) Expand all Loading... |
48 void SetCdm(CdmContext* cdm_context, | 50 void SetCdm(CdmContext* cdm_context, |
49 const CdmAttachedCB& cdm_attached_cb) override; | 51 const CdmAttachedCB& cdm_attached_cb) override; |
50 void Flush(const base::Closure& flush_cb) override; | 52 void Flush(const base::Closure& flush_cb) override; |
51 void StartPlayingFrom(base::TimeDelta time) override; | 53 void StartPlayingFrom(base::TimeDelta time) override; |
52 void SetPlaybackRate(double playback_rate) override; | 54 void SetPlaybackRate(double playback_rate) override; |
53 void SetVolume(float volume) override; | 55 void SetVolume(float volume) override; |
54 base::TimeDelta GetMediaTime() override; | 56 base::TimeDelta GetMediaTime() override; |
55 bool HasAudio() override; | 57 bool HasAudio() override; |
56 bool HasVideo() override; | 58 bool HasVideo() override; |
57 | 59 |
| 60 #if defined(OS_ANDROID) |
| 61 void SetUrl(const GURL& url); |
| 62 void SetRequestSurfaceCB(const RequestSurfaceCB& request_surface_cb); |
| 63 #endif |
| 64 |
58 private: | 65 private: |
59 // mojom::RendererClient implementation, dispatched on the | 66 // mojom::RendererClient implementation, dispatched on the |
60 // |task_runner_|. | 67 // |task_runner_|. |
61 void OnTimeUpdate(int64_t time_usec, int64_t max_time_usec) override; | 68 void OnTimeUpdate(int64_t time_usec, int64_t max_time_usec) override; |
62 void OnBufferingStateChange(mojom::BufferingState state) override; | 69 void OnBufferingStateChange(mojom::BufferingState state) override; |
63 void OnEnded() override; | 70 void OnEnded() override; |
64 void OnError() override; | 71 void OnError() override; |
65 void OnVideoNaturalSizeChange(const gfx::Size& size) override; | 72 void OnVideoNaturalSizeChange(const gfx::Size& size) override; |
66 void OnVideoOpacityChange(bool opaque) override; | 73 void OnVideoOpacityChange(bool opaque) override; |
| 74 void OnDurationChange(int64_t duration_usec) override; |
67 | 75 |
68 // Binds |remote_renderer_| to the mojo message pipe. Can be called multiple | 76 // Binds |remote_renderer_| to the mojo message pipe. Can be called multiple |
69 // times. If an error occurs during connection, OnConnectionError will be | 77 // times. If an error occurs during connection, OnConnectionError will be |
70 // called asynchronously. | 78 // called asynchronously. |
71 void BindRemoteRendererIfNeeded(); | 79 void BindRemoteRendererIfNeeded(); |
72 | 80 |
| 81 void InitializeRenderer(); |
| 82 void OnSurfaceCreated(int surface_id); |
| 83 |
73 // Callback for connection error on |remote_renderer_|. | 84 // Callback for connection error on |remote_renderer_|. |
74 void OnConnectionError(); | 85 void OnConnectionError(); |
75 | 86 |
76 // Called when |remote_renderer_| has finished initializing. | 87 // Called when |remote_renderer_| has finished initializing. |
77 void OnInitialized(bool success); | 88 void OnInitialized(bool success); |
78 | 89 |
79 // |task_runner| on which all methods are invoked, except for GetMediaTime(), | 90 // |task_runner| on which all methods are invoked, except for GetMediaTime(), |
80 // which can be called on any thread. | 91 // which can be called on any thread. |
81 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 92 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
82 | 93 |
(...skipping 24 matching lines...) Expand all Loading... |
107 mojo::Binding<RendererClient> binding_; | 118 mojo::Binding<RendererClient> binding_; |
108 | 119 |
109 // Callbacks passed to Initialize() that we forward messages from | 120 // Callbacks passed to Initialize() that we forward messages from |
110 // |remote_renderer_| through. | 121 // |remote_renderer_| through. |
111 PipelineStatusCB init_cb_; | 122 PipelineStatusCB init_cb_; |
112 | 123 |
113 // Lock used to serialize access for |time_|. | 124 // Lock used to serialize access for |time_|. |
114 mutable base::Lock lock_; | 125 mutable base::Lock lock_; |
115 base::TimeDelta time_; | 126 base::TimeDelta time_; |
116 | 127 |
| 128 #if defined(OS_ANDROID) |
| 129 GURL url_; |
| 130 RequestSurfaceCB request_surface_cb_; |
| 131 int surface_id_; |
| 132 #endif |
| 133 |
117 DISALLOW_COPY_AND_ASSIGN(MojoRendererImpl); | 134 DISALLOW_COPY_AND_ASSIGN(MojoRendererImpl); |
118 }; | 135 }; |
119 | 136 |
120 } // namespace media | 137 } // namespace media |
121 | 138 |
122 #endif // MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ | 139 #endif // MEDIA_MOJO_CLIENTS_MOJO_RENDERER_IMPL_H_ |
OLD | NEW |