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 
15 OTC_BEGIN_DECL
16 
17 #ifndef OTC_SESSION_FWD_DECL
18 #define OTC_SESSION_FWD_DECL
19 typedef struct otc_session otc_session;
20 #endif
21 
28 
33  1,
35  2,
41 };
42 
59  1542,
61 };
62 
68  uint64_t packets_lost;
70  uint64_t packets_received;
72  uint64_t bytes_received;
74  float audio_level;
75  double timestamp;
77 };
78 
88  uint64_t packets_lost;
90  uint64_t packets_received;
92  uint64_t bytes_received;
94  double timestamp;
96 };
97 
107  void *user_data;
108 
164  void(*on_rtc_stats_report)(otc_subscriber* subscriber,
165  void *user_data,
166  const char* json_array_of_reports);
167 
168  void *reserved;
169 };
170 
189  void (*on_connected)(otc_subscriber* subscriber,
190  void* user_data,
191  const otc_stream* stream);
192 
199  void (*on_disconnected)(otc_subscriber* subscriber, void* user_data);
200 
207  void (*on_reconnected)(otc_subscriber* subscriber, void* user_data);
208 
216  void (*on_render_frame)(otc_subscriber* subscriber,
217  void* user_data,
218  const otc_video_frame* frame);
219 
227  void (*on_video_disabled)(otc_subscriber* subscriber,
228  void* user_data,
229  enum otc_video_reason reason);
230 
238  void (*on_video_enabled)(otc_subscriber* subscriber,
239  void* user_data,
240  enum otc_video_reason reason);
241 
248  void (*on_audio_disabled)(otc_subscriber* subscriber, void* user_data);
249 
256  void (*on_audio_enabled)(otc_subscriber* subscriber, void* user_data);
257 
264  void (*on_video_data_received)(otc_subscriber* subscriber, void* user_data);
265 
274  void (*on_video_disable_warning)(otc_subscriber* subscriber, void* user_data);
275 
284  void (*on_video_disable_warning_lifted)(otc_subscriber* subscriber,
285  void* user_data);
286 
294  void (*on_audio_stats)(otc_subscriber* subscriber,
295  void* user_data,
296  struct otc_subscriber_audio_stats audio_stats);
297 
305  void (*on_video_stats)(otc_subscriber* subscriber,
306  void* user_data,
307  struct otc_subscriber_video_stats video_stats);
308 
316  void (*on_audio_level_updated)(otc_subscriber* subscriber,
317  void* user_data,
318  float audio_level);
319 
328  void (*on_error)(otc_subscriber* subscriber,
329  void* user_data,
330  const char* error_string,
331  enum otc_subscriber_error_code error);
332 
337  void* user_data;
338 
343  void* reserved;
344 };
345 
355 OTC_DECL(otc_subscriber*)
356 otc_subscriber_new(const otc_stream* stream,
357  const struct otc_subscriber_callbacks* callbacks);
358 
366 OTC_DECL(otc_status) otc_subscriber_delete(otc_subscriber* subscriber);
367 
375 OTC_DECL(otc_stream*)
376 otc_subscriber_get_stream(const otc_subscriber* subscriber);
377 
385 OTC_DECL(otc_status)
387  otc_bool subscribe_to_video);
388 
396 OTC_DECL(otc_status)
398  otc_bool subscribe_to_audio);
399 
406 OTC_DECL(otc_bool)
408 
415 OTC_DECL(otc_bool)
417 
425 OTC_DECL(otc_session*)
426 otc_subscriber_get_session(const otc_subscriber* subscriber);
427 
437 OTC_DECL(otc_status)
439  uint32_t preferred_width,
440  uint32_t preferred_height);
450 OTC_DECL(otc_status)
452  uint32_t* preferred_width,
453  uint32_t* preferred_height);
454 
463 OTC_DECL(otc_status)
465  float preferred_framerate);
466 
476 OTC_DECL(otc_status)
478  float* preferred_framerate);
479 
487 OTC_DECL(const char*)
489 
496 OTC_DECL(void*) otc_subscriber_get_user_data(const otc_subscriber* subscriber);
497 
512 
522 
523 OTC_END_DECL
524 
525 #endif // SUBSCRIBER_H
Definition: subscriber.h:60
Definition: subscriber.h:87
int otc_status
Definition: base.h:133
uint64_t bytes_received
Definition: subscriber.h:72
struct otc_video_frame otc_video_frame
Definition: video_frame.h:25
struct otc_subscriber otc_subscriber
Definition: subscriber.h:27
Definition: subscriber.h:180
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)
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:52
double timestamp
Definition: subscriber.h:75
float audio_level
Definition: subscriber.h:74
Audio/Video stream.
uint64_t packets_received
Definition: subscriber.h:70
struct otc_session otc_session
Definition: session.h:21
Definition: subscriber.h:67
otc_video_reason
Definition: subscriber.h:31
otc_status otc_subscriber_get_preferred_resolution(const otc_subscriber *subscriber, uint32_t *preferred_width, uint32_t *preferred_height)
Definition: subscriber.h:103
otc_status otc_subscriber_get_preferred_framerate(const otc_subscriber *subscriber, float *preferred_framerate)
otc_status otc_subscriber_delete(otc_subscriber *subscriber)
uint64_t packets_received
Definition: subscriber.h:90
struct otc_stream otc_stream
Definition: stream.h:18
Definition: subscriber.h:36
uint64_t bytes_received
Definition: subscriber.h:92
otc_subscriber_error_code
Definition: subscriber.h:48
otc_status otc_subscriber_set_preferred_resolution(otc_subscriber *subscriber, uint32_t preferred_width, uint32_t preferred_height)
Definition: subscriber.h:55
void * otc_subscriber_get_user_data(const otc_subscriber *subscriber)
otc_bool otc_subscriber_get_subscribe_to_video(const otc_subscriber *subscriber)
double timestamp
Definition: subscriber.h:94
void * reserved
Definition: subscriber.h:343
Definition: subscriber.h:58
Definition: subscriber.h:32
uint64_t packets_lost
Definition: subscriber.h:88
void * user_data
Definition: subscriber.h:337
otc_stream * otc_subscriber_get_stream(const otc_subscriber *subscriber)
uint64_t packets_lost
Definition: subscriber.h:68
int otc_bool
Definition: base.h:107
void * user_data
Definition: subscriber.h:107
otc_status otc_subscriber_set_rtc_stats_report_cb(otc_subscriber *subscriber, struct otc_subscriber_rtc_stats_report_cb cb)
Definition: subscriber.h:50
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:49
otc_session * otc_subscriber_get_session(const otc_subscriber *subscriber)
Definition: subscriber.h:38
const char * otc_subscriber_get_subscriber_id(const otc_subscriber *subscriber)
Definition: subscriber.h:34