OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/tools/player_wtl/movie.h" | 5 #include "media/tools/player_wtl/movie.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 float duration = 0.f; | 121 float duration = 0.f; |
122 if (pipeline_) | 122 if (pipeline_) |
123 duration = (pipeline_->GetMediaDuration()).InMicroseconds() / 1000000.0f; | 123 duration = (pipeline_->GetMediaDuration()).InMicroseconds() / 1000000.0f; |
124 return duration; | 124 return duration; |
125 } | 125 } |
126 | 126 |
127 // Get current movie position in seconds. | 127 // Get current movie position in seconds. |
128 float Movie::GetPosition() { | 128 float Movie::GetPosition() { |
129 float position = 0.f; | 129 float position = 0.f; |
130 if (pipeline_) | 130 if (pipeline_) |
131 position = (pipeline_->GetCurrentTime()).InMicroseconds() / 1000000.0f; | 131 position = (pipeline_->GetMediaTime()).InMicroseconds() / 1000000.0f; |
132 return position; | 132 return position; |
133 } | 133 } |
134 | 134 |
135 // Set current movie position in seconds. | 135 // Set current movie position in seconds. |
136 void Movie::SetPosition(float position) { | 136 void Movie::SetPosition(float position) { |
137 int64 us = static_cast<int64>(position * 1000000); | 137 int64 us = static_cast<int64>(position * 1000000); |
138 base::TimeDelta time = base::TimeDelta::FromMicroseconds(us); | 138 base::TimeDelta time = base::TimeDelta::FromMicroseconds(us); |
139 if (pipeline_) | 139 if (pipeline_) |
140 pipeline_->Seek(time, media::PipelineStatusCB()); | 140 pipeline_->Seek(time, media::PipelineStatusCB()); |
141 } | 141 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 void Movie::Close() { | 179 void Movie::Close() { |
180 if (pipeline_) { | 180 if (pipeline_) { |
181 pipeline_->Stop(base::Closure()); | 181 pipeline_->Stop(base::Closure()); |
182 pipeline_ = NULL; | 182 pipeline_ = NULL; |
183 } | 183 } |
184 | 184 |
185 message_loop_factory_.reset(); | 185 message_loop_factory_.reset(); |
186 } | 186 } |
187 | 187 |
188 } // namespace media | 188 } // namespace media |
OLD | NEW |