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 
166  void (*on_rtc_stats_report)(otc_subscriber* subscriber,
167  void* user_data,
168  const char* json_array_of_reports);
169 
170  void* reserved;
171 };
172 
191  void (*on_connected)(otc_subscriber* subscriber,
192  void* user_data,
193  const otc_stream* stream);
194 
201  void (*on_disconnected)(otc_subscriber* subscriber, void* user_data);
202 
209  void (*on_reconnected)(otc_subscriber* subscriber, void* user_data);
210 
218  void (*on_render_frame)(otc_subscriber* subscriber,
219  void* user_data,
220  const otc_video_frame* frame);
221 
229  void (*on_video_disabled)(otc_subscriber* subscriber,
230  void* user_data,
231  enum otc_video_reason reason);
232 
240  void (*on_video_enabled)(otc_subscriber* subscriber,
241  void* user_data,
242  enum otc_video_reason reason);
243 
250  void (*on_audio_disabled)(otc_subscriber* subscriber, void* user_data);
251 
258  void (*on_audio_enabled)(otc_subscriber* subscriber, void* user_data);
259 
266  void (*on_video_data_received)(otc_subscriber* subscriber, void* user_data);
267 
276  void (*on_video_disable_warning)(otc_subscriber* subscriber, void* user_data);
277 
286  void (*on_video_disable_warning_lifted)(otc_subscriber* subscriber,
287  void* user_data);
288 
296  void (*on_audio_stats)(otc_subscriber* subscriber,
297  void* user_data,
298  struct otc_subscriber_audio_stats audio_stats);
299 
307  void (*on_video_stats)(otc_subscriber* subscriber,
308  void* user_data,
309  struct otc_subscriber_video_stats video_stats);
310 
318  void (*on_audio_level_updated)(otc_subscriber* subscriber,
319  void* user_data,
320  float audio_level);
321 
330  void (*on_error)(otc_subscriber* subscriber,
331  void* user_data,
332  const char* error_string,
333  enum otc_subscriber_error_code error);
334 
342  void (*on_audio_data)(otc_subscriber* subscriber,
343  void* user_data,
344  const struct otc_audio_data* audio_data);
345 
350  void* user_data;
351 
356  void* reserved;
357 };
358 
368 OTC_DECL(otc_subscriber*)
369 otc_subscriber_new(const otc_stream* stream,
370  const struct otc_subscriber_callbacks* callbacks);
371 
379 OTC_DECL(otc_status) otc_subscriber_delete(otc_subscriber* subscriber);
380 
388 OTC_DECL(otc_stream*)
389 otc_subscriber_get_stream(const otc_subscriber* subscriber);
390 
398 OTC_DECL(otc_status)
400  otc_bool subscribe_to_video);
401 
409 OTC_DECL(otc_status)
411  otc_bool subscribe_to_audio);
412 
419 OTC_DECL(otc_bool)
421 
428 OTC_DECL(otc_bool)
430 
438 OTC_DECL(otc_session*)
439 otc_subscriber_get_session(const otc_subscriber* subscriber);
440 
450 OTC_DECL(otc_status)
452  uint32_t preferred_width,
453  uint32_t preferred_height);
463 OTC_DECL(otc_status)
465  uint32_t* preferred_width,
466  uint32_t* preferred_height);
467 
477 OTC_DECL(otc_status)
478 otc_subscriber_set_audio_volume(otc_subscriber* subscriber, double volume);
479 
490 OTC_DECL(otc_status)
492  double* volume);
493 
504 OTC_DECL(otc_status)
506  float preferred_framerate);
507 
517 OTC_DECL(otc_status)
519  float* preferred_framerate);
520 
528 OTC_DECL(const char*)
530 
537 OTC_DECL(void*) otc_subscriber_get_user_data(const otc_subscriber* subscriber);
538 
553 OTC_DECL(otc_status)
555 
565 OTC_DECL(otc_status)
567  otc_subscriber* subscriber,
569 
570 OTC_END_DECL
571 
572 #endif // SUBSCRIBER_H
Definition: subscriber.h:61
Definition: audio_data.h:17
Definition: subscriber.h:88
int otc_status
Definition: base.h:138
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:182
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:356
Definition: subscriber.h:59
Definition: subscriber.h:33
uint64_t packets_lost
Definition: subscriber.h:89
void * user_data
Definition: subscriber.h:350
otc_stream * otc_subscriber_get_stream(const otc_subscriber *subscriber)
uint64_t packets_lost
Definition: subscriber.h:69
int otc_bool
Definition: base.h:112
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