Skip to content

Commit

Permalink
Merge branch 'ApraNVR_CommonBuild' of https://github.com/Apra-Labs/Ap…
Browse files Browse the repository at this point in the history
…raPipes into ApraNVR_CommonBuild
  • Loading branch information
joiskash committed May 30, 2024
2 parents 55dbcb9 + fe6bd9d commit a37234b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 67 deletions.
1 change: 0 additions & 1 deletion base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ IF(ENABLE_LINUX)
src/GTKModel.cpp
src/GTKSetup.cpp
src/GTKView.cpp
test/gtkglrenderer_tests.cpp
)
ENDIF(ENABLE_LINUX)

Expand Down
50 changes: 6 additions & 44 deletions base/src/GtkGlRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ class GtkGlRenderer::Detail {

static void on_resize(GtkGLArea *area, gint width, gint height,
gpointer data) {
printf("In resize width = %d, height = %d\n", width, height);
LOG_INFO << "GL Area Width " << width << "Height " << height;
view_set_window(width, height);
background_set_window(width, height);
}
void setProps(GtkGlRendererProps &props) { mProps = props; }
static gboolean on_render(GtkGLArea *glarea, GdkGLContext *context,
gpointer data) {
// LOG_ERROR<<"DATA IN RENDER "<<data;
GtkGlRenderer::Detail *detailInstance = (GtkGlRenderer::Detail *)data;

if (detailInstance->isMetadataSet == false) {
Expand All @@ -57,9 +56,6 @@ class GtkGlRenderer::Detail {
// Get the position of the child relative to its parent
gtk_widget_translate_coordinates(GTK_WIDGET(glarea), parent, 0, 0, &x,
&y);
// g_print("Child position relative to parent: x=%d, y=%d\n", x, y);
// LOG_ERROR << "Child position relative to parent "<< x << "=====" <<
// y << "==============" << detailInstance->mProps.windowWidth ;
} else {
// g_print("Error: Child's parent is not realized.\n");
}
Expand All @@ -82,12 +78,7 @@ class GtkGlRenderer::Detail {
frameToRender = detailInstance->renderFrame->data();
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Draw background:
background_draw();

// Draw model:
// model_draw();
// draw_frames();
drawCameraFrame(frameToRender, detailInstance->frameWidth,
detailInstance->frameHeight);

Expand Down Expand Up @@ -139,22 +130,6 @@ class GtkGlRenderer::Detail {
gpointer data) {
LOG_ERROR << "UNREALIZE "
"SIGNAL==================================>>>>>>>>>>>>>>>>>";
// GdkGLContext *glcontext = gtk_gl_area_get_context(GTK_GL_AREA(glarea));
// GdkWindow *glwindow = gdk_gl_context_get_window(glcontext);
// GdkFrameClock *frame_clock = gdk_window_get_frame_clock(glwindow);

// // Disconnect the update signal from frame_clock
// g_signal_handlers_disconnect_by_func(frame_clock,
// gtk_gl_area_queue_render, G_OBJECT(glarea));

// // // Get the parent container
// GtkWidget *parent_container = gtk_widget_get_parent(glarea);

// // Remove the GtkGLArea from its parent container
// gtk_container_remove(GTK_CONTAINER(parent_container), glarea);

// // Destroy the GtkGLArea widget
// gtk_widget_destroy(glarea);
}

static gboolean on_scroll(GtkWidget *widget, GdkEventScroll *event,
Expand Down Expand Up @@ -212,7 +187,6 @@ class GtkGlRenderer::Detail {

bool init() {
connect_glarea_signals(glarea);
// initialize_gl(GTK_GL_AREA(glarea));
return true;
}

Expand All @@ -235,8 +209,6 @@ GtkGlRenderer::GtkGlRenderer(GtkGlRendererProps props)
mDetail->glarea = props.glArea;
mDetail->windowWidth = props.windowWidth;
mDetail->windowHeight = props.windowHeight;
// LOG_ERROR<<"i am creating gtkgl renderer width and height is
// "<<mDetail->mProps.windowWidth;
}

GtkGlRenderer::~GtkGlRenderer() {}
Expand All @@ -256,7 +228,6 @@ bool GtkGlRenderer::process(frame_container &frames)

{
auto myId = Module::getId();
// LOG_ERROR << "GOT "
auto frame = frames.cbegin()->second;
mDetail->cachedFrame = frame;
size_t underscorePos = myId.find('_');
Expand All @@ -272,8 +243,6 @@ bool GtkGlRenderer::process(frame_container &frames)
boost::shared_ptr<AbsControlModule> ctl =
boost::dynamic_pointer_cast<AbsControlModule>(controlModule);
ctl->handleLastGtkGLRenderTS();
// LOG_ERROR << "myID is GtkGlRendererModule_ "<<myNumber << "sending
// timestamp "<<myTime;
return true;
}
return true;
Expand All @@ -300,7 +269,6 @@ void GtkGlRenderer::processQueue() {
}

if (timeDiff >= 33) {
// LOG_ERROR << "GOT "
mDetail->cachedFrame = frame;
size_t underscorePos = myId.find('_');
std::string numericPart = myId.substr(underscorePos + 1);
Expand All @@ -315,8 +283,6 @@ void GtkGlRenderer::processQueue() {
boost::shared_ptr<AbsControlModule> ctl =
boost::dynamic_pointer_cast<AbsControlModule>(controlModule);
ctl->handleLastGtkGLRenderTS();
// LOG_ERROR << "myID is GtkGlRendererModule_ "<<myNumber << "sending
// timestamp "<<myTime;
}
lastFrameTime = currentTime;
}
Expand Down Expand Up @@ -362,14 +328,13 @@ bool GtkGlRenderer::changeProps(GtkWidget *glArea, int windowWidth,

bool GtkGlRenderer::shouldTriggerSOS() {
if (!mDetail->isMetadataSet) {
LOG_ERROR << "WIll Trigger SOS";
LOG_TRACE << "WIll Trigger SOS";
return true;
}
return false;
}

bool GtkGlRenderer::processSOS(frame_sp &frame) {
// mDetail->connect_glarea_signals(mDetail->glarea);
auto inputMetadata = frame->getMetadata();
auto frameType = inputMetadata->getFrameType();
LOG_TRACE << "GOT METADATA " << inputMetadata->getFrameType();
Expand All @@ -391,14 +356,13 @@ bool GtkGlRenderer::processSOS(frame_sp &frame) {
mDetail->isDmaMem =
metadata->getMemType() == FrameMetadata::MemType::DMABUF;

LOG_ERROR << "Width is " << metadata->getWidth() << "Height is "
LOG_INFO << "Width is " << metadata->getWidth() << "Height is "
<< metadata->getHeight();
// LOG_ERROR << "Width STEP is " << metadata->
FrameMetadata::MemType memType = metadata->getMemType();
{
if (memType != FrameMetadata::MemType::DMABUF)

LOG_ERROR << "Memory Type Is Not DMA but it's a interleaved Image";
LOG_INFO << "Memory Type Is Not DMA but it's a interleaved Image";
}
} break;
case FrameMetadata::FrameType::RAW_IMAGE_PLANAR: {
Expand All @@ -413,20 +377,18 @@ bool GtkGlRenderer::processSOS(frame_sp &frame) {
mDetail->frameHeight = metadata->getHeight(0);
mDetail->isDmaMem =
metadata->getMemType() == FrameMetadata::MemType::DMABUF;
LOG_ERROR << "Width is " << metadata->getWidth(0) << "Height is "
LOG_INFO << "Width is " << metadata->getWidth(0) << "Height is "
<< metadata->getHeight(0);
FrameMetadata::MemType memType = metadata->getMemType();
if (memType != FrameMetadata::MemType::DMABUF) {
LOG_ERROR << "Memory Type Is Not DMA but it's a planar Image";
LOG_INFO << "Memory Type Is Not DMA but it's a planar Image";
}
} break;
default:
throw AIPException(AIP_FATAL, "Unsupported FrameType<" +
std::to_string(frameType) + ">");
}
mDetail->isMetadataSet = true;
LOG_ERROR << "Done Setting Metadata=========================>";
// mDetail->init(renderHeight, renderWidth);
return true;
}

Expand Down
5 changes: 1 addition & 4 deletions base/test/gtkglrenderer_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ BOOST_AUTO_TEST_CASE(windowInit2, *boost::unit_test::disabled()) {
LOG_ERROR << "Builder not found";
}
gtk_builder_add_from_file(m_builder, "./data/app_ui.glade", NULL);
std::cout << "ui glade found" << std::endl;

window = GTK_WIDGET(gtk_window_new(GTK_WINDOW_TOPLEVEL));
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
Expand All @@ -580,12 +579,10 @@ BOOST_AUTO_TEST_CASE(windowInit2, *boost::unit_test::disabled()) {

glarea = GTK_WIDGET(gtk_builder_get_object(m_builder, "glareadraw"));
glAreaSwitch = GTK_WIDGET(gtk_builder_get_object(m_builder, "glareadraw1"));
std::cout << "Printing Pointer of Old & New GL AREA" << glarea
<< "======== " << glAreaSwitch << std::endl;

g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);

laucX86RTSPPipeline();
laucX86Pipeline();
gtk_widget_show_all(window);

gtk_main();
Expand Down
6 changes: 2 additions & 4 deletions build_scripts/build_dependencies_linux_cuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ dependencies=( "curl" "zip" "unzip" "tar" "autoconf" "automake" "autopoint" "bui
"flex" "git-core" "git-lfs" "libass-dev" "libfreetype6-dev" "libgnutls28-dev" "libmp3lame-dev"
"libsdl2-dev" "libssl-dev" "libtool" "libsoup-gnome2.4-dev" "libncurses5-dev" "libva-dev" "libvdpau-dev"
"libvorbis-dev" "libxcb1-dev" "libxdamage-dev" "libxcursor-dev" "libxinerama-dev" "libx11-dev" "libgles2-mesa-dev" "libxcb-shm0-dev" "libxcb-xfixes0-dev"
"ninja-build" "pkg-config" "texinfo" "wget" "yasm" "zlib1g-dev" "nasm" "gperf" "bison" "python3" "python3-pip","cryptsetup","libxtst-dev" "doxygen" "graphviz")
"ninja-build" "pkg-config" "texinfo" "wget" "yasm" "zlib1g-dev" "nasm" "gperf" "bison" "python3" "python3-pip" "doxygen" "graphviz" "libxi-dev"
"libgl1-mesa-dev" "libglu1-mesa-dev" "mesa-common-dev" "libxrandr-dev" "libxxf86vm-dev" "libxtst-dev" "libudev-dev" "libgl1-mesa-dev")

missing_dependencies=()

Expand Down Expand Up @@ -75,7 +76,4 @@ if ! nvcc --version &>/dev/null; then
echo "Reloaded ~/.bashrc"
fi

echo "Installing pip install Jinja2"
pip3 install Jinja2

echo "Dependencies verified and installed successfully."
3 changes: 2 additions & 1 deletion build_scripts/build_dependencies_linux_no_cuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ dependencies=( "curl" "zip" "unzip" "tar" "autoconf" "automake" "autopoint" "bui
"flex" "git-core" "git-lfs" "libass-dev" "libfreetype6-dev" "libgnutls28-dev" "libmp3lame-dev"
"libsdl2-dev" "libssl-dev" "libtool" "libsoup-gnome2.4-dev" "libncurses5-dev" "libva-dev" "libvdpau-dev"
"libvorbis-dev" "libxcb1-dev" "libxdamage-dev" "libxcursor-dev" "libxinerama-dev" "libx11-dev" "libgles2-mesa-dev" "libxcb-shm0-dev" "libxcb-xfixes0-dev"
"ninja-build" "pkg-config" "texinfo" "wget" "yasm" "zlib1g-dev" "nasm" "gperf" "bison" "python3" "python3-pip","cryptsetup","libxtst-dev" "doxygen" "graphviz")
"ninja-build" "pkg-config" "texinfo" "wget" "yasm" "zlib1g-dev" "nasm" "gperf" "bison" "python3" "python3-pip","cryptsetup","libxtst-dev" "doxygen" "graphviz"
"libxi-dev" "libgl1-mesa-dev" "libglu1-mesa-dev" "mesa-common-dev" "libxrandr-dev" "libxxf86vm-dev" "libxtst-dev" "libudev-dev" "libgl1-mesa-dev")
missing_dependencies=()

# Check and collect missing dependencies
Expand Down
13 changes: 0 additions & 13 deletions data/app_ui.glade
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@
<property name="height_request">1080</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="id_live_or_rec_status_imgctrl">
<property name="width_request">32</property>
<property name="height_request">32</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">../images/icons8-green-dot-24.png</property>
</object>
<packing>
<property name="x">1240</property>
<property name="y">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="id_app_version_label">
<property name="width_request">200</property>
Expand Down

0 comments on commit a37234b

Please sign in to comment.