mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 17:29:18 +02:00
Add videostream dev code
This commit is contained in:
@@ -151,6 +151,8 @@ set(SOURCES
|
|||||||
"imgui/imgui_draw.cpp"
|
"imgui/imgui_draw.cpp"
|
||||||
"imgui/imgui_widgets.cpp"
|
"imgui/imgui_widgets.cpp"
|
||||||
"imgui/imgui_impl_glfw.cpp"
|
"imgui/imgui_impl_glfw.cpp"
|
||||||
|
|
||||||
|
"extras/VS_Dev.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
option(USE_IMGUI_GL3 "Use OpenGL3+ imgui implementation" ON)
|
option(USE_IMGUI_GL3 "Use OpenGL3+ imgui implementation" ON)
|
||||||
|
|||||||
1
extras/DevConstants.h
Normal file
1
extras/DevConstants.h
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#pragma once
|
||||||
41
extras/VS_Dev.cpp
Normal file
41
extras/VS_Dev.cpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#include "VS_Dev.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
VSDev::VSDev()
|
||||||
|
{
|
||||||
|
ifstream DevFile;
|
||||||
|
DevFile.open("test01.bin");
|
||||||
|
DevFile.read(this->Frame1TestBuf, sizeof(this->Frame1TestBuf));
|
||||||
|
DevFile.close();
|
||||||
|
DevFile.open("test02.bin");
|
||||||
|
DevFile.read(this->Frame2TestBuf, sizeof(this->Frame2TestBuf));
|
||||||
|
DevFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
int VSDev::GetFrameFromStream(char ** Buffer)
|
||||||
|
{
|
||||||
|
if ((this->GetFrameCallNum % 2) == 0)
|
||||||
|
{
|
||||||
|
*Buffer = this->Frame1TestBuf;
|
||||||
|
this->GetFrameCallNum++;
|
||||||
|
return sizeof(this->Frame1TestBuf);
|
||||||
|
}
|
||||||
|
else if ((this->GetFrameCallNum % 3) == 0)
|
||||||
|
{
|
||||||
|
*Buffer = this->Frame2TestBuf;
|
||||||
|
this->GetFrameCallNum++;
|
||||||
|
return sizeof(this->Frame2TestBuf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->GetFrameCallNum++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VSDev::FreeFrameBuffer(char * Buffer) {
|
||||||
|
//For dev do nothing...
|
||||||
|
}
|
||||||
15
extras/VS_Dev.h
Normal file
15
extras/VS_Dev.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "VideoStream.h"
|
||||||
|
|
||||||
|
class VSDev : public VideoStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VSDev();
|
||||||
|
int GetFrameFromStream(char **Buffer);
|
||||||
|
void FreeFrameBuffer(char *Buffer);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int GetFrameCallNum = 0;
|
||||||
|
char Frame1TestBuf[102737];
|
||||||
|
char Frame2TestBuf[104143];
|
||||||
|
};
|
||||||
23
extras/VideoStream.h
Normal file
23
extras/VideoStream.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class VideoStream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
\brief Get Frame data
|
||||||
|
|
||||||
|
\param Buffer - Pointer to char pointer
|
||||||
|
|
||||||
|
\warning This function alocate some memory after use bufer data you must call FreeFrameBuffer
|
||||||
|
|
||||||
|
\return If Frame ready and complete return num of bytes in frame buffer else return 0
|
||||||
|
|
||||||
|
**/
|
||||||
|
virtual int GetFrameFromStream(char **Buffer) = 0;
|
||||||
|
/**
|
||||||
|
\brief Free alocated memory
|
||||||
|
|
||||||
|
\param Buffer - Pointer to buffer
|
||||||
|
**/
|
||||||
|
virtual void FreeFrameBuffer(char *Buffer) = 0;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user