]> Some of my projects - aniplayer2.git/commitdiff
Prevent windows from turning off the screen when video is playing.
authorAPTX <marek321@gmail.com>
Sat, 16 Aug 2014 10:55:01 +0000 (12:55 +0200)
committerAPTX <marek321@gmail.com>
Sat, 16 Aug 2014 10:55:01 +0000 (12:55 +0200)
aniplayer_dshow/aniplayerdshowinternal.cpp

index d0f301e577bcfdf83c32002bc5afde39d0b49a15..4c7e27d3c2e5b13bb52bc1dbc7a53bf613c302d9 100644 (file)
@@ -57,19 +57,34 @@ AniPlayerDShowInternal::~AniPlayerDShowInternal()
 bool AniPlayerDShowInternal::play()
 {
        HRESULT hr = pControl->Run();
-       return SUCCEEDED(hr);
+
+       if (FAILED(hr))
+               return false;
+
+       SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
+       return true;
 }
 
 bool AniPlayerDShowInternal::pause()
 {
-        HRESULT hr = pControl->Pause();
-        return SUCCEEDED(hr);
+       HRESULT hr = pControl->Pause();
+
+       if (FAILED(hr))
+               return false;
+
+       SetThreadExecutionState(ES_CONTINUOUS);
+       return true;
 }
 
 bool AniPlayerDShowInternal::stop()
 {
        HRESULT hr = pControl->Stop();
-       return SUCCEEDED(hr);
+
+       if (FAILED(hr))
+               return false;
+
+       SetThreadExecutionState(ES_CONTINUOUS);
+       return true;
 }
 
 QSize AniPlayerDShowInternal::videoSize() const