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 
33  0,
35  1,
41  6,
43  7,
46  9,
48  10,
50  11,
52  // Add any new enum value before this one.
54  255
55 };
56 
65  0,
67  1,
69  1,
70 };
71 
85  const uint8_t* (*get_plane)(void* user_data,
86  enum otc_video_frame_plane plane);
87 
96 
103  void (*release)(void* user_data);
104 
108  void* user_data;
109 
114  void* reserved;
115 };
116 
125 typedef void (*otc_video_frame_memory_release_callback)(const uint8_t* buffer,
126  void* arg);
127 
128 OTC_DECL(void*)
129 otc_video_frame_get_native_handle(const otc_video_frame* frame);
130 
141 OTC_DECL(otc_video_frame*)
143  int width,
144  int height,
145  const uint8_t* buffer);
146 
155 
170 OTC_DECL(otc_video_frame*)
171 otc_video_frame_new_I420(int width,
172  int height,
173  const uint8_t* y_plane,
174  int y_stride,
175  const uint8_t* u_plane,
176  int u_stride,
177  const uint8_t* v_plane,
178  int v_stride);
179 
190 OTC_DECL(otc_video_frame*)
191 otc_video_frame_new_MJPEG(int width,
192  int height,
193  const uint8_t* buffer,
194  size_t size);
195 
206 OTC_DECL(otc_video_frame*)
208  int height,
209  const uint8_t* buffer,
210  size_t size);
211 
224 OTC_DECL(otc_video_frame*)
226  int width,
227  int height,
228  const uint8_t** planes,
229  int* strides);
230 
243 OTC_DECL(otc_video_frame*)
245  enum otc_video_frame_format input_format,
246  int width,
247  int height,
248  const uint8_t** planes,
249  int* strides);
250 
265 OTC_DECL(otc_video_frame*)
267  enum otc_video_frame_format format,
268  int width,
269  int height,
270  otc_bool is_shallow_copyable,
271  const uint8_t* buffer,
272  size_t size,
274  void* arg);
275 
291 OTC_DECL(otc_video_frame*)
293  enum otc_video_frame_format format,
294  int width,
295  int height,
296  otc_bool is_shallow_copyable,
297  struct otc_video_frame_planar_memory_callbacks* callbacks);
298 
313 OTC_DECL(otc_video_frame*)
315  int height,
316  const uint8_t* y_plane,
317  int y_stride,
318  const uint8_t* u_plane,
319  int u_stride,
320  const uint8_t* v_plane,
321  int v_stride);
322 
335 OTC_DECL(otc_video_frame*)
337  int height,
338  const uint8_t* y_plane,
339  int y_stride,
340  const uint8_t* uv_plane,
341  int uv_stride);
342 
355 OTC_DECL(otc_video_frame*)
357  int height,
358  const uint8_t* y_plane,
359  int y_stride,
360  const uint8_t* uv_plane,
361  int uv_stride);
362 
369 OTC_DECL(const uint8_t*)
371 
379 OTC_DECL(size_t) otc_video_frame_get_buffer_size(const otc_video_frame* frame);
380 
387 OTC_DECL(int64_t) otc_video_frame_get_timestamp(const otc_video_frame* frame);
388 
395 OTC_DECL(void)
396 otc_video_frame_set_timestamp(otc_video_frame* frame, int64_t timestamp);
397 
404 OTC_DECL(int) otc_video_frame_get_width(const otc_video_frame* frame);
405 
412 OTC_DECL(int) otc_video_frame_get_height(const otc_video_frame* frame);
413 
421 OTC_DECL(size_t)
423 
431 OTC_DECL(enum otc_video_frame_format)
433 
441 OTC_DECL(void)
443  enum otc_video_frame_format format);
444 
453 OTC_DECL(const uint8_t*)
455  enum otc_video_frame_plane plane);
456 
464 OTC_DECL(size_t)
466  enum otc_video_frame_plane plane);
467 
475 OTC_DECL(int)
477  enum otc_video_frame_plane plane);
478 
486 OTC_DECL(int)
488  enum otc_video_frame_plane plane);
489 
497 OTC_DECL(int)
499  enum otc_video_frame_plane plane);
500 
507 OTC_DECL(otc_video_frame*) otc_video_frame_copy(const otc_video_frame* frame);
508 
515 OTC_DECL(otc_video_frame*)
517 
538 OTC_DECL(otc_video_frame*)
540  const otc_video_frame* frame);
541 
557 OTC_DECL(otc_status)
559  uint8_t** planes,
560  const int* strides,
561  const otc_video_frame* input_frame);
562 
569 OTC_DECL(otc_bool) otc_video_frame_is_packed(const otc_video_frame* frame);
570 
578 
588 OTC_DECL(otc_status)
590  const uint8_t* data,
591  size_t size);
592 
602 OTC_DECL(const uint8_t*)
603 otc_video_frame_get_metadata(const otc_video_frame* frame, size_t* size);
604 
605 OTC_END_DECL
606 
607 #endif // VIDEO_FRAME_H
Definition: video_frame.h:38
Definition: video_frame.h:53
int otc_status
Definition: base.h:133
Definition: video_frame.h:68
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:40
void * user_data
Definition: video_frame.h:108
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:59
enum otc_video_frame_format otc_video_frame_get_format(const otc_video_frame *frame)
Definition: video_frame.h:44
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:66
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:76
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:42
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:61
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:95
int otc_video_frame_get_height(const otc_video_frame *frame)
void * reserved
Definition: video_frame.h:114
Definition: video_frame.h:37
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:47
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:64
Definition: video_frame.h:32
void(* otc_video_frame_memory_release_callback)(const uint8_t *buffer, void *arg)
Definition: video_frame.h:125
int otc_video_frame_get_plane_height(const otc_video_frame *frame, enum otc_video_frame_plane plane)
Definition: video_frame.h:45
Base functions.
Definition: video_frame.h:51
Definition: video_frame.h:39
const uint8_t * otc_video_frame_get_metadata(const otc_video_frame *frame, size_t *size)
int otc_bool
Definition: base.h:107
Definition: video_frame.h:62
otc_video_frame * otc_video_frame_new_compressed(int width, int height, const uint8_t *buffer, size_t size)
Definition: video_frame.h:34
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:60
void otc_video_frame_set_timestamp(otc_video_frame *frame, int64_t timestamp)
void(* release)(void *user_data)
Definition: video_frame.h:103
Definition: video_frame.h:36
Definition: video_frame.h:49
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)