OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "chromecast/media/cma/backend/video_pipeline_device_default.h" | |
6 | |
7 #include "chromecast/media/cma/backend/media_component_device_default.h" | |
8 | |
9 namespace chromecast { | |
10 namespace media { | |
11 | |
12 VideoPipelineDeviceDefault::VideoPipelineDeviceDefault( | |
13 const MediaPipelineDeviceParams& params, | |
14 MediaClockDevice* media_clock_device) | |
15 : pipeline_(new MediaComponentDeviceDefault(params, media_clock_device)) { | |
16 thread_checker_.DetachFromThread(); | |
17 } | |
18 | |
19 VideoPipelineDeviceDefault::~VideoPipelineDeviceDefault() { | |
20 } | |
21 | |
22 void VideoPipelineDeviceDefault::SetClient(Client* client) { | |
23 pipeline_->SetClient(client); | |
24 } | |
25 | |
26 MediaComponentDevice::State VideoPipelineDeviceDefault::GetState() const { | |
27 return pipeline_->GetState(); | |
28 } | |
29 | |
30 bool VideoPipelineDeviceDefault::SetState(State new_state) { | |
31 bool success = pipeline_->SetState(new_state); | |
32 if (!success) | |
33 return false; | |
34 | |
35 if (new_state == kStateIdle) { | |
36 DCHECK(IsValidConfig(config_)); | |
37 } | |
38 if (new_state == kStateUninitialized) { | |
39 config_ = VideoConfig(); | |
40 } | |
41 return true; | |
42 } | |
43 | |
44 bool VideoPipelineDeviceDefault::SetStartPts(int64_t time_microseconds) { | |
45 return pipeline_->SetStartPts(time_microseconds); | |
46 } | |
47 | |
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); | |
53 } | |
54 | |
55 VideoPipelineDeviceDefault::RenderingDelay | |
56 VideoPipelineDeviceDefault::GetRenderingDelay() const { | |
57 return pipeline_->GetRenderingDelay(); | |
58 } | |
59 | |
60 void VideoPipelineDeviceDefault::SetVideoClient(VideoClient* client) { | |
61 delete client; | |
62 } | |
63 | |
64 bool VideoPipelineDeviceDefault::SetConfig(const VideoConfig& config) { | |
65 DCHECK(thread_checker_.CalledOnValidThread()); | |
66 if (!IsValidConfig(config)) | |
67 return false; | |
68 config_ = config; | |
69 if (config.extra_data_size > 0) | |
70 config_extra_data_.assign(config.extra_data, | |
71 config.extra_data + config.extra_data_size); | |
72 else | |
73 config_extra_data_.clear(); | |
74 return true; | |
75 } | |
76 | |
77 bool VideoPipelineDeviceDefault::GetStatistics(Statistics* stats) const { | |
78 return pipeline_->GetStatistics(stats); | |
79 } | |
80 | |
81 } // namespace media | |
82 } // namespace chromecast | |
OLD | NEW |