OpenTok C SDK
subscriber.h
Go to the documentation of this file.
1 
7 #ifndef SUBSCRIBER_H
8 #define SUBSCRIBER_H
9 
10 #include "config.h"
11 #include "stream.h"
12 #include "error.h"
13 #include "video_frame.h"
14 #include "audio_data.h"
15 
16 OTC_BEGIN_DECL
17 
18 #ifndef OTC_SESSION_FWD_DECL
19 #define OTC_SESSION_FWD_DECL
20 typedef struct otc_session otc_session;
21 #endif
22 
29 
46  1542,
49  1606,
51  6002,
53  6003,
54 };
55 
61  uint64_t packets_lost;
63  uint64_t packets_received;
65  uint64_t bytes_received;
67  float audio_level;
68  double timestamp;
70 };
71 
81  uint64_t packets_lost;
83  uint64_t packets_received;
85  uint64_t bytes_received;
87  double timestamp;
89 };
90 
100  void* user_data;
101 
158  void (*on_rtc_stats_report)(otc_subscriber* subscriber,
159  void* user_data,
160  const char* json_array_of_reports);
161 
162  void* reserved;
163 };
164 
183  void (*on_connected)(otc_subscriber* subscriber,
184  void* user_data,
185  const otc_stream* stream);
186 
193  void (*on_disconnected)(otc_subscriber* subscriber, void* user_data);
194 
201  void (*on_reconnected)(otc_subscriber* subscriber, void* user_data);
202 
210  void (*on_render_frame)(otc_subscriber* subscriber,
211  void* user_data,
212  const otc_video_frame* frame);
213 
221  void (*on_video_disabled)(otc_subscriber* subscriber,
222  void* user_data,
223  enum otc_video_reason reason);
224 
232  void (*on_video_enabled)(otc_subscriber* subscriber,
233  void* user_data,
234  enum otc_video_reason reason);
235 
242  void (*on_audio_disabled)(otc_subscriber* subscriber, void* user_data);
243 
250  void (*on_audio_enabled)(otc_subscriber* subscriber, void* user_data);
251 
258  void (*on_video_data_received)(otc_subscriber* subscriber, void* user_data);
259 
268  void (*on_video_disable_warning)(otc_subscriber* subscriber, void* user_data);
269 
278  void (*on_caption_text)(otc_subscriber* subscriber,
279  void* user_data,
280  const char* text,
281  otc_bool is_final);
282 
292  void* user_data);
293 
301  void (*on_audio_stats)(otc_subscriber* subscriber,
302  void* user_data,
303  struct otc_subscriber_audio_stats audio_stats);
304 
312  void (*on_video_stats)(otc_subscriber* subscriber,
313  void* user_data,
314  struct otc_subscriber_video_stats video_stats);
315 
324  void* user_data,
325  float audio_level);
326 
335  void (*on_error)(otc_subscriber* subscriber,
336  void* user_data,
337  const char* error_string,
338  enum otc_subscriber_error_code error);
339 
347  void (*on_audio_data)(otc_subscriber* subscriber,
348  void* user_data,
349  const struct otc_audio_data* audio_data);
350 
355  void* user_data;
356 
361  void* reserved;
362 };
363 
373 OTC_DECL(otc_subscriber*)
374 otc_subscriber_new(const otc_stream* stream,
375  const struct otc_subscriber_callbacks* callbacks);
376 
384 OTC_DECL(otc_status) otc_subscriber_delete(otc_subscriber* subscriber);
385 
393 OTC_DECL(otc_stream*)
394 otc_subscriber_get_stream(const otc_subscriber* subscriber);
395 
403 OTC_DECL(otc_status)
405  otc_bool subscribe_to_video);
406 
414 OTC_DECL(otc_status)
416  otc_bool subscribe_to_audio);
417 
425 OTC_DECL(otc_status)
427  otc_bool subscribe_to_captions);
428 
435 OTC_DECL(otc_bool)
437 
444 OTC_DECL(otc_bool)
446 
455 OTC_DECL(otc_bool)
457 
465 OTC_DECL(otc_session*)
466 otc_subscriber_get_session(const otc_subscriber* subscriber);
467 
477 OTC_DECL(otc_status)
479  uint32_t preferred_width,
480  uint32_t preferred_height);
490 OTC_DECL(otc_status)
492  uint32_t* preferred_width,
493  uint32_t* preferred_height);
494 
504 OTC_DECL(otc_status)
505 otc_subscriber_set_audio_volume(otc_subscriber* subscriber, double volume);
506 
517 OTC_DECL(otc_status)
519  double* volume);
520 
531 OTC_DECL(otc_status)
533  float preferred_framerate);
534 
544 OTC_DECL(otc_status)
546  float* preferred_framerate);
547 
555 OTC_DECL(const char*)
557 
564 OTC_DECL(void*) otc_subscriber_get_user_data(const otc_subscriber* subscriber);
565 
580 OTC_DECL(otc_status)
582 
592 OTC_DECL(otc_status)
594  otc_subscriber* subscriber,
596 
597 OTC_END_DECL
598 
599 #endif // SUBSCRIBER_H
void(* on_video_stats)(otc_subscriber *subscriber, void *user_data, struct otc_subscriber_video_stats video_stats)
Definition: subscriber.h:312
Definition: subscriber.h:47
void(* on_audio_stats)(otc_subscriber *subscriber, void *user_data, struct otc_subscriber_audio_stats audio_stats)
Definition: subscriber.h:301
Definition: audio_data.h:19
Definition: subscriber.h:80
int otc_status
Definition: base.h:153
uint64_t bytes_received
Definition: subscriber.h:65
struct otc_video_frame otc_video_frame
Definition: video_frame.h:25
struct otc_subscriber otc_subscriber
Definition: subscriber.h:28
void(* on_audio_disabled)(otc_subscriber *subscriber, void *user_data)
Definition: subscriber.h:242
Definition: subscriber.h:174
otc_status otc_subscriber_get_rtc_stats_report(const otc_subscriber *subscriber)
otc_status otc_subscriber_set_preferred_framerate(otc_subscriber *subscriber, float preferred_framerate)
void(* on_audio_level_updated)(otc_subscriber *subscriber, void *user_data, float audio_level)
Definition: subscriber.h:323
void(* on_video_disable_warning)(otc_subscriber *subscriber, void *user_data)
Definition: subscriber.h:268
otc_status otc_subscriber_get_audio_volume(const otc_subscriber *subscriber, double *volume)
otc_status otc_subscriber_set_subscribe_to_audio(otc_subscriber *subscriber, otc_bool subscribe_to_audio)
otc_status otc_subscriber_set_subscribe_to_video(otc_subscriber *subscriber, otc_bool subscribe_to_video)
Definition: subscriber.h:50
void(* on_audio_data)(otc_subscriber *subscriber, void *user_data, const struct otc_audio_data *audio_data)
Definition: subscriber.h:347
Definition: subscriber.h:39
double timestamp
Definition: subscriber.h:68
float audio_level
Definition: subscriber.h:67
Audio/Video stream.
uint64_t packets_received
Definition: subscriber.h:63
struct otc_session otc_session
Definition: session.h:21
void(* on_render_frame)(otc_subscriber *subscriber, void *user_data, const otc_video_frame *frame)
Definition: subscriber.h:210
Definition: subscriber.h:60
otc_status otc_subscriber_get_preferred_resolution(const otc_subscriber *subscriber, uint32_t *preferred_width, uint32_t *preferred_height)
otc_status otc_subscriber_set_subscribe_to_captions(otc_subscriber *subscriber, otc_bool subscribe_to_captions)
Definition: subscriber.h:96
void(* on_connected)(otc_subscriber *subscriber, void *user_data, const otc_stream *stream)
Definition: subscriber.h:183
otc_bool otc_subscriber_get_subscribe_to_captions(const otc_subscriber *subscriber)
otc_status otc_subscriber_get_preferred_framerate(const otc_subscriber *subscriber, float *preferred_framerate)
otc_status otc_subscriber_delete(otc_subscriber *subscriber)
void(* on_disconnected)(otc_subscriber *subscriber, void *user_data)
Definition: subscriber.h:193
uint64_t packets_received
Definition: subscriber.h:83
void(* on_error)(otc_subscriber *subscriber, void *user_data, const char *error_string, enum otc_subscriber_error_code error)
Definition: subscriber.h:335
void(* on_video_data_received)(otc_subscriber *subscriber, void *user_data)
Definition: subscriber.h:258
struct otc_stream otc_stream
Definition: stream.h:18
Audio Data.
uint64_t bytes_received
Definition: subscriber.h:85
otc_subscriber_error_code
Definition: subscriber.h:35
otc_status otc_subscriber_set_preferred_resolution(otc_subscriber *subscriber, uint32_t preferred_width, uint32_t preferred_height)
void(* on_audio_enabled)(otc_subscriber *subscriber, void *user_data)
Definition: subscriber.h:250
Definition: subscriber.h:42
void * otc_subscriber_get_user_data(const otc_subscriber *subscriber)
void(* on_video_disabled)(otc_subscriber *subscriber, void *user_data, enum otc_video_reason reason)
Definition: subscriber.h:221
otc_bool otc_subscriber_get_subscribe_to_video(const otc_subscriber *subscriber)
double timestamp
Definition: subscriber.h:87
void * reserved
Definition: subscriber.h:361
Definition: subscriber.h:45
uint64_t packets_lost
Definition: subscriber.h:81
void(* on_video_disable_warning_lifted)(otc_subscriber *subscriber, void *user_data)
Definition: subscriber.h:291
void * user_data
Definition: subscriber.h:355
otc_stream * otc_subscriber_get_stream(const otc_subscriber *subscriber)
void(* on_reconnected)(otc_subscriber *subscriber, void *user_data)
Definition: subscriber.h:201
uint64_t packets_lost
Definition: subscriber.h:61
int otc_bool
Definition: base.h:127
void * user_data
Definition: subscriber.h:100
otc_video_reason
Definition: base.h:16
void(* on_caption_text)(otc_subscriber *subscriber, void *user_data, const char *text, otc_bool is_final)
Definition: subscriber.h:278
otc_status otc_subscriber_set_rtc_stats_report_cb(otc_subscriber *subscriber, struct otc_subscriber_rtc_stats_report_cb cb)
void(* on_video_enabled)(otc_subscriber *subscriber, void *user_data, enum otc_video_reason reason)
Definition: subscriber.h:232
Definition: subscriber.h:37
void(* on_rtc_stats_report)(otc_subscriber *subscriber, void *user_data, const char *json_array_of_reports)
Definition: subscriber.h:158
otc_bool otc_subscriber_get_subscribe_to_audio(const otc_subscriber *subscriber)
otc_subscriber * otc_subscriber_new(const otc_stream *stream, const struct otc_subscriber_callbacks *callbacks)
Video frame.
Definition: subscriber.h:36
otc_status otc_subscriber_set_audio_volume(otc_subscriber *subscriber, double volume)
otc_session * otc_subscriber_get_session(const otc_subscriber *subscriber)
const char * otc_subscriber_get_subscriber_id(const otc_subscriber *subscriber)