]> git.sesse.net Git - nageru/blobdiff - image_input.h
Only load images once; add a cache.
[nageru] / image_input.h
index edc86c8fbbf76ed7562fc93cf340952144ae5cbf..3fad845ea83351a43271fc1d357b4a7d7f162356 100644 (file)
@@ -1,12 +1,12 @@
 #ifndef _IMAGE_INPUT_H
 #define _IMAGE_INPUT_H 1
 
+#include <map>
 #include <memory>
 #include <string>
 
 #include <movit/flat_input.h>
 
-
 // An output that takes its input from a static image, loaded with ffmpeg.
 // comes from a single 2D array with chunky pixels.
 class ImageInput : public movit::FlatInput {
@@ -16,7 +16,8 @@ public:
        std::string effect_type_id() const override { return "ImageInput"; }
 
 private:
-       std::unique_ptr<uint8_t[]> image_data;
+       static const uint8_t *load_image(const std::string &filename);
+       static std::map<std::string, std::unique_ptr<uint8_t[]>> all_images;
 };
 
 #endif // !defined(_IMAGE_INPUT_H)