Browse Source
Merge pull request #185 from namjeongho/master
Add video sources control - restart/pause/resume
master
Krisjanis Rijnieks
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
91 additions and
0 deletions
-
src/Application/Application.cpp
-
src/Application/Application.h
-
src/MediaServer/MediaServer.cpp
-
src/MediaServer/MediaServer.h
-
src/Sources/VideoSource.cpp
-
src/Sources/VideoSource.h
-
src/ofxPiMapper.cpp
-
src/ofxPiMapper.h
|
|
@ -652,5 +652,17 @@ void Application::toggleLayerPanel(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Application::restart(){ |
|
|
|
_mediaServer.restart(); |
|
|
|
} |
|
|
|
|
|
|
|
void Application::pause(){ |
|
|
|
_mediaServer.pause(); |
|
|
|
} |
|
|
|
|
|
|
|
void Application::resume(){ |
|
|
|
_mediaServer.resume(); |
|
|
|
} |
|
|
|
|
|
|
|
} // namespace piMapper
|
|
|
|
} // namespace ofx
|
|
|
|
|
|
@ -155,6 +155,11 @@ class Application { |
|
|
|
void reboot(); |
|
|
|
void shutdown(); |
|
|
|
|
|
|
|
// video play control
|
|
|
|
void restart(); |
|
|
|
void pause(); |
|
|
|
void resume(); |
|
|
|
|
|
|
|
protected: |
|
|
|
void setState(ApplicationBaseMode * st); |
|
|
|
|
|
|
|
|
|
@ -57,6 +57,32 @@ void MediaServer::draw(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MediaServer::restart() { |
|
|
|
typedef map <std::string, BaseSource *>::iterator it_type; |
|
|
|
for(it_type i = loadedSources.begin(); i != loadedSources.end(); i++){ |
|
|
|
if(i->second->getType() == SourceType::SOURCE_TYPE_VIDEO){ |
|
|
|
static_cast <VideoSource *>(i->second)->restart(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
void MediaServer::pause() { |
|
|
|
typedef map <std::string, BaseSource *>::iterator it_type; |
|
|
|
for(it_type i = loadedSources.begin(); i != loadedSources.end(); i++){ |
|
|
|
if(i->second->getType() == SourceType::SOURCE_TYPE_VIDEO){ |
|
|
|
static_cast <VideoSource *>(i->second)->pause(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
void MediaServer::resume() { |
|
|
|
typedef map <std::string, BaseSource *>::iterator it_type; |
|
|
|
for(it_type i = loadedSources.begin(); i != loadedSources.end(); i++){ |
|
|
|
if(i->second->getType() == SourceType::SOURCE_TYPE_VIDEO){ |
|
|
|
static_cast <VideoSource *>(i->second)->resume(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int MediaServer::getNumImages(){ |
|
|
|
|
|
|
|
return imageWatcher.getFilePaths().size(); |
|
|
|
|
|
@ -52,6 +52,10 @@ class MediaServer { |
|
|
|
void update(); |
|
|
|
void draw(); |
|
|
|
|
|
|
|
void restart(); |
|
|
|
void pause(); |
|
|
|
void resume(); |
|
|
|
|
|
|
|
int getNumVideos(); |
|
|
|
int getNumImages(); |
|
|
|
int getNumFboSources(); // new
|
|
|
|
|
|
@ -106,5 +106,29 @@ void VideoSource::stop(){ |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
void VideoSource::restart(){ |
|
|
|
#ifdef TARGET_RASPBERRY_PI |
|
|
|
_omxPlayer->restartMovie(); |
|
|
|
#else |
|
|
|
_videoPlayer->setPosition(0); |
|
|
|
_videoPlayer->play(); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
void VideoSource::pause() { |
|
|
|
#ifdef TARGET_RASPBERRY_PI |
|
|
|
_omxPlayer->setPaused(true); |
|
|
|
#else |
|
|
|
_videoPlayer->setPaused(true); |
|
|
|
#endif |
|
|
|
} |
|
|
|
void VideoSource::resume() { |
|
|
|
#ifdef TARGET_RASPBERRY_PI |
|
|
|
_omxPlayer->setPaused(false); |
|
|
|
#else |
|
|
|
_videoPlayer->setPaused(false); |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
} // namespace piMapper
|
|
|
|
} // namespace ofx
|
|
|
|
|
|
@ -30,6 +30,9 @@ class VideoSource : public BaseSource { |
|
|
|
void togglePause(); |
|
|
|
void stop(); |
|
|
|
void update(ofEventArgs & args); |
|
|
|
void restart(); |
|
|
|
void pause(); |
|
|
|
void resume(); |
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
|
|
@ -284,3 +284,15 @@ ofx::piMapper::Mode ofxPiMapper::getMode(){ |
|
|
|
void ofxPiMapper::toggleLayerPanel(){ |
|
|
|
_application.toggleLayerPanel(); |
|
|
|
} |
|
|
|
|
|
|
|
void ofxPiMapper::restart() { |
|
|
|
_application.restart(); |
|
|
|
} |
|
|
|
|
|
|
|
void ofxPiMapper::pause() { |
|
|
|
_application.pause(); |
|
|
|
} |
|
|
|
|
|
|
|
void ofxPiMapper::resume() { |
|
|
|
_application.resume(); |
|
|
|
} |
|
|
|
|
|
@ -94,6 +94,11 @@ class ofxPiMapper { |
|
|
|
void reboot(); |
|
|
|
void shutdown(); |
|
|
|
|
|
|
|
// video play control
|
|
|
|
void restart(); |
|
|
|
void pause(); |
|
|
|
void resume(); |
|
|
|
|
|
|
|
private: |
|
|
|
ofx::piMapper::Application _application; |
|
|
|
}; |
|
|
|