summaryrefslogtreecommitdiff
path: root/toxav/codec.h
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2015-02-01 23:43:54 +0100
committermannol <eniz_vukovic@hotmail.com>2015-02-01 23:43:54 +0100
commit39680f31d0121cef2358507fcea84cacad69893a (patch)
tree0f48a3ed39822a2e8c9d86d99c38badda6575353 /toxav/codec.h
parent1450c22d01cbb5185ee8eac14657ddf3301d7e48 (diff)
Progress
Diffstat (limited to 'toxav/codec.h')
-rw-r--r--toxav/codec.h60
1 files changed, 32 insertions, 28 deletions
diff --git a/toxav/codec.h b/toxav/codec.h
index 92262ef8..951d6d2f 100644
--- a/toxav/codec.h
+++ b/toxav/codec.h
@@ -96,7 +96,7 @@ typedef struct _CSSession {
96 uint32_t video_frame_piece_size; 96 uint32_t video_frame_piece_size;
97 uint32_t max_video_frame_size; 97 uint32_t max_video_frame_size;
98 98
99 /* Reassembling */ 99 /* Splitting */
100 uint8_t *split_video_frame; 100 uint8_t *split_video_frame;
101 const uint8_t *processing_video_frame; 101 const uint8_t *processing_video_frame;
102 uint16_t processing_video_frame_size; 102 uint16_t processing_video_frame_size;
@@ -110,10 +110,13 @@ typedef struct _CSSession {
110 110
111 /* audio encoding */ 111 /* audio encoding */
112 OpusEncoder *audio_encoder; 112 OpusEncoder *audio_encoder;
113 int32_t channels; 113 int32_t encoder_channels;
114 114
115 /* audio decoding */ 115 /* audio decoding */
116 OpusDecoder *audio_decoder; 116 OpusDecoder *audio_decoder;
117 int32_t last_pack_channels;
118 int32_t last_packet_sampling_rate;
119 int32_t last_packet_frame_duration;
117 struct _JitterBuffer *j_buf; 120 struct _JitterBuffer *j_buf;
118 121
119 122
@@ -127,54 +130,55 @@ typedef struct _CSSession {
127 * 130 *
128 * 131 *
129 */ 132 */
130 133 void *agent; /* Pointer to ToxAV TODO make this pointer to ToxAV*/
131 /* Callbacks */
132 PAIR(CSAudioCallback, void *) acb;
133 PAIR(CSVideoCallback, void *) vcb;
134
135 void *agent; /* Pointer to ToxAv */
136 int32_t call_idx; 134 int32_t call_idx;
137 135
138 pthread_mutex_t queue_mutex[1]; 136 pthread_mutex_t queue_mutex[1];
139} CSSession; 137} CSSession;
140 138
141int cs_split_video_payload(CSSession *cs, const uint8_t *payload, uint16_t length);
142const uint8_t *cs_get_split_video_frame(CSSession *cs, uint16_t *size);
143 139
144/** 140/**
145 * Call playback callbacks 141 * Generic
146 */ 142 */
147void cs_do(CSSession *cs); 143void cs_do(CSSession *cs);
148 144
149/** 145/* Make sure to be called BEFORE corresponding rtp_new */
150 * Reconfigure video settings; return 0 on success or -1 on failure. 146CSSession *cs_new(uint32_t s_audio_b, uint32_t p_audio_b, uint32_t s_video_b, uint32_t p_video_b);
147/* Make sure to be called AFTER corresponding rtp_kill */
148void cs_kill(CSSession *cs);
149
150
151/**
152 * VIDEO HANDLING
151 */ 153 */
154void cs_init_video_splitter_cycle(CSSession *cs);
155int cs_update_video_splitter_cycle(CSSession* cs, const uint8_t* payload, uint16_t length);
156const uint8_t *cs_iterate_split_video_frame(CSSession *cs, uint16_t *size);
157
152int cs_set_sending_video_resolution(CSSession *cs, uint16_t width, uint16_t height); 158int cs_set_sending_video_resolution(CSSession *cs, uint16_t width, uint16_t height);
153int cs_set_sending_video_bitrate(CSSession *cs, uint32_t bitrate); 159int cs_set_sending_video_bitrate(CSSession *cs, uint32_t bitrate);
154 160
161int cs_enable_video_sending(CSSession* cs, uint32_t bitrate);
162int cs_enable_video_receiving(CSSession* cs);
163
164void cs_disable_video_sending(CSSession* cs);
165void cs_disable_video_receiving(CSSession* cs);
166
167/**
168 * AUDIO HANDLING
169 */
155int cs_set_sending_audio_bitrate(CSSession* cs, int32_t rate); 170int cs_set_sending_audio_bitrate(CSSession* cs, int32_t rate);
156/* NOTE: Try not to call these a lot */
157int cs_set_sending_audio_sampling_rate(CSSession* cs, int32_t rate); 171int cs_set_sending_audio_sampling_rate(CSSession* cs, int32_t rate);
158int cs_set_sending_audio_channels(CSSession* cs, int32_t count); 172int cs_set_sending_audio_channels(CSSession* cs, int32_t count);
159 173
160/** 174int cs_enable_audio_sending(CSSession* cs, uint32_t bitrate, int channels);
161 * Make sure to be called BEFORE corresponding rtp_new
162 */
163CSSession *cs_new(uint32_t s_audio_b, uint32_t p_audio_b, uint32_t s_video_b, uint32_t p_video_b);
164/**
165 * Make sure to be called AFTER corresponding rtp_kill
166 */
167void cs_kill(CSSession *cs);
168
169int cs_enable_audio_sending(CSSession* cs, uint32_t bitrate);
170int cs_enable_audio_receiving(CSSession* cs); 175int cs_enable_audio_receiving(CSSession* cs);
171int cs_enable_video_sending(CSSession* cs, uint32_t bitrate);
172int cs_enable_video_receiving(CSSession* cs);
173 176
174void cs_disable_audio_sending(CSSession* cs); 177void cs_disable_audio_sending(CSSession* cs);
175void cs_disable_audio_receiving(CSSession* cs); 178void cs_disable_audio_receiving(CSSession* cs);
176void cs_disable_video_sending(CSSession* cs); 179
177void cs_disable_video_receiving(CSSession* cs); 180
181
178 182
179/* Internal. Called from rtp_handle_message */ 183/* Internal. Called from rtp_handle_message */
180void queue_message(RTPSession *session, RTPMessage *msg); 184void queue_message(RTPSession *session, RTPMessage *msg);