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 
34  1,
36  2,
42 };
43 
60  1542,
62 };
63 
69  uint64_t packets_lost;
71  uint64_t packets_received;
73  uint64_t bytes_received;
75  float audio_level;
76  double timestamp;
78 };
79 
89  uint64_t packets_lost;
91  uint64_t packets_received;
93  uint64_t bytes_received;
95  double timestamp;
97 };
98 
108  void *user_data;
109 
165  void(*on_rtc_stats_report)(otc_subscriber* subscriber,
166  void *user_data,
167  const char* json_array_of_reports);
168 
169  void *reserved;
170 };
171 
190  void (*on_connected)(otc_subscriber* subscriber,
191  void* user_data,
192  const otc_stream* stream);
193 
200  void (*on_disconnected)(otc_subscriber* subscriber, void* user_data);
201 
208  void (*on_reconnected)(otc_subscriber* subscriber, void* user_data);
209 
217  void (*on_render_frame)(otc_subscriber* subscriber,
218  void* user_data,
219  const otc_video_frame* frame);
220 
228  void (*on_video_disabled)(otc_subscriber* subscriber,
229  void* user_data,
230  enum otc_video_reason reason);
231 
239  void (*on_video_enabled)(otc_subscriber* subscriber,
240  void* user_data,
241  enum otc_video_reason reason);
242 
249  void (*on_audio_disabled)(otc_subscriber* subscriber, void* user_data);
250 
257  void (*on_audio_enabled)(otc_subscriber* subscriber, void* user_data);
258 
265  void (*on_video_data_received)(otc_subscriber* subscriber, void* user_data);
266 
275  void (*on_video_disable_warning)(otc_subscriber* subscriber, void* user_data);
276 
285  void (*on_video_disable_warning_lifted)(otc_subscriber* subscriber,
286  void* user_data);
287 
295  void (*on_audio_stats)(otc_subscriber* subscriber,
296  void* user_data,
297  struct otc_subscriber_audio_stats audio_stats);
298 
306  void (*on_video_stats)(otc_subscriber* subscriber,
307  void* user_data,
308  struct otc_subscriber_video_stats video_stats);
309 
317  void (*on_audio_level_updated)(otc_subscriber* subscriber,
318  void* user_data,
319  float audio_level);
320 
329  void (*on_error)(otc_subscriber* subscriber,
330  void* user_data,
331  const char* error_string,
332  enum otc_subscriber_error_code error);
333 
340  void (*on_audio_data)(otc_subscriber* subscriber,
341  void* user_data,
342  const struct otc_audio_data* audio_data);
343 
348  void* user_data;
349 
354  void* reserved;
355 };
356 
366 OTC_DECL(otc_subscriber*)
367 otc_subscriber_new(const otc_stream* stream,
368  const struct otc_subscriber_callbacks* callbacks);
369 
377 OTC_DECL(otc_status) otc_subscriber_delete(otc_subscriber* subscriber);
378 
386 OTC_DECL(otc_stream*)
387 otc_subscriber_get_stream(const otc_subscriber* subscriber);
388 
396 OTC_DECL(otc_status)
398  otc_bool subscribe_to_video);
399 
407 OTC_DECL(otc_status)
409  otc_bool subscribe_to_audio);
410 
417 OTC_DECL(otc_bool)
419 
426 OTC_DECL(otc_bool)
428 
436 OTC_DECL(otc_session*)
437 otc_subscriber_get_session(const otc_subscriber* subscriber);
438 
448 OTC_DECL(otc_status)
450  uint32_t preferred_width,
451  uint32_t preferred_height);
461 OTC_DECL(otc_status)
463  uint32_t* preferred_width,
464  uint32_t* preferred_height);
465 
477 OTC_DECL(otc_status)
478 otc_subscriber_set_audio_volume(otc_subscriber* subscriber, double volume);
479 
492 OTC_DECL(otc_status)
494  double* volume);
495 
506 OTC_DECL(otc_status)
508  float preferred_framerate);
509 
519 OTC_DECL(otc_status)
521  float* preferred_framerate);
522 
530 OTC_DECL(const char*)
532 
539 OTC_DECL(void*) otc_subscriber_get_user_data(const otc_subscriber* subscriber);
540 
555 
565 
566 OTC_END_DECL
567 
568 #endif // SUBSCRIBER_H
Definition: subscriber.h:61
Definition: audio_data.h:17
Definition: subscriber.h:88
int otc_status
Definition: base.h:133
uint64_t bytes_received
Definition: subscriber.h:73
struct otc_video_frame otc_video_frame
Definition: video_frame.h:25
struct otc_subscriber otc_subscriber
Definition: subscriber.h:28
Definition: subscriber.h:181
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_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:53
double timestamp
Definition: subscriber.h:76
float audio_level
Definition: subscriber.h:75
Audio/Video stream.
uint64_t packets_received
Definition: subscriber.h:71
struct otc_session otc_session
Definition: session.h:21
Definition: subscriber.h:68
otc_video_reason
Definition: subscriber.h:32
otc_status otc_subscriber_get_preferred_resolution(const otc_subscriber *subscriber, uint32_t *preferred_width, uint32_t *preferred_height)
Definition: subscriber.h:104
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:91
struct otc_stream otc_stream
Definition: stream.h:18
Definition: subscriber.h:37
Audio Data.
uint64_t bytes_received
Definition: subscriber.h:93
otc_subscriber_error_code
Definition: subscriber.h:49
otc_status otc_subscriber_set_preferred_resolution(otc_subscriber *subscriber, uint32_t preferred_width, uint32_t preferred_height)
Definition: subscriber.h:56
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:95
void * reserved
Definition: subscriber.h:354
Definition: subscriber.h:59
Definition: subscriber.h:33
uint64_t packets_lost
Definition: subscriber.h:89
void * user_data
Definition: subscriber.h:348
otc_stream * otc_subscriber_get_stream(const otc_subscriber *subscriber)
uint64_t packets_lost
Definition: subscriber.h:69
int otc_bool
Definition: base.h:107
void * user_data
Definition: subscriber.h:108
otc_status otc_subscriber_set_rtc_stats_report_cb(otc_subscriber *subscriber, struct otc_subscriber_rtc_stats_report_cb cb)
Definition: subscriber.h:51
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:50
otc_status otc_subscriber_set_audio_volume(otc_subscriber *subscriber, double volume)
otc_session * otc_subscriber_get_session(const otc_subscriber *subscriber)
Definition: subscriber.h:39
const char * otc_subscriber_get_subscriber_id(const otc_subscriber *subscriber)
Definition: subscriber.h:35