OpenTok C SDK
|
Video frame. More...
Go to the source code of this file.
Data Structures | |
struct | otc_video_frame_planar_memory_callbacks |
Macros | |
#define | OTC_VIDEO_FRAME_METADATA_MAX_SIZE 32 |
Typedefs | |
typedef struct otc_video_frame | otc_video_frame |
typedef void(* | otc_video_frame_memory_release_callback) (const uint8_t *buffer, void *arg) |
typedef void(* | video_transform_callback) (void *user_data, struct otc_video_frame *frame) |
The callback that will perform the custom transformation. More... | |
Video frame.
This file includes the type definition for a video frame along with several function declarations useful when handling them.
#define OTC_VIDEO_FRAME_METADATA_MAX_SIZE 32 |
Max size for an array containing metadata items in a video frame.
typedef struct otc_video_frame otc_video_frame |
Video frame type definition.
typedef void(* otc_video_frame_memory_release_callback) (const uint8_t *buffer, void *arg) |
Type definition for the video frame memory release callback function.
This is a function pointer to the callback function that is called when the app should release the memory holding a video frame.
buffer | A function pointer to the buffer. |
arg | A pointer to additional arguments. |
typedef void(* video_transform_callback) (void *user_data, struct otc_video_frame *frame) |
The callback that will perform the custom transformation.
Note: This functionality only applies to the Vonage Video API macOS SDK. It does not work in the Vonage Video API Linux SDK.
Video frame video format enumeration.
This enumeration represents several video frame formats.
Video frame video plane enumeration.
otc_video_frame* otc_video_frame_convert | ( | enum otc_video_frame_format | format, |
const otc_video_frame * | frame | ||
) |
Converts a given frame. All the video frames provided by the SDK callback functions are bound to this. If you plan to save the frame so you use it later, you'll need to copy it. In addition to that, if you want to convert a video frame to a different format, you'll use this function also If the destination format is the same as the source, a shallow copy (n buffer copy) will be made if possible.
format | The format of the video frame which will be returned. This function can convert frames to the following formats: OTC_VIDEO_FRAME_FORMAT_ARGB32 , OTC_VIDEO_FRAME_FORMAT_BGRA32 , OTC_VIDEO_FRAME_FORMAT_ABGR32 , OTC_VIDEO_FRAME_FORMAT_RGBA32 and OTC_VIDEO_FRAME_FORMAT_YUV420P . |
frame | A pointer to the video frame instance. |
otc_status otc_video_frame_convert_inplace | ( | enum otc_video_frame_format | format, |
uint8_t ** | planes, | ||
const int * | strides, | ||
const otc_video_frame * | input_frame | ||
) |
Converts a given frame in place. This changes the data of the input frame.
format | The format of the video frame. This function can convert frames to the following formats: OTC_VIDEO_FRAME_FORMAT_ARGB32 , OTC_VIDEO_FRAME_FORMAT_BGRA32 , OTC_VIDEO_FRAME_FORMAT_ABGR32 , and OTC_VIDEO_FRAME_FORMAT_YUV420P . |
input_frame | A pointer to the video frame instance. |
planes | A pointer to a pointer to the video frame planes. |
strides | A pointer to a pointer to the video frame stride. |
otc_video_frame* otc_video_frame_copy | ( | const otc_video_frame * | frame | ) |
Copies a given video frame.
frame | A pointer to the video frame instance. |
otc_status otc_video_frame_delete | ( | otc_video_frame * | frame | ) |
Free resources associated with the frame.
frame | A pointer to a video frame instance. |
const uint8_t* otc_video_frame_get_buffer | ( | const otc_video_frame * | frame | ) |
Gets a pointer to the buffer containing video frame data.
frame | A pointer to the video frame instance to get the buffer from. |
size_t otc_video_frame_get_buffer_size | ( | const otc_video_frame * | frame | ) |
Gets the size of the buffer containing video frame data.
frame | A pointer to the video frame instance to get the buffer size from. |
enum otc_video_frame_format otc_video_frame_get_format | ( | const otc_video_frame * | frame | ) |
Gets the video format of a video frame.
frame | A pointer to the video frame instance. |
int otc_video_frame_get_height | ( | const otc_video_frame * | frame | ) |
Gets the height of a video frame, in pixels.
frame | A pointer to the video frame instance. |
const uint8_t* otc_video_frame_get_metadata | ( | const otc_video_frame * | frame, |
size_t * | size | ||
) |
Gets the metadata associated with the video frame.
frame | A pointer to the video frame instance. |
size | The size of the metadata buffer associated with this frame. |
size_t otc_video_frame_get_number_of_planes | ( | const otc_video_frame * | frame | ) |
Gets the number of planes of a video frame. Typically, this returns 3 for a YUV fame and 1 for a RGBA/BGRA fame.
frame | A pointer to the video frame instance. |
const uint8_t* otc_video_frame_get_plane_binary_data | ( | const otc_video_frame * | frame, |
enum otc_video_frame_plane | plane | ||
) |
Gets the binary data from one of the planes of a video frame.
frame | A pointer to the video frame instance. |
plane | The video plane to get data from. |
int otc_video_frame_get_plane_height | ( | const otc_video_frame * | frame, |
enum otc_video_frame_plane | plane | ||
) |
Gets the height of a plane in a video frame.
frame | A pointer to the video frame instance. |
plane | The video plane to get the height from. |
size_t otc_video_frame_get_plane_size | ( | const otc_video_frame * | frame, |
enum otc_video_frame_plane | plane | ||
) |
Gets the size of a plane in a video frame.
frame | A pointer to the video frame instance. |
plane | The video plane to get the size from. |
int otc_video_frame_get_plane_stride | ( | const otc_video_frame * | frame, |
enum otc_video_frame_plane | plane | ||
) |
Gets plane stride from a give plane in a video frame.
frame | A pointer to the video frame instance. |
plane | The video plane to get the stride from. |
int otc_video_frame_get_plane_width | ( | const otc_video_frame * | frame, |
enum otc_video_frame_plane | plane | ||
) |
Gets the width of a plane in a video frame.
frame | A pointer to the video frame instance. |
plane | The video plane to get the width from. |
int64_t otc_video_frame_get_timestamp | ( | const otc_video_frame * | frame | ) |
Gets a video frame timestamp in milliseconds since epoch time.
frame | A pointer to the video frame instance. |
int otc_video_frame_get_width | ( | const otc_video_frame * | frame | ) |
Gets the width of a video frame, in pixels.
frame | A pointer to the video frame instance. |
otc_bool otc_video_frame_is_contiguous | ( | const otc_video_frame * | frame | ) |
Checks whether a video frame is contiguous or not.
frame | A pointer to the video frame instance. |
otc_bool otc_video_frame_is_packed | ( | const otc_video_frame * | frame | ) |
Checks whether a video frame is packed or not.
frame | A pointer to the video frame instance. |
otc_video_frame* otc_video_frame_mutable_copy | ( | const otc_video_frame * | frame | ) |
Makes a mutable copy of a given video frame.
frame | A pointer to the video frame instance. |
otc_video_frame* otc_video_frame_new | ( | enum otc_video_frame_format | format, |
int | width, | ||
int | height, | ||
const uint8_t * | buffer | ||
) |
Creates a new video frame with a given format.
format | The desired format. |
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
buffer | A pointer to a buffer containing video frame data. |
otc_video_frame* otc_video_frame_new_compressed | ( | int | width, |
int | height, | ||
const uint8_t * | buffer, | ||
size_t | size | ||
) |
Creates a new compressed video frame.
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
buffer | A pointer to a buffer containing video frame data. |
size | The video frame size in memory. |
otc_video_frame* otc_video_frame_new_contiguous_memory_wrapper | ( | enum otc_video_frame_format | format, |
int | width, | ||
int | height, | ||
otc_bool | is_shallow_copyable, | ||
const uint8_t * | buffer, | ||
size_t | size, | ||
otc_video_frame_memory_release_callback | callback, | ||
void * | arg | ||
) |
Creates a new video frame from data in a contiguous memmory buffer.
format | The format for the video frame passed in. |
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
is_shallow_copyable | Whether you can make a shallow copy of the frame. |
buffer | A pointer to the buffer containing the frame data. |
size | The size of the frame data. |
callback | The video frame memory release callback function. |
arg | A pointer to additional arguments. |
otc_video_frame* otc_video_frame_new_from_planes | ( | enum otc_video_frame_format | format, |
int | width, | ||
int | height, | ||
const uint8_t ** | planes, | ||
int * | strides | ||
) |
Creates a new video frame with a given format from its planes.
format | The desired format. |
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
planes | A pointer to a pointer to the buffer containing the video frame planes. |
strides | Strides. |
otc_video_frame* otc_video_frame_new_I420 | ( | int | width, |
int | height, | ||
const uint8_t * | y_plane, | ||
int | y_stride, | ||
const uint8_t * | u_plane, | ||
int | u_stride, | ||
const uint8_t * | v_plane, | ||
int | v_stride | ||
) |
Creates a new video frame with I420 format.
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
y_plane | A pointer to a buffer containing Y plane data. |
y_stride | Y stride. |
u_plane | A pointer to a buffer containing U plane data. |
u_stride | U stride. |
v_plane | A pointer to a buffer containing V plane data. |
v_stride | V stride. |
otc_video_frame* otc_video_frame_new_I420_from_planes_with_format | ( | enum otc_video_frame_format | input_format, |
int | width, | ||
int | height, | ||
const uint8_t ** | planes, | ||
int * | strides | ||
) |
Creates a new video frame with I420 format from a list of planes.
input_format | The format for the video frame passed as input. |
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
planes | A pointer to a pointer to the buffer containing the video frame planes. |
strides | Strides. |
otc_video_frame* otc_video_frame_new_I420_wrapper | ( | int | width, |
int | height, | ||
const uint8_t * | y_plane, | ||
int | y_stride, | ||
const uint8_t * | u_plane, | ||
int | u_stride, | ||
const uint8_t * | v_plane, | ||
int | v_stride | ||
) |
Creates a new I420 format video frame from YUV data.
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
y_plane | A pointer the Y plane. |
y_stride | The Y stride. |
u_plane | A pointer the U plane. |
u_stride | The U stride. |
v_plane | A pointer the V plane. |
v_stride | The V stride. |
otc_video_frame* otc_video_frame_new_MJPEG | ( | int | width, |
int | height, | ||
const uint8_t * | buffer, | ||
size_t | size | ||
) |
Creates a new video frame with MJPEG format.
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
buffer | A pointer to a buffer containing video frame data. |
size | The video frame size in memory. |
otc_video_frame* otc_video_frame_new_NV12_wrapper | ( | int | width, |
int | height, | ||
const uint8_t * | y_plane, | ||
int | y_stride, | ||
const uint8_t * | uv_plane, | ||
int | uv_stride | ||
) |
Creates a new video frame with an NV12 wrapper.
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
y_plane | A pointer the Y plane. |
y_stride | The Y stride. |
uv_plane | A pointer the UV plane. |
uv_stride | The UV stride. |
otc_video_frame* otc_video_frame_new_NV21_wrapper | ( | int | width, |
int | height, | ||
const uint8_t * | y_plane, | ||
int | y_stride, | ||
const uint8_t * | uv_plane, | ||
int | uv_stride | ||
) |
Creates a new video frame with an NV21 wrapper.
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
y_plane | A pointer the Y plane. |
y_stride | The Y stride. |
uv_plane | A pointer the UV plane. |
uv_stride | The UV stride. |
otc_video_frame* otc_video_frame_new_planar_memory_wrapper | ( | enum otc_video_frame_format | format, |
int | width, | ||
int | height, | ||
otc_bool | is_shallow_copyable, | ||
struct otc_video_frame_planar_memory_callbacks * | callbacks | ||
) |
Creates a new video frame from a planar memory wrapper. The otc_video_frame_planar_memory_callbacks struct, passed in, defines callback functions that are invoked when video frame and stride data is requested.
format | The format for the video frame passed in. |
width | The width of the video, in pixels. |
height | The height of the video, in pixels. |
is_shallow_copyable | Whether you can make a shallow copy of the frame. |
callbacks | A pointer to the struct containing the video frame callback functions. |
void otc_video_frame_set_format | ( | otc_video_frame * | frame, |
enum otc_video_frame_format | format | ||
) |
Sets the video format of a video frame.
frame | A pointer to the video frame instance. |
format | The video frame format. |
otc_status otc_video_frame_set_metadata | ( | otc_video_frame * | frame, |
const uint8_t * | data, | ||
size_t | size | ||
) |
Sets the metadata associated with a video frame.
frame | A pointer to the video frame instance. |
data | A pointer to the metadata buffer to be copied into the frame. |
size | The size of the metadata buffer to be copied. |
void otc_video_frame_set_timestamp | ( | otc_video_frame * | frame, |
int64_t | timestamp | ||
) |
Sets the timestamp for a video frame in milliseconds since epoch time.
frame | A pointer to the video frame instance. |
timestamp | The timestamp value. |