L4T Multimedia API Reference

27.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NvOSD Library

Detailed Description

This file defines the NvOSD library to be used to draw rectangles and text over the frame for given parameters.

Data Structures

struct  _NvOSD_ColorParams
 Holds the color parameters of the box or text to be overlayed. More...
 
struct  _NvOSD_FontParams
 Holds the font parameters of the text to be overlayed. More...
 
struct  _NvOSD_TextParams
 Holds the text parameters of the text to be overlayed. More...
 
struct  _NvOSD_RectParams
 Holds the box parameters of the box to be overlayed. More...
 

Macros

#define NVOSD_MAX_NUM_RECTS   128
 

Typedefs

typedef struct _NvOSD_ColorParams NvOSD_ColorParams
 Holds the color parameters of the box or text to be overlayed. More...
 
typedef struct _NvOSD_FontParams NvOSD_FontParams
 Holds the font parameters of the text to be overlayed. More...
 
typedef struct _NvOSD_TextParams NvOSD_TextParams
 Holds the text parameters of the text to be overlayed. More...
 
typedef struct _NvOSD_RectParams NvOSD_RectParams
 Holds the box parameters of the box to be overlayed. More...
 

Enumerations

enum  NvOSD_Mode {
  MODE_CPU,
  MODE_GPU,
  MODE_HW
}
 List modes used to overlay boxes and text. More...
 

Functions

void * nvosd_create_context (void)
 Creates NvOSD context. More...
 
void nvosd_destroy_context (void *nvosd_ctx)
 Destroys NvOSD context. More...
 
void nvosd_set_clock_params (void *nvosd_ctx, NvOSD_TextParams *clk_params)
 Sets clock parameters for the given context. More...
 
int nvosd_put_text (void *nvosd_ctx, NvOSD_Mode mode, int fd, int num_strings, NvOSD_TextParams *text_params_list)
 Overlays clock and given text at given location on a buffer. More...
 
int nvosd_draw_rectangles (void *nvosd_ctx, NvOSD_Mode mode, int fd, int num_rects, NvOSD_RectParams *rect_params_list)
 Overlays boxes at given location on a buffer. More...
 

Macro Definition Documentation

#define NVOSD_MAX_NUM_RECTS   128

Definition at line 57 of file nvosd.h.

Typedef Documentation

Holds the color parameters of the box or text to be overlayed.

Holds the font parameters of the text to be overlayed.

Holds the box parameters of the box to be overlayed.

Holds the text parameters of the text to be overlayed.

Enumeration Type Documentation

enum NvOSD_Mode

List modes used to overlay boxes and text.

Enumerator
MODE_CPU 

Selects CPU for OSD processing.

Works with RGBA data only

MODE_GPU 

Selects GPU for OSD processing.

Yet to be implemented

MODE_HW 

Selects NV HW engine for rectangle draw and mask.

This mode works with both YUV and RGB data. It does not consider alpha parameter. Not applicable for drawing text.

Definition at line 135 of file nvosd.h.

Function Documentation

void* nvosd_create_context ( void  )

Creates NvOSD context.

Returns
A pointer to NvOSD context, NULL in case of failure.
void nvosd_destroy_context ( void *  nvosd_ctx)

Destroys NvOSD context.

Parameters
[in]nvosd_ctxA pointer to NvOSD context.
int nvosd_draw_rectangles ( void *  nvosd_ctx,
NvOSD_Mode  mode,
int  fd,
int  num_rects,
NvOSD_RectParams rect_params_list 
)

Overlays boxes at given location on a buffer.

Boxes can be configured with: a. Only border To draw boxes with only border, you must set border_width and set has_bg_color to 0 for the given box. b. Border and background color To draw boxes with border and background color, you must set border_width and set has_bg_color to 1, and specify background color parameters for the given box. c. Solid fill acting as mask region To draw boxes with solid fill acting as mask region, you must set border_width to 0 and has_bg_color to 1 for the given box.

You must ensure that the length of rect_params_list is at least num_rects.

Parameters
[in]nvosd_ctxA pointer to NvOSD context.
[in]modeSpecifies the mode selection to draw the boxes.
[in]fdSpecifies the DMABUF FD of buffer on which boxes are to be overlayed.
[in]num_rectsSpecifies the number of boxes to be overlayed.
[in]rect_params_listA pointer to an array of NvOSD_TextParams structure for the clock and text to be overlayed.
Returns
0 for success, -1 for failure.
int nvosd_put_text ( void *  nvosd_ctx,
NvOSD_Mode  mode,
int  fd,
int  num_strings,
NvOSD_TextParams text_params_list 
)

Overlays clock and given text at given location on a buffer.

To overlay the clock, you must set clock params using nvosd_set_clock_params(). You must ensure that the length of text_params_list is at least num_strings.

Note
Currently only MODE_CPU is supported. Specifying other modes will have no effect.
Parameters
[in]nvosd_ctxA pointer to NvOSD context.
[in]modeSpecifies the mode selection to draw the text.
[in]fdSpecifies the DMABUF FD of buffer on which text is to be overlayed.
[in]num_stringsSpecifies the number of strings to be overlayed.
[in]text_params_listA pointer to an array of NvOSD_TextParams structure for the clock and text to be overlayed.
Returns
0 for success, -1 for failure.
void nvosd_set_clock_params ( void *  nvosd_ctx,
NvOSD_TextParams clk_params 
)

Sets clock parameters for the given context.

The clock is overlayed when nvosd_put_text() is called. If no other text is to be overlayed, nvosd_put_text must be called with num_strings as 0 and text_params_list as NULL.

Parameters
[in]nvosd_ctxA pointer to NvOSD context.
[in]clk_paramsA pointer to NvOSD_TextParams structure for the clock to be overlayed; NULL to disable the clock.