summaryrefslogtreecommitdiff
path: root/rotord
diff options
context:
space:
mode:
Diffstat (limited to 'rotord')
-rwxr-xr-xrotord/make_proxies8
-rw-r--r--rotord/src/rotor.h34
2 files changed, 27 insertions, 15 deletions
diff --git a/rotord/make_proxies b/rotord/make_proxies
index d9a4cce..bd78ecc 100755
--- a/rotord/make_proxies
+++ b/rotord/make_proxies
@@ -6,8 +6,8 @@ do
file=${source##*/}
suffix=${file##*.}
stub=${file%.*}
- mkdir "$path/$stub";
- ffmpeg -i "$source" -s 1280x720 "$path/$stub/720.$suffix";
- ffmpeg -i "$source" -s 640x360 "$path/$stub/360.$suffix";
- ffmpeg -i "$source" -s 320x180 "$path/$stub/180.$suffix";
+ mkdir "$path/$stub.proxies";
+ ffmpeg -i "$source" -s 1280x720 "$path/$stub.proxies/720.$suffix";
+ ffmpeg -i "$path/$stub.proxies/720.$suffix" -s 640x360 "$path/$stub.proxies/360.$suffix";
+ ffmpeg -i "$path/$stub.proxies/360.$suffix" -s 320x180 "$path/$stub.proxies/180.$suffix";
done \ No newline at end of file
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index fd59c68..8499408 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -788,23 +788,27 @@ namespace Rotor {
create_attribute("media_id","media_id","media_id","media_id"); //for rotorW
NODEID="e92255a0-447a-11e3-b0ce-3fc7ff4bdac9";
isLoaded=false;
+ isLoadable=true;
};
bool load(const string &filename,const int h=0){
Poco::Logger& logger = Poco::Logger::get(Log_name);
+ std::string file_use;
if (h>0&&h<721){
Poco::Path path(filename);
- std::string stub(path.getBaseName());
+ std::string stub(path.getBaseName()+".proxies/");
std::string suffix(path.getExtension());
- std::string size=h>359?"/720.":h>179?"/360.":"/180.";
- Poco::File file_to_use(stub+size+suffix);
- if (file_to_use.exists()){
- cerr<<"using prescaled file: "<<stub<<size<<suffix<<endl;
+ std::string pathto="/";
+ for (int i=0;i<path.depth();i++){
+ pathto=pathto+path[i]+"/";
}
- else cerr<<"could not find prescaled file: "<<stub<<size<<suffix<<" for "<<filename<<endl;
+ std::string size=h>360?"720.":h>180?"360.":"180.";
+ Poco::File file_to_use(pathto+stub+size+suffix);
+ if (file_to_use.exists()) file_use=pathto+stub+size+suffix;
+ else file_use=filename;
}
- isLoaded=player.open(filename);
+ isLoaded=player.open(file_use);
if (isLoaded){
- logger.information("libav::decoder loaded "+filename+": "\
+ logger.information("libav::decoder loaded "+file_use+": "\
+toString(player.get_number_frames())+" frames, "\
+toString(player.get_framerate())+" fps, "\
+toString(player.get_width())+"x"+toString(player.get_height())\
@@ -812,7 +816,8 @@ namespace Rotor {
lastframe=-2;
return true;
}
- logger.error("libav::decoder failed to load "+filename);
+ logger.error("libav::decoder failed to load "+file_use);
+ isLoadable=false;
return false;
}
bool get_frame(double wanted,const Frame_spec &frame){
@@ -894,6 +899,7 @@ namespace Rotor {
libav::video_decoder player;
int lastframe;
bool isLoaded;
+ bool isLoadable;
string media_path;
};
//relative timelines used to stretch video
@@ -920,6 +926,12 @@ namespace Rotor {
};
~Video_loader(){};
+ Image *output(const Frame_spec &frame){
+ if (!isLoaded&&isLoadable){
+ isLoaded=load(media_path+attributes["filename"]->value,frame.h);
+ }
+ Base_video::output(frame);
+ }
//void init_attribute(const string &attr){
// if (attr=="filename") {
// isLoaded=load(media_path+attributes[attr]->value);
@@ -957,7 +969,7 @@ namespace Rotor {
if (!inputs[0]->connection){ //default to single loader if the selector isn't in use
if (!isLoaded){
if (attributes["filenames"]->vals.size()){
- if (load(media_path+attributes["filenames"]->vals[0])) {
+ if (load(media_path+attributes["filenames"]->vals[0],frame.h)) {
isLoaded=true;
}
}
@@ -973,7 +985,7 @@ namespace Rotor {
int wv=seg%attributes["filenames"]->vals.size();
ph=seg==0?ph:fmod(ph,seg);
if (clip_loaded!=wv){
- if (load(media_path+attributes["filenames"]->vals[wv])) { //check if loading is succesful
+ if (load(media_path+attributes["filenames"]->vals[wv],frame.h)) { //check if loading is succesful
clip_loaded=wv;
isLoaded=true;
lastframe=-2;