summaryrefslogtreecommitdiff
path: root/toxav/codec.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxav/codec.h')
-rw-r--r--toxav/codec.h74
1 files changed, 37 insertions, 37 deletions
diff --git a/toxav/codec.h b/toxav/codec.h
index 90a74ce8..dd054338 100644
--- a/toxav/codec.h
+++ b/toxav/codec.h
@@ -42,8 +42,8 @@
42/* Audio encoding/decoding */ 42/* Audio encoding/decoding */
43#include <opus.h> 43#include <opus.h>
44 44
45typedef void (*CSAudioCallback) (void* agent, int32_t call_idx, const int16_t* PCM, uint16_t size, void* data); 45typedef void (*CSAudioCallback) (void *agent, int32_t call_idx, const int16_t *PCM, uint16_t size, void *data);
46typedef void (*CSVideoCallback) (void* agent, int32_t call_idx, const vpx_image_t* img, void* data); 46typedef void (*CSVideoCallback) (void *agent, int32_t call_idx, const vpx_image_t *img, void *data);
47 47
48typedef enum _CsCapabilities { 48typedef enum _CsCapabilities {
49 a_encoding = 1 << 0, 49 a_encoding = 1 << 0,
@@ -54,12 +54,12 @@ typedef enum _CsCapabilities {
54 54
55typedef struct _CSSession { 55typedef struct _CSSession {
56 56
57/* VIDEO 57 /* VIDEO
58 * 58 *
59 * 59 *
60 */ 60 */
61 int support_video; 61 int support_video;
62 62
63 /* video encoding */ 63 /* video encoding */
64 vpx_codec_ctx_t v_encoder; 64 vpx_codec_ctx_t v_encoder;
65 uint32_t frame_counter; 65 uint32_t frame_counter;
@@ -69,28 +69,28 @@ typedef struct _CSSession {
69 int max_width; 69 int max_width;
70 int max_height; 70 int max_height;
71 71
72 72
73 /* Data handling */ 73 /* Data handling */
74 uint8_t *frame_buf; /* buffer for split video payloads */ 74 uint8_t *frame_buf; /* buffer for split video payloads */
75 uint32_t frame_size; /* largest address written to in frame_buf for current input frame*/ 75 uint32_t frame_size; /* largest address written to in frame_buf for current input frame*/
76 uint8_t frameid_in, frameid_out; /* id of input and output video frame */ 76 uint8_t frameid_in, frameid_out; /* id of input and output video frame */
77 uint32_t last_timestamp; /* calculating cycles */ 77 uint32_t last_timestamp; /* calculating cycles */
78 78
79 /* Limits */ 79 /* Limits */
80 uint32_t video_frame_piece_size; 80 uint32_t video_frame_piece_size;
81 uint32_t max_video_frame_size; 81 uint32_t max_video_frame_size;
82 82
83 /* Reassembling */ 83 /* Reassembling */
84 uint8_t *split_video_frame; 84 uint8_t *split_video_frame;
85 const uint8_t *processing_video_frame; 85 const uint8_t *processing_video_frame;
86 uint16_t processing_video_frame_size; 86 uint16_t processing_video_frame_size;
87 87
88 88
89 89
90/* AUDIO 90 /* AUDIO
91 * 91 *
92 * 92 *
93 */ 93 */
94 94
95 /* audio encoding */ 95 /* audio encoding */
96 OpusEncoder *audio_encoder; 96 OpusEncoder *audio_encoder;
@@ -106,44 +106,44 @@ typedef struct _CSSession {
106 int audio_decoder_frame_duration; 106 int audio_decoder_frame_duration;
107 int audio_decoder_channels; 107 int audio_decoder_channels;
108 108
109 struct _JitterBuffer* j_buf; 109 struct _JitterBuffer *j_buf;
110 110
111 111
112 /* Voice activity detection */ 112 /* Voice activity detection */
113 uint32_t EVAD_tolerance; /* In frames */ 113 uint32_t EVAD_tolerance; /* In frames */
114 uint32_t EVAD_tolerance_cr; 114 uint32_t EVAD_tolerance_cr;
115 115
116 116
117 117
118/* OTHER 118 /* OTHER
119 * 119 *
120 * 120 *
121 */ 121 */
122 122
123 uint64_t capabilities; /* supports*/ 123 uint64_t capabilities; /* supports*/
124 124
125 /* Buffering */ 125 /* Buffering */
126 void* abuf_raw, *vbuf_raw; /* Un-decoded data */ 126 void *abuf_raw, *vbuf_raw; /* Un-decoded data */
127 _Bool active; 127 _Bool active;
128 pthread_mutex_t queue_mutex[1]; 128 pthread_mutex_t queue_mutex[1];
129 129
130 void* agent; /* Pointer to ToxAv */ 130 void *agent; /* Pointer to ToxAv */
131 int32_t call_idx; 131 int32_t call_idx;
132} CSSession; 132} CSSession;
133 133
134CSSession *cs_new(const ToxAvCSettings* cs_self, const ToxAvCSettings* cs_peer, uint32_t jbuf_size, int has_video); 134CSSession *cs_new(const ToxAvCSettings *cs_self, const ToxAvCSettings *cs_peer, uint32_t jbuf_size, int has_video);
135void cs_kill(CSSession *cs); 135void cs_kill(CSSession *cs);
136 136
137int cs_split_video_payload(CSSession* cs, const uint8_t* payload, uint16_t length); 137int cs_split_video_payload(CSSession *cs, const uint8_t *payload, uint16_t length);
138const uint8_t* cs_get_split_video_frame(CSSession* cs, uint16_t* size); 138const uint8_t *cs_get_split_video_frame(CSSession *cs, uint16_t *size);
139 139
140/** 140/**
141 * Call playback callbacks 141 * Call playback callbacks
142 */ 142 */
143void cs_do(CSSession* cs); 143void cs_do(CSSession *cs);
144 144
145void cs_register_audio_callback(CSAudioCallback cb, void* data); 145void cs_register_audio_callback(CSAudioCallback cb, void *data);
146void cs_register_video_callback(CSVideoCallback cb, void* data); 146void cs_register_video_callback(CSVideoCallback cb, void *data);
147 147
148/* Reconfigure video encoder; return 0 on success or -1 on failure. */ 148/* Reconfigure video encoder; return 0 on success or -1 on failure. */
149int cs_set_video_encoder_resolution(CSSession *cs, uint16_t width, uint16_t height); 149int cs_set_video_encoder_resolution(CSSession *cs, uint16_t width, uint16_t height);