diff --git a/CMakeLists.txt b/CMakeLists.txt index 32d42bc1..1d28dd91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,8 @@ set(SOURCES "imgui/imgui_draw.cpp" "imgui/imgui_widgets.cpp" "imgui/imgui_impl_glfw.cpp" + +"extras/VS_Dev.cpp" ) option(USE_IMGUI_GL3 "Use OpenGL3+ imgui implementation" ON) diff --git a/extras/DevConstants.h b/extras/DevConstants.h new file mode 100644 index 00000000..6f70f09b --- /dev/null +++ b/extras/DevConstants.h @@ -0,0 +1 @@ +#pragma once diff --git a/extras/VS_Dev.cpp b/extras/VS_Dev.cpp new file mode 100644 index 00000000..d594fa35 --- /dev/null +++ b/extras/VS_Dev.cpp @@ -0,0 +1,41 @@ +#include "VS_Dev.h" +#include +#include + +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... +} \ No newline at end of file diff --git a/extras/VS_Dev.h b/extras/VS_Dev.h new file mode 100644 index 00000000..2e0fea49 --- /dev/null +++ b/extras/VS_Dev.h @@ -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]; +}; \ No newline at end of file diff --git a/extras/VideoStream.h b/extras/VideoStream.h new file mode 100644 index 00000000..72335621 --- /dev/null +++ b/extras/VideoStream.h @@ -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; +}; \ No newline at end of file