1 // Copyright 2015 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 #include "chromecast/media/cma/backend/video_pipeline_device_default.h"
7 #include "chromecast/media/cma/backend/media_component_device_default.h"
12 VideoPipelineDeviceDefault::VideoPipelineDeviceDefault(
13 const MediaPipelineDeviceParams
& params
,
14 MediaClockDevice
* media_clock_device
)
15 : pipeline_(new MediaComponentDeviceDefault(params
, media_clock_device
)) {
16 thread_checker_
.DetachFromThread();
19 VideoPipelineDeviceDefault::~VideoPipelineDeviceDefault() {
22 void VideoPipelineDeviceDefault::SetClient(Client
* client
) {
23 pipeline_
->SetClient(client
);
26 MediaComponentDevice::State
VideoPipelineDeviceDefault::GetState() const {
27 return pipeline_
->GetState();
30 bool VideoPipelineDeviceDefault::SetState(State new_state
) {
31 bool success
= pipeline_
->SetState(new_state
);
35 if (new_state
== kStateIdle
) {
36 DCHECK(IsValidConfig(config_
));
38 if (new_state
== kStateUninitialized
) {
39 config_
= VideoConfig();
44 bool VideoPipelineDeviceDefault::SetStartPts(int64_t time_microseconds
) {
45 return pipeline_
->SetStartPts(time_microseconds
);
48 MediaComponentDevice::FrameStatus
VideoPipelineDeviceDefault::PushFrame(
49 DecryptContext
* decrypt_context
,
50 CastDecoderBuffer
* buffer
,
51 FrameStatusCB
* completion_cb
) {
52 return pipeline_
->PushFrame(decrypt_context
, buffer
, completion_cb
);
55 VideoPipelineDeviceDefault::RenderingDelay
56 VideoPipelineDeviceDefault::GetRenderingDelay() const {
57 return pipeline_
->GetRenderingDelay();
60 void VideoPipelineDeviceDefault::SetVideoClient(VideoClient
* client
) {
64 bool VideoPipelineDeviceDefault::SetConfig(const VideoConfig
& config
) {
65 DCHECK(thread_checker_
.CalledOnValidThread());
66 if (!IsValidConfig(config
))
69 if (config
.extra_data_size
> 0)
70 config_extra_data_
.assign(config
.extra_data
,
71 config
.extra_data
+ config
.extra_data_size
);
73 config_extra_data_
.clear();
77 bool VideoPipelineDeviceDefault::GetStatistics(Statistics
* stats
) const {
78 return pipeline_
->GetStatistics(stats
);
82 } // namespace chromecast