diff options
| author | Comment <tim@gray.(none)> | 2013-11-02 16:13:41 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-11-02 16:13:41 +0000 |
| commit | 510a5218d5e981db3dde9ed31ddc6f732ed6a22a (patch) | |
| tree | b9d09c4dbdefed1ec693e0492841cde426ef6643 /rotord/src/libavwrapper.cpp | |
| parent | 8864f5da9649c176e472a7fb8913dd8114deec54 (diff) | |
| parent | eaccb1437465c6aa49e1d5511876852543e3b0fa (diff) | |
merge branch
Diffstat (limited to 'rotord/src/libavwrapper.cpp')
| -rw-r--r-- | rotord/src/libavwrapper.cpp | 22 |
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); } |
