summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
Diffstat (limited to 'media/base')
-rw-r--r--media/base/filter_host.h3
-rw-r--r--media/base/mock_filter_host.h3
-rw-r--r--media/base/pipeline.h4
-rw-r--r--media/base/pipeline_impl.cc9
-rw-r--r--media/base/pipeline_impl.h5
-rw-r--r--media/base/pipeline_impl_unittest.cc4
6 files changed, 19 insertions, 9 deletions
diff --git a/media/base/filter_host.h b/media/base/filter_host.h
index 4ac939b..0d9af0f 100644
--- a/media/base/filter_host.h
+++ b/media/base/filter_host.h
@@ -32,6 +32,9 @@ class FilterHost {
// Gets the current time in microseconds.
virtual base::TimeDelta GetTime() const = 0;
+ // Gets the duration in microseconds.
+ virtual base::TimeDelta GetDuration() const = 0;
+
// Updates the current time. Other filters should poll to examine the updated
// time.
virtual void SetTime(base::TimeDelta time) = 0;
diff --git a/media/base/mock_filter_host.h b/media/base/mock_filter_host.h
index 0ec6912..a697226 100644
--- a/media/base/mock_filter_host.h
+++ b/media/base/mock_filter_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
//
@@ -29,6 +29,7 @@ class MockFilterHost : public FilterHost {
// FilterHost implementation.
MOCK_METHOD0(InitializationComplete, void());
MOCK_METHOD1(SetError, void(PipelineError error));
+ MOCK_CONST_METHOD0(GetDuration, base::TimeDelta());
MOCK_CONST_METHOD0(GetTime, base::TimeDelta());
MOCK_METHOD1(SetTime, void(base::TimeDelta time));
MOCK_METHOD1(SetDuration, void(base::TimeDelta duration));
diff --git a/media/base/pipeline.h b/media/base/pipeline.h
index f474df7..82c551c 100644
--- a/media/base/pipeline.h
+++ b/media/base/pipeline.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -133,7 +133,7 @@ class Pipeline : public base::RefCountedThreadSafe<Pipeline> {
// Get the duration of the media in microseconds. If the duration has not
// been determined yet, then returns 0.
- virtual base::TimeDelta GetDuration() const = 0;
+ virtual base::TimeDelta GetMediaDuration() const = 0;
// Get the total number of bytes that are buffered on the client and ready to
// be played.
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 0331e5c..cbc1061b 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -240,7 +240,7 @@ base::TimeDelta PipelineImpl::GetBufferedTime() const {
static_cast<int64>(duration_.InMilliseconds() * ratio));
}
-base::TimeDelta PipelineImpl::GetDuration() const {
+base::TimeDelta PipelineImpl::GetMediaDuration() const {
AutoLock auto_lock(lock_);
return duration_;
}
@@ -363,6 +363,11 @@ base::TimeDelta PipelineImpl::GetTime() const {
return GetCurrentTime();
}
+base::TimeDelta PipelineImpl::GetDuration() const {
+ DCHECK(IsRunning());
+ return GetMediaDuration();
+}
+
void PipelineImpl::SetTime(base::TimeDelta time) {
DCHECK(IsRunning());
AutoLock auto_lock(lock_);
diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h
index 92eceaa..a1ca141 100644
--- a/media/base/pipeline_impl.h
+++ b/media/base/pipeline_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -80,7 +80,7 @@ class PipelineImpl : public Pipeline, public FilterHost {
virtual void SetVolume(float volume);
virtual base::TimeDelta GetCurrentTime() const;
virtual base::TimeDelta GetBufferedTime() const;
- virtual base::TimeDelta GetDuration() const;
+ virtual base::TimeDelta GetMediaDuration() const;
virtual int64 GetBufferedBytes() const;
virtual int64 GetTotalBytes() const;
virtual void GetVideoSize(size_t* width_out, size_t* height_out) const;
@@ -141,6 +141,7 @@ class PipelineImpl : public Pipeline, public FilterHost {
// FilterHost implementation.
virtual void SetError(PipelineError error);
virtual base::TimeDelta GetTime() const;
+ virtual base::TimeDelta GetDuration() const;
virtual void SetTime(base::TimeDelta time);
virtual void SetDuration(base::TimeDelta duration);
virtual void SetBufferedTime(base::TimeDelta buffered_time);
diff --git a/media/base/pipeline_impl_unittest.cc b/media/base/pipeline_impl_unittest.cc
index f442e0b..9edae50 100644
--- a/media/base/pipeline_impl_unittest.cc
+++ b/media/base/pipeline_impl_unittest.cc
@@ -270,7 +270,7 @@ TEST_F(PipelineImplTest, NotStarted) {
EXPECT_TRUE(kZero == pipeline_->GetCurrentTime());
EXPECT_TRUE(kZero == pipeline_->GetBufferedTime());
- EXPECT_TRUE(kZero == pipeline_->GetDuration());
+ EXPECT_TRUE(kZero == pipeline_->GetMediaDuration());
EXPECT_EQ(0, pipeline_->GetBufferedBytes());
EXPECT_EQ(0, pipeline_->GetTotalBytes());
@@ -485,7 +485,7 @@ TEST_F(PipelineImplTest, Properties) {
EXPECT_TRUE(pipeline_->IsInitialized());
EXPECT_EQ(PIPELINE_OK, pipeline_->GetError());
EXPECT_EQ(kDuration.ToInternalValue(),
- pipeline_->GetDuration().ToInternalValue());
+ pipeline_->GetMediaDuration().ToInternalValue());
EXPECT_EQ(kTotalBytes, pipeline_->GetTotalBytes());
EXPECT_EQ(kBufferedBytes, pipeline_->GetBufferedBytes());
EXPECT_EQ(kDuration.ToInternalValue(),