diff options
| author | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-05-04 20:59:05 +0000 | 
|---|---|---|
| committer | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-05-04 20:59:05 +0000 | 
| commit | 48fee4ebb26e644408252d5fd6bfc67eeb15556b (patch) | |
| tree | 63060297b9cda9eb67a9c76b74e3156718dc7e2e | |
| parent | 9768f3ab067bd56dc83a14b3955f5d371707106e (diff) | |
| download | vdr-plugin-live-48fee4ebb26e644408252d5fd6bfc67eeb15556b.tar.gz vdr-plugin-live-48fee4ebb26e644408252d5fd6bfc67eeb15556b.tar.bz2 | |
- added grab abfrage ob kann
| -rw-r--r-- | grab.cpp | 42 | ||||
| -rw-r--r-- | grab.h | 1 | ||||
| -rw-r--r-- | pages/remote.ecpp | 7 | 
3 files changed, 39 insertions, 11 deletions
| @@ -22,6 +22,7 @@ public:  		{}  	void Activate() { m_firstTime = 0; } +	bool IsActive();  private:  	uint64_t m_firstTime; @@ -29,34 +30,50 @@ private:  	int m_quality;  	int m_width;  	int m_height; + +	bool GrabImage();  	virtual void Action();  }; -void GrabImageTask::Action() +bool GrabImageTask::IsActive()   { -	uint64_t now = cTimeMs::Now(); - -	if ( m_firstTime == 0 ) -		m_firstTime = now; - -	if ( now - m_lastTime < GrabMinIntervalMs || now - m_firstTime > GrabPauseIntervalMs ) -		return; +	cMutexLock lock( &LiveTaskManager() ); +	return GrabImage(); +} +bool GrabImageTask::GrabImage() +{  	cDevice* device = cDevice::PrimaryDevice();  	if ( device == 0 ) {  		SetError( tr("Couldn't aquire primary device") ); -		return; +		return false;  	}  	int size = 0;  	uchar* image = device->GrabImage( size, true, m_quality, m_width, m_height );  	if ( image == 0 ) {  		SetError( tr("Couldn't grab image from primary device") ); -		return; +		return false;  	}  	LiveGrabImageManager().PutImage( reinterpret_cast< char* >( image ), size ); +	return true; +} + +void GrabImageTask::Action() +{ +	uint64_t now = cTimeMs::Now(); + +	if ( m_firstTime == 0 ) +		m_firstTime = now; + +	if ( now - m_lastTime < GrabMinIntervalMs || now - m_firstTime > GrabPauseIntervalMs ) +		return; + +	if ( !GrabImage() ) +		return; +  	m_lastTime = now;  } @@ -74,6 +91,11 @@ GrabImageInfo GrabImageManager::GetImage() const  	return make_pair( m_image, m_size );  } +bool GrabImageManager::CanGrab() const  +{ +	return m_task->IsActive(); +} +  void GrabImageManager::PutImage( char* image, int size )  {  	m_image.reset( image, &free ); @@ -17,6 +17,7 @@ class GrabImageManager  	friend class GrabImageTask;  public: +	bool CanGrab() const;  	GrabImageInfo GetImage() const;  private: diff --git a/pages/remote.ecpp b/pages/remote.ecpp index 3ab8c35..5a0e4b8 100644 --- a/pages/remote.ecpp +++ b/pages/remote.ecpp @@ -2,6 +2,7 @@  #include <vdr/i18n.h>  #include <vdr/keys.h>  #include "setup.h" +#include "grab.h"  using namespace vdrlive;  </%pre> @@ -75,7 +76,11 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");  		<& menu active="remote" component=("remote.remote_actions")>  		<div class="inhalt">  			<div class="screenshot"> -				<img src="screenshot.jpg" name="vdrlive" /><br /> +<{				if (!LiveGrabImageManager().CanGrab()) {	}> +					bloek +<{				} else {									}> +					<img src="screenshot.jpg" name="vdrlive" /><br /> +<{				}											}>  			</div>  			<div>  			<img src="remotecontrol.jpg" width="162" height="363" border="0" usemap="#remote" /> | 
