diff options
| author | tim <tim@eclectronics.org> | 2017-05-30 00:50:56 +0100 |
|---|---|---|
| committer | tim <tim@eclectronics.org> | 2017-05-30 00:50:56 +0100 |
| commit | a0e8fefd1bf241b805c4542421bdbc6a4447fdc3 (patch) | |
| tree | e503e4f0bfbbb2faff0e754d3a379c28f2fcf81f /testDir/src/dirscanner.cpp | |
| parent | 7a201017da4b0aedd79bb93747c855fe63b5ede9 (diff) | |
no alpha or movsdirscanner
Diffstat (limited to 'testDir/src/dirscanner.cpp')
| -rw-r--r-- | testDir/src/dirscanner.cpp | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/testDir/src/dirscanner.cpp b/testDir/src/dirscanner.cpp index 34dec9b..f3aa974 100644 --- a/testDir/src/dirscanner.cpp +++ b/testDir/src/dirscanner.cpp @@ -1,9 +1,17 @@ #include "dirscanner.h" void playItem::play(){ - + if (video.isLoaded()){ + video.play(); + ofLogNotice() << "playing video: "<<filename; + } + if (image.isAllocated()){ + ofLogNotice() << "playing still: "<<filename; + } + startTime=ofGetElapsedTimef(); } -bool playItem::load(string filename){ +bool playItem::load(string _filename){ + filename=_filename; ofFile file(filename); string ext=ofToLower(file.getExtension()); loaded=0; @@ -13,7 +21,7 @@ bool playItem::load(string filename){ loaded=1; } } - if (ext=="mkv"||ext=="mov"){ + if (ext=="mp4"||ext=="mov"){ if (video.load(filename)){ ofLogNotice() << "loaded clip: "<<filename; loaded=2; @@ -22,10 +30,23 @@ bool playItem::load(string filename){ return loaded>0; } void playItem::draw(){ + if (image.isAllocated()){ -} -bool playItem::isFinished(){ + //ofEnableAlphaBlending(); + //ofSetColor(255,255,255,1.0); + image.draw(0,0); + //ofDisableAlphaBlending(); + if (ofGetElapsedTimef()-startTime>5.0){ + isFinished=true; + } + } + if (video.isLoaded()){ + video.draw(0,0); + if (video.getIsMovieDone()){ + isFinished=true; + } + } } void dirScanner::scan(){ @@ -45,7 +66,7 @@ void dirScanner::scan(){ int start = ofToInt(d.substr(0,4)); int end = ofToInt(d.substr(5,4)); - if (start&&end){ + if (end){ slots.push_back(timeSlot(dir.getPath(i),start,end)); ofLogNotice() << "directory "<<i<<": "<<start<<" - "<<end<<" "<<dir.getPath(i); @@ -72,10 +93,10 @@ int dirScanner::getSlotForTime(){ void dirPlayer::load(std::string path){ items.clear(); ofDirectory dir(path); - dir.allowExt("mkv"); + dir.allowExt("mp4"); dir.allowExt("mov"); dir.allowExt("jpg"); - // dir.allowExt("png"); + dir.allowExt("png"); dir.listDir(); for(int i = 0; i < dir.size(); i++){ string d=dir.getPath(i); @@ -84,6 +105,9 @@ void dirPlayer::load(std::string path){ items.push_back(item); } } + currentItem=0; + ofLogNotice() << "found "<<items.size()<<" items"; + } void dirPlayer::draw(){ @@ -98,6 +122,11 @@ void dirPlayer::draw(){ } currentslot=slot; } - + if (items[currentItem].isFinished){ + items[currentItem].isFinished=false; + currentItem=(currentItem+1)%items.size(); + items[currentItem].play(); + } + items[currentItem].draw(); }
\ No newline at end of file |
