Throw an exception rather than asserting when unable to handle a pixel format (#65).
[dcpomatic.git] / src / lib / exceptions.h
index 6de8806e4e8debc24eeef6100235a9a44498f96f..277355117ee097f86dce6d1d2c084436e8def4db 100644 (file)
@@ -28,6 +28,9 @@
 #include <cstring>
 #include <boost/exception/all.hpp>
 #include <boost/thread.hpp>
+extern "C" {
+#include <libavutil/pixfmt.h>
+}
 #include "compose.hpp"
 
 /** @class StringError
@@ -220,6 +223,14 @@ public:
        {}
 };
 
+class PixelFormatError : public StringError
+{
+public:
+       PixelFormatError (std::string o, AVPixelFormat f)
+               : StringError (String::compose ("Cannot handle pixel format %1 during %2", f, o))
+       {}
+};
+
 class ExceptionStore
 {
 public:
@@ -245,4 +256,6 @@ private:
        mutable boost::mutex _mutex;
 };
 
+       
+
 #endif