23 #include <glm/glm.hpp>
24 #include <glm/gtc/matrix_transform.hpp>
28 jevois::
VideoOutput(), itsImageQueue(std::max(size_t(2), nbufs)), itsStreaming(false)
35 itsStreaming.store(
false);
37 itsImageQueue.clear();
38 size_t const nbufs = itsImageQueue.size();
41 unsigned int imsize = m.osize();
43 for (
size_t i = 0; i < nbufs; ++i)
45 itsBuffers.push_back(std::make_shared<jevois::VideoBuf>(-1, imsize, 0, -1));
52 img.
buf = itsBuffers[i];
56 itsImageQueue.push(img);
59 LDEBUG(
"Allocated " << nbufs <<
" buffers");
66 for (
auto & b : itsBuffers)
68 if (b.use_count() > 1)
LERROR(
"Ref count non zero when attempting to free VideoBuf");
78 if (itsStreaming.load() ==
false)
LFATAL(
"Not streaming");
81 img = itsImageQueue.pop();
82 LDEBUG(
"Empty image " << img.
bufindex <<
" handed over to application code for filling");
88 if (itsStreaming.load() ==
false)
LFATAL(
"Not streaming");
91 unsigned short winw, winh;
92 itsBackend.getWindowSize(winw, winh);
97 itsBackend.init(1920, 1080,
true);
98 itsBackend.getWindowSize(winw, winh);
102 itsBackend.newFrame();
105 bool shouldclose =
false; itsBackend.pollEvents(shouldclose);
109 #ifdef JEVOIS_PLATFORM
111 static glm::mat4 pvm = glm::translate(glm::scale(glm::mat4(1.0f), glm::vec3(2.0f / winw, 2.0f / winh, 1.0f)),
112 glm::vec3(0.375f, 0.375f, 0.0f));
115 static glm::mat4 pvm = glm::scale(glm::mat4(1.0f), glm::vec3(2.0f / winw, 2.0f / winh, 1.0f));
120 int x = 0, y = 0;
unsigned short w = 0,
h = 0;
121 itsImage.draw(x, y, w,
h,
true, pvm);
128 itsImageQueue.push(img);
129 LDEBUG(
"Empty image " << img.
bufindex <<
" ready for filling in by application code");
134 { itsStreaming.store(
true); }
138 { itsStreaming.store(
false); }
142 { itsStreaming.store(
false); }