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"
20 class AudioDecoderConfig
;
21 class VideoDecoderConfig
;
24 namespace chromecast
{
29 class CodedFrameProvider
;
30 class VideoPipelineDevice
;
32 class VideoPipelineImpl
: public VideoPipeline
{
34 // |buffering_controller| can be NULL.
35 explicit VideoPipelineImpl(VideoPipelineDevice
* video_device
);
36 ~VideoPipelineImpl() override
;
38 // Input port of the pipeline.
39 void SetCodedFrameProvider(scoped_ptr
<CodedFrameProvider
> frame_provider
);
41 // Provide the CDM to use to decrypt samples.
42 void SetCdm(BrowserCdmCast
* media_keys
);
44 // Functions to control the state of the audio pipeline.
46 const ::media::VideoDecoderConfig
& config
,
47 scoped_ptr
<CodedFrameProvider
> frame_provider
,
48 const ::media::PipelineStatusCB
& status_cb
);
49 bool StartPlayingFrom(base::TimeDelta time
,
50 const scoped_refptr
<BufferingState
>& buffering_state
);
51 void Flush(const ::media::PipelineStatusCB
& status_cb
);
54 // Update the playback statistics for this video stream.
55 void UpdateStatistics();
57 // VideoPipeline implementation.
58 void SetClient(const VideoPipelineClient
& client
) override
;
61 void OnFlushDone(const ::media::PipelineStatusCB
& status_cb
);
62 void OnUpdateConfig(const ::media::AudioDecoderConfig
& audio_config
,
63 const ::media::VideoDecoderConfig
& video_config
);
64 void OnNaturalSizeChanged(const gfx::Size
& size
);
66 VideoPipelineDevice
* video_device_
;
68 scoped_ptr
<AvPipelineImpl
> av_pipeline_impl_
;
69 VideoPipelineClient video_client_
;
71 ::media::PipelineStatistics previous_stats_
;
73 base::WeakPtr
<VideoPipelineImpl
> weak_this_
;
74 base::WeakPtrFactory
<VideoPipelineImpl
> weak_factory_
;
76 DISALLOW_COPY_AND_ASSIGN(VideoPipelineImpl
);
80 } // namespace chromecast
82 #endif // CHROMECAST_MEDIA_CMA_BASE_VIDEO_PIPELINE_IMPL_H_