Skip to content

Commit

Permalink
easy pickings round 1 pr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mraduldubey committed May 20, 2024
1 parent c3a9956 commit 3f78f9b
Show file tree
Hide file tree
Showing 22 changed files with 100 additions and 213 deletions.
33 changes: 20 additions & 13 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,20 @@ IF(ENABLE_LINUX)
list(APPEND CORE_FILES_H include/KeyboardListener.h)
list(APPEND GENERIC_FILES src/VirtualCameraSink.cpp)
list(APPEND GENERIC_FILES_H include/VirtualCameraSink.h)
SET(GTKGL_FILES_H include/Background.h
include/GLUtils.h
include/GtkGlRenderer.h
include/GTKMatrix.h
include/GTKModel.h
include/GTKSetup.h
include/GTKView.h
)
SET(GTK_GL_CPP src/Background.cpp
src/GtkGlRenderer.cpp
src/GTKMatrix.cpp
src/GTKModel.cpp
src/GTKSetup.cpp
src/GTKView.cpp)
ENDIF(ENABLE_LINUX)

SET(IP_FILES
Expand Down Expand Up @@ -389,12 +403,6 @@ ELSE()
src/H264EncoderNVCodec.cpp
src/H264DecoderNvCodecHelper.cpp
src/H264DecoderNvCodecHelper.h
src/Background.cpp
src/GtkGlRenderer.cpp
src/Matrix.cpp
src/Model.cpp
src/Program.cpp
src/View.cpp
)
ENDIF(ENABLE_ARM64)

Expand Down Expand Up @@ -443,13 +451,6 @@ ELSE()
include/JPEGDecoderNVJPEG.h
include/H264EncoderNVCodecHelper.h
include/H264EncoderNVCodec.h
include/Background.h
include/GLUtils.h
include/GtkGlRenderer.h
include/Matrix.h
include/Model.h
include/Program.h
include/View.h
)
ENDIF(ENABLE_ARM64)

Expand All @@ -467,6 +468,12 @@ IF(ENABLE_CUDA)
)
ENDIF(ENABLE_CUDA)

IF(ENABLE_LINUX)
set(SOURCE ${SOURCE}
${GTKGL_FILES_H} ${GTKGL_FILES_CPP}
)
ENDIF(ENABLE_LINUX)

add_library(aprapipes STATIC ${SOURCE})

target_include_directories ( aprapipes PRIVATE
Expand Down
3 changes: 1 addition & 2 deletions base/include/BoundBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <boost/thread/thread.hpp>
#include <boost/call_traits.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>
using namespace boost::placeholders;

template <class T>
Expand Down Expand Up @@ -46,7 +45,7 @@ class bounded_buffer
bool isCommandQueueNotFull = m_unread < m_capacity * 2;
if (m_accept && isCommandQueueNotFull)
{
std::cout << "command pushed" << std::endl;
LOG_TRACE << "command pushed" << std::endl;
m_container.push_back(item);
++m_unread;
lock.unlock();
Expand Down
112 changes: 13 additions & 99 deletions base/include/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ class Command
Relay,
Step,
ValvePassThrough,
MultimediaQueueXform,
ExportMMQ,
Seek,
MP4WriterLastTS,
Mp4ErrorHandle,
PlayPause,
DeleteWindow,
CreateWindow,
PlayPause,
NVRCommandExportView,
MP4WriterLastTS,
MMQtimestamps,
Rendertimestamp,
RenderPlayPause,
Mp4ErrorHandle
/* NVR Commands */
NVRCommandExportView = 1000,
SendMMQTimestamps,
SendLastGTKGLRenderTS
};

Command()
Expand Down Expand Up @@ -252,16 +252,16 @@ class EglRendererCreateWindow : public Command
}
};

class MultimediaQueueXformCommand : public Command
class ExportMMQ : public Command
{
public:
MultimediaQueueXformCommand() : Command(Command::CommandType::MultimediaQueueXform)
ExportMMQ() : Command(Command::CommandType::ExportMMQ)
{
}

size_t getSerializeSize()
{
return Command::getSerializeSize() + sizeof(startTime) + sizeof(endTime);
return Command::getSerializeSize() + sizeof(startTime) + sizeof(endTime) + sizeof(direction);
}

int64_t startTime = 0;
Expand Down Expand Up @@ -314,40 +314,6 @@ class Mp4SeekCommand : public Command
}
};

//NVRCommands

class NVRCommandExportView : public Command
{
public:
NVRCommandExportView() : Command(Command::CommandType::NVRCommandExportView)
{
}

size_t getSerializeSize()
{
return Command::getSerializeSize() + sizeof(startViewTS) + sizeof(stopViewTS);
}

uint64_t startViewTS = 0;
uint64_t stopViewTS = 0;
bool direction = true;
bool mp4ReaderExport = false;
bool onlyDirectionChange = false;

private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int /* file_version */)
{
ar& boost::serialization::base_object<Command>(*this);
ar& startViewTS;
ar& stopViewTS;
ar& direction;
ar& mp4ReaderExport;
ar& onlyDirectionChange;
}
};

class MP4WriterLastTS : public Command
{
public:
Expand All @@ -374,10 +340,10 @@ class MP4WriterLastTS : public Command
}
};

class MMQtimestamps : public Command
class SendMMQTimestamps : public Command
{
public:
MMQtimestamps() : Command(Command::CommandType::MMQtimestamps)
SendMMQTimestamps() : Command(Command::CommandType::SendMMQTimestamps)
{
}

Expand Down Expand Up @@ -406,34 +372,6 @@ class MMQtimestamps : public Command
}
};

class Rendertimestamp : public Command
{
public:
Rendertimestamp() : Command(Command::CommandType::Rendertimestamp)
{
}

size_t getSerializeSize()
{
return Command::getSerializeSize() + sizeof(currentTimeStamp) +sizeof(moduleId);
}

uint64_t currentTimeStamp = 0;
std::string moduleId;

private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int /* file_version */)
{
ar& boost::serialization::base_object<Command>(*this);
ar& currentTimeStamp;
ar& moduleId;
}
};



class PlayPauseCommand : public Command
{
public:
Expand Down Expand Up @@ -473,30 +411,6 @@ class PlayPauseCommand : public Command
}
};

class RenderPlayPause : public Command
{
public:
RenderPlayPause() : Command(Command::CommandType::RenderPlayPause)
{
}

size_t getSerializeSize()
{
return Command::getSerializeSize() + sizeof(pauseRenderer);
}

bool pauseRenderer;

private:
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int /* file_version */)
{
ar& boost::serialization::base_object<Command>(*this);
ar& pauseRenderer;
}
};

class Mp4ErrorHandle : public Command
{
public:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions base/include/GtkGlRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
#include "Module.h"
#include <gtk/gtk.h>// remove this
#include <chrono>
#include <boost/serialization/vector.hpp>
class GtkGlRendererProps : public ModuleProps
{
public:
GtkGlRendererProps(GtkWidget* _glArea, int _windowWidth, int _windowHeight) : ModuleProps() // take gtk string
{
// gladeFileName = _gladeFileName;
glArea = _glArea;
windowWidth = _windowWidth;
windowHeight = _windowHeight;
Expand All @@ -28,8 +26,6 @@ class GtkGlRenderer : public Module
bool init();
bool term();
bool changeProps(GtkWidget* glArea, int windowWidth, int windowHeight);
// wait_for_exit

protected:
bool process(frame_container& frames);
bool processSOS(frame_sp &frame);
Expand Down
45 changes: 23 additions & 22 deletions base/include/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class Module {
bool addFeedback(boost::shared_ptr<Module> next, bool open = true); // take all the output pins
boost_deque<boost::shared_ptr<Module>> getConnectedModules();

bool relay(boost::shared_ptr<Module> next, bool open);
bool relay(boost::shared_ptr<Module> next, bool open, bool priority = false);

virtual bool init();
void operator()(); //to support boost::thread
Expand All @@ -179,27 +179,6 @@ class Module {
virtual void flushQue();
bool getPlayDirection() { return mDirection; }
virtual void flushQueRecursive();
template<class T>
bool queueCommand(T& cmd, bool priority = false)
{
auto size = cmd.getSerializeSize();
auto frame = makeCommandFrame(size, mCommandMetadata);

Utils::serialize(cmd, frame->data(), size);

// add to que
frame_container frames;
frames.insert(make_pair("command", frame));
if(priority)
{
Module::push_back(frames);
}
else
{
Module::push(frames);
}
return true;
}
protected:
virtual boost_deque<frame_sp> getFrames(frame_container& frames);
virtual bool process(frame_container& frames) { return false; }
Expand Down Expand Up @@ -248,6 +227,28 @@ class Module {
return true;
}

template<class T>
bool queueCommand(T& cmd, bool priority = false)
{
auto size = cmd.getSerializeSize();
auto frame = makeCommandFrame(size, mCommandMetadata);

Utils::serialize(cmd, frame->data(), size);

// add to que
frame_container frames;
frames.insert(make_pair("command", frame));
if(priority)
{
Module::push_back(frames);
}
else
{
Module::push(frames);
}
return true;
}

template<class T>
void getCommand(T& cmd, frame_sp& frame)
{
Expand Down
2 changes: 1 addition & 1 deletion base/include/OrderedCacheOfFiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class OrderedCacheOfFiles
void updateCache(std::string& filePath, uint64_t& start_ts, uint64_t& end_ts); // allow updates from playback
std::map<std::string, std::pair<uint64_t, uint64_t>> getSnapShot(); // too costly, use for debugging only
bool probe(boost::filesystem::path dirPath, std::string& videoName);
bool getPreviosAndNextFile(std::string videoPath, std::string& previousFile, std::string& nextFile);
bool getPreviousAndNextFile(std::string videoPath, std::string& previousFile, std::string& nextFile);
private:
bool lastKnownPlaybackDir = true; // sync with mp4 playback
boost::mutex m_mutex;
Expand Down
15 changes: 0 additions & 15 deletions base/include/stdafx.h

This file was deleted.

5 changes: 1 addition & 4 deletions base/src/Background.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#include <gdk/gdk.h>
//yash change
// #include <GL/gl.h>
#ifndef GL_H
#define GL_H
#include <GL/glew.h>
#include <GL/glut.h>
#endif
// #include <GL/gl.h>
#include "Program.h"
#include "GTKSetup.h"

static GLuint texture;
static GLuint vao, vbo;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions base/src/Model.cpp → base/src/GTKModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <GL/glut.h>
#endif
// #include <opencv2/opencv.hpp>
#include "Matrix.h"
#include "Program.h"
#include "GTKMatrix.h"
#include "GTKSetup.h"
#include "GLUtils.h"

static GLuint vao, vbo;
Expand Down
Loading

0 comments on commit 3f78f9b

Please sign in to comment.