Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: media/mojo/services/mojo_renderer_service.h

Issue 1977173002: Rename media::interfaces to media::mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android + chromeos files Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/mojo/services/mojo_renderer_impl.cc ('k') | media/mojo/services/mojo_renderer_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SERVICES_MOJO_RENDERER_SERVICE_H_ 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ 6 #define MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "media/base/buffering_state.h" 16 #include "media/base/buffering_state.h"
17 #include "media/base/pipeline_status.h" 17 #include "media/base/pipeline_status.h"
18 #include "media/base/renderer_client.h" 18 #include "media/base/renderer_client.h"
19 #include "media/mojo/interfaces/renderer.mojom.h" 19 #include "media/mojo/interfaces/renderer.mojom.h"
20 #include "mojo/public/cpp/bindings/strong_binding.h" 20 #include "mojo/public/cpp/bindings/strong_binding.h"
21 21
22 namespace media { 22 namespace media {
23 23
24 class DemuxerStreamProviderShim; 24 class DemuxerStreamProviderShim;
25 class MediaKeys; 25 class MediaKeys;
26 class MojoCdmServiceContext; 26 class MojoCdmServiceContext;
27 class Renderer; 27 class Renderer;
28 28
29 // An interfaces::Renderer implementation that use a media::Renderer to render 29 // A mojom::Renderer implementation that use a media::Renderer to render
30 // media streams. 30 // media streams.
31 class MojoRendererService : public interfaces::Renderer, public RendererClient { 31 class MojoRendererService : public mojom::Renderer, public RendererClient {
32 public: 32 public:
33 // |mojo_cdm_service_context| can be used to find the CDM to support 33 // |mojo_cdm_service_context| can be used to find the CDM to support
34 // encrypted media. If null, encrypted media is not supported. 34 // encrypted media. If null, encrypted media is not supported.
35 MojoRendererService( 35 MojoRendererService(
36 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, 36 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context,
37 std::unique_ptr<media::Renderer> renderer, 37 std::unique_ptr<media::Renderer> renderer,
38 mojo::InterfaceRequest<interfaces::Renderer> request); 38 mojo::InterfaceRequest<mojom::Renderer> request);
39 ~MojoRendererService() final; 39 ~MojoRendererService() final;
40 40
41 // interfaces::Renderer implementation. 41 // mojom::Renderer implementation.
42 void Initialize(interfaces::RendererClientPtr client, 42 void Initialize(mojom::RendererClientPtr client,
43 interfaces::DemuxerStreamPtr audio, 43 mojom::DemuxerStreamPtr audio,
44 interfaces::DemuxerStreamPtr video, 44 mojom::DemuxerStreamPtr video,
45 const mojo::Callback<void(bool)>& callback) final; 45 const mojo::Callback<void(bool)>& callback) final;
46 void Flush(const mojo::Closure& callback) final; 46 void Flush(const mojo::Closure& callback) final;
47 void StartPlayingFrom(int64_t time_delta_usec) final; 47 void StartPlayingFrom(int64_t time_delta_usec) final;
48 void SetPlaybackRate(double playback_rate) final; 48 void SetPlaybackRate(double playback_rate) final;
49 void SetVolume(float volume) final; 49 void SetVolume(float volume) final;
50 void SetCdm(int32_t cdm_id, const mojo::Callback<void(bool)>& callback) final; 50 void SetCdm(int32_t cdm_id, const mojo::Callback<void(bool)>& callback) final;
51 51
52 private: 52 private:
53 enum State { 53 enum State {
54 STATE_UNINITIALIZED, 54 STATE_UNINITIALIZED,
(...skipping 26 matching lines...) Expand all
81 void SchedulePeriodicMediaTimeUpdates(); 81 void SchedulePeriodicMediaTimeUpdates();
82 82
83 // Callback executed once Flush() completes. 83 // Callback executed once Flush() completes.
84 void OnFlushCompleted(const mojo::Closure& callback); 84 void OnFlushCompleted(const mojo::Closure& callback);
85 85
86 // Callback executed once SetCdm() completes. 86 // Callback executed once SetCdm() completes.
87 void OnCdmAttached(scoped_refptr<MediaKeys> cdm, 87 void OnCdmAttached(scoped_refptr<MediaKeys> cdm,
88 const mojo::Callback<void(bool)>& callback, 88 const mojo::Callback<void(bool)>& callback,
89 bool success); 89 bool success);
90 90
91 mojo::StrongBinding<interfaces::Renderer> binding_; 91 mojo::StrongBinding<mojom::Renderer> binding_;
92 92
93 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_; 93 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_;
94 94
95 State state_; 95 State state_;
96 96
97 std::unique_ptr<DemuxerStreamProviderShim> stream_provider_; 97 std::unique_ptr<DemuxerStreamProviderShim> stream_provider_;
98 98
99 base::RepeatingTimer time_update_timer_; 99 base::RepeatingTimer time_update_timer_;
100 uint64_t last_media_time_usec_; 100 uint64_t last_media_time_usec_;
101 101
102 interfaces::RendererClientPtr client_; 102 mojom::RendererClientPtr client_;
103 103
104 // Hold a reference to the CDM set on the |renderer_| so that the CDM won't be 104 // Hold a reference to the CDM set on the |renderer_| so that the CDM won't be
105 // destructed while the |renderer_| is still using it. 105 // destructed while the |renderer_| is still using it.
106 scoped_refptr<MediaKeys> cdm_; 106 scoped_refptr<MediaKeys> cdm_;
107 107
108 // Note: Destroy |renderer_| first to avoid access violation into other 108 // Note: Destroy |renderer_| first to avoid access violation into other
109 // members, e.g. |stream_provider_| and |cdm_|. 109 // members, e.g. |stream_provider_| and |cdm_|.
110 // Must use "media::" because "Renderer" is ambiguous. 110 // Must use "media::" because "Renderer" is ambiguous.
111 std::unique_ptr<media::Renderer> renderer_; 111 std::unique_ptr<media::Renderer> renderer_;
112 112
113 base::WeakPtr<MojoRendererService> weak_this_; 113 base::WeakPtr<MojoRendererService> weak_this_;
114 base::WeakPtrFactory<MojoRendererService> weak_factory_; 114 base::WeakPtrFactory<MojoRendererService> weak_factory_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(MojoRendererService); 116 DISALLOW_COPY_AND_ASSIGN(MojoRendererService);
117 }; 117 };
118 118
119 } // namespace media 119 } // namespace media
120 120
121 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_ 121 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_SERVICE_H_
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_renderer_impl.cc ('k') | media/mojo/services/mojo_renderer_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698