Extension syncing: Introduce a NeedsSync pref
[chromium-blink-merge.git] / chromecast / browser / media / media_pipeline_host.h
blobd53ba3f9c695787029f6b9ff0dba0c48731ccf86
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.
5 #ifndef CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_
6 #define CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_
8 #include <map>
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/thread_checker.h"
15 #include "base/time/time.h"
16 #include "chromecast/common/media/cma_ipc_common.h"
17 #include "chromecast/media/cma/backend/media_pipeline_device.h"
18 #include "chromecast/media/cma/pipeline/load_type.h"
19 #include "media/base/pipeline_status.h"
21 namespace base {
22 class SharedMemory;
23 class SingleThreadTaskRunner;
26 namespace media {
27 class AudioDecoderConfig;
28 class VideoDecoderConfig;
31 namespace chromecast {
32 namespace media {
33 struct AvPipelineClient;
34 class BrowserCdmCast;
35 struct MediaPipelineClient;
36 class MediaPipelineImpl;
37 struct VideoPipelineClient;
39 class MediaPipelineHost {
40 public:
41 MediaPipelineHost();
42 ~MediaPipelineHost();
44 void Initialize(
45 LoadType load_type,
46 const MediaPipelineClient& client,
47 const media::CreatePipelineDeviceCB& create_pipeline_device_cb);
49 void SetAvPipe(TrackId track_id,
50 scoped_ptr<base::SharedMemory> shared_mem,
51 const base::Closure& pipe_read_activity_cb,
52 const base::Closure& av_pipe_set_cb);
53 void AudioInitialize(TrackId track_id,
54 const AvPipelineClient& client,
55 const ::media::AudioDecoderConfig& config,
56 const ::media::PipelineStatusCB& status_cb);
57 void VideoInitialize(TrackId track_id,
58 const VideoPipelineClient& client,
59 const std::vector<::media::VideoDecoderConfig>& configs,
60 const ::media::PipelineStatusCB& status_cb);
61 void StartPlayingFrom(base::TimeDelta time);
62 void Flush(const ::media::PipelineStatusCB& status_cb);
63 void Stop();
65 void SetPlaybackRate(double playback_rate);
66 void SetVolume(TrackId track_id, float playback_rate);
67 void SetCdm(BrowserCdmCast* cdm);
69 void NotifyPipeWrite(TrackId track_id);
71 private:
72 base::ThreadChecker thread_checker_;
74 scoped_ptr<MediaPipelineImpl> media_pipeline_;
76 // The shared memory for a track id must be valid until Stop is invoked on
77 // that track id.
78 struct MediaTrackHost;
79 typedef std::map<TrackId, MediaTrackHost*> MediaTrackMap;
80 MediaTrackMap media_track_map_;
82 DISALLOW_COPY_AND_ASSIGN(MediaPipelineHost);
85 } // namespace media
86 } // namespace chromecast
88 #endif // CHROMECAST_BROWSER_MEDIA_MEDIA_PIPELINE_HOST_H_