Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6fab6a3
changes for creating the EGLImage from the DMA buffer, addded some lo…
RashmiShinde21 Oct 14, 2025
6341040
added timeout to the select() call in the camera event loop. This pre…
RashmiShinde21 Nov 6, 2025
2c42553
added capture and vcam_crop tests
RashmiShinde21 Nov 6, 2025
d85c627
-fix for the nvtransform error -3 NvBufSurfTransformError_InvalidParams
RashmiShinde21 Nov 6, 2025
1106990
-made changes for jpeg encoding using file descriptor of the DMABUF
RashmiShinde21 Nov 6, 2025
20f6b79
-added test cases for jpeg encoding using dmabuf
RashmiShinde21 Nov 6, 2025
8f0dd5e
-made changes for jpeg decoding using fd
RashmiShinde21 Nov 10, 2025
7d72698
changes in header files for decoding using fd
RashmiShinde21 Nov 10, 2025
0b10796
Merged JetPack upgrade changes and validated working modules
chidanandm-wq Nov 12, 2025
1ecdf43
Fix for green tint issue while converting from rgb to yuv420
chidanandm-wq Nov 18, 2025
863dea2
fixed nvbufsurface: Wrong plane index error in nvtrasform
chidanandm-wq Nov 19, 2025
f02ce21
code refactoring :removed unecessary logs and comments
RashmiShinde21 Nov 14, 2025
155ef6c
- fixed the memory access violation for jpeg encoding of rgb formats
rashmis-21 Nov 19, 2025
6c18c12
fixed the issue of nvv4l2 camera capturing frames only for 10 sec
rashmis-21 Nov 20, 2025
d390e08
- Fixed bug in RawImagePlanarMetadata where data size was not updated
chidanandm-wq Nov 20, 2025
6a78126
fix for the crash in invalid_sensor_mode test for argus camera
rashmis-21 Nov 20, 2025
f375216
added documentation for migration and feature update for JetPack 6.2 …
rashmis-21 Nov 20, 2025
808cbf2
Enhance ImageViewerModule with improved EGL renderer configuration an…
chidanandm-wq Nov 24, 2025
080cbd5
Support conditional JPEG linking in CMake, enable HighGUI in vcpkg co…
chidanandm-wq Nov 27, 2025
131d80a
Added option for jpeg decoder in cmakelist
chidanandm-wq Nov 27, 2025
c7efd81
added scaling functionality in jpeg encoder, supports yuv,mono formats
rashmis-21 Nov 27, 2025
928fbbb
made changes for compatibility with sfml 3.x
rashmis-21 Nov 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
333 changes: 193 additions & 140 deletions base/CMakeLists.txt

Large diffs are not rendered by default.

128 changes: 112 additions & 16 deletions base/include/ApraNvEglRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include <map>
#include <string>
#include <iostream>

#include <X11/Xlib.h>

Expand Down Expand Up @@ -95,9 +100,29 @@ class NvEglRenderer
*/
static NvEglRenderer *createEglRenderer(const char *name, uint32_t width,
uint32_t height, uint32_t x_offset,
uint32_t y_offset , bool displayOnTop);
uint32_t y_offset,
const char* ttfFilePath = NULL,
const char* message = NULL,
float scale = 0.0f,
float r = 0.0f,
float g = 0.0f,
float b = 0.0f,float fontsize = 0.0f,int textPosX = 0, int textPosY = 0,
std::string imagePath = "",int imagePosX = 0,int imagePosY = 0,uint32_t imageWidth = 0,uint32_t imageHeight = 0,float opacity = 1,bool mask = false,
float imageOpacity = 1.0f,float textOpacity = 1.0f);
~NvEglRenderer();

std::string ttfFilePath;
std::string message;
float scale;
float r, g, b;
float fontSize;
int textPosX, textPosY;
float opacity;
std::string imagePath;
int imagePosX, imagePosY;
uint32_t imageWidth, imageHeight;
float imageOpacity,textOpacity;
bool mask;
/**
* Renders a buffer.
*
Expand All @@ -112,6 +137,41 @@ class NvEglRenderer
*/
int render(int fd);

// Set dmabuf import parameters for EGL_EXT_image_dma_buf_import
void setImportParams(int pitchBytes, int fourcc, int offsetBytes = 0, int width = 0, int height = 0)
{
render_pitch = pitchBytes;
render_fourcc = fourcc;
render_offset = offsetBytes;
render_width = width;
render_height = height;
render_num_planes = 1;
}

// Set multi-plane import parameters (e.g., NV12 - 2 planes, YUV420 - 3 planes)
void setImportParamsPlanar(int fourcc,
int width,
int height,
int pitchPlane0,
int offsetPlane0,
int pitchPlane1,
int offsetPlane1,
int pitchPlane2 = 0,
int offsetPlane2 = 0,
int numPlanes = 2)
{
render_fourcc = fourcc;
render_width = width;
render_height = height;
render_pitch = pitchPlane0;
render_offset = offsetPlane0;
render_pitch1 = pitchPlane1;
render_offset1 = offsetPlane1;
render_pitch2 = pitchPlane2;
render_offset2 = offsetPlane2;
render_num_planes = numPlanes;
}

/**
* Sets the rendering rate in frames per second (fps).
*
Expand All @@ -138,8 +198,7 @@ class NvEglRenderer
* @return 0 for success, -1 otherwise.
*/
static int getDisplayResolution(uint32_t &width, uint32_t &height);
bool renderAndDrawLoop();
bool windowDrag();

/**
* Sets the overlay string.
*
Expand All @@ -149,23 +208,25 @@ class NvEglRenderer
* @param[in] y Vertical offset, in pixels.
* @return 0 for success, -1 otherwise.
*/
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOES;
static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES;
static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOES;

int setOverlayText(char *str, uint32_t x, uint32_t y);
public:
void setWindowOpacity(float opacity);
void RenderText(std::string text, float x, float y, float scale, float r, float g, float b);
GLuint initTextShader();
int initFontAtlas(const char* fontPath, int fontSize);
GLuint loadImageTexture(const char* imagePath);
GLuint initImageShader();
void RenderImage(GLuint texture, float x, float y, float width, float height);

private:
Display * x_display; /**< Connection to the X server created using
XOpenDisplay(). */
Window x_window; /**< Holds the window to be used for rendering created using
XCreateWindow(). */

uint32_t mWidth,mHeight;

int drag_start_x = 0;
int drag_start_y = 0;
bool is_dragging = false;
uint32_t _x_offset = 0;
uint32_t _y_offset = 0;
XEvent event;
bool drawBorder = false;

EGLDisplay egl_display; /**< Holds the EGL Display connection. */
EGLContext egl_context; /**< Holds the EGL rendering context. */
EGLSurface egl_surface; /**< Holds the EGL Window render surface. */
Expand All @@ -176,7 +237,9 @@ class NvEglRenderer
GC gc; /**< Graphic Context */
XFontStruct *fontinfo; /**< Brush's font info */
char overlay_str[512]; /**< Overlay's text */

GLuint gl_program = 0; // OpenGL shader program handle
GLint alpha_location = -1; // Location of alpha uniform in shader
GLuint cached_image_texture = 0; // Cached image texture loaded once during initialization
/**
* Creates a GL texture used for rendering.
*
Expand Down Expand Up @@ -223,7 +286,15 @@ class NvEglRenderer
* Constructor called by the wrapper createEglRenderer.
*/
NvEglRenderer(const char *name, uint32_t width, uint32_t height,
uint32_t x_offset, uint32_t y_offset , bool displayOnTop);
uint32_t x_offset, uint32_t y_offset,
const char* ttfFilePath = NULL,
const char* message = NULL,
float scale = 0.0f,
float r = 0.0f,
float g = 0.0f,
float b = 0.0f,float fontsize = 0.0f,int textPosX = 0, int textPosY = 0,
std::string imagePath = "",int imagePosX = 0,int imagePosY = 0,uint32_t imageWidth = 0,uint32_t imageHeight = 0,float opacity = 1,bool mask = false,
float imageOpacity = 1.0f,float textOpacity = 1.0f);
/**
* Gets the pointers to the required EGL methods.
*/
Expand All @@ -242,6 +313,19 @@ class NvEglRenderer
*/
int renderInternal();

/**
* Helper functions for rendering
*/
EGLImageKHR createEglImageFromDmaBuf();
int renderVideoFrame(EGLImageKHR hEglImage);
void renderOverlays();
void saveGLState(GLint& prevProgram, GLint& prevVAO, GLint& prevTexExternal,
GLint& prevTex2D, GLint& prevArrayBuffer, GLint& prevActiveTexUnit,
GLboolean& wasBlendEnabled);
void restoreGLState(GLint prevProgram, GLint prevVAO, GLint prevTexExternal,
GLint prevTex2D, GLint prevArrayBuffer, GLint prevActiveTexUnit,
GLboolean wasBlendEnabled);

/**
* These EGL function pointers are required by the renderer.
*/
Expand All @@ -252,6 +336,18 @@ class NvEglRenderer
static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR;
static PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;

// dma-buf import params
int render_pitch = 0;
int render_offset = 0;
int render_fourcc = 0;
int render_width = 0;
int render_height = 0;
int render_num_planes = 1;
int render_pitch1 = 0;
int render_offset1 = 0;
int render_pitch2 = 0;
int render_offset2 = 0;
};
/** @} */
#endif
8 changes: 3 additions & 5 deletions base/include/AudioCaptureSrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ class AudioCaptureSrcProps : public ModuleProps
AudioCaptureSrcProps(
int _sampleRate,
int _channels,
int _audioInputDeviceIndex,
int _processingIntervalMS) : sampleRate(_sampleRate),
int _audioInputDeviceIndex) : sampleRate(_sampleRate),
channels(_channels),
audioInputDeviceIndex(_audioInputDeviceIndex),
processingIntervalMS(_processingIntervalMS)
audioInputDeviceIndex(_audioInputDeviceIndex)
{
}
int sampleRate;
int channels;
int audioInputDeviceIndex; // starts from 0 to no. of available devices on users system.
int processingIntervalMS;

};

class AudioCaptureSrc : public Module
Expand Down
24 changes: 23 additions & 1 deletion base/include/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class Command {
SendMMQTimestamps,
SendLastGTKGLRenderTS,
DecoderPlaybackSpeed,
Mp4FileClose
Mp4FileClose,
DecoderEOS
};

Command() { type = CommandType::None; }
Expand Down Expand Up @@ -68,6 +69,27 @@ class NoneCommand : public Command {
}
};

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

size_t getSerializeSize()
{
return Command::getSerializeSize();
}

private:

friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& ar, const unsigned int)
{
ar& boost::serialization::base_object<Command>(*this);
}
};
class FileReaderModuleCommand : public Command {
public:
FileReaderModuleCommand() : Command(CommandType::FileReaderModule) {
Expand Down
Loading