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_
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/threading/thread_checker.h"
14 #include "chromecast/media/cma/pipeline/video_pipeline.h"
15 #include "chromecast/media/cma/pipeline/video_pipeline_client.h"
16 #include "chromecast/public/media/stream_id.h"
23 class AudioDecoderConfig
;
24 class VideoDecoderConfig
;
27 namespace chromecast
{
32 class CodedFrameProvider
;
33 class VideoPipelineDevice
;
35 class VideoPipelineImpl
: public VideoPipeline
{
37 // |buffering_controller| can be NULL.
38 explicit VideoPipelineImpl(VideoPipelineDevice
* video_device
);
39 ~VideoPipelineImpl() override
;
41 // Input port of the pipeline.
42 void SetCodedFrameProvider(scoped_ptr
<CodedFrameProvider
> frame_provider
);
44 // Provide the CDM to use to decrypt samples.
45 void SetCdm(BrowserCdmCast
* media_keys
);
47 // Functions to control the state of the audio pipeline.
49 const std::vector
<::media::VideoDecoderConfig
>& configs
,
50 scoped_ptr
<CodedFrameProvider
> frame_provider
,
51 const ::media::PipelineStatusCB
& status_cb
);
52 bool StartPlayingFrom(base::TimeDelta time
,
53 const scoped_refptr
<BufferingState
>& buffering_state
);
54 void Flush(const ::media::PipelineStatusCB
& status_cb
);
57 // Update the playback statistics for this video stream.
58 void UpdateStatistics();
60 // VideoPipeline implementation.
61 void SetClient(const VideoPipelineClient
& client
) override
;
64 void OnFlushDone(const ::media::PipelineStatusCB
& status_cb
);
65 void OnUpdateConfig(StreamId id
,
66 const ::media::AudioDecoderConfig
& audio_config
,
67 const ::media::VideoDecoderConfig
& video_config
);
68 void OnNaturalSizeChanged(const gfx::Size
& size
);
70 VideoPipelineDevice
* video_device_
;
72 scoped_ptr
<AvPipelineImpl
> av_pipeline_impl_
;
73 VideoPipelineClient video_client_
;
75 ::media::PipelineStatistics previous_stats_
;
77 base::WeakPtr
<VideoPipelineImpl
> weak_this_
;
78 base::WeakPtrFactory
<VideoPipelineImpl
> weak_factory_
;
80 DISALLOW_COPY_AND_ASSIGN(VideoPipelineImpl
);
84 } // namespace chromecast
86 #endif // CHROMECAST_MEDIA_CMA_BASE_VIDEO_PIPELINE_IMPL_H_