diff options
Diffstat (limited to 'media/tools')
-rw-r--r-- | media/tools/player_wtl/mainfrm.h | 61 | ||||
-rw-r--r-- | media/tools/player_wtl/movie.cc | 5 | ||||
-rw-r--r-- | media/tools/player_wtl/movie.h | 7 | ||||
-rw-r--r-- | media/tools/player_wtl/player_wtl.cc | 2 | ||||
-rw-r--r-- | media/tools/player_wtl/props.h | 2 | ||||
-rw-r--r-- | media/tools/player_wtl/seek.h | 8 | ||||
-rw-r--r-- | media/tools/player_wtl/view.h | 5 |
7 files changed, 40 insertions, 50 deletions
diff --git a/media/tools/player_wtl/mainfrm.h b/media/tools/player_wtl/mainfrm.h index 6c73957..f92a97d 100644 --- a/media/tools/player_wtl/mainfrm.h +++ b/media/tools/player_wtl/mainfrm.h @@ -61,10 +61,10 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, virtual BOOL OnIdle() { BOOL bEnable = !m_view.bmp_.IsNull(); - BOOL bMovieOpen = media::Movie::GetInstance()->IsOpen() ? true : false; + BOOL bMovieOpen = media::Movie::get()->IsOpen() ? true : false; - float current_position = media::Movie::GetInstance()->GetPosition(); - float duration = media::Movie::GetInstance()->GetDuration(); + float current_position = media::Movie::get()->GetPosition(); + float duration = media::Movie::get()->GetDuration(); if (enable_exit && bEnable && duration > 0.0f && current_position >= duration) { OnFileExit(0, 0, 0); @@ -304,8 +304,8 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, } void UpdateSpeedUICheck() { - if (media::Movie::GetInstance()) { - float play_rate = media::Movie::GetInstance()->GetPlayRate(); + if (media::Movie::get()) { + float play_rate = media::Movie::get()->GetPlayRate(); UISetCheck(ID_PLAY_HALFSPEED, (play_rate == 0.5f)); UISetCheck(ID_PLAY_NORMALSPEED, (play_rate == 1.0f)); UISetCheck(ID_PLAY_DOUBLESPEED, (play_rate == 2.0f)); @@ -422,10 +422,10 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, TogglePrintPreview(); // If a movie is open, close it. - media::Movie::GetInstance()->Close(); + media::Movie::get()->Close(); if (IsMovie(file_name)) { - success = media::Movie::GetInstance()->Open(file_name, m_view.renderer_); + success = media::Movie::get()->Open(file_name, m_view.renderer_); } else { HBITMAP hbmp = NULL; hbmp = (HBITMAP)::LoadImage(NULL, file_name, IMAGE_BITMAP, 0, 0, @@ -590,7 +590,7 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, if (m_bPrintPreview) TogglePrintPreview(); - media::Movie::GetInstance()->Close(); + media::Movie::get()->Close(); m_view.Reset(); UpdateTitleBar(NULL); m_szFilePath[0] = 0; @@ -643,44 +643,44 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, } void OnPlayPlayPause(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { - bool paused = !media::Movie::GetInstance()->GetPause(); - media::Movie::GetInstance()->SetPause(paused); + bool paused = !media::Movie::get()->GetPause(); + media::Movie::get()->SetPause(paused); } void OnPlayStepForward(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { - float current_position = media::Movie::GetInstance()->GetPosition(); - media::Movie::GetInstance()->SetPosition(current_position + 10.0f); + float current_position = media::Movie::get()->GetPosition(); + media::Movie::get()->SetPosition(current_position + 10.0f); } void OnPlayStepBackward(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { - float current_position = media::Movie::GetInstance()->GetPosition(); - media::Movie::GetInstance()->SetPosition(current_position - 10.0f); + float current_position = media::Movie::get()->GetPosition(); + media::Movie::get()->SetPosition(current_position - 10.0f); } void OnPlayGotoStart(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { - media::Movie::GetInstance()->SetPosition(0.0); + media::Movie::get()->SetPosition(0.0); } void OnPlayGotoEnd(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { - float current_position = media::Movie::GetInstance()->GetDuration(); - media::Movie::GetInstance()->SetPosition(current_position - 30.0f); + float current_position = media::Movie::get()->GetDuration(); + media::Movie::get()->SetPosition(current_position - 30.0f); } void SetPlayRate(int play_speed) { if (play_speed == 0) { - media::Movie::GetInstance()->Play(0.5f); + media::Movie::get()->Play(0.5f); } else if (play_speed == 2) { - media::Movie::GetInstance()->Play(2.0f); + media::Movie::get()->Play(2.0f); } else if (play_speed == 3) { - media::Movie::GetInstance()->Play(3.0f); + media::Movie::get()->Play(3.0f); } else if (play_speed == 4) { - media::Movie::GetInstance()->Play(4.0f); + media::Movie::get()->Play(4.0f); } else if (play_speed == 5) { - media::Movie::GetInstance()->Play(8.0f); + media::Movie::get()->Play(8.0f); } else if (play_speed == 6) { - media::Movie::GetInstance()->Play(16.0f); + media::Movie::get()->Play(16.0f); } else { - media::Movie::GetInstance()->Play(1.0f); + media::Movie::get()->Play(1.0f); } } @@ -699,23 +699,22 @@ class CMainFrame : public CFrameWindowImpl<CMainFrame>, } void OnOptionsDraw(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { - bool enable_draw = !media::Movie::GetInstance()->GetDrawEnable(); - media::Movie::GetInstance()->SetDrawEnable(enable_draw); + bool enable_draw = !media::Movie::get()->GetDrawEnable(); + media::Movie::get()->SetDrawEnable(enable_draw); UISetCheck(ID_OPTIONS_DRAW, enable_draw); UpdateLayout(); } void OnOptionsAudio(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wnd*/) { - bool enable_audio = !media::Movie::GetInstance()->GetAudioEnable(); - media::Movie::GetInstance()->SetAudioEnable(enable_audio); + bool enable_audio = !media::Movie::get()->GetAudioEnable(); + media::Movie::get()->SetAudioEnable(enable_audio); UISetCheck(ID_OPTIONS_AUDIO, enable_audio); UpdateLayout(); } void OnOptionsDumpYUVFile(UINT /*uNotify*/, int /*nID*/, CWindow /*wnd*/) { - bool enable_dump_yuv_file = - !media::Movie::GetInstance()->GetDumpYuvFileEnable(); - media::Movie::GetInstance()->SetDumpYuvFileEnable(enable_dump_yuv_file); + bool enable_dump_yuv_file = !media::Movie::get()->GetDumpYuvFileEnable(); + media::Movie::get()->SetDumpYuvFileEnable(enable_dump_yuv_file); UISetCheck(ID_OPTIONS_DUMPYUVFILE, enable_dump_yuv_file); UpdateLayout(); } diff --git a/media/tools/player_wtl/movie.cc b/media/tools/player_wtl/movie.cc index 7a06cb9..70ede51 100644 --- a/media/tools/player_wtl/movie.cc +++ b/media/tools/player_wtl/movie.cc @@ -4,7 +4,6 @@ #include "media/tools/player_wtl/movie.h" -#include "base/singleton.h" #include "base/utf_string_conversions.h" #include "media/base/filter_collection.h" #include "media/base/pipeline_impl.h" @@ -40,10 +39,6 @@ Movie::Movie() Movie::~Movie() { } -Movie* Movie::GetInstance() { - return Singleton<Movie>::get(); -} - bool Movie::IsOpen() { return pipeline_ != NULL; } diff --git a/media/tools/player_wtl/movie.h b/media/tools/player_wtl/movie.h index 581a0db..e505165 100644 --- a/media/tools/player_wtl/movie.h +++ b/media/tools/player_wtl/movie.h @@ -11,20 +11,17 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/singleton.h" #include "base/thread.h" -template <typename T> struct DefaultSingletonTraits; class WtlVideoRenderer; namespace media { class PipelineImpl; -class Movie { +class Movie : public Singleton<Movie> { public: - // Returns the singleton instance. - static Movie* GetInstance(); - // Open a movie. bool Open(const wchar_t* url, WtlVideoRenderer* video_renderer); diff --git a/media/tools/player_wtl/player_wtl.cc b/media/tools/player_wtl/player_wtl.cc index b1dbabc..8fe9f1b 100644 --- a/media/tools/player_wtl/player_wtl.cc +++ b/media/tools/player_wtl/player_wtl.cc @@ -55,7 +55,7 @@ int Run(wchar_t* win_cmd_line, int cmd_show) { int result = the_loop.Run(); - media::Movie::GetInstance()->Close(); + media::Movie::get()->Close(); g_module.RemoveMessageLoop(); return result; diff --git a/media/tools/player_wtl/props.h b/media/tools/player_wtl/props.h index d2b7dbb..65224e5 100644 --- a/media/tools/player_wtl/props.h +++ b/media/tools/player_wtl/props.h @@ -124,7 +124,7 @@ class CPageOne : public CPropertyPageImpl<CPageOne> { SetDlgItemText(IDC_FILESIZE, szBuff); // TODO(fbarchard): We need a pipeline property for frame rate. - float duration = media::Movie::GetInstance()->GetDuration(); + float duration = media::Movie::get()->GetDuration(); float fps = 29.97f; wsprintf(szBuff, L"%i.%2i Seconds, %i Frames", static_cast<int>(duration), diff --git a/media/tools/player_wtl/seek.h b/media/tools/player_wtl/seek.h index d5cf464..84f3c95 100644 --- a/media/tools/player_wtl/seek.h +++ b/media/tools/player_wtl/seek.h @@ -34,12 +34,12 @@ class CSeek : public CSimpleDialog<IDD_SEEK>, BOOL& bHandled) { static float previous_position = -1.0f; - float position = media::Movie::GetInstance()->GetPosition(); + float position = media::Movie::get()->GetPosition(); if (static_cast<int>(position * 10) != static_cast<int>(previous_position * 10)) { previous_position = position; wchar_t szBuff[200]; - float duration = media::Movie::GetInstance()->GetDuration(); + float duration = media::Movie::get()->GetDuration(); float fps = 29.97f; wsprintf(szBuff, L"%i.%i / %i.%i, %i / %i", static_cast<int>(position), @@ -58,8 +58,8 @@ class CSeek : public CSimpleDialog<IDD_SEEK>, virtual BOOL OnIdle() { wchar_t szBuff[200]; - float position = media::Movie::GetInstance()->GetPosition(); - float duration = media::Movie::GetInstance()->GetDuration(); + float position = media::Movie::get()->GetPosition(); + float duration = media::Movie::get()->GetDuration(); // TODO(fbarchard): Use frame rate property when it exists. float fps = 29.97f; wsprintf(szBuff, L"%i.%i / %i.%i, %i / %i", diff --git a/media/tools/player_wtl/view.h b/media/tools/player_wtl/view.h index cbb0a48..dd1aaaf 100644 --- a/media/tools/player_wtl/view.h +++ b/media/tools/player_wtl/view.h @@ -182,8 +182,7 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> { } // Append each frame to end of file. - bool enable_dump_yuv_file = - media::Movie::GetInstance()->GetDumpYuvFileEnable(); + bool enable_dump_yuv_file = media::Movie::get()->GetDumpYuvFileEnable(); if (enable_dump_yuv_file) { DumpYUV(video_frame); } @@ -192,7 +191,7 @@ class WtlVideoWindow : public CScrollWindowImpl<WtlVideoWindow> { double yuv_time_start = GetTime(); // Start timer. #endif - bool enable_draw = media::Movie::GetInstance()->GetDrawEnable(); + bool enable_draw = media::Movie::get()->GetDrawEnable(); if (enable_draw) { DCHECK(bm.bmBitsPixel == 32); DrawYUV(video_frame, |