OpenTok C SDK
video_frame.h
Go to the documentation of this file.
1 
7 #ifndef VIDEO_FRAME_H
8 #define VIDEO_FRAME_H
9 
10 #ifndef _WIN32
11 #include <unistd.h>
12 #endif
13 
14 #include "base.h"
15 #include "config.h"
16 
17 OTC_BEGIN_DECL
18 
21 #define OTC_VIDEO_FRAME_METADATA_MAX_SIZE 32
22 
26 
45  // Add any new enum value before this one.
47 };
48 
59 };
60 
74  const uint8_t *(*get_plane)(void *user_data, enum otc_video_frame_plane plane);
75 
84 
91  void (*release)(void *user_data);
92 
96  void *user_data;
97 
102  void *reserved;
103 };
104 
113 typedef void(*otc_video_frame_memory_release_callback)(const uint8_t *buffer,
114  void *arg);
115 
126  int width,
127  int height,
128  const uint8_t *buffer);
129 
138 
152 OTC_DECL(otc_video_frame *) otc_video_frame_new_I420(int width,
153  int height,
154  const uint8_t *y_plane,
155  int y_stride,
156  const uint8_t *u_plane,
157  int u_stride,
158  const uint8_t *v_plane,
159  int v_stride);
160 
170 OTC_DECL(otc_video_frame *) otc_video_frame_new_MJPEG(int width,
171  int height,
172  const uint8_t *buffer,
173  size_t size);
174 
184 OTC_DECL(otc_video_frame *) otc_video_frame_new_compressed(int width,
185  int height,
186  const uint8_t *buffer,
187  size_t size);
188 
200  int width,
201  int height,
202  const uint8_t **planes,
203  int *strides);
204 
216  int width,
217  int height,
218  const uint8_t **planes,
219  int *strides);
220 
235  int width,
236  int height,
237  otc_bool is_shallow_copyable,
238  const uint8_t *buffer,
239  size_t size,
241  void *arg);
242 
257  int width, int height,
258  otc_bool is_shallow_copyable,
259  struct otc_video_frame_planar_memory_callbacks *callbacks);
260 
275  int height,
276  const uint8_t *y_plane,
277  int y_stride,
278  const uint8_t *u_plane,
279  int u_stride,
280  const uint8_t *v_plane,
281  int v_stride);
282 
295  int height,
296  const uint8_t *y_plane,
297  int y_stride,
298  const uint8_t *uv_plane,
299  int uv_stride);
300 
313  int height,
314  const uint8_t *y_plane,
315  int y_stride,
316  const uint8_t *uv_plane,
317  int uv_stride);
318 
325 OTC_DECL(const uint8_t *) otc_video_frame_get_buffer(const otc_video_frame *frame);
326 
333 OTC_DECL(size_t) otc_video_frame_get_buffer_size(const otc_video_frame *frame);
334 
341 OTC_DECL(int64_t) otc_video_frame_get_timestamp(const otc_video_frame *frame);
342 
349 OTC_DECL(void) otc_video_frame_set_timestamp(otc_video_frame *frame, int64_t timestamp);
350 
357 OTC_DECL(int) otc_video_frame_get_width(const otc_video_frame *frame);
358 
365 OTC_DECL(int) otc_video_frame_get_height(const otc_video_frame *frame);
366 
374 OTC_DECL(size_t) otc_video_frame_get_number_of_planes(const otc_video_frame *frame);
375 
384 
392 OTC_DECL(void) otc_video_frame_set_format(otc_video_frame *frame, enum otc_video_frame_format format);
393 
401 OTC_DECL(const uint8_t *) otc_video_frame_get_plane_binary_data(const otc_video_frame *frame,
402  enum otc_video_frame_plane plane);
403 
411 OTC_DECL(size_t) otc_video_frame_get_plane_size(const otc_video_frame *frame,
412  enum otc_video_frame_plane plane);
413 
421 OTC_DECL(int) otc_video_frame_get_plane_stride(const otc_video_frame *frame,
422  enum otc_video_frame_plane plane);
423 
431 OTC_DECL(int) otc_video_frame_get_plane_width(const otc_video_frame *frame,
432  enum otc_video_frame_plane plane);
433 
441 OTC_DECL(int) otc_video_frame_get_plane_height(const otc_video_frame *frame,
442  enum otc_video_frame_plane plane);
443 
450 OTC_DECL(otc_video_frame *) otc_video_frame_copy(const otc_video_frame *frame);
451 
459 
480  const otc_video_frame *frame);
481 
498  uint8_t **planes,
499  const int *strides,
500  const otc_video_frame *input_frame);
501 
508 OTC_DECL(otc_bool) otc_video_frame_is_packed(const otc_video_frame *frame);
509 
517 
528  const uint8_t *data,
529  size_t size);
530 
540 OTC_DECL(const uint8_t *) otc_video_frame_get_metadata(const otc_video_frame *frame,
541  size_t *size);
542 
543 OTC_END_DECL
544 
545 #endif // VIDEO_FRAME_H
Definition: video_frame.h:36
Definition: video_frame.h:46
int otc_status
Definition: base.h:114
Definition: video_frame.h:58
struct otc_video_frame otc_video_frame
Definition: video_frame.h:25
int64_t otc_video_frame_get_timestamp(const otc_video_frame *frame)
int otc_video_frame_get_width(const otc_video_frame *frame)
const uint8_t * otc_video_frame_get_buffer(const otc_video_frame *frame)
otc_video_frame_format
Definition: video_frame.h:31
Definition: video_frame.h:38
void * user_data
Definition: video_frame.h:96
size_t otc_video_frame_get_buffer_size(const otc_video_frame *frame)
size_t otc_video_frame_get_number_of_planes(const otc_video_frame *frame)
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)
otc_video_frame_plane
Definition: video_frame.h:51
enum otc_video_frame_format otc_video_frame_get_format(const otc_video_frame *frame)
Definition: video_frame.h:40
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)
otc_bool otc_video_frame_is_contiguous(const otc_video_frame *frame)
Definition: video_frame.h:57
otc_video_frame * otc_video_frame_mutable_copy(const otc_video_frame *frame)
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)
otc_status otc_video_frame_delete(otc_video_frame *frame)
Definition: video_frame.h:65
otc_video_frame * otc_video_frame_new(enum otc_video_frame_format format, int width, int height, const uint8_t *buffer)
Definition: video_frame.h:39
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)
otc_video_frame * otc_video_frame_new_MJPEG(int width, int height, const uint8_t *buffer, size_t size)
Definition: video_frame.h:53
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)
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)
int(* get_plane_stride)(void *user_data, enum otc_video_frame_plane plane)
Definition: video_frame.h:83
int otc_video_frame_get_height(const otc_video_frame *frame)
void * reserved
Definition: video_frame.h:102
Definition: video_frame.h:35
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)
void otc_video_frame_set_format(otc_video_frame *frame, enum otc_video_frame_format format)
Definition: video_frame.h:42
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)
size_t otc_video_frame_get_plane_size(const otc_video_frame *frame, enum otc_video_frame_plane plane)
otc_video_frame * otc_video_frame_convert(enum otc_video_frame_format format, const otc_video_frame *frame)
otc_video_frame * otc_video_frame_copy(const otc_video_frame *frame)
Definition: video_frame.h:56
Definition: video_frame.h:32
void(* otc_video_frame_memory_release_callback)(const uint8_t *buffer, void *arg)
Definition: video_frame.h:113
int otc_video_frame_get_plane_height(const otc_video_frame *frame, enum otc_video_frame_plane plane)
Definition: video_frame.h:41
Base functions.
Definition: video_frame.h:44
Definition: video_frame.h:37
const uint8_t * otc_video_frame_get_metadata(const otc_video_frame *frame, size_t *size)
int otc_bool
Definition: base.h:100
Definition: video_frame.h:54
otc_video_frame * otc_video_frame_new_compressed(int width, int height, const uint8_t *buffer, size_t size)
Definition: video_frame.h:33
otc_bool otc_video_frame_is_packed(const otc_video_frame *frame)
const uint8_t * otc_video_frame_get_plane_binary_data(const otc_video_frame *frame, enum otc_video_frame_plane plane)
int otc_video_frame_get_plane_stride(const otc_video_frame *frame, enum otc_video_frame_plane plane)
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)
Definition: video_frame.h:52
void otc_video_frame_set_timestamp(otc_video_frame *frame, int64_t timestamp)
void(* release)(void *user_data)
Definition: video_frame.h:91
Definition: video_frame.h:34
Definition: video_frame.h:43
otc_status otc_video_frame_set_metadata(otc_video_frame *frame, const uint8_t *data, size_t size)
int otc_video_frame_get_plane_width(const otc_video_frame *frame, enum otc_video_frame_plane plane)