| 1 | |
| 2 | #include <cvd/videofilebuffer.h> |
| 3 | |
| 4 | #include <sstream> |
| 5 | using namespace std; |
| 6 | namespace CVD |
| 7 | { |
| 8 | |
| 9 | using namespace Exceptions::VideoFileBuffer; |
| 10 | |
| 11 | // |
| 12 | // EXCEPTIONS |
| 13 | // |
| 14 | |
| 15 | Exceptions::VideoFileBuffer::FileOpen::FileOpen(const std::string& name, const string& error) |
| 16 | : All("RawVideoFileBuffer: Error opening file \"" + name + "\": " + error) |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | Exceptions::VideoFileBuffer::BadFrameAlloc::BadFrameAlloc() |
| 21 | : All("RawVideoFileBuffer: Unable to allocate video frame.") |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | Exceptions::VideoFileBuffer::BadDecode::BadDecode(double t, const string& s) |
| 26 | : All([=]() { |
| 27 | ostringstream os; |
| 28 | os << "RawVideoFileBuffer: Error decoding video frame at time " << t; |
| 29 | |
| 30 | if(s == "") |
| 31 | os << "."; |
| 32 | else |
| 33 | os << ": " << s; |
| 34 | return os.str(); |
| 35 | }()) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | Exceptions::VideoFileBuffer::EndOfFile::EndOfFile() |
| 40 | : All("RawVideoFileBuffer: Tried to read off the end of the file.") |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | Exceptions::VideoFileBuffer::BadSeek::BadSeek(double t, const string& s) |
| 45 | : All([=]() { |
| 46 | ostringstream os; |
| 47 | os << "RawVideoFileBuffer: Seek to time " << t << "s failed"; |
| 48 | |
| 49 | if(s == "") |
| 50 | os << "."; |
| 51 | else |
| 52 | os << ": " << s; |
| 53 | |
| 54 | return os.str(); |
| 55 | }()) |
| 56 | { |
| 57 | } |
| 58 | |
| 59 | } |