Add ianwen to watch list for related projects
[chromium-blink-merge.git] / chromecast / media / cma / pipeline / video_pipeline_impl.h
blob25f875fcf636e0a6d16a46d2af451f09d9eb134a
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_MEDIA_CMA_BASE_VIDEO_PIPELINE_IMPL_H_
6 #define CHROMECAST_MEDIA_CMA_BASE_VIDEO_PIPELINE_IMPL_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/threading/thread_checker.h"
12 #include "chromecast/media/cma/pipeline/video_pipeline.h"
13 #include "chromecast/media/cma/pipeline/video_pipeline_client.h"
14 #include "chromecast/public/media/stream_id.h"
16 namespace gfx {
17 class Size;
20 namespace media {
21 class AudioDecoderConfig;
22 class VideoDecoderConfig;
25 namespace chromecast {
26 namespace media {
27 class AvPipelineImpl;
28 class BrowserCdmCast;
29 class BufferingState;
30 class CodedFrameProvider;
31 class VideoPipelineDevice;
33 class VideoPipelineImpl : public VideoPipeline {
34 public:
35 // |buffering_controller| can be NULL.
36 explicit VideoPipelineImpl(VideoPipelineDevice* video_device);
37 ~VideoPipelineImpl() override;
39 // Input port of the pipeline.
40 void SetCodedFrameProvider(scoped_ptr<CodedFrameProvider> frame_provider);
42 // Provide the CDM to use to decrypt samples.
43 void SetCdm(BrowserCdmCast* media_keys);
45 // Functions to control the state of the audio pipeline.
46 void Initialize(
47 const std::vector<::media::VideoDecoderConfig>& configs,
48 scoped_ptr<CodedFrameProvider> frame_provider,
49 const ::media::PipelineStatusCB& status_cb);
50 bool StartPlayingFrom(base::TimeDelta time,
51 const scoped_refptr<BufferingState>& buffering_state);
52 void Flush(const ::media::PipelineStatusCB& status_cb);
53 void Stop();
55 // Update the playback statistics for this video stream.
56 void UpdateStatistics();
58 // VideoPipeline implementation.
59 void SetClient(const VideoPipelineClient& client) override;
61 private:
62 void OnFlushDone(const ::media::PipelineStatusCB& status_cb);
63 void OnUpdateConfig(StreamId id,
64 const ::media::AudioDecoderConfig& audio_config,
65 const ::media::VideoDecoderConfig& video_config);
66 void OnNaturalSizeChanged(const gfx::Size& size);
68 VideoPipelineDevice* video_device_;
70 scoped_ptr<AvPipelineImpl> av_pipeline_impl_;
71 VideoPipelineClient video_client_;
73 ::media::PipelineStatistics previous_stats_;
75 base::WeakPtr<VideoPipelineImpl> weak_this_;
76 base::WeakPtrFactory<VideoPipelineImpl> weak_factory_;
78 DISALLOW_COPY_AND_ASSIGN(VideoPipelineImpl);
81 } // namespace media
82 } // namespace chromecast
84 #endif // CHROMECAST_MEDIA_CMA_BASE_VIDEO_PIPELINE_IMPL_H_