RTS API Documentation
1.10.11
|
video includes header More...
#include <switch.h>
Go to the source code of this file.
Data Structures | |
struct | switch_yuv_color_s |
struct | switch_rgb_color_s |
struct | switch_hsl_color_s |
struct | switch_lab_color_t |
struct | switch_xyz_color_t |
struct | switch_image_rect |
Representation of a rectangle on a surface. More... | |
struct | switch_png_s |
Macros | |
#define | CHROMAKEY_MAX_MASK 25 |
Typedefs | |
typedef struct switch_yuv_color_s | switch_yuv_color_t |
typedef struct switch_rgb_color_s | switch_rgb_color_t |
typedef struct switch_hsl_color_s | switch_hsl_color_t |
typedef struct switch_image_rect | switch_image_rect_t |
Representation of a rectangle on a surface. More... | |
typedef struct switch_png_opaque_s | switch_png_opaque_t |
typedef struct switch_png_s | switch_png_t |
Enumerations | |
enum | switch_core_video_filter_t { SCV_FILTER_GRAY_FG = (1 << 0), SCV_FILTER_GRAY_BG = (1 << 1), SCV_FILTER_SEPIA_FG = (1 << 2), SCV_FILTER_SEPIA_BG = (1 << 3), SCV_FILTER_8BIT_FG = (1 << 4) } |
enum | switch_shade_t { SWITCH_SHADE_NONE = 0, SWITCH_SHADE_RED, SWITCH_SHADE_GREEN, SWITCH_SHADE_BLUE, SWITCH_SHADE_AUTO } |
enum | switch_img_position_t { POS_LEFT_TOP = 0, POS_LEFT_MID, POS_LEFT_BOT, POS_CENTER_TOP, POS_CENTER_MID, POS_CENTER_BOT, POS_RIGHT_TOP, POS_RIGHT_MID, POS_RIGHT_BOT, POS_NONE } |
enum | switch_img_fit_t { SWITCH_FIT_SIZE, SWITCH_FIT_SCALE, SWITCH_FIT_SIZE_AND_SCALE, SWITCH_FIT_NECESSARY, SWITCH_FIT_NONE } |
enum | switch_convert_fmt_t { SWITCH_CONVERT_FMT_YUYV = 0 } |
enum | switch_image_rotation_mode_t { SRM_NONE = 0, SRM_90 = 90, SRM_180 = 180, SRM_270 = 270 } |
Functions | |
switch_image_t * | switch_img_alloc (switch_image_t *img, switch_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align) |
Open a descriptor, allocating storage for the underlying image. More... | |
switch_image_t * | switch_img_wrap (switch_image_t *img, switch_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align, unsigned char *img_data) |
Open a descriptor, using existing storage for the underlying image. More... | |
int | switch_img_set_rect (switch_image_t *img, unsigned int x, unsigned int y, unsigned int w, unsigned int h) |
Set the rectangle identifying the displayed portion of the image. More... | |
void | switch_img_patch (switch_image_t *IMG, switch_image_t *img, int x, int y) |
patch a small img to a big IMG at position x,y More... | |
void | switch_img_attenuate (switch_image_t *img) |
void | switch_img_patch_rgb (switch_image_t *IMG, switch_image_t *img, int x, int y, switch_bool_t noalpha) |
patch a small img to a big IMG at position x,y More... | |
void | switch_img_patch_rect (switch_image_t *IMG, int X, int Y, switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h) |
patch part of a small img (x,y,w,h) to a big IMG at position X,Y More... | |
void | switch_img_copy (switch_image_t *img, switch_image_t **new_img) |
Copy image to a new image. More... | |
void | switch_img_rotate_copy (switch_image_t *img, switch_image_t **new_img, switch_image_rotation_mode_t mode) |
void | switch_img_rotate (switch_image_t **img, switch_image_rotation_mode_t mode) |
Flip the image vertically (top for bottom) More... | |
void | switch_img_free (switch_image_t **img) |
Close an image descriptor. More... | |
void | switch_img_draw_text (switch_image_t *IMG, int x, int y, switch_rgb_color_t color, uint16_t font_size, char *text) |
void | switch_img_add_text (void *buffer, int w, int x, int y, char *s) |
switch_image_t * | switch_img_copy_rect (switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h) |
Copy part of an image to a new image. More... | |
void | switch_img_fill (switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color) |
Fill image with color. More... | |
void | switch_img_8bit (switch_image_t *img) |
void | switch_img_gray (switch_image_t *img, int x, int y, int w, int h) |
void | switch_img_sepia (switch_image_t *img, int x, int y, int w, int h) |
void | switch_img_fill_noalpha (switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color) |
void | switch_color_set_rgb (switch_rgb_color_t *color, const char *color_str) |
Set RGB color with a string. More... | |
void | switch_color_set_yuv (switch_yuv_color_t *color, const char *color_str) |
Set YUV color with a string. More... | |
switch_status_t | switch_img_txt_handle_create (switch_img_txt_handle_t **handleP, const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle, switch_memory_pool_t *pool) |
Created a text handle. More... | |
void | switch_img_txt_handle_destroy (switch_img_txt_handle_t **handleP) |
Free a text handle. More... | |
uint32_t | switch_img_txt_handle_render (switch_img_txt_handle_t *handle, switch_image_t *img, int x, int y, const char *text, const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle) |
Render text to an img. More... | |
void | switch_img_patch_hole (switch_image_t *IMG, switch_image_t *img, int x, int y, switch_image_rect_t *rect) |
switch_status_t | switch_png_patch_img (switch_png_t *use_png, switch_image_t *img, int x, int y) |
switch_image_t * | switch_img_read_png (const char *file_name, switch_img_fmt_t img_fmt) |
switch_image_t * | switch_img_read_png_from_memory (void *mem, size_t size, switch_img_fmt_t img_fmt) |
switch_status_t | switch_img_write_png (switch_image_t *img, char *file_name) |
switch_status_t | switch_png_open (switch_png_t **pngP, const char *file_name) |
void | switch_png_free (switch_png_t **pngP) |
switch_status_t | switch_img_data_url_png (switch_image_t *img, char **urlP) |
switch_status_t | switch_img_data_url (switch_image_t *img, char **urlP, const char *type, int quality) |
switch_image_t * | switch_img_read_from_file (const char *file_name, switch_img_fmt_t img_fmt) |
Read an image file to switch_image_t. More... | |
switch_status_t | switch_img_write_to_file (switch_image_t *img, const char *file_name, int quality) |
Write an image file, supported formats png,jpg,bmp,tga,hdr. More... | |
void | switch_img_overlay (switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t percent) |
put a small img over a big IMG at position x,y, with alpha transparency More... | |
switch_status_t | switch_img_mirror (switch_image_t *src, switch_image_t **destP) |
switch_status_t | switch_img_scale (switch_image_t *src, switch_image_t **destP, int width, int height) |
switch_status_t | switch_img_fit (switch_image_t **srcP, int width, int height, switch_img_fit_t fit) |
void | switch_img_calc_fit (switch_image_t *src, int width, int height, int *new_wP, int *new_hP) |
switch_img_position_t | parse_img_position (const char *name) |
switch_img_fit_t | parse_img_fit (const char *name) |
void | switch_img_find_position (switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP) |
switch_status_t | switch_img_to_raw (switch_image_t *src, void *dest, int stride, switch_img_fmt_t fmt) |
convert img to raw format More... | |
switch_status_t | switch_img_from_raw (switch_image_t **destP, void *src, switch_img_fmt_t fmt, int width, int height) |
convert raw memory to switch_img_t More... | |
switch_image_t * | switch_img_write_text_img (int w, int h, switch_bool_t full, const char *text) |
switch_image_t * | switch_img_read_file (const char *file_name) |
switch_status_t | switch_img_letterbox (switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color) |
switch_bool_t | switch_core_has_video (void) |
switch_status_t | switch_I420_copy (const uint8_t *src_y, int src_stride_y, const uint8_t *src_u, int src_stride_u, const uint8_t *src_v, int src_stride_v, uint8_t *dst_y, int dst_stride_y, uint8_t *dst_u, int dst_stride_u, uint8_t *dst_v, int dst_stride_v, int width, int height) |
I420 to I420 Copy. More... | |
switch_status_t | switch_I420_copy2 (uint8_t *src_planes[], int src_stride[], uint8_t *dst_planes[], int dst_stride[], int width, int height) |
switch_status_t | switch_I420ToARGB (const uint8_t *src_y, int src_stride_y, const uint8_t *src_u, int src_stride_u, const uint8_t *src_v, int src_stride_v, uint8_t *dst_argb, int dst_stride_argb, int width, int height) |
I420 to ARGB Convertion. More... | |
switch_status_t | switch_RGBAToARGB (const uint8_t *src_frame, int src_stride_frame, uint8_t *dst_argb, int dst_stride_argb, int width, int height) |
switch_status_t | switch_ABGRToARGB (const uint8_t *src_frame, int src_stride_frame, uint8_t *dst_argb, int dst_stride_argb, int width, int height) |
switch_status_t | switch_ARGBToARGB (const uint8_t *src_frame, int src_stride_frame, uint8_t *dst_argb, int dst_stride_argb, int width, int height) |
void | switch_img_chromakey (switch_image_t *img, switch_rgb_color_t *mask, int threshold) |
chromakey an img, img must be RGBA and return modified img More... | |
switch_status_t | switch_chromakey_clear_colors (switch_chromakey_t *ck) |
switch_status_t | switch_chromakey_autocolor (switch_chromakey_t *ck, switch_shade_t autocolor, uint32_t threshold) |
switch_status_t | switch_chromakey_add_color (switch_chromakey_t *ck, switch_rgb_color_t *color, uint32_t threshold) |
switch_status_t | switch_chromakey_destroy (switch_chromakey_t **ckP) |
switch_status_t | switch_chromakey_create (switch_chromakey_t **ckP) |
void | switch_chromakey_set_default_threshold (switch_chromakey_t *ck, uint32_t threshold) |
void | switch_chromakey_process (switch_chromakey_t *ck, switch_image_t *img) |
switch_image_t * | switch_chromakey_cache_image (switch_chromakey_t *ck) |
switch_shade_t | switch_chromakey_str2shade (switch_chromakey_t *ck, const char *shade_name) |
void | switch_core_video_parse_filter_string (switch_core_video_filter_t *filters, const char *filter_str) |
video includes header
The things powered by libvpx are renamed into the switch_ namespace to provide a cleaner look to things and helps me to document what parts of video I am using I'd like to take this opportunity to thank libvpx for all the awesome stuff it does and for making my life much easier.
Definition in file switch_core_video.h.
#define CHROMAKEY_MAX_MASK 25 |
Definition at line 47 of file switch_core_video.h.
Referenced by switch_chromakey_add_color(), and switch_chromakey_clear_colors().
typedef struct switch_hsl_color_s switch_hsl_color_t |
typedef struct switch_image_rect switch_image_rect_t |
Representation of a rectangle on a surface.
typedef struct switch_png_opaque_s switch_png_opaque_t |
Definition at line 140 of file switch_core_video.h.
typedef struct switch_png_s switch_png_t |
typedef struct switch_rgb_color_s switch_rgb_color_t |
typedef struct switch_yuv_color_s switch_yuv_color_t |
enum switch_convert_fmt_t |
Enumerator | |
---|---|
SWITCH_CONVERT_FMT_YUYV |
Definition at line 135 of file switch_core_video.h.
Enumerator | |
---|---|
SCV_FILTER_GRAY_FG | |
SCV_FILTER_GRAY_BG | |
SCV_FILTER_SEPIA_FG | |
SCV_FILTER_SEPIA_BG | |
SCV_FILTER_8BIT_FG |
Definition at line 49 of file switch_core_video.h.
Enumerator | |
---|---|
SRM_NONE | |
SRM_90 | |
SRM_180 | |
SRM_270 |
Definition at line 147 of file switch_core_video.h.
enum switch_img_fit_t |
Enumerator | |
---|---|
SWITCH_FIT_SIZE | |
SWITCH_FIT_SCALE | |
SWITCH_FIT_SIZE_AND_SCALE | |
SWITCH_FIT_NECESSARY | |
SWITCH_FIT_NONE |
Definition at line 79 of file switch_core_video.h.
Enumerator | |
---|---|
POS_LEFT_TOP | |
POS_LEFT_MID | |
POS_LEFT_BOT | |
POS_CENTER_TOP | |
POS_CENTER_MID | |
POS_CENTER_BOT | |
POS_RIGHT_TOP | |
POS_RIGHT_MID | |
POS_RIGHT_BOT | |
POS_NONE |
Definition at line 66 of file switch_core_video.h.
enum switch_shade_t |
Enumerator | |
---|---|
SWITCH_SHADE_NONE | |
SWITCH_SHADE_RED | |
SWITCH_SHADE_GREEN | |
SWITCH_SHADE_BLUE | |
SWITCH_SHADE_AUTO |
Definition at line 58 of file switch_core_video.h.
switch_img_fit_t parse_img_fit | ( | const char * | name | ) |
Definition at line 162 of file switch_core_video.c.
References fit_el::fit, fit_el::name, switch_assert, and SWITCH_FIT_SIZE.
switch_img_position_t parse_img_position | ( | const char * | name | ) |
Definition at line 129 of file switch_core_video.c.
References pos_el::name, pos_el::pos, POS_NONE, and switch_assert.
switch_status_t switch_ABGRToARGB | ( | const uint8_t * | src_frame, |
int | src_stride_frame, | ||
uint8_t * | dst_argb, | ||
int | dst_stride_argb, | ||
int | width, | ||
int | height | ||
) |
Definition at line 3847 of file switch_core_video.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_ARGBToARGB | ( | const uint8_t * | src_frame, |
int | src_stride_frame, | ||
uint8_t * | dst_argb, | ||
int | dst_stride_argb, | ||
int | width, | ||
int | height | ||
) |
Definition at line 3860 of file switch_core_video.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_chromakey_add_color | ( | switch_chromakey_t * | ck, |
switch_rgb_color_t * | color, | ||
uint32_t | threshold | ||
) |
Definition at line 1054 of file switch_core_video.c.
References switch_chromakey_s::auto_color, switch_rgb_color_s::b, CHROMAKEY_MAX_MASK, switch_rgb_color_s::g, switch_chromakey_s::mask, switch_chromakey_s::mask_len, switch_rgb_color_s::r, switch_assert, SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_chromakey_s::thresholds.
Referenced by switch_chromakey_process().
switch_status_t switch_chromakey_autocolor | ( | switch_chromakey_t * | ck, |
switch_shade_t | autocolor, | ||
uint32_t | threshold | ||
) |
Definition at line 1039 of file switch_core_video.c.
References switch_chromakey_s::auto_color, switch_chromakey_s::autocolor, switch_chromakey_s::cache_img, switch_chromakey_s::dft_thresh, switch_chromakey_s::dft_thresh_squared, memset(), switch_chromakey_s::no_cache, switch_assert, switch_chromakey_clear_colors(), switch_img_free(), and SWITCH_STATUS_SUCCESS.
switch_image_t* switch_chromakey_cache_image | ( | switch_chromakey_t * | ck | ) |
Definition at line 1103 of file switch_core_video.c.
References switch_chromakey_s::cache_img, and switch_assert.
switch_status_t switch_chromakey_clear_colors | ( | switch_chromakey_t * | ck | ) |
Definition at line 1026 of file switch_core_video.c.
References switch_chromakey_s::autocolor, CHROMAKEY_MAX_MASK, switch_chromakey_s::mask, switch_chromakey_s::mask_len, memset(), switch_chromakey_s::no_cache, switch_assert, SWITCH_SHADE_NONE, SWITCH_STATUS_SUCCESS, and switch_chromakey_s::thresholds.
Referenced by switch_chromakey_autocolor().
switch_status_t switch_chromakey_create | ( | switch_chromakey_t ** | ckP | ) |
Definition at line 1089 of file switch_core_video.c.
References switch_assert, SWITCH_STATUS_SUCCESS, and switch_zmalloc.
switch_status_t switch_chromakey_destroy | ( | switch_chromakey_t ** | ckP | ) |
Definition at line 1072 of file switch_core_video.c.
References switch_chromakey_s::cache_img, switch_assert, switch_img_free(), and SWITCH_STATUS_SUCCESS.
void switch_chromakey_process | ( | switch_chromakey_t * | ck, |
switch_image_t * | img | ||
) |
Definition at line 1194 of file switch_core_video.c.
References switch_rgb_color_s::a, switch_chromakey_s::auto_color, switch_chromakey_s::autocolor, switch_rgb_color_s::b, b, switch_chromakey_s::bb, switch_chromakey_s::cache_img, switch_chromakey_s::color_count, vpx_image::d_h, vpx_image::d_w, switch_chromakey_s::dft_thresh, vpx_image::fmt, switch_chromakey_s::frames_read, switch_rgb_color_s::g, get_dom(), switch_chromakey_s::gg, switch_chromakey_s::mask, switch_chromakey_s::mask_len, switch_chromakey_s::no_cache, vpx_image::planes, switch_rgb_color_s::r, switch_chromakey_s::rr, switch_assert, switch_chromakey_add_color(), switch_color_distance_cheap(), switch_color_distance_literal(), switch_color_distance_multi(), switch_color_dom_cmp(), switch_img_copy(), SWITCH_IMG_FMT_ARGB, switch_img_free(), SWITCH_PLANE_PACKED, SWITCH_SHADE_AUTO, and switch_chromakey_s::thresholds.
void switch_chromakey_set_default_threshold | ( | switch_chromakey_t * | ck, |
uint32_t | threshold | ||
) |
Definition at line 1014 of file switch_core_video.c.
References switch_chromakey_s::dft_thresh, switch_chromakey_s::dft_thresh_squared, switch_chromakey_s::mask_len, and switch_chromakey_s::thresholds.
switch_shade_t switch_chromakey_str2shade | ( | switch_chromakey_t * | ck, |
const char * | shade_name | ||
) |
Definition at line 997 of file switch_core_video.c.
References SWITCH_SHADE_AUTO, SWITCH_SHADE_BLUE, SWITCH_SHADE_GREEN, SWITCH_SHADE_NONE, and SWITCH_SHADE_RED.
void switch_color_set_rgb | ( | switch_rgb_color_t * | color, |
const char * | color_str | ||
) |
Set RGB color with a string.
Color string should be in #RRGGBB format
[out] | color | RGB color pointer |
[in] | color_str | Color string in #RRGGBB format |
Definition at line 1747 of file switch_core_video.c.
References switch_rgb_color_s::a, switch_rgb_color_s::b, b, switch_rgb_color_s::g, switch_rgb_color_s::r, switch_yuv_color_s::u, switch_yuv_color_s::v, switch_yuv_color_s::y, and zstr.
Referenced by switch_color_set_yuv(), switch_core_media_bug_patch_spy_frame(), switch_core_session_write_blank_video(), switch_img_letterbox(), switch_img_txt_handle_create(), switch_img_txt_handle_render(), switch_img_write_text_img(), video_bug_thread(), video_helper_thread(), and video_write_thread().
void switch_color_set_yuv | ( | switch_yuv_color_t * | color, |
const char * | color_str | ||
) |
Set YUV color with a string.
Color string should be in #RRGGBB format
[out] | color | YUV color pointer |
[in] | color_str | Color string in #RRGGBB format |
Definition at line 1812 of file switch_core_video.c.
References switch_color_set_rgb().
switch_bool_t switch_core_has_video | ( | void | ) |
Definition at line 179 of file switch_core_video.c.
References SWITCH_FALSE, and SWITCH_TRUE.
void switch_core_video_parse_filter_string | ( | switch_core_video_filter_t * | filters, |
const char * | filter_str | ||
) |
Definition at line 3874 of file switch_core_video.c.
References SCV_FILTER_8BIT_FG, SCV_FILTER_GRAY_BG, SCV_FILTER_GRAY_FG, SCV_FILTER_SEPIA_BG, SCV_FILTER_SEPIA_FG, and switch_stristr().
switch_status_t switch_I420_copy | ( | const uint8_t * | src_y, |
int | src_stride_y, | ||
const uint8_t * | src_u, | ||
int | src_stride_u, | ||
const uint8_t * | src_v, | ||
int | src_stride_v, | ||
uint8_t * | dst_y, | ||
int | dst_stride_y, | ||
uint8_t * | dst_u, | ||
int | dst_stride_u, | ||
uint8_t * | dst_v, | ||
int | dst_stride_v, | ||
int | width, | ||
int | height | ||
) |
I420 to I420 Copy.
Definition at line 3779 of file switch_core_video.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_I420_copy2 | ( | uint8_t * | src_planes[], |
int | src_stride[], | ||
uint8_t * | dst_planes[], | ||
int | dst_stride[], | ||
int | width, | ||
int | height | ||
) |
Definition at line 3797 of file switch_core_video.c.
References SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_I420ToARGB | ( | const uint8_t * | src_y, |
int | src_stride_y, | ||
const uint8_t * | src_u, | ||
int | src_stride_u, | ||
const uint8_t * | src_v, | ||
int | src_stride_v, | ||
uint8_t * | dst_argb, | ||
int | dst_stride_argb, | ||
int | width, | ||
int | height | ||
) |
I420 to ARGB Convertion.
Definition at line 3815 of file switch_core_video.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
void switch_img_8bit | ( | switch_image_t * | img | ) |
Definition at line 1464 of file switch_core_video.c.
References switch_rgb_color_s::a, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
void switch_img_add_text | ( | void * | buffer, |
int | w, | ||
int | x, | ||
int | y, | ||
char * | s | ||
) |
Definition at line 1725 of file switch_core_video.c.
References index, and scv_tag().
switch_image_t* switch_img_alloc | ( | switch_image_t * | img, |
switch_img_fmt_t | fmt, | ||
unsigned int | d_w, | ||
unsigned int | d_h, | ||
unsigned int | align | ||
) |
Open a descriptor, allocating storage for the underlying image.
Returns a descriptor for storing an image of the given format. The storage for the descriptor is allocated on the heap.
[in] | img | Pointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap. |
[in] | fmt | Format for the image |
[in] | d_w | Width of the image |
[in] | d_h | Height of the image |
[in] | align | Alignment, in bytes, of the image buffer and each row in the image(stride). |
Definition at line 192 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, switch_assert, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_GD, switch_img_free(), vpx_image::user_priv, and vpx_img_alloc().
Referenced by switch_core_session_write_blank_video(), switch_img_8bit(), switch_img_copy(), switch_img_find_position(), switch_img_from_raw(), switch_img_letterbox(), switch_img_mirror(), switch_img_read_from_file(), switch_img_rotate(), switch_img_rotate_copy(), switch_img_scale(), switch_img_write_text_img(), video_bug_thread(), and video_helper_thread().
void switch_img_attenuate | ( | switch_image_t * | img | ) |
Definition at line 371 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, SWITCH_IMG_FMT_ARGB, SWITCH_PLANE_PACKED, and vpx_image::user_priv.
void switch_img_calc_fit | ( | switch_image_t * | src, |
int | width, | ||
int | height, | ||
int * | new_wP, | ||
int * | new_hP | ||
) |
Definition at line 3363 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, and switch_assert.
Referenced by switch_img_fit().
void switch_img_chromakey | ( | switch_image_t * | img, |
switch_rgb_color_t * | mask, | ||
int | threshold | ||
) |
chromakey an img, img must be RGBA and return modified img
Definition at line 1385 of file switch_core_video.c.
References switch_rgb_color_s::a, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, switch_assert, switch_color_distance(), SWITCH_IMG_FMT_ARGB, and SWITCH_PLANE_PACKED.
void switch_img_copy | ( | switch_image_t * | img, |
switch_image_t ** | new_img | ||
) |
Copy image to a new image.
if new_img is NULL, a new image is allocated if new_img is not NULL but not the same size as img, new_img is destroyed and a new new_img is allocated else, copy the img data to the new_img
[in] | img | Image descriptor |
[out] | new_img | New Image descriptor, NULL if out of memory |
Definition at line 584 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, switch_assert, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_ARGB_LE, SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
Referenced by find_free_frame(), switch_chromakey_process(), switch_core_media_bug_patch_spy_frame(), switch_core_media_bug_push_spy_frame(), switch_core_session_read_video_frame(), switch_core_session_write_video_frame(), switch_frame_dup(), switch_img_copy_rect(), switch_img_letterbox(), switch_img_patch_rect(), and video_write_overlay_callback().
switch_image_t* switch_img_copy_rect | ( | switch_image_t * | img, |
uint32_t | x, | ||
uint32_t | y, | ||
uint32_t | w, | ||
uint32_t | h | ||
) |
Copy part of an image to a new image.
[in] | img | Image descriptor |
[in] | x | Leftmost pos to be read from |
[in] | y | Topmost pos to be read from |
[in] | w | Max width to be read from |
[in] | h | Max height to be read from |
Definition at line 687 of file switch_core_video.c.
References switch_lab_color_t::a, switch_rgb_color_s::b, switch_lab_color_t::b, b, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, switch_rgb_color_s::g, switch_hsl_color_s::h, if(), switch_hsl_color_s::l, switch_lab_color_t::l, M_PI, MIN, vpx_image::planes, switch_rgb_color_s::r, switch_hsl_color_s::s, switch_assert, switch_img_copy(), SWITCH_IMG_FMT_PLANAR, switch_img_free(), switch_img_set_rect(), SWITCH_PLANE_PACKED, SWITCH_PLANE_Y, vpx_img_wrap(), switch_xyz_color_t::x, switch_xyz_color_t::y, and switch_xyz_color_t::z.
Referenced by switch_core_media_bug_patch_spy_frame().
switch_status_t switch_img_data_url | ( | switch_image_t * | img, |
char ** | urlP, | ||
const char * | type, | ||
int | quality | ||
) |
Definition at line 3241 of file switch_core_video.c.
References buffer, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, switch_assert, switch_b64_encode(), switch_buffer_create_dynamic(), switch_buffer_destroy(), switch_buffer_get_head_pointer(), switch_buffer_inuse(), SWITCH_CHANNEL_LOG, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_zmalloc.
switch_status_t switch_img_data_url_png | ( | switch_image_t * | img, |
char ** | urlP | ||
) |
Definition at line 3109 of file switch_core_video.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), and SWITCH_STATUS_FALSE.
void switch_img_draw_text | ( | switch_image_t * | IMG, |
int | x, | ||
int | y, | ||
switch_rgb_color_t | color, | ||
uint16_t | font_size, | ||
char * | text | ||
) |
void switch_img_fill | ( | switch_image_t * | img, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
switch_rgb_color_t * | color | ||
) |
Fill image with color.
[in] | img | Image descriptor |
[in] | x | Leftmost pos to be read from |
[in] | y | Topmost pos to be read from |
[in] | w | Max width to be read from |
[in] | h | Max height to be read from |
[in] | color | RGB color |
Definition at line 1576 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, memset(), MIN, vpx_image::planes, vpx_image::stride, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, switch_yuv_color_s::u, switch_yuv_color_s::v, and switch_yuv_color_s::y.
Referenced by switch_core_media_bug_patch_spy_frame(), switch_core_session_write_blank_video(), switch_img_letterbox(), switch_img_write_text_img(), video_bug_thread(), video_helper_thread(), and video_write_thread().
void switch_img_fill_noalpha | ( | switch_image_t * | img, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
switch_rgb_color_t * | color | ||
) |
Definition at line 1437 of file switch_core_video.c.
References switch_rgb_color_s::a, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, SWITCH_IMG_FMT_ARGB, and SWITCH_PLANE_PACKED.
void switch_img_find_position | ( | switch_img_position_t | pos, |
int | sw, | ||
int | sh, | ||
int | iw, | ||
int | ih, | ||
int * | xP, | ||
int * | yP | ||
) |
Definition at line 3687 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, POS_CENTER_BOT, POS_CENTER_MID, POS_CENTER_TOP, POS_LEFT_BOT, POS_LEFT_MID, POS_LEFT_TOP, POS_NONE, POS_RIGHT_BOT, POS_RIGHT_MID, POS_RIGHT_TOP, SWITCH_CHANNEL_LOG, SWITCH_DECLARE, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_GD, switch_img_free(), switch_img_read_file(), SWITCH_LOG_ERROR, switch_log_printf(), and vpx_image::user_priv.
Referenced by switch_core_media_bug_patch_spy_frame(), video_bug_thread(), and video_write_overlay_callback().
switch_status_t switch_img_fit | ( | switch_image_t ** | srcP, |
int | width, | ||
int | height, | ||
switch_img_fit_t | fit | ||
) |
Definition at line 3401 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, fmt, switch_assert, SWITCH_FIT_NECESSARY, SWITCH_FIT_SCALE, SWITCH_FIT_SIZE_AND_SCALE, switch_img_calc_fit(), SWITCH_IMG_FMT_444A, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_ARGB_LE, SWITCH_IMG_FMT_BGR24, SWITCH_IMG_FMT_I420, SWITCH_IMG_FMT_I42016, SWITCH_IMG_FMT_I422, SWITCH_IMG_FMT_I42216, SWITCH_IMG_FMT_I440, SWITCH_IMG_FMT_I44016, SWITCH_IMG_FMT_I444, SWITCH_IMG_FMT_I44416, SWITCH_IMG_FMT_NONE, SWITCH_IMG_FMT_RGB24, SWITCH_IMG_FMT_RGB32, SWITCH_IMG_FMT_RGB32_LE, SWITCH_IMG_FMT_RGB555, SWITCH_IMG_FMT_RGB555_LE, SWITCH_IMG_FMT_RGB565, SWITCH_IMG_FMT_RGB565_LE, SWITCH_IMG_FMT_UYVY, SWITCH_IMG_FMT_VPXI420, SWITCH_IMG_FMT_VPXYV12, SWITCH_IMG_FMT_YUY2, SWITCH_IMG_FMT_YV12, SWITCH_IMG_FMT_YVYU, switch_img_free(), switch_img_scale(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_media_bug_patch_spy_frame(), video_bug_thread(), video_write_overlay_callback(), and video_write_thread().
void switch_img_free | ( | switch_image_t ** | img | ) |
Close an image descriptor.
Frees all allocated storage associated with an image descriptor.
[in] | img | pointer to pointer of Image descriptor |
Definition at line 295 of file switch_core_video.c.
References switch_assert, SWITCH_IMG_FMT_GD, SWITCH_IMG_FMT_I44016, switch_safe_free, and vpx_img_free().
Referenced by flush_video_queue(), switch_chromakey_autocolor(), switch_chromakey_destroy(), switch_chromakey_process(), switch_core_media_bug_destroy(), switch_core_media_bug_patch_spy_frame(), switch_core_session_write_blank_video(), switch_core_session_write_video_frame(), switch_frame_buffer_free(), switch_frame_free(), switch_img_8bit(), switch_img_alloc(), switch_img_copy(), switch_img_copy_rect(), switch_img_find_position(), switch_img_fit(), switch_img_letterbox(), switch_img_mirror(), switch_img_patch_rect(), switch_img_rotate(), switch_img_rotate_copy(), switch_img_scale(), switch_ivr_video_write_overlay_session(), video_bug_thread(), video_helper_thread(), video_write_overlay_callback(), and video_write_thread().
switch_status_t switch_img_from_raw | ( | switch_image_t ** | destP, |
void * | src, | ||
switch_img_fmt_t | fmt, | ||
int | width, | ||
int | height | ||
) |
convert raw memory to switch_img_t
if dest is NULL then a new img is created, user should destroy it later, otherwize it will re-used the dest img, and the dest img size must match the src width and height, width and height can be 0 in the latter case and it will figure out according to the dest img
[in] | dest | The image descriptor |
[in] | src | The raw data memory address |
[in] | fmt | The raw data format |
[in] | width | The raw data width |
[in] | height | The raw data height |
Definition at line 3524 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, SWITCH_CHANNEL_LOG, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
void switch_img_gray | ( | switch_image_t * | img, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h | ||
) |
Definition at line 1546 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, memset(), MIN, vpx_image::planes, vpx_image::stride, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_PLANE_PACKED, SWITCH_PLANE_U, and SWITCH_PLANE_V.
switch_status_t switch_img_letterbox | ( | switch_image_t * | img, |
switch_image_t ** | imgP, | ||
int | width, | ||
int | height, | ||
const char * | color | ||
) |
Definition at line 3318 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, switch_assert, switch_color_set_rgb(), switch_img_alloc(), switch_img_copy(), switch_img_fill(), SWITCH_IMG_FMT_I420, switch_img_free(), switch_img_patch(), switch_img_scale(), and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_session_write_video_frame().
switch_status_t switch_img_mirror | ( | switch_image_t * | src, |
switch_image_t ** | destP | ||
) |
Definition at line 3643 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, SWITCH_CHANNEL_LOG, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PLANE_PACKED, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
void switch_img_overlay | ( | switch_image_t * | IMG, |
switch_image_t * | img, | ||
int | x, | ||
int | y, | ||
uint8_t | percent | ||
) |
put a small img over a big IMG at position x,y, with alpha transparency
Both IMG and img must be non-NULL
[in] | IMG | The BIG Image descriptor |
[in] | img | The small Image descriptor |
[in] | x | Leftmost pos |
[in] | y | Topmost pos |
[in] | percent | Alaha value from 0(completely transparent) to 100(opaque) |
Definition at line 1647 of file switch_core_video.c.
References switch_rgb_color_s::a, switch_rgb_color_s::b, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, switch_rgb_color_s::g, MIN, switch_rgb_color_s::r, switch_assert, switch_img_draw_pixel(), SWITCH_IMG_FMT_I420, and switch_img_get_rgb_pixel().
Referenced by video_write_overlay_callback().
void switch_img_patch | ( | switch_image_t * | IMG, |
switch_image_t * | img, | ||
int | x, | ||
int | y | ||
) |
patch a small img to a big IMG at position x,y
Both IMG and img must be non-NULL
[in] | IMG | The BIG Image descriptor |
[in] | img | The small Image descriptor |
[in] | x | Leftmost pos to patch to |
[in] | y | Topmost pos to patch to |
Definition at line 441 of file switch_core_video.c.
References switch_rgb_color_s::a, switch_rgb_color_s::b, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, switch_rgb_color_s::g, MIN, vpx_image::planes, switch_rgb_color_s::r, vpx_image::stride, switch_assert, SWITCH_CHANNEL_LOG, SWITCH_FALSE, switch_img_draw_pixel(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_GD, SWITCH_IMG_FMT_I420, switch_img_get_rgb_pixel(), switch_img_patch_rgb(), SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, and vpx_image::user_priv.
Referenced by switch_core_media_bug_patch_spy_frame(), switch_img_letterbox(), switch_img_patch_rect(), and video_bug_thread().
void switch_img_patch_hole | ( | switch_image_t * | IMG, |
switch_image_t * | img, | ||
int | x, | ||
int | y, | ||
switch_image_rect_t * | rect | ||
) |
Definition at line 2274 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, switch_image_rect::h, MIN, vpx_image::planes, vpx_image::stride, switch_assert, SWITCH_IMG_FMT_I420, SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, switch_image_rect::w, switch_image_rect::x, and switch_image_rect::y.
void switch_img_patch_rect | ( | switch_image_t * | IMG, |
int | X, | ||
int | Y, | ||
switch_image_t * | img, | ||
uint32_t | x, | ||
uint32_t | y, | ||
uint32_t | w, | ||
uint32_t | h | ||
) |
patch part of a small img (x,y,w,h) to a big IMG at position X,Y
Both IMG and img must be non-NULL
[in] | IMG | The BIG Image descriptor |
[in] | X | Leftmost pos to patch to IMG |
[in] | Y | Topmost pos to patch to IMG |
[in] | img | The small Image descriptor |
[in] | x | Leftmost pos to be read from img |
[in] | y | Topmost pos to be read from |
[in] | w | Max width to be read from img |
[in] | h | Max height to be read from img |
Definition at line 546 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, MIN, vpx_image::planes, vpx_image::stride, switch_img_copy(), SWITCH_IMG_FMT_PLANAR, switch_img_free(), switch_img_patch(), switch_img_set_rect(), SWITCH_PLANE_PACKED, SWITCH_PLANE_Y, and vpx_img_wrap().
void switch_img_patch_rgb | ( | switch_image_t * | IMG, |
switch_image_t * | img, | ||
int | x, | ||
int | y, | ||
switch_bool_t | noalpha | ||
) |
patch a small img to a big IMG at position x,y
Both IMG and img must be non-NULL
[in] | IMG | The BIG Image descriptor |
[in] | img | The small Image descriptor |
[in] | x | Leftmost pos to patch to |
[in] | y | Topmost pos to patch to |
[in] | noalpha | skip writing to non-transparent pixels |
Definition at line 390 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, MIN, vpx_image::planes, vpx_image::stride, SWITCH_IMG_FMT_ARGB, and SWITCH_PLANE_PACKED.
Referenced by switch_img_patch().
switch_image_t* switch_img_read_file | ( | const char * | file_name | ) |
Definition at line 3773 of file switch_core_video.c.
Referenced by switch_img_find_position().
switch_image_t* switch_img_read_from_file | ( | const char * | file_name, |
switch_img_fmt_t | img_fmt | ||
) |
Read an image file to switch_image_t.
Definition at line 3117 of file switch_core_video.c.
References vpx_image::planes, vpx_image::stride, switch_assert, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
switch_image_t* switch_img_read_png | ( | const char * | file_name, |
switch_img_fmt_t | img_fmt | ||
) |
Definition at line 3097 of file switch_core_video.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, and switch_log_printf().
Referenced by switch_ivr_video_write_overlay_session(), and video_helper_thread().
switch_image_t* switch_img_read_png_from_memory | ( | void * | mem, |
size_t | size, | ||
switch_img_fmt_t | img_fmt | ||
) |
void switch_img_rotate | ( | switch_image_t ** | img, |
switch_image_rotation_mode_t | mode | ||
) |
Flip the image vertically (top for bottom)
Adjusts the image descriptor's pointers and strides to make the image be referenced upside-down.
[in] | img | Image descriptor |
Definition at line 262 of file switch_core_video.c.
References vpx_image::planes, SRM_270, SRM_90, vpx_image::stride, switch_assert, switch_img_alloc(), SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
void switch_img_rotate_copy | ( | switch_image_t * | img, |
switch_image_t ** | new_img, | ||
switch_image_rotation_mode_t | mode | ||
) |
Definition at line 650 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, SRM_270, SRM_90, vpx_image::stride, switch_assert, switch_img_alloc(), SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
switch_status_t switch_img_scale | ( | switch_image_t * | src, |
switch_image_t ** | destP, | ||
int | width, | ||
int | height | ||
) |
Definition at line 3592 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, switch_assert, SWITCH_CHANNEL_LOG, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PLANE_PACKED, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_media_bug_patch_spy_frame(), switch_img_fit(), and switch_img_letterbox().
void switch_img_sepia | ( | switch_image_t * | img, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h | ||
) |
Definition at line 1517 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, memset(), MIN, vpx_image::planes, vpx_image::stride, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_PLANE_PACKED, SWITCH_PLANE_U, and SWITCH_PLANE_V.
int switch_img_set_rect | ( | switch_image_t * | img, |
unsigned int | x, | ||
unsigned int | y, | ||
unsigned int | w, | ||
unsigned int | h | ||
) |
Set the rectangle identifying the displayed portion of the image.
Updates the displayed rectangle (aka viewport) on the image surface to match the specified coordinates and size.
[in] | img | Image descriptor |
[in] | x | leftmost column |
[in] | y | topmost row |
[in] | w | width |
[in] | h | height |
Definition at line 249 of file switch_core_video.c.
References vpx_img_set_rect().
Referenced by switch_img_copy_rect(), and switch_img_patch_rect().
switch_status_t switch_img_to_raw | ( | switch_image_t * | src, |
void * | dest, | ||
int | stride, | ||
switch_img_fmt_t | fmt | ||
) |
convert img to raw format
dest should be pre-allocated and big enough for the target fmt
[in] | src | The image descriptor |
[in] | dest | The target memory address |
[in] | stride | Bytes in a row for the destination. Pass 0 if the buffer has contiguous rows. Can be negative. A multiple of 16 is optimal. |
[in] | fmt | The target format |
Definition at line 3487 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, switch_assert, SWITCH_CHANNEL_LOG, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PLANE_PACKED, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_img_txt_handle_create | ( | switch_img_txt_handle_t ** | handleP, |
const char * | font_family, | ||
const char * | font_color, | ||
const char * | bgcolor, | ||
uint16_t | font_size, | ||
double | angle, | ||
switch_memory_pool_t * | pool | ||
) |
Created a text handle.
[out] | handleP | Pointer to the text handle pointer |
[in] | font_family | Font family |
[in] | font_color | Font color in #RRGGBB format |
[in] | bgcolor | Background color in #RRGGBB format |
[in] | font_size | Font size in point |
[in] | angle | Angle to rotate |
[in] | pool | APR memory pool |
Definition at line 1864 of file switch_core_video.c.
References switch_img_txt_handle_s::angle, switch_img_txt_handle_s::bgcolor, switch_img_txt_handle_s::color, switch_img_txt_handle_s::font_family, switch_img_txt_handle_s::font_size, switch_directories::fonts_dir, switch_img_txt_handle_s::free_pool, init_gradient_table(), pool, switch_img_txt_handle_s::pool, SWITCH_CHANNEL_LOG, switch_color_set_rgb(), switch_core_alloc, switch_core_destroy_memory_pool, switch_core_new_memory_pool, switch_core_sprintf(), switch_core_strdup, switch_file_exists(), SWITCH_GLOBAL_dirs, switch_is_file_path(), SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PATH_SEPARATOR, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and zstr.
Referenced by switch_img_write_text_img().
void switch_img_txt_handle_destroy | ( | switch_img_txt_handle_t ** | handleP | ) |
Free a text handle.
[in] | handleP | Pointer to the text handle pointer |
Definition at line 1927 of file switch_core_video.c.
References switch_rgb_color_s::a, switch_rgb_color_s::b, switch_img_txt_handle_s::color, vpx_image::d_h, vpx_image::d_w, switch_img_txt_handle_s::free_pool, switch_rgb_color_s::g, switch_img_txt_handle_s::gradient_table, MAX_GRADIENT, pool, switch_img_txt_handle_s::pool, switch_rgb_color_s::r, switch_assert, SWITCH_CHANNEL_LOG, switch_core_destroy_memory_pool, switch_img_draw_pixel(), switch_img_get_rgb_pixel(), switch_log_printf(), SWITCH_LOG_WARNING, and switch_img_txt_handle_s::use_bgcolor.
Referenced by switch_img_write_text_img().
uint32_t switch_img_txt_handle_render | ( | switch_img_txt_handle_t * | handle, |
switch_image_t * | img, | ||
int | x, | ||
int | y, | ||
const char * | text, | ||
const char * | font_family, | ||
const char * | font_color, | ||
const char * | bgcolor, | ||
uint16_t | font_size, | ||
double | angle | ||
) |
Render text to an img.
[in] | handle | Pointer to the text handle pointer |
[in] | img | The image to be render text on |
[in] | x | Leftmost position |
[in] | y | Topmost position |
[in] | text | Text to render |
[in] | font_family | Font to use, NULL to use the handle font |
[in] | font_color | Font color, NULL to use the handle color |
[in] | bgcolor | Background color, NULL for transparency |
[in] | font_size | Font size in point |
[in] | angle | Angle to rotate |
Definition at line 2025 of file switch_core_video.c.
References switch_img_txt_handle_s::angle, switch_img_txt_handle_s::bgcolor, switch_img_txt_handle_s::color, vpx_image::fmt, switch_img_txt_handle_s::font_family, switch_img_txt_handle_s::font_size, index, init_gradient_table(), switch_img_txt_handle_s::pool, switch_assert, SWITCH_CHANNEL_LOG, switch_color_set_rgb(), switch_core_strdup, SWITCH_FALSE, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_TRUE, switch_u8_get_char(), switch_img_txt_handle_s::use_bgcolor, and zstr.
Referenced by switch_img_write_text_img().
switch_image_t* switch_img_wrap | ( | switch_image_t * | img, |
switch_img_fmt_t | fmt, | ||
unsigned int | d_w, | ||
unsigned int | d_h, | ||
unsigned int | align, | ||
unsigned char * | img_data | ||
) |
Open a descriptor, using existing storage for the underlying image.
Returns a descriptor for storing an image of the given format. The storage for descriptor has been allocated elsewhere, and a descriptor is desired to "wrap" that storage.
[in] | img | Pointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap. |
[in] | fmt | Format for the image |
[in] | d_w | Width of the image |
[in] | d_h | Height of the image |
[in] | align | Alignment, in bytes, of each row in the image. |
[in] | img_data | Storage to use for the image |
Definition at line 235 of file switch_core_video.c.
References vpx_img_wrap().
switch_status_t switch_img_write_png | ( | switch_image_t * | img, |
char * | file_name | ||
) |
Definition at line 3103 of file switch_core_video.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), and SWITCH_STATUS_FALSE.
switch_image_t* switch_img_write_text_img | ( | int | w, |
int | h, | ||
switch_bool_t | full, | ||
const char * | text | ||
) |
Definition at line 2151 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, end_of, memset(), vpx_image::planes, switch_assert, switch_color_set_rgb(), switch_img_alloc(), switch_img_fill(), SWITCH_IMG_FMT_ARGB, switch_img_txt_handle_create(), switch_img_txt_handle_destroy(), switch_img_txt_handle_render(), SWITCH_PLANE_PACKED, switch_safe_free, switch_split, switch_url_decode(), and zstr.
switch_status_t switch_img_write_to_file | ( | switch_image_t * | img, |
const char * | file_name, | ||
int | quality | ||
) |
Write an image file, supported formats png,jpg,bmp,tga,hdr.
[in] | img | The image descriptor |
[in] | file_name | The file_name to write |
[in] | quality | Only used in jpg, 1 ~ 100 |
Definition at line 3164 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, vpx_image::planes, vpx_image::stride, switch_assert, SWITCH_CHANNEL_LOG, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
void switch_png_free | ( | switch_png_t ** | pngP | ) |
switch_status_t switch_png_open | ( | switch_png_t ** | pngP, |
const char * | file_name | ||
) |
switch_status_t switch_png_patch_img | ( | switch_png_t * | use_png, |
switch_image_t * | img, | ||
int | x, | ||
int | y | ||
) |
switch_status_t switch_RGBAToARGB | ( | const uint8_t * | src_frame, |
int | src_stride_frame, | ||
uint8_t * | dst_argb, | ||
int | dst_stride_argb, | ||
int | width, | ||
int | height | ||
) |
Definition at line 3833 of file switch_core_video.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.