summaryrefslogtreecommitdiffstats
path: root/media/player
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-18 03:37:43 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-18 03:37:43 +0000
commita564815aed4c8bd1e2c187f9024320f8bb3d3379 (patch)
tree21a3875638d117250721085a589df2bb911d8081 /media/player
parentab8295896cfd8e05655da45c85716edb104752fc (diff)
downloadchromium_src-a564815aed4c8bd1e2c187f9024320f8bb3d3379.zip
chromium_src-a564815aed4c8bd1e2c187f9024320f8bb3d3379.tar.gz
chromium_src-a564815aed4c8bd1e2c187f9024320f8bb3d3379.tar.bz2
Added reference counting to the Pipeline interface.
BUG=17107 TEST=none Review URL: http://codereview.chromium.org/155713 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21044 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/player')
-rw-r--r--media/player/movie.cc20
-rw-r--r--media/player/movie.h2
2 files changed, 11 insertions, 11 deletions
diff --git a/media/player/movie.cc b/media/player/movie.cc
index 3554730..7f13f24 100644
--- a/media/player/movie.cc
+++ b/media/player/movie.cc
@@ -49,7 +49,7 @@ Movie::~Movie() {
}
bool Movie::IsOpen() {
- return pipeline_.get() != NULL;
+ return pipeline_ != NULL;
}
void Movie::SetFrameBuffer(HBITMAP hbmp, HWND hwnd) {
@@ -59,7 +59,7 @@ void Movie::SetFrameBuffer(HBITMAP hbmp, HWND hwnd) {
bool Movie::Open(const wchar_t* url, WtlVideoRenderer* video_renderer) {
// Close previous movie.
- if (pipeline_.get()) {
+ if (pipeline_) {
Close();
}
@@ -81,10 +81,10 @@ bool Movie::Open(const wchar_t* url, WtlVideoRenderer* video_renderer) {
thread_.reset(new base::Thread("PipelineThread"));
thread_->Start();
- pipeline_.reset(new PipelineImpl(thread_->message_loop()));
+ pipeline_ = new PipelineImpl(thread_->message_loop());
// Create and start our pipeline.
- pipeline_->Start(factories.get(), WideToUTF8(std::wstring(url)), NULL);
+ pipeline_->Start(factories, WideToUTF8(std::wstring(url)), NULL);
while (true) {
PlatformThread::Sleep(100);
if (pipeline_->IsInitialized())
@@ -98,7 +98,7 @@ bool Movie::Open(const wchar_t* url, WtlVideoRenderer* video_renderer) {
void Movie::Play(float rate) {
// Begin playback.
- if (pipeline_.get())
+ if (pipeline_)
pipeline_->SetPlaybackRate(enable_pause_ ? 0.0f : rate);
if (rate > 0.0f)
play_rate_ = rate;
@@ -112,7 +112,7 @@ float Movie::GetPlayRate() {
// Get movie duration in seconds.
float Movie::GetDuration() {
float duration = 0.f;
- if (pipeline_.get())
+ if (pipeline_)
duration = (pipeline_->GetDuration()).InMicroseconds() / 1000000.0f;
return duration;
}
@@ -120,7 +120,7 @@ float Movie::GetDuration() {
// Get current movie position in seconds.
float Movie::GetPosition() {
float position = 0.f;
- if (pipeline_.get())
+ if (pipeline_)
position = (pipeline_->GetCurrentTime()).InMicroseconds() / 1000000.0f;
return position;
}
@@ -129,7 +129,7 @@ float Movie::GetPosition() {
void Movie::SetPosition(float position) {
int64 us = static_cast<int64>(position * 1000000);
base::TimeDelta time = base::TimeDelta::FromMicroseconds(us);
- if (pipeline_.get())
+ if (pipeline_)
pipeline_->Seek(time, NULL);
}
@@ -195,10 +195,10 @@ bool Movie::GetOpenMpEnable() {
// Teardown.
void Movie::Close() {
- if (pipeline_.get()) {
+ if (pipeline_) {
pipeline_->Stop(NULL);
thread_->Stop();
- pipeline_.reset();
+ pipeline_ = NULL;
thread_.reset();
}
}
diff --git a/media/player/movie.h b/media/player/movie.h
index eb23822..ac8fba1 100644
--- a/media/player/movie.h
+++ b/media/player/movie.h
@@ -90,7 +90,7 @@ class Movie : public Singleton<Movie> {
Movie();
virtual ~Movie();
- scoped_ptr<PipelineImpl> pipeline_;
+ scoped_refptr<PipelineImpl> pipeline_;
scoped_ptr<base::Thread> thread_;
bool enable_audio_;