Lumiverse  2.5
A framework for creating lighting control applications
ArnoldFileFrameManager.h
Go to the documentation of this file.
1 
4 #ifndef _ArnoldFileFRAMEMANAGER_H_
5 #define _ArnoldFileFRAMEMANAGER_H_
6 
7 #pragma once
8 
9 #include "LumiverseCoreConfig.h"
10 #ifdef USE_ARNOLD
11 
12 #include "../lib/libjson/libjson.h"
13 #include "Logger.h"
14 #include "ArnoldFrameManager.h"
15 #include "imageio.h"
16 
17 #include <mutex>
18 #include <functional>
19 #include <set>
20 #include <chrono>
21 #include <sstream>
22 #include <iostream>
23 #include <cstdio>
24 #include "../lib/libpng/png.h"
25 
26 namespace Lumiverse {
34  class ArnoldFileFrameManager : public ArnoldFrameManager
35  {
36  public:
40  ArnoldFileFrameManager(std::string frame_path, int fps = 24) :
41  m_frame_path(frame_path), m_prev_frame(-1), m_current(0), m_buffer(NULL),
42  ArnoldFrameManager(fps) { }
43 
47  virtual ~ArnoldFileFrameManager();
48 
53  virtual void dump(time_t time, float *frame, size_t width, size_t height);
54 
58  void saveToFile(string file, float *frame, size_t width, size_t height);
59 
67  virtual float *getCurrentFrameBuffer();
68 
76  virtual time_t getCurrentTime() const;
77 
84  virtual time_t getNextTime() const;
85 
91  virtual bool hasNext() const;
92 
97  virtual bool isEmpty() const;
98 
104  virtual size_t getFrameNum() const;
105 
111  virtual void clear();
112 
118  virtual std::string getType() { return "ArnoldFileFrameManager"; }
119 
120  private:
126  bool fileExists(std::string fileName) const;
127 
128  void deleteFile(std::string fileName) const;
129 
130  // A frame buffer of current frame. This buffer is only used to display.
131  float *m_buffer;
132 
133  // The path to the directory containing all frames.
134  std::string m_frame_path;
135 
136  // The index of the last frame from the previous call.
137  int m_prev_frame;
138 
139  // The index of current frame.
140  size_t m_current;
141  };
142 
143 }
144 
145 #endif
146 
147 #endif
Contains functions for logging information to console or file.
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2
The superclass for all implementation of frame managers.