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

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

Issue 551963004: media: scaffolding and plumbing for MojoRenderer{Impl, Service} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_
6 #define MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "media/base/renderer.h"
11 #include "media/mojo/interfaces/media_renderer.mojom.h"
12
13 namespace base {
14 class SingleThreadTaskRunner;
15 }
16
17 namespace mojo {
18 class ServiceProvider;
19 }
20
21 namespace media {
22 class Demuxer;
23
24 // A media::Renderer that proxies to a mojo::MediaRenderer. That
25 // mojo::MediaRenderer proxies back to the MojoRendererImpl via the
26 // mojo::MediaRendererClient interface.
27 //
28 // MojoRendererImpl implements media::Renderer for use as either an audio
29 // or video renderer.
30 //
31 // TODO(tim): Only audio is currently supported. Bug 410451.
scherkus (not reviewing) 2014/09/09 20:35:33 URLify bugs http://crbug.com/410451
tim (not reviewing) 2014/09/10 23:08:30 Done.
32 class MojoRendererImpl : public Renderer, public mojo::MediaRendererClient {
33 public:
34 // |task_runner| is the TaskRunner on which all methods are invoked.
35 // |demuxer| provides encoded streams for decoding and rendering.
36 // |audio_renderer_provider| is a ServiceProvider from a connected
37 // Application that is hosting a mojo::MediaRenderer.
38 MojoRendererImpl(
39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
40 Demuxer* demuxer,
41 mojo::ServiceProvider* audio_renderer_provider);
42 virtual ~MojoRendererImpl();
43
44 // Renderer implementation.
45 virtual void Initialize(const base::Closure& init_cb,
46 const StatisticsCB& statistics_cb,
47 const base::Closure& ended_cb,
48 const PipelineStatusCB& error_cb,
49 const BufferingStateCB& buffering_state_cb,
50 const TimeDeltaCB& get_duration_cb) OVERRIDE;
51 virtual void Flush(const base::Closure& flush_cb) OVERRIDE;
52 virtual void StartPlayingFrom(base::TimeDelta time) OVERRIDE;
53 virtual void SetPlaybackRate(float playback_rate) OVERRIDE;
54 virtual void SetVolume(float volume) OVERRIDE;
55 virtual base::TimeDelta GetMediaTime() OVERRIDE;
56 virtual bool HasAudio() OVERRIDE;
57 virtual bool HasVideo() OVERRIDE;
58 virtual void SetCdm(MediaKeys* cdm) OVERRIDE;
59
60 // mojo::MediaRendererClient implementation.
61 virtual void OnTimeUpdate(int64_t time_usec,
62 int64_t max_time_usec) MOJO_OVERRIDE;
63 virtual void OnBufferingStateChange(
64 mojo::BufferingState state) MOJO_OVERRIDE;
65 virtual void OnEnded() MOJO_OVERRIDE;
66 virtual void OnError() MOJO_OVERRIDE;
67
68 private:
69 // Task runner used to execute pipeline tasks.
70 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
71
72 Demuxer* demuxer_;
73 mojo::MediaRendererPtr remote_audio_renderer_;
xhwang 2014/09/10 00:00:52 s/remote_audio_renderer_/remote_renderer_/ ?
tim (not reviewing) 2014/09/10 23:08:30 Hmm. I was thinking of this as the analog to the
xhwang 2014/09/15 04:57:29 I see your point here. Let's keep this and iterate
tim (not reviewing) 2014/09/15 21:52:51 Acknowledged.
74
75 // Callbacks passed to Initialize that we forward messages from
scherkus (not reviewing) 2014/09/09 20:35:32 Initialize()
tim (not reviewing) 2014/09/10 23:08:30 Dang it! I thought I caught all of these :)
76 // |remote_audio_renderer_| through.
77 base::Closure ended_cb_;
78 PipelineStatusCB error_cb_;
79 BufferingStateCB buffering_state_cb_;
80
81 base::WeakPtrFactory<MojoRendererImpl> weak_factory_;
82 DISALLOW_COPY_AND_ASSIGN(MojoRendererImpl);
83 };
84
85 } // namespace media
86
87 #endif // MEDIA_MOJO_SERVICES_MOJO_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698