summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rotord/src/libavwrapper.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/rotord/src/libavwrapper.cpp b/rotord/src/libavwrapper.cpp
index 26523fc..2ee9985 100644
--- a/rotord/src/libavwrapper.cpp
+++ b/rotord/src/libavwrapper.cpp
@@ -33,15 +33,25 @@ bool libav::video_decoder::open(const std::string& filename){
Mutex::ScopedLock lock(mutex);
loaded=false;
+ Poco::File f=Poco::File(filename);
+ if (!f.exists()) {
+ cerr<<"ERROR: "<<filename<<" does not exist"<<endl;
+ return false;
+ }
+
//first check if an index object exists
Poco::StringTokenizer tokens(filename,".");
string idxfile="";
- for (int i=0;i<tokens.count()-1;i++){
- idxfile+=tokens[i];
- idxfile+=".";
+ if (tokens.count()>1){
+ for (int i=0;i<tokens.count()-1;i++){
+ idxfile+=tokens[i];
+ idxfile+=".";
+ }
+ idxfile+="idx";
}
- idxfile+="idx";
- Poco::File f=Poco::File(idxfile);
+ else idxfile=filename+".idx";
+
+ f=Poco::File(idxfile);
bool makeindex=true;
FFMS_Index *index;
if (f.exists()) {
@@ -54,7 +64,7 @@ bool libav::video_decoder::open(const std::string& filename){
}
}
if (makeindex) {
- cerr<<"FFMS2: created index "<<idxfile<<endl;
+ cerr<<"FFMS2: creating index "<<idxfile<<endl;
index = FFMS_MakeIndex(filename.c_str(), 0, 0, NULL, NULL, FFMS_IEH_IGNORE, NULL, NULL, &err);
FFMS_WriteIndex(idxfile.c_str(),index,&err);
}