2 #define _IMAGE_INPUT_H 1
5 #include <movit/flat_input.h>
15 // An output that takes its input from a static image, loaded with ffmpeg.
16 // comes from a single 2D array with chunky pixels. The image is refreshed
17 // from disk about every second.
18 class ImageInput : public movit::FlatInput {
20 ImageInput(const std::string &pathname);
22 std::string effect_type_id() const override { return "ImageInput"; }
23 void set_gl_state(GLuint glsl_program_num, const std::string& prefix, unsigned *sampler_num) override;
24 static void shutdown_updaters();
28 std::unique_ptr<uint8_t[]> pixels;
29 timespec last_modified;
33 std::shared_ptr<const Image> current_image;
35 static std::shared_ptr<const Image> load_image(const std::string &pathname);
36 static std::shared_ptr<const Image> load_image_raw(const std::string &pathname);
37 static void update_thread_func(const std::string &pathname, const timespec &first_modified);
38 static std::mutex all_images_lock;
39 static std::map<std::string, std::shared_ptr<const Image>> all_images;
40 static std::map<std::string, std::thread> update_threads;
41 static volatile bool threads_should_quit;
44 #endif // !defined(_IMAGE_INPUT_H)