summaryrefslogtreecommitdiff
path: root/testDir
diff options
context:
space:
mode:
authortim <tim@eclectronics.org>2017-06-13 23:10:55 +0100
committertim <tim@eclectronics.org>2017-06-13 23:10:55 +0100
commitedeccbd160c72553d789516b40d4b922df848aac (patch)
treeabe08020cb9d965b98abf1755d150ea371b88666 /testDir
parente7d2892633ba9761a8ab8cc98f812e2db89e8beb (diff)
dirscanner playing
Diffstat (limited to 'testDir')
-rw-r--r--testDir/src/dirscanner.cpp17
-rw-r--r--testDir/src/main.cpp7
-rw-r--r--testDir/src/ofApp.cpp4
3 files changed, 19 insertions, 9 deletions
diff --git a/testDir/src/dirscanner.cpp b/testDir/src/dirscanner.cpp
index f3aa974..c3101a5 100644
--- a/testDir/src/dirscanner.cpp
+++ b/testDir/src/dirscanner.cpp
@@ -1,12 +1,13 @@
#include "dirscanner.h"
void playItem::play(){
+ ofLogNotice() << "playing----->"<<filename;
if (video.isLoaded()){
video.play();
- ofLogNotice() << "playing video: "<<filename;
+ ofLogNotice() << "video: "<<filename;
}
if (image.isAllocated()){
- ofLogNotice() << "playing still: "<<filename;
+ ofLogNotice() << "still: "<<filename;
}
startTime=ofGetElapsedTimef();
}
@@ -23,6 +24,7 @@ bool playItem::load(string _filename){
}
if (ext=="mp4"||ext=="mov"){
if (video.load(filename)){
+ video.setLoopState(OF_LOOP_NONE);
ofLogNotice() << "loaded clip: "<<filename;
loaded=2;
}
@@ -34,7 +36,7 @@ void playItem::draw(){
//ofEnableAlphaBlending();
//ofSetColor(255,255,255,1.0);
- image.draw(0,0);
+ image.draw(0,0,ofGetWidth(),ofGetHeight());
//ofDisableAlphaBlending();
if (ofGetElapsedTimef()-startTime>5.0){
@@ -42,7 +44,9 @@ void playItem::draw(){
}
}
if (video.isLoaded()){
- video.draw(0,0);
+ video.update();
+ video.draw(0,0,ofGetWidth(),ofGetHeight());
+ //ofLogNotice() << "position: "<<video.getPosition();
if (video.getIsMovieDone()){
isFinished=true;
}
@@ -102,11 +106,13 @@ void dirPlayer::load(std::string path){
string d=dir.getPath(i);
playItem item;
if (item.load(d)){
+ ofLogNotice() << "pushing back: "<<i;
items.push_back(item);
}
}
- currentItem=0;
ofLogNotice() << "found "<<items.size()<<" items";
+ currentItem=items.size()-1;
+ items[currentItem].isFinished=true;
}
@@ -126,6 +132,7 @@ void dirPlayer::draw(){
items[currentItem].isFinished=false;
currentItem=(currentItem+1)%items.size();
items[currentItem].play();
+ ofLogNotice() << "playing clip "<<currentItem<<" - "<<(items[currentItem].loaded==0?"none":items[currentItem].loaded==1?"image":"mov");
}
items[currentItem].draw();
diff --git a/testDir/src/main.cpp b/testDir/src/main.cpp
index 120f5a0..733814a 100644
--- a/testDir/src/main.cpp
+++ b/testDir/src/main.cpp
@@ -3,11 +3,14 @@
//========================================================================
int main( ){
+ float rotation=ofDegToRad(ROTATION);
+ int width=(1920*FACTOR*sin(rotation))+(1080*FACTOR*cos(rotation));
+ int height=(1920*FACTOR*cos(rotation))+(1080*FACTOR*sin(rotation));
#ifdef FULLSCREEN
- ofSetupOpenGL(1080,1920,OF_FULLSCREEN);
+ ofSetupOpenGL(width,height,OF_FULLSCREEN);
#else
- ofSetupOpenGL(1080,1920,OF_WINDOW); // <-------- setup the GL context
+ ofSetupOpenGL(width,height,OF_WINDOW);
#endif
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
diff --git a/testDir/src/ofApp.cpp b/testDir/src/ofApp.cpp
index 9ac9e12..d2f7b08 100644
--- a/testDir/src/ofApp.cpp
+++ b/testDir/src/ofApp.cpp
@@ -10,7 +10,7 @@ void ofApp::setup(){
player=dirPlayer(&scanner);
- ofSetFrameRate(5);
+ ofSetFrameRate(25);
}
//--------------------------------------------------------------
@@ -22,7 +22,7 @@ void ofApp::update(){
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(255,255,255);
-
+
player.draw();
}